{ tech }

This post describes how to upgrade a clean debian wheezy install, as described in my previous guide.

However, one can also directly install debian jessie following my previous guide and:

  • use jessie instead of wheezy in debootstrap
  • compile 4.x kernel as described below

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 crosstool-ng toolchain to be the most convenient one.

First, we clone the repository and switch into the checked out path

git clone https://github.com/crosstool-ng/crosstool-ng
cd crosstool-ng/

Next, we install the build dependencies

sudo apt-get install autoconf gperf bison flex makeinfo texinfo help2man libtool-bin automake

Then, we bootstrap, configure and install the ct-ng tool

./bootstrap 
./configure --prefix=/usr/local
make
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

ct-ng list-samples
ct-ng show-powerpc-405-linux-gnu

Lets install the powerpc cross compiler for powerpc 405 - it’s compatible with powerpc 440 arch of our MyBook Live:

ct-ng updatetools
ct-ng powerpc-405-linux-gnu
ct-ng build

Now we should have a working cross compiler in the x-tools directory in your home.

To build a Kernel image suitable to boot directly from u-boot bootloader, we need to have the u-boot-tools installed

sudo apt-get install u-boot-tools

Next, we pull, extract and patch the kernel-sources:

wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.1.17.tar.xz
git clone https://github.com/MyBookLive/kernel-4.0.x.git
tar -xvJf linux-4.1.17.tar.xz 
cd linux-4.1.17
patch -p1 < ../kernel-4.0.x/01_mbl.patch 
patch -p1 < ../kernel-4.0.x/02_ppc4xx_ocm_enable.patch 
patch -p1 < ../kernel-4.0.x/03_enable_leds.patch 
patch -p1 < ../kernel-4.0.x/04_enable_button.patch 

If we build the kernel with a cross compiler, we have to set some environment variables before build:

export PATH=$PATH:~/x-tools/powerpc-405-linux-gnu/bin
export ARCH=powerpc 
export CROSS_COMPILE=powerpc-405-linux-gnu-

Next, we copy the example config and adapt it if required

cp ../kernel-4.0.x/config_mbl .config
make menuconfig

When configured, we build an uImage, which we can copy into the /boot directory on the MyBook Live. Alternatively, we can copy the image via scp, if we cross compile.

make -j 10 # or 1 on mybook live
make uImage
scp arch/powerpc/boot/uImage root@mybooklive:/boot/

When compiling on mybooklive, we can directly build and install modules if required:

make modules install

Otherwise, we can also cross compile, copy the source tree and install them on the device

make modules
rsync -av ./ /data/linux-4.1.17/

# switch to mybook live
cd /data/linux-4.1.17/
make modules install

With the new kernel - we’re ready for Debian Jessie. Follow the excellent Debian Upgrade Guide - in short:

apt-cache clean
apt-get dist-upgrade

If everything works well, you should have a running debian jessie.