Compiling a My Book Live Kernel

Compiling a My Book Live Kernel

NOTICE! THIS PROCEDURE HAVE A VERY HIGH POTENTIAL TO BRICK YOUR WD DEVICE! ONLY BUILD A NEW KERNEL IF YOU REALLY KNOW WHAT YOU ARE DOING

Issue
I had such a hard time with my My Book World Edition (white lights). I wanted to use iptables, so I need netfilter and some other modules.
Differently from My Book World White Lights, MBL was promising: It already had the required "entrypoint" in its monolithic kernel, so the only thing I would need was the modules.
However, after compiling extra netfilter modules, I had all the sort of problems:

ip_tables: no symbol version for module_layout

Or:
ip_tables: disagrees about version of symbol xt_unregister_target
ip_tables: Unknown symbol xt_unregister_target

Or when inserting a module:

# modprobe ip_tables
FATAL: Error inserting iptables (/lib/modules/2.6.32.11-svn52288/kernel/net/ipv4/netfilter/ip_tables.ko): Invalid module format

After spending a full sunday (and geting a ANGRY wife) trying to make modules work, I eventually got so frustrated and I considered the last-resort: building a new kernel. And, the best part… It worked!

In the end, I really took it for granted and respun several kernel versions, adding new features and even backporting upstream code. I've done it to two MBLs so far. The procedure has proven safe, at least to me. Why RaspberryPI when you have MBL? Darn, I was almost buying one… :-)

Environment

  • My Book Live
  • Kernel 2.6.32.11-svn52288

Resolution
1. Install the required tools:

# aptitude install gcc-4.3 libncurses5-dev make patch uboot-mkimage

Notice: If you run into trying to overwrite '/etc/ld.so.conf.d/powerpc-linux-gnu.conf', which is also in package wd-lib issue, refer to http://forums.debian.net/viewtopic.php?f=7&t=83830#p450933

2. Set gcc alternatives:

# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 43 --slave /usr/bin/cpp cpp /usr/bin/cpp-4.3

3. Download the relevant GNU package that matches your actual system level from http://support.wdc.com/download/gpl/

4. Create your build directory:

# mkdir /Datavolume/build

4. Unzip the GNU package in /DataVolume/build
5. cd to /DataVolume/build/packages/kernel_2.6.32-11/
6. Download and install a kernel patch which addresses a build failure:

# wget http://mybookworld.wikidot.com/local--files/compiling-mybook-live-modules/kernel_2.6.32-11-crtsavres-v2.patch
# patch -p0 < kernel_2.6.32-11-crtsavres-v2.patch

7. Run make menuconfig and configure your kernel. Hint: In order to save image space, I've disabled XFS, USB, NTFS, FAT (why? can't attach local drives to the system) & IPv6 support.
8. Important. After configuring the kernel, copy the .config to your home directory:
# cp .config ~

9. The GPL package bundles a build.sh. However, it's tailored for cross compiling. I've wrote an modified version, that will build the kernel, modules and install them at /newkernel. Download from http://mybookworld.wikidot.com/local--files/compiling-mybook-live-kernel/build.sh

10. And, build your kernel:

# ./build.sh

11. Ensure if everything was built correctly, and the resulting artifacts are written at /newkernel.
12. If you're OK and got the balls needed to overwrite the kernel, install it:
# cd /boot
# cp uImage uImage.orig
# mv /newkernel/lib/modules/<your kernel> /lib/modules

## ENSURE THAT YOU HAVE COPIED THE MODULES DIR CORRECTLY!!!!!!!!!!!

# cp /newkernel/boot/uImage /boot

13. Take a deep breathe, and restart yor system.
14. If everything went nicely, your system will boot up in your new kernel!
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License