自定义initrd无法装入RAM磁盘映像

时间:2017-11-14 16:48:41

标签: linux-kernel initrd

我正在尝试构建一个简约的内核和initrd映像,我希望与qemu一起使用。

我正在使用cpio by

打包initrd映像
find . | cpio -oHnewc | gzip > ../initrd.img

如果我没有在/ lib / modules中保留任何内容,内核会加载并安装RAM磁盘映像。在我将内核模块保留在那里的那一刻,RAM磁盘映像没有安装并因以下错误而失败,

I1114 14:44:07.171914   30333 proxy.go:135] vmconsole: [    0.231680] RAMDISK: Couldn't find valid RAM disk image starting at 0.
I1114 14:44:07.172070   30333 proxy.go:135] vmconsole: [    0.231853] List of all partitions:
I1114 14:44:07.172100   30333 proxy.go:135] vmconsole: [    0.231877] 0100           65536 ram0  (driver?)
I1114 14:44:07.172131   30333 proxy.go:135] vmconsole: [    0.231907] 0101           65536 ram1  (driver?)
I1114 14:44:07.172162   30333 proxy.go:135] vmconsole: [    0.231937] 0102           65536 ram2  (driver?)
I1114 14:44:07.172188   30333 proxy.go:135] vmconsole: [    0.231967] 0103           65536 ram3  (driver?)
I1114 14:44:07.172218   30333 proxy.go:135] vmconsole: [    0.231995] 0104           65536 ram4  (driver?)
I1114 14:44:07.172252   30333 proxy.go:135] vmconsole: [    0.232026] 0105           65536 ram5  (driver?)
I1114 14:44:07.172278   30333 proxy.go:135] vmconsole: [    0.232057] 0106           65536 ram6  (driver?)
I1114 14:44:07.172309   30333 proxy.go:135] vmconsole: [    0.232085] 0107           65536 ram7  (driver?)
I1114 14:44:07.172337   30333 proxy.go:135] vmconsole: [    0.232114] 0108           65536 ram8  (driver?)
I1114 14:44:07.172367   30333 proxy.go:135] vmconsole: [    0.232143] 0109           65536 ram9  (driver?)
I1114 14:44:07.172398   30333 proxy.go:135] vmconsole: [    0.232173] 010a           65536 ram10  (driver?)
I1114 14:44:07.172423   30333 proxy.go:135] vmconsole: [    0.232201] 010b           65536 ram11  (driver?)
I1114 14:44:07.172452   30333 proxy.go:135] vmconsole: [    0.232230] 010c           65536 ram12  (driver?)
I1114 14:44:07.172482   30333 proxy.go:135] vmconsole: [    0.232259] 010d           65536 ram13  (driver?)
I1114 14:44:07.172513   30333 proxy.go:135] vmconsole: [    0.232288] 010e           65536 ram14  (driver?)
I1114 14:44:07.172542   30333 proxy.go:135] vmconsole: [    0.232319] 010f           65536 ram15  (driver?)
I1114 14:44:07.172622   30333 proxy.go:135] vmconsole: [    0.232348] No filesystem could mount root, tried:  ext3 ext2 ext4 squashfs vfat fuseblk
I1114 14:44:07.172665   30333 proxy.go:135] vmconsole: [    0.232429] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
I1114 14:44:07.172701   30333 proxy.go:135] vmconsole: [    0.232472] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.87 #8
I1114 14:44:07.172714   30333 proxy.go:135] vmconsole: [    0.232506] Call Trace:
I1114 14:44:07.172762   30333 proxy.go:135] vmconsole: [    0.232523] [c00000000e3e3ae0] [c000000000b8a89c] dump_stack+0xb0/0xf0 (unreliable)
I1114 14:44:07.172807   30333 proxy.go:135] vmconsole: [    0.232571] [c00000000e3e3b20] [c000000000b8841c] panic+0x100/0x2c0
I1114 14:44:07.172856   30333 proxy.go:135] vmconsole: [    0.232614] [c00000000e3e3bb0] [c000000000f54890] mount_block_root+0x338/0x33c
I1114 14:44:07.172907   30333 proxy.go:135] vmconsole: [    0.232664] [c00000000e3e3c70] [c000000000f54c94] prepare_namespace+0x1f4/0x254
I1114 14:44:07.172956   30333 proxy.go:135] vmconsole: [    0.232714] [c00000000e3e3cf0] [c000000000f542b8] kernel_init_freeable+0x334/0x37c
I1114 14:44:07.173002   30333 proxy.go:135] vmconsole: [    0.232765] [c00000000e3e3dc0] [c00000000000be0c] kernel_init+0x2c/0x160
I1114 14:44:07.173049   30333 proxy.go:135] vmconsole: [    0.232808] [c00000000e3e3e30] [c000000000009538] ret_from_kernel_thread+0x5c/0xa4
I1114 14:44:07.174582   30333 proxy.go:135] vmconsole: [    0.234339] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)

我能够理解如何通过在initrd中添加模块导致这种行为?

0 个答案:

没有答案