e42.uk Circle Device

 

Techie Stuff

Projects

Quick Reference

Will be moved to Quick Reference soon

Cross Compile MyBook World White Light

Cross Compile MyBook World White Light

I noticed that quite a few people had looked at the old page from a link posted on WikiDot. I have since writing the previous article bought a new MyBook World 1Tb White Light drive currently online at home and the first thing I wanted to do was get my Torrents working on it... The mybook now comes with cTorrent and so I did not really need to do anything but since I am a systems programmer at heart I wanted to be able to cross compile C code for the MyBook.

The white light MyBook has close to 128Mb RAM and does not use uClibc as the previous MyBook did.

Prepare for the fun

Download the code library from Western Digital. http://support.wdc.com/product/download.asp?groupid=117&sid=116&lang=en I got mine here :-)

You should have Linux on your machine... I don't know how to do this in Windows. I have a VM you can use if you want ;-) send me a mail (email address here).

Prepare your compilation environment

Extract the library in your home directory:

tar -xzvf WD-MyBookWorld-v1.01.16.tar.gz

When extracted my copy creates a directory called WD-MyBookWorld-v1.01.14-GPL so don't get confused when I use that in the path later.

This next step is much easier than with the old buildroot kit nonesense you has to go through with the blue circle MyBook drive. No need to compile all the build tools as they are provided in the toolchain directory. So lets go and extract them:

$ cd WD-MyBookWorld-v1.01.14-GPL/toolchain
$ tar -xzf gcc-csl-arm-2005q1-glibc-csl-arm.tar.gz

To make sure it works write a simple C programme and compile it:

#include 
int main(int argc, char *argv[]) {
fprintf(stdout, "It works!!!");
return 0;
}

Save it as hello.c, then:

$ export PATH=$PATH:/home/ben/WD-MyBookWorld-v1.01.14-GPL/toolchain/bin
$ arm-linux-gnueabi-gcc hello.c -o hello

Of course you will need to change /home/ben to your home directory. You should now have a file hello copy this to your MyBook World and type ./hello from your bash prompt.

From the information provided above and the other page on MyBook world compilation you should be able to compile anything you like for the MyBook World. Once I have the latest version (or maybe an old version) of transmission compiled and all the required support I will put it here. Until then good luck :-).

OpenSSL

I will be using version 1.0.0.

export cross=arm-linux-gnueabi-
./Configure dist
make CC="${cross}gcc" AR="${cross}ar r" RANLIB="${cross}ranlib"

"ar r" above IS correct! Move the libraries into a place so cURL can find them:

mkdir lib
cp lib* lib/

cURL

I will be using version 7.20.1. All on one line please:

CC="arm-linux-gnueabi-gcc" ./configure --build=arm-linux-gnueabi \
  --target=arm-linux-gnueabi --host=i686-pc-linux-gnu \
  --with-ssl=/home/ben/MyBook/openssl-1.0.0 --without-random

And finally:

make

Summary

You have now compiled OpenSSL and curl for your MyBook. Do you want more? How about Transmission? let's get to it.

Transmission

I will be using version 1.92.

OPENSSL_CFLAGS="-I/home/ben/MyBook/openssl-1.0.0/include" \
LIBCURL_CFLAGS="-I/home/ben/MyBook/curl-7.20.1/include" \
CC="arm-linux-gnueabi-gcc" CXX="arm-linux-gnueabi-g++" \
LIBCURL_LIBS="-L/home/ben/MyBook/curl-7.20.1/lib/.libs -lcurl" \
OPENSSL_LIBS="-L/home/ben/MyBook/openssl-1.0.0/lib" \
./configure --build=arm-linux-gnueabi --target=arm-linux-gnueabi \
  --host=i686-pc-linux-gnu --disable-gtk

make

And you're done! I am sorry this was a bit of a whistle stop tour but you get it now, it all works and more details can be found in my earlier article.

Quick Links: Techie Stuff | General | Personal | Quick Reference