Debian supports (either officially or unofficially) a lot of
architectures, which is of course a nice thing. Sometimes you want to
play with some exotic architecture you are not familiar with, or you
want to debug a problem with that architecture, but you do not have a
computer implementing that architecture. Fortunately QEMU is able to
emulate most of the architectures supported by Debian (
ia64 being an
exception), however it can be difficult to install it or to find
ready-to-use images on the Internet (there are some, but usually they
are quite a few years old). Let's also say that for some reason you
cannot or do not want to use the Debian porterboxes (maybe you are not
a DD, or you want to mess up with the network, or you want to be
root). What do you do?
Mostly for the fun of hacking on some exotic architectures, I tried to
brew together a little script, the Debian Quick Image
Baker (DQIB). It is basically a
wrapper that calls
qemu-debootstrap with the right options (where
"right" means "those that I have experimentally found to work"), with
some thin icing layer on top.
qemu-debootstrap is basically another
wrapper on top of
debootstrap, which of course does the heavy
qemu-user-static, that allows
debootstrap to run
executables for foreign architectures.
With DQIB you can quickly create working images for most Debian
official architectures (
s390x works, but requires a little
workaround because of a little
bug that was fixed in
recent QEMU versions. Images for
armel can be created, but the only
Linux kernel offered by Debian for
armel does not work on any QEMU
machine. I don't know of a workaround here. I would also like to
support non official architectures, but this is work in progress. For
all the non official architecture, either
qemu-debootstrap fails for
some reason, or I cannot find the right options to make the
Debian-distributed kernel running (except for
riscv64, where I know
how to make the kernel work, but it requires some non trivial changes
to the DQIB script; however, the
riscv64 panorama is very dynamical
and things could change in very little time).
You can either clone the repository and run DQIB on you computer (check out the README), or download pre-baked images regenerated weekly by a CI process (which include the right command line to launch QEMU; see above for the definition of "right").
(You might ask why this is hosted on Gitlab.com instead of the Debian Developer's obvious choice. The reason is that the artifacts generated by the CI are rather large, and I am not sure DSA would be happy to have them on their servers)
Have fun, and if know how to support more architectures please let me know!
Leave a comment
Comment will be manually reviewed before being published.
josch said, on 2019-06-09 19:00:35+02:00:
In README.md you write: "Unfortunately the root requirement comes from debootstrap and cannot be removed."
This is not correct. You can either call debootstrap with the wrapper suggested in Debian bug #829134 or you can use mmdebstrap which is a drop-in replacement for debootstrap with multiple advantages over it (3-6 times faster, multiple mirrors, reproducible output, qemu-user-static support, ...).
Paul Wise said, on 2019-06-10 01:24:08+02:00:
FYI, qemu-debootstrap is now obsolete (in Debian buster and later), you can just install qemu-user-static and run debootstrap itself. The Linux kernel will do the right thing
Giovanni Mascellani said, on 2019-06-10 09:00:00+02:00:
Nice to know, thanks for the feedback!
Andrej Shadura said, on 2019-06-10 19:11:20+02:00:
Hi, have you heard of debos? It takes a similar approach but is more flexible and has a bit more mature code base.
Giovanni Mascellani said, on 2019-06-11 22:30:00+02:00:
I did not know about it, but maybe my target is a bit different: the point is not having "good" images, but having them for different architectures, and having the options that make QEMU run those images.