无法在 qemu 中启动自定义构建的 Linux 内核

无法在 qemu 中启动自定义构建的 Linux 内核

我在qemu上安装了Linux的MIPS端口。所以我从以下位置下载了 initrd 和 vmlinux (kernel 4.9.0) 映像http://ftp.debian.org/debian/dists/Debian9.5/main/installer-mips/20170615+deb9u4/images/malta/netboot/ 安装顺利完成,我可以启动 qemu:

$ qemu-system-mips -M malta -m 1G -hda ./debian-mips.qcow2 \
      -initrd $initrd \
      -kernel $vmlinux \
      -append "nokaslr root=/dev/sda1" -nographic

其中 $initrd 和 $vmlinux 来自上面的链接。

但是,当我使用与 4.9.0 相同的配置交叉编译新内核 4.18.0,然后再次启动 qemu 时,它会失败,如下所示:

...
[    4.019974] serial8250.0: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
[    4.022670] cacheinfo: Failed to find cpu0 device node
[    4.022950] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    4.024763] mousedev: PS/2 mouse device common for all mice
[    4.027981] rtc_cmos 70.rtc: registered as rtc0
[    4.028277] rtc_cmos 70.rtc: alarms up to one day, 242 bytes nvram
[    4.030893] NET: Registered protocol family 10
[    4.036155] Segment Routing with IPv6
[    4.036660] mip6: Mobile IPv6
[    4.036903] NET: Registered protocol family 17
...  [    4.045894] rtc_cmos 70.rtc: setting system clock to 2018-07-23 02:26:58 UTC (1532312818)
[    4.076247] Freeing unused kernel memory: 1528K
[    4.076491] This architecture does not have kernel memory protection.
Loading, please wait...
starting version 232
[    4.685538] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[    4.703542] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[    4.754874] random: udevadm: uninitialized urandom read (16 bytes read)
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... Begin: Waiting for suspend/resume device ... Begin: Running /scripts/local-block ... done.
Begin: Running /scripts/local-block ... done.
Begin: Running /scripts/local-block ... done.
Begin: Running /scripts/local-block ... done.
...
done.
Gave up waiting for suspend/resume device
done.
Begin: Waiting for root file system ... Begin: Running /scripts/local-block ...
done.
done.
Gave up waiting for root file system device.  Common problems:
 - Boot args (cat /proc/cmdline)
   - Check rootdelay= (did the system wait long enough?)
 - Missing modules (cat /proc/modules; ls /dev)
ALERT!  /dev/sda1 does not exist.  Dropping to a shell!


BusyBox v1.22.1 (Debian 1:1.22.0-19+b3) built-in shell (ash)
Enter 'help' for a list of built-in commands.

(initramfs)

因此,由于某种原因,尽管内核具有所有必要的支持(文件系统、SCSI 驱动程序等),但它无法挂载 /dev/sda1 设备。

可能是什么原因?我是否应该在每次构建新内核时重新构建 initrd 映像?

谢谢。

相关内容