You are not logged in.

#1 2014-10-29 07:00:55

citsuac
Member
Registered: 2014-08-26
Posts: 17

[SOLVED] qemu, direct-kernel boot, initramfs and mkinitpcio hooks

Hi All,

I was getting an error when trying to boot directly to the arch kernel using qemu-system-x86_64 following this guide to get setup (replacing debian steps with arch equivlant of course).

I created my own initram using mkinitcpio after arch-chrooting into the new environment.  I then tried to execute the kernel with this command:

$ qemu-system-x86_64 -kernel /boot/vmlinuz-linux \
    -initrd /tmp/initramfs-linux.img \
    -append "root=/dev/vda rootwait ignore_loglevel debug udev.log_priority=8 loglevel=8 option.debug=Y" \
    -drive file=/tmp/arch.img,if=virtio

The error I received was the 'waiting 10 seconds for /dev/xyz' which is probably familiar to most readers of this forum.

The solution I found was to move the 'block' hook in mkinitcpio.conf (responsible for virtio) before the 'autodetect' hook after reading this somewhat obscure statement on the wiki: "Any hooks placed before 'autodetect' will be installed in full."

Does anyone know why ordering failed when autodetect came before block when running qemu?  I would think that I'm not the first one to come across this, but searching the forums and the internet didn't yield much.

Thanks!

https://wiki.archlinux.org/index.php/mk … mmon_hooks

Last edited by citsuac (2014-10-29 16:43:25)

Offline

#2 2014-10-29 13:00:40

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] qemu, direct-kernel boot, initramfs and mkinitpcio hooks

Probably it fails because you're using an autodetect-enabled image that wasn't generated on the qemu guest. Therefore, it doesn't have the necessary virtio block modules included.

Autodetect-enabled images are not in any way portable, by design.

Offline

#3 2014-10-29 16:42:16

citsuac
Member
Registered: 2014-08-26
Posts: 17

Re: [SOLVED] qemu, direct-kernel boot, initramfs and mkinitpcio hooks

It makes sense that since I ran mkinitcpio in a chroot environment that the virtio module wouldn't be loaded and therefore wouldn't be put into the initram.

Now that I'm not totally exhausted, I took the time to read the code and understand when everything gets executed.

My confusion came from misunderstanding when hooks actually got ran (at image generation, not boot time).  Reading the wiki and man page again, I think part of my confusion was that they say the hooks run at 'mkinitcpio runtime' which of course is when the image gets generated.  In my tired mind though, I read that and thought that the hooks get run in the early userspace environment.

Thanks Falconindy!

Offline

Board footer

Powered by FluxBB