Compiling white-light Modules from source

Here's how I was able to compile modules from the Western Digital sources

known SDK for white book:
v1.00.16 http://support.wdc.com/download/mybook/WD-MyBookWorld-v1.00.16-GPL.tar.gz
v1.01.16 http://download.wdc.com/gpl/WD-MyBookWorld-v1.01.16.tar.gz

the original WD firmware files are compiled by (five) different GCC cross compiler versions:
http://mybookworld.wikidot.com/forum/t-207396/cross-compiling-kernel-modules


Variant 1

in Ubuntu Jaunty 9.04 (64-bit)

Keep in mind that you're going to need (at least) the following packages installed on our workstation: bison, flex, texinfo, libc6-dev-i386, build-essential. For "make menuconfig" you need libncurses5-dbg and libncursesw5-dbg.

1. tar -xzvf WD-MyBookWorld-v1.00.16-GPL.tar.gz
2. cd WD-MyBookWorld-v1.00.16-GPL/kernel/
3. tar -xzvf kernel-source.tar.gz
4. cd kernel-source
5. tar -xjvf buildroot-20080225.tar.bz2
6. cp -rf buildroot-patches/* buildroot/
(you can also run buildroot-patches/snapshot.patch buildroot-patches buildroot, skipping step 8)
7. cd buildroot
8. ./snapshot.patch . .
9. make defconfig
10. vim "target/makedevs/makedevs.mk" , Remove -Werror from
11. create the file "libusb-0.1.12-nocirc.patch" in "package/libusb/" , enter:

--- libusb-0.1.12/configure.in.orig    2006-03-04 03:53:04.000000000 +0100
+++ libusb-0.1.12/configure.in    2008-05-23 16:08:59.000000000 +0200
@@ -149,6 +149,7 @@
 fi

 # Checks for programs.
+AC_PROG_CXX
 AC_LANG_CPLUSPLUS
 AC_PROG_CC
 AM_PROG_CC_C_O

12. cd to WD-MyBookWorld-v1.00.16-GPL/kernel/kernel-source/buildroot, run make
13. Eventaully it dies compiling gdb. To fix remove -Werror from "WD-MyBookWorld-v1.00.16-GPL/kernel/kernel-source/buildroot/toolchain_build_arm/gdbhost-6.6/bfd/Makefile"
14. run make again
15. Pretty soon thereafter, make will die. To fix remove -Werror from "WD-MyBookWorld-v1.00.16-GPL/kernel/kernel-source/buildroot/toolchain_build_arm/gdbhost-6.6/opcodes/Makefile"
16. run make again
17. cd ..
18. source ./setup-paths.sh
19. cd kernel-0.4.6
20. make oxnas_810_eabi_dse_defconfig
21. make menuconfig (Here's where you can adjust the existing modules and add your own)
22. make modules

comment: You don't need remove -Werror
Rename the symbol in unifdef.c to parseline (3x) to avoid this conflicting declaration.
"error scripts/unifdef.c:209: error: conflicting types for ‘getline’"
… after then the make runs fine until build of arm-linux-gcc-4.1.2


Variant 2

from http://mockmoon-cybernetics.ch/computer/wdh1nc10000/crosscompiling.html

Crosscompiling for the MyBook World
Prerequisites

* Download the firmware from WD's site WD-MyBookWorld-v1.00.16-GPL.tar.gz
* Extract the toolchain (and the kernel directories)
* Set the PATH accordingly (e.g. export PATH="$PATH:/opt/mbwe/toolchain/bin"

Crosscompiling kernel modules

* cd to the kernel-0.4.6 directory
* export CROSS_COMPILE=arm-linux-gnueabi-
* export PATH="$PATH:path..to/toolchain/bin"
* make oxnas_810_eabi_dse_defconfig
* make menuconfig
* make modules

Crosscompiling packages using autoconf/automake

* export PATH="$PATH:path..to/toolchain/bin"
* ./configure —host=arm-linux-gnueabi …
* make
[[/code]]


Variant 3 (not for kernel modules)

if you don't need kernel modules you can use this simple way with the svn (build a cross compiler)

1. install a clean ubuntu (I'm using VMWARE with ubuntu 9.10)
2. go to "synaptic package manager" and install "build-essentials" and "subversion"
3. open a terminal 
4. sudo su
5. mkdir ./slug; cd ./slug 
6. svn co http://svn.nslu2-linux.org/svnroot/optware/trunk optware
7. cd optware; make cs05q1armel-target
8. cd cs05q1armel; make directories ipkg-utils toolchain
9. make hello-dirclean hello-ipk

now you find a running binary "hello" in … /slug/optware/cs05q1armel/builds/hello/src
copy it to white book -> chmod 777 -> execute it

/DataVolume/Download/test # ./hello-gcc -n
+---------------+
| Hello, world! |
+---------------+

now you can change the sample code and test your own code

#cd to folder /slug/optware/cs05q1armel/builds/hello/src
gedit hello.c
make clean
make

copy the binary to white book and run it


Variant 4

MyBook World Cross Compilation
http://bengreen.eu/pmwiki/pmwiki.php?n=Linux.CrossCompileMyBookWorld
http://bengreen.eu/pmwiki/pmwiki.php?n=Linux.CrossCompileMyBookWorldWhiteLight

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License