Maemo 2.0 on AMD64
This document describes how to make Scratchbox 0.9.8 work on Ubuntu for AMD64.
The approach taken is to set up a 32-bit chroot environment for Scratchbox to run in.
Please note that I’m writing this documentation about one week after the fact and thus
the information provided here might be incomplete. Do not hesitate to send me corrections.
The approach shown here works just fine with Ubuntu 6.10 (Edgy Eft)
as well as Ubuntu 6.06 (Dapper Drake) as the host system. I haven’t tried yet with
an Edgy guest system inside the chroot, though.
Part of this document is based on the Ubuntu 32bit CHROOT for AMD64 wiki page by Matt T. Proud.
1. Package prerequisites
Invoke:
sudo apt-get install dchroot debootstrap linux32
2. Setup of the chroot location
Choose a location that has ample free space and create the chroot directory there.
I’ll be using /chroot/dapper-i386 in the remainder of this document.
sudo mkdir -p /chroot/dapper-i386
Add that location to /etc/dchroot.conf:
...dapper-i386 /chroot/dapper-i386
3. Base system installation
Invoke:
sudo debootstrap --arch i386 dapper /chroot/dapper-i386
Put the following lines into /chroot/dapper-i386/etc/apt/sources.list:
deb http://archive.ubuntu.com/ubuntu dapper main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu dapper-security main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse
Invoke
sudo linux32 dchroot -c dapper-i386 -d
to enter the chroot environment as root. Then run:
apt-get updateapt-get dist-upgradeapt-get install language-pack-en ubuntu-standardtouch /etc/shadow /etc/hostsmkdir /media/cdrom0 /media/floppy0
Exit the shell to leave the chroot environment.
4. System integration
To integrate the 32-bit chroot into your system, download
the chroot32 script
and place it into /etc/init.d. You’ll want to inspect that
file as it will become part of your boot process. Once you’re sure, go on
and create the necessary symbolic links in the /etc/rc?.d
directories to have the script executed on boot-up. On Debian and its derivates,
the distribution tool update-rc.d can be used to set up all
runlevels at once:
sudo chmod a+rx /etc/init.d/chroot32sudo update-rc.d chroot32 defaults 94 86
At this point, you might as well download the
scratchbox32-core
script needed later on and place that into /etc/init.d, too.
Then, after you had a look at the file and made sure it won’t hose your
system, integrate this script into your system’s initialization procedure
as well:
sudo chmod a+rx /etc/init.d/scratchbox32-coresudo update-rc.d scratchbox32-core defaults 95 85
Since /etc/init.d/chroot32 runs mount --bind
to make the chroot’s group and
passwd files reflect the content of the host system’s
files, the sbox group must be created manually within the
host environment:
sudo addgroup --system sboxsudo adduser <your-user-name> sbox
For <your-user-name>, insert the login name of the user who will be working with Scratchbox. Repeat as necessary for multiple users.
Finally, run the initialization script to prepare the 32-bit
chroot environment for use:
sudo /etc/init.d/chroot32 start
5. Installing Scratchbox
Download the Debian packages from the Scratchbox 0.9.8 repository. You’ll probably need:
scratchbox-core_0.9.8.8_i386.debscratchbox-devkit-debian_0.9.8.8_i386.debscratchbox-libs_0.9.8.8_i386.debscratchbox-toolchain-cs2005q3.2-glibc-arm_0.9.8.5-6_i386.debscratchbox-toolchain-cs2005q3.2-glibc-i386_0.9.8.5-6_i386.deb
If you put them somewhere in your home directory, they should now be accessible
from inside the 32-bit chroot as the entire /home
is mirrored into the chroot tree.
sudo linux32 dchroot -c dapper-i386 -dcd <download-destination>dpkg -i scratchbox-core_0.9.8.8_i386.deb scratchbox-devkit-debian_0.9.8.8_i386.deb scratchbox-libs_0.9.8.8_i386.deb scratchbox-toolchain-cs2005q3.2-glibc-arm_0.9.8.5-6_i386.deb scratchbox-toolchain-cs2005q3.2-glibc-i386_0.9.8.5-6_i386.deb
The package installation automatically started the Scratchbox environment.
However, we’ll be using our own system integration scripts outside the chroot
since doing it that way turns out to be more reliable in my experience. Undo
the automatic startup with:
/etc/init.d/scratchbox-core stop
Now exit the shell to leave the chroot environment. Outside of the chroot
environment, create this link:
sudo ln -s chroot/dapper-i386/scratchbox /
This allows using the supplied sbox_ctl script from
outside the chroot without changes. Then run the Scratchbox startup script:
sudo /etc/init.d/scratchbox32-core start
And finally enter the Scratchbox environment:
linux32 dchroot -c dapper-i386 -d /scratchbox/login
Congratulations! You should now be able to follow the instructions from the maemo tutorial.
6. Notes
The documentation is a bit unclear on the intended environment to run
Xephyr in. In my experience, it works best to run Xephyr outside Scratchbox,
but inside the 32-bit chroot. You may want to use my
login-xephyr
wrapper script around /scratchbox/login in order to start
Xephyr together with Scratchbox.