我使用包含busybox的cpio文件系统编译了Linux内核。
功能
Linux内核的配置是i386_defconfig并进行了一些更改。指定工具链的编译器前缀,主机名,内核压缩模式为XZ,支持仅启用XZ的initramfs,针对Linux内核的配置中的大小进行优化。
我成功编译了Linux内核。
用QEMU 2.5.0测试initramfs之后。这些参数为qemu-system-i386 -m 256 -kernel bzImage -display curses
。
BUt,Linux内核给出了错误。此错误如下所示:
[ 3.745110] 00000000 00000086 cf8adef8 c12276e0 cf8adf00 cf0ae000 cf8adf10 c
10cb4c6
[ 3.745110] cf0ae000 cf8adf44 cf0ae000 cffc15c0 cf8adf70 c19aaef3 c17e967e c
f8adf44
[ 3.745110] c17e962d c17e95fa 00000000 cf8adf44 fffffffa cf0ae15a c17e96e2 0
0000000
[ 3.745110] Call Trace:
[ 3.745110] [<c12276e0>] dump_stack+0x47/0x5b
[ 3.745110] [<c10cb4c6>] panic+0x8f/0x1ae
[ 3.745110] [<c19aaef3>] mount_block_root+0x12c/0x1b9
[ 3.745110] [<c1002930>] ? x86_pmu_hw_config+0x80/0x1a6
[ 3.745110] [<c19ab146>] mount_root+0x10e/0x115
[ 3.745110] [<c110ea97>] ? SyS_unlink+0x10/0x12
[ 3.745110] [<c19ab263>] prepare_namespace+0x116/0x147
[ 3.745110] [<c19aac38>] kernel_init_freeable+0x191/0x1a3
[ 3.745110] [<c165307a>] kernel_init+0x8/0xd0
[ 3.745110] [<c16561a2>] ret_from_kernel_thread+0xe/0x24
[ 3.745110] [<c1653072>] ? rest_init+0x5f/0x5f
[ 3.745110] Kernel Offset: disabled
[ 3.745110] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs
on unknown-block(0,0)
我该如何解决这个问题?
编辑:我使用了内核参数rootfstype=ramfs
而内核又出现了另一个错误:
[ 4.212083] 00000000 00000086 cf89bf88 c121c501 cf8a0000 c1906560 cf89bfa0 c
10c5bdf
[ 4.212083] c1906560 cf8a0000 c1906560 cfdd3980 cf89bfac c1645fe3 c17db667 c
18ddf04
[ 4.212083] c1649022 c1645f17 00000000 00000000 00000000 00000000 00000000 0
0000000
[ 4.212083] Call Trace:
[ 4.212083] [<c121c501>] dump_stack+0x47/0x5b
[ 4.212083] [<c10c5bdf>] panic+0x8f/0x1ae
[ 4.212083] [<c1645fe3>] kernel_init+0xcc/0xd0
[ 4.212083] [<c1649022>] ret_from_kernel_thread+0xe/0x24
[ 4.212083] [<c1645f17>] ? rest_init+0x5f/0x5f
[ 4.212083] Kernel Offset: disabled
[ 4.212083] ---[ end Kernel panic - not syncing: No working init found. Try
passing init= option to kernel. See Linux Documentation/init.txt for guidance.
linux内核如何检测init?谢谢你的回复。