Linux 的第二次启动 - 内核恐慌

Linux 的第二次启动 - 内核恐慌

我目前正在开发一个buildroot为 ARM 设备创建的 Linux 发行版。文件系统是JFFS2。我正在使用 Das U-Boot 启动。

我能够成功启动一次。我的初次启动成功,我能够登录 Linux 并通过命令行执行人们期望的操作。第二次启动会产生内核恐慌。

我比较了初始启动前后的内核内存,完全相同。

我的结论是,文件系统中的某些内容在初始启动时发生了变化,导致了内核崩溃。

以下是我的启动的相关摘录(我粘贴了额外内容以提供启动失败的上下文,但只有最后六行可能很重要):

...
cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver ftdi_sio
usbserial: USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver pl2303
usbserial: USB Serial support registered for pl2303
mousedev: PS/2 mouse device common for all mice
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP: cubic registered
NET: Registered protocol family 10
sit: IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
atmel_nand 40000000.nand: PMECC: Too many errors
VFS: Cannot open root device "mtdblock1" or unknown-block(31,1): error -5
Please append a correct "root=" boot option; here are the available partitions:
1f00            8192 mtdblock0  (driver?)
1f01          253952 mtdblock1  (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,1)

Uboot配置 我的 U-Bootprintenv看起来像这样:

baudrate=115200
bootargs=mem=128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=jffs2
bootcmd=nand read 0x22000000 0x200000 0x300000; bootm 0x22000000
bootdelay=3
ethact=macb0

所以我的问题是是否有人可以帮助我了解在第一次启动成功的情况下第二次启动失败的原因。有人见过这个吗?也许有人有类似情况的经验,至少可以指出这里可能发生的情况。

PS 如果需要,我可以提供更多信息。我试图抽象出不重要的细节,但如果有帮助的话我非常愿意添加更多。

答案1

您可以尝试将 bootargs 设置为只读:

bootargs=mem=128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 ro rootfstype=jffs2

相关内容