【求助】【已解决】qemu启动系统init进程报-22错误
最近移植的OpenHarmony,使用qemu启动时运行init报错了,具体日志如下: [ 2.893957] Run /init as init process [ 2.906628] Failed to execute /init (error -22) [ 2.906981] Run /bin/init as init process [ 2.908
·
最近移植的OpenHarmony,使用qemu启动时运行init报错了,具体日志如下:
[ 2.893957] Run /init as init process
[ 2.906628] Failed to execute /init (error -22)
[ 2.906981] Run /bin/init as init process
[ 2.908712] Kernel panic - not syncing: Requested init /bin/init failed (error -22).
[ 2.909450] CPU: 2 PID: 1 Comm: init Not tainted 6.1.36 #1
[ 2.909888] Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
[ 2.910501] Stack : 0000000000000000 0000000000000000 90000000011ceb20 9000000008128000
[ 2.911198] 900000000812bc90 0000000000000000 0000000000000000 900000000151539e
[ 2.911676] 900000000812bc98 0000000000000140 0000000000000140 0000000000000000
[ 2.912176] 900000000812b982 000000000000018f 0000000000000006 000000000000ffff
[ 2.912667] 0000000000ffff0a ffffffffffffffff 0000000000000016 0000000000000000
[ 2.913239] 9000000009bc8e00 0000000000000002 0000000005d94000 900000000151539e
[ 2.913725] 0000000000000004 00000000000000b0 0000000000000004 0000000000000000
[ 2.914234] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 2.914751] 0000000000000000 0000000000000000 9000000000222e10 0000000000000000
[ 2.915703] 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c
[ 2.916226] ...
[ 2.916471] Call Trace:
[ 2.916714] [<9000000000222e10>] show_stack+0x70/0x140
[ 2.917874] [<90000000011ceb20>] dump_stack_lvl+0x5c/0x7c
[ 2.918171] [<90000000011c5934>] panic+0x14c/0x338
[ 2.918435] [<90000000011d02cc>] kernel_init+0xac/0x180
[ 2.918703] [<9000000000221730>] ret_from_kernel_thread+0xc/0x9c
[ 2.919076]
[ 2.924982] ---[ end Kernel panic - not syncing: Requested init /bin/init failed (error -22). ]---
已经确认过ramdisk.img中是有/init程序的。只是内核启动参数中没有指定system/vendor分区配置。
我也使用busybox制作的ramdisk.img测试过,能够正常运行,因此内核应该是正常的。
看源代码中init有单元测试,想先测试一下init功能是否正常。那么,这些单元测试怎么运行呢?需要在设备上运行吗?
解决办法
该问题是由于内核的页大小(16KB)和elf的段对齐(4KB)不一致导致的vm_mmap()函数报错。修改编译选项增加-Wl,-z,max-page-size=16384,使elf段按照16KB对齐后,能够正常启动init了。
更多推荐
已为社区贡献14条内容
所有评论(0)