Hacking devices can/will void your warranty and can turn your expensive consumer electronics into worthless trash if you don't know what you're doing. This blog is for information purposes only, and if you try to hack into your own consumer electronics, you do so at your own risk. The device I'm currently hacking is the Canon SX10 IS camera.

Friday, June 12, 2009

New Buildroot / Toolchain

I have used the linux code published by iomega https://iomega-eu-en.custhelp.com/cgi-bin/iomega_eu_en.cfg/php/enduser/std_adp.php?p_faqid=21578 and the uClibc from the raidsonic http://www.raidsonic.de/de/data/driver/firmware/IB-MP3010HW/Sources_RaidSonic.rar which is also an RTD player like the SPP.

Using these two sources has enabled me to make library files that are closer to what is on the Iomega device. Without Iomega's version of the uClibc, it'll take more work to get it to be exact.

These instructions are what is necessary to set up a complete cross compiling environment and using the buildroot to make your own toolchain. You can use the toolchain on the iomega device, or just use the buildroot to build whatever files you need.

All of the links to the new stuff will be at the bottom of this post. For those who want to try to recreate and maybe fix anything I did wrong, here's a set by step.

VMWare Player (I'm using version 2.5). It's free, but requires registration to download from http://vmware.com/products/player/
VMX Builder (free, google it. It is used to make the configuration files for vmware)
Ubuntu 8.04.1 (free, google it)

step 1, installing Ubuntu
Setup new virtual machine using VMX Builder.
Set at least a 20 GB hard drive, CD Player pointing to the Ubuntu 8.04.1 ISO, ethernet (amdlance, NAT)
and a reasonable amount of memory (1 Gig works well). Make sure target platform is Player 2.x, guest is Linux, and OS is Ubuntu.
Boot the virtual machine
Select to install Ubuntu.
Ubuntu will boot and if you don't see the Install screen within a few minutes, you probably didn't give it enough memory.
Login name: developer
Login password: root
Wait...twiddle thumbs...power nap
After reboot, click on the CD-ROM button to "take the CD out of the drive".
It will finally boot to the login screen. Login with your username and password you selected.
Select System>Preferences>Screen Resolution. You're going to need to increase it to at least 1024 x 768 to even make it useable.
This virtual Machine will take about 2 1/2 GB on your drive at this point.

step 2, Preparing the machine for development. Much of this comes from the gumstix wiki.
Select Applications>Accessories>Terminal
Confirm that you can connect to the network. ping your gateway, and ping www.google.com. Fix any network problems before continuing.
You should be able to run the update.

sudo apt-get update
(you will need to provide your password)

sudo apt-get install build-essential libncurses-dev bison flex texinfo zlib1g-dev gettext autoconf subversion wget samba git git-core

sudo dpkg-reconfigure dash
select no. This will uninstall dash.

now to get the buildroot source:

git clone git://opensphd.git.sourceforge.net/gitroot/opensphd/opensphd opensphd

(note: Edited 12/12/2009. On 8/25/2009, sourceforge modified the git repository capabilities which required an adjustment to the above git command. If it wasn't working for you before now, try again. It just needed an opensphd added to the end of it)

At this point, you will probably want to set up a share so you can easily transfer files from Windows to Ubuntu through a virtual network.
chmod 777 opensphd
sudo vi /etc/samba/smb.conf

You are now using vi. Search the web to find instructions on how to use vi, because you'll use it often.
Find the section called Share Definitions and add this
comment = opensphd
path = /home/developer/opensphd
read only = no
guest ok = no

Now save that file.
sudo /etc/init.d/samba restart

sudo smbpasswd -a developer
and enter root for the password.

Now you can find out what your IP is using ifconfig and then browse that from the network. The netbios name will be something like developer-deskt if you used the user name as instructed above. Now you can start > run > \\ (or whatever IP address was identified in ifconfig) and you should see the directory.

Now, back to Ubuntu. Switch to the buildroot directory.
cd ~/opensphd/buildroot

and make the config

make menuconfig

If this is your first time using the buildroot, then just select exit and save. Otherwise, feel free to select the additional packages you need.

now type:


and wait...a long time. It's going to take a few hours. It downloads each package needed and compiles it. The final result will be in the /opensphd/buildroot/binaries/uclibc/ and there will be a rootfs.mipsel.ext2 file, your toolchain.

Once you've built the toolchain, you can copy it to your screenplay drive and mount it and chroot to it. gcc works, but g++ stopped working on this version for some reason, so I didn't include it in the default menuconfig.

I would suggest doing development in the buildroot cross development environment. If it's one of the packages already included in the buildroot, then just go back into menuconfig and add it. Then make again and presto, it'll be in your toolchain file. It'll also be in one of the working directories on ubuntu, (project_build_mipsel/uclibc/root or something like that).

You should also be able to use the staging directory and do your own cross compiling. I'll detail that another day.

The uClibc had a few minor changes, which I added as a patch in the toolchain/uclibc directory. I also removed all of the .o and .a files from it, since it interferes with a good compile. Do not remove the .so files though. They are required for the build.

The Linux is also slightly modified. the mconf.c file had a reference to LC_ALL, which is normally defined in the locale.h (bits/locale.h) file. But that file isn't a part of the iomega published files, so I subsituted the actual value in. mconf.c is not a main part of the linux system anyway (I believe it's used for the menuconfig). I also removed all of the CVS/SVN and excess files to reduce the size from 150 MB down to 50 MB.

Oh yes, if you didn't notice, I have placed all of this on sourceforge as the opensphd (Open ScreenPlay Pro HD). Feel free to send me any patch files to improve the buildroot.

edit 4/26/2010: I have updated the files today. I figured out that the headers it was downloading were responsible from some of the problems. When I compared it with the conceptronic tools, I found that I could just use the unsanitized headers. This can easily be undone by deleting the linux-libc-headers- file in the buildroot/dl directory. I also encountered the "mipsel-linux-objcopy missing" error discussed in the comments when I enabled initramfs. I was able to determine this was from the Makefile in the linux code that Iomega provided. it was not using the variables from Makefile so it would only find them if the staging_dir happened to be in your path. So I fixed that. The last thing I ran into was after g++ started compiling it then couldn't link on the device (worked fine from the PC staging directory but not on the ScreenPlay) because it was missing crt1.o and others. So I modified the scripts to copy those .o files as well when building the ext2 file.


  1. Great work.
    Compiling it now.

    By the way, can you explain a bit on how to cross-compile on my machine instead of compiling on the SPP?

  2. I get an error while trying to build it...

    mipsel-linux-objcopy -O binary -R .comment -R .note vmlinux vmlinux.bin
    make[1]: mipsel-linux-objcopy: Command not found
    make[1]: *** [vmlinux] Error 127

    Any idea?

  3. I did a new git to download everything and then did a make and it worked. It built the mipsel-linux-objcopy. What the error you put is saying is that it cannot find mipsel-linux-objcopy. There should be a sym link in opensphd/buildroot/build_mipsel/staging_dir/bin for mipsel-linux-objcopy that points to mipsel-linux-uclibc-objcopy in that same directory. Did something happen during the build that might explain why it didn't compile that? Maybe terminating the build during the build process? Typically it will stop if it is unable to build a target.

    As for compiling other programs, it will depend on if the program has an autoconfiguration file, or a newer menuconfig or old config. Generally, you'll need to add the bin files to the path and set the compiler vars.

    export PATH=~/opensphd/buildroot/build_mipsel/staging_dir/usr/bin:~/buildroot/opensphd/buildroot/build_mipsel/staging_dir/bin:$PATH
    export AR=~/opensphd/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-ar
    export AS=~/opensphd/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-as
    export LD=~/opensphd/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-ld
    export NM=~/opensphd/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-nm
    export CC=~/opensphd/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-cc
    export CPP=~/opensphd/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-cpp
    export GCC=~/opensphd/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-gcc
    export CXX=~/opensphd/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-cxx
    export RANLIB=~/opensphd/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-ranlib
    export ac_cv_linux_vers=2.6.12
    export LDFLAGS="-static"
    export CFLAGS="-Os -s"

    and then running the config (make menuconfig, or make oldconfig, or ./configure depending on the package) or if you just want to compile one program then mipsel-linux-cc filename.c (or mipsel-linux-c++ filename.cpp). You'll probably want to sstrip and there's a good chance you'll want other flags once you get into it. But this should get you started.

  4. Hey, I havn't got time to try again on compiling the buildroot.

    By the way the drivers that I'm trying to compile are the RT2870USB from www.ralinktech.com/ralink/Home/Support/Linux.html .
    I have managed to used the old toolchain you've posted with the kernel headers from this new one, but after a lot of time compiling, it complains about the endianess of the system and the compiled files or something.

  5. Hi there

    First of all thanks for some really interesting posts and the walk-through's ..would love some more info on your dropbear install if at all possible :-)

    I have an emtec moviecube model R100.
    Doing a uname -a displayes LINUX gcc version 3.4.4 mipssde-6.02.03-20050629 #16 Wed Dec 12 10:18:27 CST 2007

    I am desperately trying to add functionality to my moviecube too!

    So far I have added quite a lot of functionality and I'm sure you could do the same or more with your screenplay box :-)
    check out my posts under the name of dman on here
    and all posts for dman here

    As you can see I have already managed to setup quite a lot of functionality.
    It's frustrating though because there is no make or install option and since I am not a developer I totally confused as to how to get apps installed on my device
    Priority number 1 is to add a util called djmount which leverages off the FUSE libraries which are part of the kernel we have.
    djmount allows one to mount a UPNP server's shares onto a directory in the file system of your device , this means that your built in player will be able to browse to the mounted directory and in turn play the content (provided you have the right codecs installed for the media presented!)
    So what I did first was to install an application called mediatomb which over and above everything else it does, allows the moviecube to act as a UPNP server.
    I can now browse the network using a UPNP capable player like XBMC or windows media player (vista and windows 7) or even from mobile phones like the nokia N-series.
    From within the player you can choose which content (songs, movies,photos) you would like to view by just click your selection (that which you presented by mediatomb or any UPNP server share) and instantly your media gets streamed to your player (the UPNP client)

    So my request to you is whether or not you could or would spend a little time to help me (and the world) to get apps like this installed.

    I would also like to make the moviecube an ISCSI target and more.

    I just need a little help because the linux dev environment is alittle confusing for me at this stage

    Hope to hear form you soon

    Kind regards

  6. how can i grow up the ext2 File for more free diskspace? - or how can i mount some USB Stick into the Buildroot?

  7. Hello,
    I have compiled the buildroot successfully. Now I am trying to build a module for a wireless key. If I cross compile it I get this error when I try to insert it:
    arusb_lnx: disagrees about version of symbol struct_module

    If I try to compile it using the SP Pro (chroot-ing in the buildroot) it takes ages to build even the first .o file and exit complaining something like "newline expected".
    Any help on how to build modules that can be loaded in the kernel? By the way, none of the modules found in the buildroot can be loaded, they all spit out the same message "version fo struct_module".
    Any help will be HIGHLY appreciated, thanks!

  8. Rospogrigio,

    Sorry, I'm not familiar enough with the kernel modules to give you any help. You might want to try the newest toolchain: http://consumerelectronicshacker.blogspot.com/2009/10/organization-and-yet-another-toolchain.html The significance in this newer toolchain is that while it is still the venus linux, it is compiled with the same tools that the vendors use to compile. You might have a little more success with it.

  9. Thanks, I'll give it a try. One more question: are you sure that using mipsel is correct? Is it possible that mips should be used? I've read that the difference is that mipsel is little-endian, maybe this explains the fact that the CRC check for the symbols fails... but I think that in this case the binaries would not run.
    Anyway, I tried to compile the buildroot using mips and it failed building so I guess I'll try the new toolchain and see what happens. I would really love to be successful in this because this would make possible to use almost any wireless adapter, and many other users are hoping to be able to use their own device.
    Thanks for the reply, I look forward to hearing your opinion about the mips/mipsel. Greetings,

  10. 100% positive it is mipsel. If you telnet into the drive and type objdump -f /bin/busybox, or objdump -f /usr/local/bin/DvdPlayer, it says the ELF file format is elf32-tradlittlemips. That's mipsel. I remember seeing something else that convinced me but that memory eludes me at the moment.

  11. Thanks! Your toolchain save a lot of time and helps me to build rt73 driver for Iconbit HDS4L mediaplayer.

  12. Hello Joman100,

    I downloaded the buildroot/ toolchain

    It worked without errors (as far as I know).

    I also tried to compile your HelloWorld. That's when i Hit trouble.
    I set the Compiler Variables, and added the binaries to the PATH as you suggested in another comment. But I kept getting this error:
    mipsel-linux-gcc: HDMI-1262.cpp: C++ compiler not installed on this system
    make: *** [HDMI-1262.o] Error 1

    I'm not sure what I've missed. Any help is appreciated.

    Some folks at the OpenWRT forum had a similar error and the response was to enable stdcpp in the makefile.

    Looking forward for your response.

  13. Shades, look at http://consumerelectronicshacker.blogspot.com/2009/10/organization-and-yet-another-toolchain.html

    That's the toolchain I am currently using for the HelloWorld-JC development. It was a guaranteed match with what Iomega was using. And compiling is done on the PC instead of on the ScreenPlay, so it's much faster. I believe it is what Realtek ships with their SDK.

  14. DeadVirus, I got your error make[1]: mipsel-linux-objcopy: Command not found and modified the files and the blog post. I know this is nearly a year after the fact, but I wasn't running into the error until I turned on the initramfs. I'm sure you probably won't see this comment, but it may help others looking at this in the future.