Compiling Homebrew 1.08.17 on Ubuntu 12.04

Warning : Flashing the WDTV Live Streaming (Gen3) will void its warranty and the online streaming service functionality will not be available anymore !
!!! Do it at your own risks, I WILL NOT be taken responsible for any damage caused to your device (such as brick) !!!

Why using GPL code ?
GPL code allows to add functionnality to your WDTV box (I will add SSHFS support in a previous article)

What you need ?
- A Physical or Virtual PC running Ubuntu version 8.04 or newer in 32 bits (64 bits returns an error during compiling)
- At least 6 Gb free space on your hard disk drive.
- The source from Western Digital : WDTV_LiveStreaming_GPL_Code_package_1.08.17.zip and the toolchain for cross-compiling GPL_toolchain_of_WDTV.zip
- A lot of time (more than 6 hours on my P4 2.8 GHz !)

Preparing the system :

- Install prerequired package
sudo apt-get install openssh-server vim automake libtool patch gettext libglib2.0-dev gawk cramfsprogs genromfs flex texi2html texinfo bison libncurses5-dev intltool build-essential subversion python-gtk2 unzip

- Modify sh interpreter (see README_PREREQUISITES in file WDTV_LiveStreaming_GPL_Code_package_1.08.17.zip)
cd /bin
sudo rm sh
sudo ln bash sh

- Create a directory in your home directory and download toolchain (cross-compiler)
cd
mkdir wdtvgen3
cd wdtvgen3
wget http://download.wdc.com/gpl/GPL_toolchain_of_WDTV.zip

- Uncompress and configure toolchain for cross-compiling
unzip GPL_toolchain_of_WDTV.zip
tar xzfv GPL_toolchain_of_WDTV/toolchain_binary/mips-4.3.tgz
sudo mv mips-4.3 /opt

- Patch automake (Only with Ubuntu 12.04. Not on older, not on newer, just with 12.04)
wget http://mirror.ovh.net/ubuntu//pool/main/a/automake1.11/automake_1.11.6-1ubuntu1_all.deb
sudo dpkg -i automake_1.11.6-1ubuntu1_all.deb

- Configure environnement variable
echo "export DIRECTFB_I=~/wdtvgen3/PALACE_1.08.17_G/src/libs/qt-everywhere-opensource-src/directfb" >> ~/.profile

Compiling homebrew :

- Download and decrompress WDTV GPL source code
wget http://download.wdc.com/gpl/WDTV_LiveStreaming_GPL_Code_package_1.08.17.zip
unzip WDTV_LiveStreaming_GPL_Code_package_1.08.17.zip
tar xzfv PALACE_1.08.17_G.tgz

- recheck the variable Directfb_i
export DIRECTFB_I=~/wdtvgen3/PALACE_1.08.17_G/src/libs/qt-everywhere-opensource-src/directfb
echo $DIRECTFB_I

- Patch WPA_Supplicant
cd ~/wdtvgen3/PALACE_1.08.17_G/src/libs/make
mv wpa_supplicant.mk wpa_supplicant_old.mk
wget http://guimli.free.fr/download/patch/wpa_supplicant.mk

- Patch Avahi (Use this Avahi patch only with Ubuntu 12.04 or newer !!!)
cd ~/wdtvgen3/PALACE_1.08.17_G/src/libs/avahi-0.6.30
mv avahi.patch avahi_old.patch
wget http://guimli.free.fr/download/patch/avahi.patch

- Compil source code
cd ~/wdtvgen3/PALACE_1.08.17_G
make distclean
make

- Wait 6h

- Copy binaries files to directory structure.
make install

- Build the firmware
make firmware

- Increase the version number in wdtvlivegen3.ver file (this is useful only if you reflash a GPL firmware with same version)
~/wdtvgen3/PALACE_1.08.17_G/build
sed -i 's/1.08.17/2.08.17/g' wdtvlivegen3.ver
cat wdtvlivegen3.ver

- Copy all files in the Palace_launch_1006 folder at the root of an USB key formatted in FAT32 (this is useful only if you flash from official firmware)
This Firmware delete the security key from your WDTV Live and switch your box in GPL mode.

- Flash your WDTV Live Streaming, wait for the GPL Warning and remove the USB key.

- Copy the 3 wdtvlivegen3 files in PALACE_1.05.18_G/build at the root of your USB key.

- Flash your WDTV Live Streaming !

You now have a GPL firmware !

Homebrew based on 1.10.12

This release contains three new problems that I had corrected before obtaining a functional firmware.
All these problems are caused by DMARender binary.
- The network configuration that is now in the /usr/local/bin/wpa_supplicant.realtek. So I create a new symbolic link name of this
- Configuration files for Apache are no longer generated. Suddenly, the httpd server can not find the configuration files and does not start. I redirected the symbolic link to the file httpd.conf /webserver/conf/httpd.conf.backup.
- And finally DMARender always NFS mounts in the /tmp/nfs but seeks media /tmp/media/nfs. So I once again changed the file /bin/mount to create a symbolic link when mounting NFS.

Firmware 1.10.12 G V1.03

I also included batch and log files to help you check the progress of your compilations or modification.

Writing a document using the mounting SSHFS is in progress

Compilation : Errors and solutions

This page contains all the error messages produced during compilation
source GPL.
I will complete this page later when I could recreate the different mistakes that were reported.

Error :
make[4]: *** Pas de règle pour fabriquer la cible « /directfb/directfb.h », nécessaire pour « .obj/release-shared-emb-mips/qscreendriverfactory_qws.o ». Arrêt.
make[3]: *** [sub-gui-install_subtargets-ordered] Erreur 2
make[2]: *** [/home/guimli/wdtvgen3/GPL_PALACE_1.10.12_G/PALACE_1.09.10_G/src/libs/../../src/libs/.qt_compiled] Erreur 2
make[1]: *** [subdir-libs] Erreur 2
make: *** [subdir-src] Erreur 2

Solution :
Check DIRECTFB_I variable. Check that the path name is correct
export DIRECTFB_I=~/wdtvgen3/PALACE_1.08.17_G/src/libs/qt-everywhere-opensource-src/directfb

Error :
service-type-database/Makefile.am:21: `pkglibdir' is not a legitimate directory for `DATA'
make[3]: *** [Makefile.in] Error 1
make[3]: Leaving directory `/home/guimli/wdtvgen3/GPL_PALACE_1.10.12_G/PALACE_1.09.10_G/src/libs/avahi-0.6.30/avahi-0.6.30'
make[2]: *** [/home/guimli/wdtvgen3/GPL_PALACE_1.10.12_G/PALACE_1.09.10_G/src/libs/../../src/libs/.avahi_compiled] Error 2
make[2]: Leaving directory `/home/guimli/wdtvgen3/GPL_PALACE_1.10.12_G/PALACE_1.09.10_G/src/libs'
make[1]: *** [subdir-libs] Error 2
make[1]: Leaving directory `/home/guimli/wdtvgen3/GPL_PALACE_1.10.12_G/PALACE_1.09.10_G/src'
make: *** [subdir-src] Error 2

Solution :
On Ubuntu 12.04 or newer, Avahi need to be patched.
cd ~/wdtvgen3/PALACE_1.08.17_G/src/libs/avahi-0.6.30
mv avahi.patch avahi_old.patch
wget http://guimli.free.fr/download/patch/avahi.patch

Error :
checking for mipsel-linux-gcc... /opt/mips-4.3/bin//mipsel-linux-gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
make[2]: *** [/home/guimli/wdtvgen3/PALACE_1.12.14_G/src/libs/../../src/libs/.libiconv_configured] Erreur 77
make[2]: quittant le répertoire « /home/guimli/wdtvgen3/PALACE_1.12.14_G/src/libs »
make[1]: *** [subdir-libs] Erreur 2
make[1]: quittant le répertoire « /home/guimli/wdtvgen3/PALACE_1.12.14_G/src »
make: *** [subdir-src] Erreur 2

Solution :
You use 64 bit Ubuntu version. Reinstall Ubuntu in 32 bit.