WARNING: this is currently under development and being revised, you can use this current version at your own risk. I will update this once I have confirmed all is correct.
This guide will step you through the process to install Debian 8 (Jessie) to either a new hard drive or to replace the original OS of your MyBookLive NAS.
I built this guide after researching multiple sources trying to get a detailed step by step, but all of the sources I found either built off other guides with confusing instructions or were very broken and hard to follow. So this is what I have come up with. I’ve tested this many, many times as I was changing configurations and just trying out different things to see what the MyBookLive could handle and a lot of the time it ended with the system no longer responding on the network. Since I don’t have a JTAG device to access the device I have just found it easier to just reload the drive with a new system.
There are some limitations to what you can load onto the drive since the processor is a PowerPC, but the stuff that could be loaded in the OS makes it a pretty useful network device.
WARRANTY WARNING: The following steps will void your warranty, if you still have one!
There are steps to reset your drive back to factory if you so desire to, a quick search on Google will guide you through that.
You need to be able to connect to the hard disk and therefore you must open the MyBookLive case. There’s a nice video of how to do this on YouTube.
Debian Linux 8 – 64bit (Either a physical system or through a virtual machine) installed.
NOTE: All of the code listed below is done from a virtual machine setup. You will need to make sure that you attach the hard drive to the virtual machine.
USB to SATA Unless you can connect your drive directly to your computer Note: Depending on how old your USB to SATA adapter is you might noticed when you go to partition the hard drive the drive size is only reported as about 750GB, this doesn’t stop anything but you will want to wait on making all of the partitions on the hard drive since you technically won’t be able to configure all of the space during the initial setup.
Active Internet Connection (You will be downloading files from the internet, so this is important)
If you are performing these steps on a virtual machine you need to DISABLE ANY AUTO RESTART APPLICATIONS on your host system. I’ve had this happen a couple of times where the host system installed new updates and decided, hey there isn’t anything going on let’s restart your computer! Nothing is really lost, but it leaves you wondering at what point in the processes did it restart!
If you run into major problems it is also very helpful, if you can attach a serial converter to debug the boot process. Otherwise you can connect the drive to your computer so that you can look at the logs to figure out where the problems during boot up are.
Partition the hard drive
If this is a brand new hard drive or you have decided to wipe everything from your existing hard drive (hopefully you backed up your data before you started this adventure!) Then you will partition your hard disk with GPT partition table e.g. using parted or gparted if you have a GUI installed.
I created a 10 Gb EXT3 partition for the system as the first partition, you are welcome to create whatever size you’d like but I recommend no less than 5 GB.
user@debian:~# sudo parted /dev/sdb
(parted) mklabel gpt
Filesystem [ext2]: (press enter)
End: (this is up to you, if you want 10 GB enter 10.00GB)
user@debian:~# sudo mkfs -t ext3 /dev/sdb1
If you are using a USB to SATA adapter and it isn’t showing you the correct volume size then you need to wait on creating the other partitions later.
Otherwise, create a second partition that is ext4 that uses all but 1 GB of space and then create the swap partition of 1 GB at the end of the drive
You should already have the debootstrap package installed if you followed the first guide. If you didn’t follow those steps, then follow this next step if you did follow it you can skip this next step.
The machine you are using needs to have an active internet connection, otherwise this will not work.
Bootstrap the base system to the MyBookLive hard drive
The command below will initially load the system to your hard drive for the MyBookLive. The “include” option allows you to install packages to the system. You can add more to it if you want the system to have these packages installed right away rather than installing them later. I have found that these are the minimum packages that should be initially installed
You are now in a “virtual” jailed environment of the system installed on your MyBookLive hard drive. All of the commands executed will be making changes on that system. You will notice that the prompt is now different.
Your new system will assume the name of the computer that you used to build. Example I named my debian install “debian” so looking at the hostname file on the new system will show the same hostname. Execute the following command to change the hostname of the MyBookLive system.
root@debian:/# echo 'saturn' > /etc/hostname
Of course you can change the name to whatever you’d like, just as long as it is something different than any system on your network.
Change the root password on your new system
One of the first things I did was to set the password for the new system, this will be the root password. Change it to something that is secure, unless you just don’t care about security.
Newer versions of openssh in debian disallow password based login for the root user. Therefore we have to change the following line in /etc/ssh/sshd_config to allow the root user to login via SSH:
Alternatively, you can place the public part of your ssh key in /root/.ssh/authorized_keys.
Prepare /boot and compile a kernel
Compile a kernel according to the guide update using a cross compiler (one dos not need to build the modules, uImage is fine). Place the resulting uBoot image in /boot and the apollo3g.dtb from the original harddisk as well.
Create a boot.scr with the uboot-tools package as described in the original guide. Since the bootloader is on a separate flash, one doesn’t need to install it as on several other arm boards. Just as a warning – the default kernel config does not support booting using UUIDs as root parameter for the kernel.
Kernel & UBoot
Preparation and Patching
root@debian:~/# mkdir /boot/kernel
root@debian:~/# cd /boot/kernel
In our chroot, we now install all the tools we require for kernel building and creation of the u-boot bootloader entrypoint.
root@debian:~/kernel/linux-220.127.116.11# make distclean
root@debian:~/kernel/linux-18.104.22.168# make mrproper
root@debian:~/kernel/linux-22.214.171.124# make 44x/apollo_3G_nas_defconfig
root@debian:~/kernel/linux-126.96.36.199# make uImage
The final and kind of a pain step is to copy the apollo3g.dtb file to the hard drive, this is necessary for the system to boot up. The only way to get the file is to extract it from the image. It could be hosted somewhere for all I know, but it is just easiest for me to download the firmware file from WD, extract the package, mount the image and then copy the file to the hard drive. Yeah sounds like a lot of steps, but I’ve done it a bunch of times so… If you already have the file extracted somewhere then copy it to the /boot directory on your MyBookLive hard drive. Otherwise here are the steps I used to get it downloaded and extracted.
After you have copied over the apollo3g.dtb file to the hard drive you now need to unmount the partitions you mounted earlier before you disconnect the drive and mate it with the mainboard from the MyBookLive.
Once you have unmounted the partitions, then you can disconnect the hard drive (if you used a USB to SATA adapter) or shutdown your system to remove it from your computer.
Connect the Hard Drive back to the mainboard
Once you have the mainboard connected to the hard drive and secured to the hard drive, you can power it on to see if everything worked. The easiest way to find out is to start a ping to the address you assigned to it above. Once it starts replying then you should be able to SSH into the drive.
As I mentioned above you can now compile the 4.0.x kernel for the system. You will do this all via SSH (unless you have a serial device connected), otherwise you are free to customize the system as you like. You will need to finish the partitioning of the hard drive as I mentioned at the start, this is completely up to you on how you partition the drive.
(WIP) Compiling 4.x Kernel
The follow is something I was experimenting with as a way to just compile a 4.x kernel directly rather than compile 2.6.x, boot the system and then compile another kernel. I have moved the following out of the main section of this document as a work in progress. If you have input about this or notes for making this all work, please comment it below.
Install crosstool-ng and configure cross compiler
To compile the powerpc kernel on a x86_64 machine, we need a cross compiler. We do not need this step, if we compile the kernel directly on the MyBook Live. I tried various options and found installation via crosstool-ng to be the most convenient one.
First, we clone the repository and switch into the checked out path
debianuser:debian:~# git clone https://github.com/crosstool-ng/crosstool-ng
debianuser:debian:~# cd crosstool-ng/
Next, we bootstrap, configure and install the ct-ng tool
sudo make install
Now, we should have ct-ng available in path so that it can be used to install the required cross compiler suite. The available cross compilers can be listed and inspected via
Aaron has an AS in Network Technology and a BS in Information Technology - Security. He has been active in the Information Technology field for almost 20 years and is always learning. He likes to tinker with devices and his home network experimenting and solving problems!