[First in a series recreating the lost posts -- This was originally posted 10/08/10]
Mozzwald's zubuntu being ubuntu based and thus debian based has alot of prebuilt software via the apt repositories but there are times when you just want to knock something up for yourself or build something that isn't in the repositoires or even rebuild something that is but isn't ZipitZ2 friendly.
You can install and use gcc on the ZipitZ2 but it isn't something I recommend unless you have alot of patience and are a bit of a masochist. However there is another way that leverages the power of your desktop, Scratchbox2. Scratchbox2 is a toolkit for building cross compiling SDK's, in fact it is the basis of the maemo sdk for the nokia n7xx/8xx/9xx.There is one problem with Scratchbox2 though, there is little documentation and what little there is sucks.
Scratchbox2 has a few dependencies but if you are planning on using it on a ubuntu or debian host they are all (except one) available in the repositories.
The first thing to download is a toolchain for your target processor, in the case of the ZipitZ2 and zubuntu we need an ARM toolchain and the de facto standard for prebuilt ARM toolchains is CodeSourcery's G++ lite. Download the 2010q1 release. Although I prefer the CodeSourcery toolchain you might prefer the emdebian one or to build one yourself. After downloading the toolchain, in my case CodeSourcery's. Create a directory and extract the toolchain into it.
mkdir ZipitZ2 tar xjvf ../path/to/downloaded/arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 ls arm-2010q1
Now we have to install Scratchbox2, if you are using ubuntu >= 9.10 it should already be in the ubuntu repositories, if not add the following likes to your /etc/apt/sources.list
deb http://maemo-sdk.garage.maemo.org/download/host ubuntu-jaunty free
andsudo apt-get update
Once that is done or if Scratchbox2 is already in the repositoriessudo apt-get scratchbox2 sb2-qemu-arm
Scratchbox2 is now installed on your system and it's time to add a seed rootfs, at minimum this is just the lib, include and etc directories from your target device but in this case because we have the whole rootfs available and configured we might as well use it as it will give us a few abilities that we wouldn't have otherwise, such as the ability to use apt on the seed rootfs once it is installed.
There are several ways to do this, but the easiest would be to use the technique in my previous post Mounting a raw disk image. Once mounted create a directory inside the ZipitZ2 directory.cd ~/ZipitZ2 mkdir zubuntu_rootfs
and copy the directories and files from the mounted image to zubuntu_rootfs, using mc or cp will do (will will need to do this as root or via sudo as we need to create /dev nodes and you might have permission problems if you don't. then change the owner and group of all the files and directories in zubuntu_rootfs.
[Update: #zipit user slug said I copped out on the above paragraph by saying use mc or cp. the real command you should use if you aren't going to use mc is.sudo cp -RvPp /media/mounted/image/. ~/ZipitZ2/zubuntu_rootfs
]cd ~/ZipitZ2/zubuntu_rootfs sudo chown -R user * sudo chgrp -R user *
And finally we now need to setup Scratchbox2 for our target device, so make sure you are in the rootfs directory and then run sb2-init.cd ~/ZipitZ2/zubuntu_rootfssb2-init -c sb2-qemu-arm ZipitZ2 $HOME/ZipitZ2/arm-2010q1/bin/arm-none-linux-gnueabi-gcccd .. mkdir build cd build sb2 -eR apt-get update sb2 -eR apt-get upgrade
You are now ready to build software for the ZipitZ2 running mozzwald's zubuntu. To build stuff for your host use the normal commands, make, gcc.... if you are building for your target then prefix everything with sb2 i.e.gcc hello.c -o hello
builds for your hostsb2 gcc hello.c -o hello
Builds for your target.
If you are building and need to use libraries or include files from your seed rootfs then you will need to use the -R (fakeroot) option of sb2 i.e.sb2 -R gcc hello.c -o hello
and if you need to install a handbuilt library or other software into your seed rootfs then you'll need to use both the -R option and the -e (emulate) option i.e.sb2 -eR make install
I have used this method to setup Scratchbox2 successfully and have used it to build both small dirty hacks and build my ZipitZ2 utilities for messing with gpio's and also really large software such as OpenCOBOL.