Friday, January 25, 2008

Creating and booting an ia32 debian system from an amd64 one

I've recently gone back to use wine to play "old" Windows games. Unfortunately, Morrowind, the one I'd like to play - really great one, if I daresay, is not working on my computer, though it should, according to its AppDB page. I tweaked wine's configuration, but no success so far. I decided it would be worth to try from within a real IA32 environment, just to check if that could be a bug linked to this. So, today's game is to create an IA32 debian system from my own, set it up and boot it.

First thing, create a i386 chroot using debootstrap:

debootstrap --arch=i386 sid /chroots

The target, here /chroots must be the root directory of a given device -- else booting won't work. Then, you must set up a proper /etc/fstab file, so it actually can mount things once you've decided to boot it.

Then, for fun, I've decided to cross-compile the kernel I would be using, so, after download/extracting recent kernel source, this is what I did. First, spawn the configuration tool:

make xconfig ARCH=i386
make -j2 ARCH=i386 

Then, I copied the kernel images using

cp arch/i386/boot/bzImage /chroots/boot/vmlinux
cp arch/i386/boot/compressed/vmlinux.bin /chroots/boot

The latter is important for the kexec kernel call. I also copied the kernel sources from the current system to the chroot, so as to be able to build kernel modules in the target system. Then, I did use the kexec utility to boot my new kernel:

telinit 1
kexec -l /chroots/boot/vmlinux.bin --append=root=0342
kexec -e

And there you go !! Then, you probably need to setup new users and also configure the network (try to copy from your current config).

So I did all this, to finally realize that it didn't work any better with a full ia32 system... Pity !

No comments: