|
GPE: UML GTK 2 cross compiling environment |
The file "gtk2-arm-cross.ext2.bz2" contains a bzip2ed image of a complete ext2 filesystem. It is intended for use with User Mode Linux (UML).
There are RPM and Debian packages of UML available. UML is now part of the "official" Debian distro: the Sid package can be found here and documentation here. RPM packages can be found here on the UML website. As of this writing (2003-07-15), the latest RPM is dated Sep 16 2002 and is based on a 2.4.19 kernel [2004-05-13: this is still the latest RPM on that page]. You can also build your own UML executable by following the instructions here.
Once you have UML installed, use bunzip2 to extract gtk2-arm-cross.ext2
into the directory from which you will be running your UML session (~/uml in
this example)
~/uml$ bunzip2 -kc /path/to/gtk2-arm-cross.ext2.bz2 >
gtk2-arm-cross.ext2
In order for UML to find this image, you either need to give it this filename
on the command line, or create a symbolic link called root_fs (you could
rename the file, but that's a less flexible option).
~/uml$ ln -s gtk2-arm-cross.ext2 root_fs
Now you can run UML.
~/uml$ linux
For Debian systems (and any others that don't use devfs by default), you will
need to specify "devfs=mount" on the command line. If you didn't create a
link or rename your image file, you need to use the "ubd0=" option.
~/uml$ linux devfs=mount ubd0=gtk2-arm-cross.ext2
2004-05-13: It came to my attention some time ago that when you upgrade to
(or install from the start) a later version of UML than the one I was
originally using (2.4.20-6um), the image refuses to boot up and generates a
kernel panic. This is due to the modules in the image being for an earlier
kernel version.
After installing/upgrading the Debian user-mode-linux package, you can find
the modules for the new kernel in /usr/lib/uml/modules. To install these
modules into the image file, do this (as root)
/home/user/uml# modprobe loop
/home/user/uml# losetup /dev/loop0 gtk2-arm-cross.ext2
If you are using devfs, you should use /dev/loop/0 instead of /dev/loop0
/home/user/uml# mount -t ext2 /dev/loop0 /mnt
/home/user/uml# cp -a /usr/lib/uml/modules/. /mnt/lib/modules
You should then be able to start UML as described above (as your normal user).
Presumably there is some mechanism by which you can always use the modules
from /usr/lib/uml/modules (instead of the ones in the image file's
/lib/modules), but I haven't had time to look into this yet. You may also want
to delete the obsolete modules directory from the image's /lib/modules
directory. You can do that either on the loopback mounted filesystem, or from
with the UML session (as the UML root user).
The filesystem image contains a root user and a normal user "toby". Neither
have a password, so at the login prompt you only need to type a username to
gain access to the virtual machine. You will probably want to login as root
first to delete the user "toby" (unless I happen to be your namesake)
# deluser toby
and then add a user with the same username as the one you use on your "real"
machine
# adduser <username>
You will also need to edit /etc/fstab. The "vi" editor is available on the
virtual machine for this purpose
# vi /etc/fstab
Change both occurences of "toby" to whatever your username is. This allows you
to mount your real home directory in the virtual machine's filesystem so that
you can access all your source code etc. from both inside and outside the
virtual machine. I set it up this way so that you can use your favourite
editors and stuff on your real machine to create your sources, then use the
UML machine to do the compiling and such.
/$ mount /home/<username>
If your real machine is not running Debian, you can also delete the line that
refers to /var/cache/apt/archives. I used this to gain access to the real
machine's archive of Debian packages.
The guts of the cross compiling environment is under /usr/arm-linux. There
are also some files and links in /usr/bin. The compilier executable is called
"arm-linux-gcc", as usual. If you set up your makefiles for an "arm" target,
you shouldn't have any problems there. There is a set of libraries for
building GTK 2 applications under /usr/arm-linux/lib. If you want some other
libraries (or need to upgrade or downgrade the existing ones), use the
tpkg-install-libc script from the dpkg-cross package as explained here. I
forgot to install dpkg-cross before creating this image file, but it's simple
enough to do it for yourself. First, download the
.deb file to somewhere in your home directory so that the file will be
accessible from the UML machine. Then login to the UML machine as root, mount
your home directory and run
# dpkg -i /home/<user>/path/to/dpkg-cross_*.deb