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.

Wednesday, January 7, 2009

Getting buildroot to work

Ok, I've already talked about compiling a binary on the device using the toolchain I found. Unfortunately, it works less often than I expected due to the difference in libraries and linux system.

So a better option would be to build my own so I can specify exactly which linux kernel to use, and which uclibc to use.

Well, this has not been an easy process. I originally started documenting all of the steps, but there have been so many steps trying to get it to work that I've lost track.

Step 1. Get the Ubuntu 8.04 ISO.
Step 2. Get vmware player. This will allow you to play a virtual machine on your machine. It's a way to host another operating system without losing what you have on yours.
Step 3. Get vmx builder. This is a way to build the virtual machines. You'll need to set up one that has a CD Rom that points to the Ubuntu ISO, and a hard drive with at least 20 GB.
Step 4. Launch the ubuntu VMX. This will start the virtual machine and launch the Ubuntu install. After you have completed the linux install, you'll be ready to start the real task.
Step 5. Once into linux, open a terminal screen. At the prompt type:
sudo apt-get install xxxxx
where xxxxx is replaced with the following packages:
gcc
libssl-dev
libncurses-dev
bison
flex
texinfo
zlib1g-dev
gettext
autoconf
patch
subversion
wget

That will install those individual packages. You can combine those onto one line separated with a space to save time. I've put them on individual lines so you can see each package required.

Then type:
sudo dpkg-reconfigure dash

and when prompted, select No. This was at the recommendation of another website that said dash would interfere.

That's all for the prerequisites.

now type

svn co svn://uclibc.org/trunk/buildroot

That will pull down the buildroot source. Now you need to configure it. Type:

make menuconfig

and after a moment, you will get the configuration. Change the configuration target so that it will do (first option) MIPSEL, (second option) MIPS32. You can also enable Large File support (I suspect Iomega forgot to do that one) and the generic development too.


Now exit. Then type

make

Bye bye. It'll take a while. When you get back, you'll find that you've just compiled a root file system for the wrong version of the Linux kernel, and the wrong version of the uClibc. Hold on, that doesn't mean get mad at me for not telling you the additional configuration options. You have to do it first the way it is currently checked into SVN. It is possible it won't work. If it doesn't work, solve the problems before continuing on. That'll make it easier to solve the problems you will run into when selecting the right kernel and uclibc.

Ok, if you want the older version of the linux file system that matches the one on the SPP, then go to the ~/buildroot/package/linux directory and modify the Config.in file in it to include the correct version of linux.

Now build, selecting the new version of linux. It'll download and decompress it, but then fail because it doesn't know how to build the Kbuild file. You'll need to pull the Kbuilds from the other linux directory. The Kbuild file appears to tell the buildroot utility what include files are needed. Well, the other linux directory includes files in the Kbuilds that aren't in the older version of linux, so after you copy then you'll have to modify those Kbuild files to remove those references.

Except there's another complication. The newer version of linux includes unifdef which is needed in the build. So you need to pull that one from the other version of linux as well.

Then you may find .h files in different places, which can be resolved by putting in symbolic links from their regular place.

And then there's trying to find the right package selection. I selected the build environment and blew everything up.

uClibc version is there, but you have to select the option for showing obsolete packages. Oh, and be sure to do a make clean when switching between linux and uclibc versions.

Yeah, see, it was getting so complicated I couldn't keep it down to a few simple steps.

Maybe somebody who understands buildroot will find an easier way. But I think from here, the best thing for me to do is to provide the .tar of my buildroot directory (so you can pull down your own packages as needed, and solve the problems with them as you try to compile them).

And for those who are satisfied with a 2.6.12.6 version of linux + 0.9.28 uClibc toolchain + gcc and tools in an .ext2 file that can be chrooted to, I can provide the ext2 file.

All I have to do at this point is find a place to host the files. box isn't going to do it because the ext2 is 75 Mb and the tar file is over 1 gb, although I think I can get the size down on that by removing some of the easy-to-add packages and let them download.

Stay tuned if you're interested in either of these files. In fact, leave me a comment letting me know you're interested, as I probably won't try to find a host until I know somebody wants this.

2 comments:

  1. hi,
    what do you think about building an image of the current state (newer kernel, uclibc) and copy the DvdRecorder and RootApp to it? how many drivers are closed source (only the venus?) which might make troubles?
    ok...I know..it might not be that easy to configure a kernel that works on the board..

    I hope I have more time in 1 or 2 weeks to try to get a buildroot as well..

    cheers,
    dominik

    ReplyDelete
  2. "And for those who are satisfied with a 2.6.12.6 version of linux + 0.9.28 uClibc toolchain + gcc and tools in an .ext2 file that can be chrooted to, I can provide the ext2 file."

    Iam interested about this file. Can you send me a link to get it?

    (remove -nospam)
    cybermomo-nospam@techemail.com

    ReplyDelete