First published on july 25 2007
|Complete check of document. Corrected a lot of errors. Added some steps to quick install to avoid hangs on startup.|
|New root filesystem with Debian ARM|
|Leon chip support, new kernel and new root filesystem|
Both with broken disk. To recover functionality, the only way is to return it to manufacturer and pay the price of a new one, more or less, if you don't have a valid warranty.
My curious attitude wins, and after a lot of work I recovered basic functions: the MyBook is now a little computer with Debian GNU/Linux inside.
Table of Contents
This is a simple diary of the operations made to recycle a device ready to be discarded. Here you can't find how to restore the original functions of MyBook device. More, all the procedures described here have the result of voids the original warranty, if any.
Procedures are difficult and requires many skills: electronics, programming, Linux/Unix development tools and so on. Without these it's impossible follow the steps described here. In the software building phase I face a lot of troubles, some of them very puzzling, that changes with versions and configuration options. It's really impossible for me to write a step by step procedure. I can only suggest some solutions for some big problems, no more.
At the end you will have a working Linux system, but really minimal: kernel, shell and few other packages. But this would be sufficient to add function and applications without too many troubles.
I'm sorry, but I cannot give any help, to anyone. If you want to try, you can count only on this document. I cannot explain how to format a filesystem or how to mount a disk under Linux: you must know these basic commands. The reason is really simple: I don't have time, so I can't duplicate here all the command and the related manual. There are thousands pages on the Net that already do that.
This is an early alpha software: it is really easy to get no results at all! But, if you try these procedures and you can't get the Mybook revived you can help me to correct errors. So, please double check your steps and, before contact me, please collect all the data that I need to figure why your Mybook isn't working. Useful data are:
Files modified by you before booting
Partition scheme, filesystems, and so on.
System logs (located in
/var/log). You can get it
from Mybook disk. Very useful are:
If you have serial console (Section 3, “A serial, at least!”), a log of the boot will be really precious.
This document cover only MyBook World Edition, not World Edition II. The devices seem to be very similar, but the system configuration is quite different. I do not have a WEII, so I cannot try my procedures with it.
At least: I'm not and I will not responsible of anything. If you choose "surgery" to your MyBook you are on your own. NO warranty of ANY success.
The two MyBook were completely disassembled (Figure 1, “The MyBook”). Of course, no disks, which were broken.
Looking at the electronics, searching with Google the signature of the bigger chip, OXE800 took me on manifacturer website and a website of someone that has partially hacked the MyBook, at least on the software side.
From some messages on Western Digital forum I gathered all the information that I need:
Processor: ARM 926 class.
Architecture: proprietary, with PCI bus.
Memory: RAM 32M, ROM unknown.
Disk controller: two channel S-ATA, only the first used.
Other ports: one USB2 host.
Operating System: Linux
From Western Digital support site is available for download a quite large package with GPLed sources and utilities for the MyBook, 400Mbytes, but there aren't inside the proprietary Western Digital applications for the MyBook, so: no way to restore all the original functions.
And again: most configuration files are missing, or in the default state, that is unusable.
To get a working core (kernel, shell, development tools and a terminal) it was a hard work. But here it is.
It's impossible to made a "blind" installation without any clue of what happen in the device. The MyBook lack all of the standard human interaction devices, no keyboard, no monitor, no mouse. Try to boot from a pen drive lead no results at all.
From the basic data sheet of main chip, there is a serial port. Looking at the PCB you can see four soldering pads inside a rectangle, with "Serial" word nearby (Figure 2, “A serial connector... maybe.”, red arrow), near the USB connector.
To identify the pin function I used a tester. Pin 1 is Vcc (3,3V), pin 2 in GND. To identify pin 3 and 4 I used a cellular phone USB data cable, as suggested here, so pin 3 is RxD (receive data, from computer to MyBook), while pin 4 is TxD (transmit data, form MyBook to computer).
To communicate with MyBook you can use the cu utility, that Fedora Linux contains in the uucp package, not installed by default. The serial is configured as 8 bit, no parity, 115200 bps, so the command will be:
$cu -l /dev/ttyUSB0 -s 115200
The MyBook serial don't use standard RS232 voltage levels, but from 0V to 3,3V so you need an adapter. I used an old cell phone data cable, that uses this kind of serial, so all the work was for identify the signals from cable and from MyBook. The cable was for an Ericsson R300/T28, compatible with original Ericsson cable model DCU-10/DCU-11. I found very useful the information at this website.
By the way, powering up the MyBook with serial cable connected has no result, that mean: no ROM monitor, nor advanced BIOS in ROM.
Unpacking sources from WD you obtain this directory tree:
$ls buildroot-patches crosstool-patches gpl-buildroot-archives.tar gpl-crosstool-archives.tar gpl-leon-archives.tar leon stage1 vendor
These are the various components:
buildroot is an environment to build a root filesystem from scratch, with cross-compilation support. We will use it to create the root filesystem with directory tree and development tools, for the ARM processor.
crosstool another cross development environment. I didn't use it.
leon is an open implementation of a processor with SPARC architecture. Seems to be used as a network coprocessor on some version of MyBook, but I'm not sure. My Mybook work fine without this piece.
stage1 is a "first stage" bootloader. But we need
first the GCC cross compiler for ARM processor and main libraries.
vendor contains two directories:
u-boot. The first contains full Linux kernel sources
version 2.6.17 modified for the MyBook architecture. The latter contains the U-Boot bootloader, suitable for little and
We will use the kernel, the first stage bootloader in
stage1, U-Boot bootloader and Buildroot to obtain the cross
I used Linux Fedora 7 as development system to do all the work.
We need first the first stage bootloader in
stage1. But we need the toolchain for ARM processor. Not only,
we also need information about specific MyBook resources: address and peripheral types, memory
maps and so on.
From the tarball
gpl-buildroot-archives.tar, we get the file
buildroot-20060823.tar.bz2, that we unpack where we want.
In the directory
buildroot-patches there are some files
with the differences for the original MyBook, but, as we already said, it's impossible to
restore the original functionality. In this version we do not use any of the original file.
To obtain all the development tools for the ARM, we go in the
buildroot directory and launch a
make menuconfig, as for kernel sources to configure them. A menu
appears and we are able to choose the configuration for development tools and root filesystem
we are about to generate. My own configuration is in this page, under
To short the build process we can copy all the files from
buildroot-archives directory to
buildroot/dl directory, avoid re-downloading sources we already
Development toolchain contains GCC compiler, binutils utility and the uClibc library, a "light" version of glibc for embedded systems.
When we start building as usual with make command inside
buildroot directory, the build script ask for some information
about the processor and the architecture to build appropriately the uClibc
library. All the answers must be the default, but only one question must be replied
Target CPU has a floating point unit (FPU) (HAS_FPU) [Y/n/?] (NEW)
we reply with n, as for no floating point unit in the processor. After that the build proceeds straight to the end.
Now we have all the toolchain ready. All tools are in the
buildroot/build_arm_nofpu/staging_dir/bin directory, and that
directory must be added to the PATH environment variable, to made tools available for all the
Now we go in
stage1 directory and start building
process with the command:
(pay attention to the final dash) and after few seconds we obtain a file called
stage1.bin, while in the
stage1/tools directory we have two programs that we will use
The file is the first stage bootloader, that do some basic configuration on MyBook hardware before it loads the real bootloader (second stage).
My binary version of the first stage is here.
Now we need to install it on a new S-ATA disk. I used an external USB to S-ATA box, with a 250G disk inside. First we connect the disk to the computer where we build all the tools, and we partition it as needed.
The first stage bootloader must be loaded starting from absolute sector 1 of the disk, that is immediately after the MBR. The MBR must contains partition table, and must be modified for the presence of the first stage bootloader.
These are the steps:
First we made the partitions on the disk. For first experiments we can do only two partitions, one for the root filesystem and one for swap space. Pay attention: first partition must start after 1000 sectors from the start of disk, and must be formatted as ext2 or better ext3. For example we can use 2 as start cylinder for the first partition This space is needed for second stage bootloader, that will be on disk from absolute sector 64 for at least 200 sector. It's better do not spare space.
After partitioning, we copy the MBR on a file (we suppose that external disk is
#dd if=/dev/sdb of=mbr bs=512 count=1
On the file (a copy of MBR) we use the program
stage1/tools/installer, that modifies the MBR to obtain the loading
of the first stage bootloader:
We copy back the modified MBR:
#dd if=mbr of=/dev/sdb bs=512 count=1
Now we can install first stage bootloader:
#dd if=stage1.bin of=/dev/sdb bs=512 seek=1
Now we can use the serial cable (Section 3, “A serial, at least!”) to do a simple functionality test.
After connecting MyBook and computer, we launch the cu utility. Next we
power up the MyBook. On the cuscreen must appear something like this:
Looking at the source in
stage1/src/stage1.c we can understand what means
letters and numbers. For example the 'X' (capital x ) means error accessing disk.
Next step is the U-Boot building. We need to change the Makefile in
vendor/u-boot/ deleting row 130, from that:
# The "tools" are needed early, so put this first # Don't include stuff already done in $(LIBS) SUBDIRS = tools \ examples \ post \ post/cpu
# The "tools" are needed early, so put this first # Don't include stuff already done in $(LIBS) SUBDIRS = tools \ post \ post/cpu
to avoid errors in examples building, that we don't need. After, we need to configure the
bootloader before building. First we need to modify
vendor/u-boot/include/configs/oxnas.h file. I prepared for this a patch. After patching, we can go to see the file.
We can focus on lines 243-244:
#define CONFIG_BOOTARGS "mem=32M console=ttyS0,115200 root=/dev/sda1 netdev=0,0,0x0030e000,0x0001,eth0 elevator=cfq" #define CONFIG_BOOTCOMMAND "ext2load ide 0:1 0x48500000 /uImage ; bootm 0x48500000"
First row contains the kernel command line at the boot time, while the second shows the command to load and execute the kernel itself.
The third and fourth parameter in netdev variable are the MAC address we want to assign to ethernet interface. The CONFIG_BOOTCOMMAND can be explained as:
ext2load means that a file must be loaded from an ext2/ext3 filesystem. U-Boot act as GRUB, accessing the filesystem that contains kernel image file to load it. This will be a great simplification when we will try different kernel configuration.
ide means that loading must be performed from an IDE/S-ATA disk
0:1 means disk:partition index, that is first disk, first partition. Of
course, in this procedure the kernel image file must reside in the first partition. If
we want use a different partition we must change these values accordingly.
0x48500000 is the memory address where the kernel image file must be
/uImage is the pathname of kernel image file. Must be a complete path,
including a '/' if the file reside in the root. In this procedure it will be a file
uImage in the root directory of filesystem in first disk
partition. Note that is case sensitive.
The next command, bootm, means that execution continue from the address where we load the kernel image file. If all operations are correct, at this point we will see the kernel starts its execution. But we must do some more steps before.
Next step, we configure U-Boot for the MyBook machine, using this command:
$make oxnas_config Configuring for oxnas board...
Next we can start building with make. Note that if building stop suddenly complaining about missing ARM compiler arm-linux-gcc, we forgot to add it in the PATH, as said previously.
At the end we have a file named
u-boot.bin. As we already said,
this is second stage bootloader that is in charge to loads and executes the kernel. Now we
need to transfer it on disk, but requires one more step before: it needs an header with file
checksum that will be verified by first stage bootloader. Without it, the first stage
bootloader refuse to execute the second stage bootloader just read from disk. We use a program
stage1, that is
stage1/tools/packager, this way:
$stage1/tools/packager vendor/u-boot/u-boot.bin u-boot.img Input file - vendor/u-boot/u-boot.bin Output file - u-boot.img Input File Size - 95832
that adds the header with checksum and writes a new file named
u-boot.img, ready for transfer on disk:
#dd if=u-boot.img of=/dev/sdb bs=512 seek=64
from absolute sector 64.
Once done that, we are ready for a second test, if we have the serial cable. After connecting disk, and powering up the MyBook we see something like this:
NASOx_0800 dom lug 15 00:29:51 CEST 2007 U-Boot 1.1.2 (Jul 15 2007 - 19:41:08) U-Boot code: 48D00000 -> 48D17658 BSS: -> 48D1B2C8 RAM Configuration: Bank #0: 48000000 32 MB *** Warning - bad CRC, using default environment Boot reached stage -1 In: serial Out: serial Err: serial Initialising disks No FIS received from device 1 Detecting SATA busses: Bus 0: Found first device OK Device 0: Model: Maxtor 6V300F0 Firm: VA111630 Ser#: V60EWCCG Type: Hard Disk Supports 48-bit addressing Capacity: 286188.8 MB = 279.4 GB (586114704 x 512) Device 1: not available IDE read: device 0 block # 63, count 1 ... 1 blocks read: OK Hit any key to stop autoboot: 1
that confirm the right configuration and installation of both bootloader. The U-Boot booting sequence can be interrupted by hitting a key during countdown, as we can do for GRUB: in this case we have a little shell from we can give commands to the bootloader.
My binary version of U-Boot with checksum, ready for use, is here.
This step is optional, because the Mybook works fine even without it. Unpack
gpl-leon-archives.tar file, to obtain a directory named
leon-archives. Next we go to directory
leon/toolchain/src. In that directory we see four subdirectory,
matching names of packages in
leon-archives. We can ignore gdb, and work
for other three. You must unpack every package in directories with same name, leave it as is.
I.e., for binutils, we move in the
binutils directory and we unpack
binutils-2.16.1.tar.bz2 inside it, obtain a path like this:
Next we go in
toolchain directory and we launch
make command, that works for about 20 minutes, terminating with an error
caused by the absence of gdb sources, error that we can safely ignore.
Next we add to PATH the absolute path to the directory
leon/toolchain/install/gcc-3.4.6/i686-pc-linux/bin/ to have all
compile tools available, that this time are for SPARC architecture.
After done, we return in the
leon directory and we
launch make command, followed by
make -f power-button.mk. These commands will build two C language
header files, that will be copied in the kernel sources directory. Headers are:
At the kernel build stage, we can leave now enabled the Leon chip support. During compile
stage the Leon support will be included in new kernel.
Now we are ready to build a kernel. Sources are in
vendor/linux-kernel, including patches and support for MyBook,
that we cannot found in standard kernels. After checking that build tools are in PATH, we need
one more utility in
named mkimage that will be used to generate an image U-Boot-compatible.
After that, we can launch the basic configuration command:
$make CROSS_COMPILE=arm-linux- oxnas_wd2nc_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/split-include HOSTCC scripts/basic/docproc HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/kxgettext.o ... ... a lot of rows ... * * Library routines * CRC-CCITT functions (CRC_CCITT) [Y/?] y CRC16 functions (CRC16) [N/m/y/?] n CRC32 functions (CRC32) [Y/?] y CRC32c (Castagnoli, et al) Cyclic Redundancy-Check (LIBCRC32C) [N/m/y/?] n
that configure kernel for MyBook platform. The configuration is really minimal, and not includes support for really many features, but if we know what we do, we can use the well-known command to add features:
$make CROSS_COMPILE=arm-linux- menuconfig
changing options as needed. Anyway, if we don't include Leon chip code (Section 7, “Leon support”) we must uncheck an option in System Type, Oxford Semiconductor NAS Options, Include support for Leon, that prevents successfully kernel build.
Next, we can start building:
$make CROSS_COMPILE=arm-linux- uImage ... ... a lot of rows ... OBJCOPY arch/arm/boot/zImage Kernel: arch/arm/boot/zImage is ready UIMAGE arch/arm/boot/uImage Image Name: Linux-184.108.40.206 Created: Tue Jul 24 15:24:09 2007 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1215572 Bytes = 1187.08 kB = 1.16 MB Load Address: 0x48008000 Entry Point: 0x48008000 Image arch/arm/boot/uImage is ready
uImage target needs to generate kernel image compatible with U-Boot. At the
end we will have a file named
Next we build modules:
$make CROSS_COMPILE=arm-linux- modules
Now we are ready to install kernel and modules, but we don't use the Buildroot root
filesystem, we need to make a new one in the disk that we will use for the revived Mybook. So
we prepare the disk, partitions, filesystems, and after that we can copy the kernel image, the
System.map file to the root of the new filesystem, next we can install
modules using the command:
#make CROSS_COMPILE=arm-linux- \ > INSTALL_MOD_PATH=/path/to/mounted/root/filesystem modules_install
We almost finished.
Now we have: bootloader (first and second stage), kernel, modules. We need the final root filesystem with minimal functionality.
After three weeks of tests, I finally realize that is impssible for me to obtain an usable system, not using Buildroot. So, I looked to official distributions. Fedora has a porting project for ARM platforms, but there is a problem: only EABI is supported, and EABI requires GCC version 4 or newer. The GCC versio 4.x is affected by a bug with floating point emulation in cross compiling, so it's impossible to generate a kernel for Mybook with EABI support with cross compilation.
The other choice is Debian, that has an extended support for ARM. In three days I generated a complete root filesystem, with apt support.
So I made two packages: one with kernel and modules, one with root filesystem, based on Debian "lenny". Packages are here and to install them look at the next paragraph.
For the impatient, and who can't build all binaries, here the quick steps:
Get packages from here. You need: the
installer utility to modify the MBR, stage 1 bootloader
stage1.bin, U-Boot bootloader ready for
u-boot.img, kernel and root filesystem.
Connect the new MyBook disk to your computer and proceed to make all partitions needed.
Preferred partition scheme is: a root partition, starting from second cylinder, size
3-5Gbytes, a swap partition, size 100Mbytes, the remaining space to a partition that
will be mounted as
My disk (250Gbytes) has this partition table:
/dev/sda1 2 488 3911827+ 83 Linux /dev/sda2 489 501 104422+ 82 Linux swap / Solaris /dev/sda3 502 30515 241087455 83 Linux
After partitioning, we read the MBR (assuming that external S-ATA disk is
#dd if=/dev/sdb of=mbr bs=512 count=1
Next we modify the MBR with installer utility:
Now put back the MBR (assuming that external disk is
#dd if=mbr of=/dev/sdb bs=512 count=1
Now we install the first stage bootloader:
#dd if=stage1.bin of=/dev/sdb bs=512 seek=1
followed by second stage bootloader:
#dd if=u-boot.img of=/dev/sdb bs=512 seek=64
Now we can format all three partitions, first and third with:
#mkfs -j -I 128 /dev/sdb1
(inode size for root partition MUST be 128 bytes, or MyBook will not boot) and
#mkfs -j -m0 /dev/sdb3
and the swap partition with the command:
It can happen that in the boot phase, the system stops after checking filesystems, complaining about needed fsck (for maximal mount count or too time from last check), but the system is without console, so the system waits indefinitely for a command that we cannot give. So the solution is to use ext3 filesystem with check interval and maximal mount count set to disabled, using this command:
#tune2fs -c -1 -i 0 /dev/sdb1
for root filesystem and:
#tune2fs -c -1 -i 0 /dev/sdb3
/home filesystem. after that we check in the
/etc/fstab that all rows ends with 0 0, to
avoid requests for deep checking in boot phase.
There is no need to repeat these steps (to here) if we do not touch partitions and MBR. We must only delete files in the root partition before proceed to next step.
Now we can mount MyBook root partition to unpack the new filesystem. Command is:
#tar xjf mybook-rootfs-debian-DATE.tar.bz2
from the main directory where the disk is mounted, that is if disk is mounted in
/media/mybook the command must be given in that
directory. The filesystem contains init scripts and some applications. Similar command
to install kernel and modules:
#tar xzf kernel-VERSION.tar.gz
Note that both commands must be given from
root account, because we need to preserve permissions,
file owner and type.
Check the file
/etc/network/interfaces: ethernet interface is
configured for DHCP. If you want a static IP address, you must change this file
Check the file
/etc/apt/sources.list to choose the Debian mirror
next to you. At the moment the Debian generic FTP site is configured.
Done. Now we can unmount the disk, and connect it to the MyBook. After a couple of minute, we should see the blue leds in the external ring lights on. After that we can logon via SSH.
After logon you can do some other tasks:
Optional, but suggested: delete SSH keys in
/etc/ssh and generate new keys. Delete
/etc/ssh directory and give the
that proceed to generate new keys. Do not delete keys without generate new pairs: you cannot anymore access to Mybook via SSH.
/etc/fstab the swap partition. I.e. if your swap partition
/dev/sda2, you can add this line to
/dev/sda2 swap swap defaults 0 0
/etc/fstab other partition, if any. Remember to ends lines
with 0 0 to avoid filesystem checks requests on boot. I.e, if
/home partition is
/dev/sda3 add a line
/dev/sda3 /home ext3 defaults 0 0
Now you can proceed to installation and configuration of desired packages. For choice and configuration you can refer to Debian guides that you can found on the Net.
The filesystem image contains only
with password mybook, and you can logon only via SSH.
U-Boot bootloader website.
Oxford Semiconductor website.
Martin Hinner website.
Support download on WD website for MyBook GPLed sources.
Similar project, with serial port adapter hints.
Buildroot software website.
uClibc Glibc “light version” website.
The great Debian Reference Manual.
A really big thanks to my wife, that tolerate the time I spent on computers, and fortunately she don't work with then.
Without the great work of Fedora Peoples (http://fedoraproject.org/wiki/), my favorite Lunix distribution, and Debian Peoples (http://www.debian.org/), this work cannot be made. Same gratitude go to countless people that contributes to Open Source software, the core of Linux, its applications, goods for any needings.
A thank, to say, to TV programming: now I have more and more time to spend in really pleasant and useful manner.
To generate this document I used the default documentation environment available on Fedora, that is compliant with DocBook XML standard, details on website http://www.docbook.org/tdg/en/html/docbook.html. I create the XML source file of this document with VIM, using a configuration file for speeding up writing most frequently used tags.
You can find new versions of this document on my website: http://ismprofessional.net/pascucci, and some more things.
This document is released under Creative Commons license.