简体   繁体   中英

Using qemu/kvm to boot Linux kernel with argument like “-kernel, -initrd,-append”

In qemu/kvm, we can set arguments -kernel with path to kernel image, -initrd with path to init ram disk and -append with the cmdline for booting kernel. Will it be conflict with the linux kernel image included in the guest system? How can it skip the duplicate procedure of loading kernel image when guest is booted? Thanks

I am guessing that your are referring on your kernel vmlinuz image with the /boot/vmlinuz kernel image that your init ram disk has on.

The boot process are a two (in general) step process. a. The initial boot (parameter -kernel) that use the qemu-kvm binary, is to load a kernel into ram and a initramfs disk. b. Then the kernel will try to identify the /boot/vmlinuz kernel on your initramfs and pivot (or switch_root) to your /boot/vmlinuz kernel inside your initramfs image.

So there is no duplicate procedure and no conflict with the guest (or host) kernel image.

If you want to try a new kernel image for your initramfs image, then i suggest to boot your new kernel image and chroot to your initramfs image (with bind mounts on /sys, /dev & /proc).

You have to be sure that your "new" kernel image can read properly the initramfs.

On append parameters - dont forget to add your kernel path of your initramfs image

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM