Cross-strapping!

So, I’ve actually done something vaguely productive with arch now; namely put debootstrap into it, and hacked on cross-strapping support. Cross-strapping is basically inspired by the needs of the Hurd project, and more particularly the crosshurd package. Basically, in order to install a Debian GNU/Hurd system you have to boot up Linux, do partitioning and a partial install, then reboot into that partial install and finish it off. You can’t do the partitioning in Hurd, and you can’t get a functional Hurd system from Linux, so you have to do it in two stages.

So naturally, that’s how debootstrap works now. The first stage can thus be executed on any Unixy platform, and just needs basic things like a POSIX sh, sed, wget and access to a Debian archive; and while the second stage does have to be run on the target host, it doesn’t require anything other than what the first stage has already setup. In fact, the procedure for completing the second stage install is just:

chroot $TARGET debootstrap/debootstrap

In theory this should be useful for a bunch of things other than the Hurd; such as setting up Linux chroots on BSD systems, installing Debian onto embedded systems, and possibly doing cool emulation stuff with things like qemu.

The only real problem with it at the moment, is that it isn’t able to create the correct devices for the target system (it creates the devices for the host system instead). Hopefully that can be fixed once Bdale finishes porting the Red Hat makedev to Debian.

A snapshot tarball is available here. If you want to play, you can do a first stage only install with:

debootstrap --arch ${TARGET_ARCH} --foreign sarge ${TARGET_DIR} ${MIRROR}

The --arch flag is required for everything interesting, the --foreign flag tells debootstrap to do the first stage only.

Leave a Reply