【发布时间】:2021-06-25 04:17:09
【问题描述】:
我一直在遵循 Chris Simmonds 的“掌握嵌入式 linux 编程”一书中的命令。我已经创建了工具链、内核 zImage 和 busybox 文件系统。当我将这些组合在一起在 QEMU 上运行时,它应该显示一个 root shell 提示符。
当我运行命令时,我得到以下信息。
/bin/sh: can't access tty; job control turned off
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/amba/amba:fpga/10007000.kmi/serio1/input/input2
当我按下回车键时,我可以看到 root shell 提示,并且可以执行简单的 shell 命令。
但是,当我按下退出时,我收到以下错误。
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000
CPU: 0 PID: 1 Comm: sh Not tainted 4.9.13 #1
Hardware name: ARM-Versatile (Device Tree Support)
[<c001b5a4>] (unwind_backtrace) from [<c0018860>] (show_stack+0x10/0x14)
[<c0018860>] (show_stack) from [<c00737f4>] (panic+0xb8/0x230)
[<c00737f4>] (panic) from [<c0024e24>] (do_exit+0x8e8/0x938)
[<c0024e24>] (do_exit) from [<c0025cf8>] (do_group_exit+0x38/0xb4)
[<c0025cf8>] (do_group_exit) from [<c0025d84>] (__wake_up_parent+0x0/0x18)
---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000
我该如何解决这个问题
编辑:
以下是我运行的QEMU命令
QEMU_AUDIO_DRV=none \qemu-system-arm
-m 256M -nographic
-M versatilepb
-kernel ~/linux-4.9.13/arch/arm/boot/zImage
\-append "console=ttyAMA0,115200 rdinit=/bin/sh"
-dtb ~/linux-4.9.13/arch/arm/boot/dts/versatile-pb.dtb
-initrd ~/busybox/initramfs.cpio.gz
【问题讨论】:
-
改用 Buildroot 发行版。您所做的是实现相同目标的艰难方法,并且据您所知,容易出错。在上面你有两个问题,在某处你禁用了
tty,最重要的是你的busybox包含不正确的/etc/inittab。等等,等等…… -
我正在做一个项目,该项目需要从头开始,而不是使用任何发行版。
标签: linux embedded-linux qemu