I am on a 64-bit kernel and want to run a 32-bit kernel in QEMU. Once I had the compressed kernel image I tried creating the initramfs image using mkinitcpio but this only created an image with 64-bit code (busybox, which mkinitcpio uses, was 64-bit and the other executables too).

I could use the gen_init_cpio program, which is part of the kernel and get the 32-bit executables in some other way, but I'd prefer to avoid this and let a program decide what the kernel needs in rootfs.

Is there any way to get a 32-bit initramfs image while running a 64-bit kernel?


A 64bit system won't generate a 32bit initramfs because it doesn't need it. So you'd have to install the 32bit distro in a chroot.

But that might not work either, since most initramfs generators, including mkinitcpio, do module autodetection. The initramfs will contain only the modules needed for your specific hardware and setup, it won't work anywhere else. In the end, with most initramfs generators, you have to run it inside the booted VM itself.

You can disable module autodetection but then initramfs will be huge. A compromise is to manually specify the required modules in a config file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.