我想构建一个最小的 Linux 系统。我收集了它并最终得到了两个文件。initrd.img 和 vmlinuz。我使用以下命令在 qemu 中启动整个过程: qemu-system-x86_64 -kernel vmlinuz -initrd initrd.img -ngraphic -append 'console=ttyS0'
然后启动后就报错:
[ 4.844559] Please append a correct "root=" boot option; here are the available partitions:
[ 4.845955] 0b00 1048575 sr0
[ 4.846232] driver: sr
[ 4.847642] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 4.848312] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.336 #1
[ 4.848312] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.3-1-1 04/01/2014
[ 4.848312] Call Trace:
[ 4.848312] dump_stack+0x50/0x63
[ 4.848312] panic+0xde/0x22a
[ 4.848312] mount_block_root+0x174/0x1fe
[ 4.848312] prepare_namespace+0x136/0x16c
[ 4.848312] kernel_init_freeable+0x1b6/0x1c4
[ 4.848312] ? rest_init+0x9a/0x9a
[ 4.848312] kernel_init+0x5/0xf7
[ 4.848312] ret_from_fork+0x35/0x40
[ 4.848312] Kernel Offset: 0x35000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 4.848312] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
请知情人士告诉我,这该怎么办?
我正在向您展示我在 initrd 文件中放入的内容!剧透,我是构建 Linux 的新手,所以不要因为第一个错误而杀了我))
我将以下文件夹放在那里:
etc
lib
dev
mnt
proc
tmp
root
创建了这些文件:
/etc/inittab
/etc/fstab
/etc/mtab
/etc/rc.d/rc.S
/etc/profile
/etc/shell
从答案来看,我需要编写某种 init,对吧?