我正在使用 ARM SOC (AT91SAM9G25) 的平台上将内核从 3.2 升级到 4.4。这是一个 sysv 系统。之前的 3.2 工作正常,但是在启动 4.4 内核时,它在执行 /sbin/init 后挂起。我可以在 U-Boot bootargs 上指定“init=/bin/sh”,它会成功执行 shell(我收到 shell 提示符)。从那里开始,事情看起来很正常。我可以挂载 /proc、验证 rootfs 是否已挂载、启动 NIC 接口等。
我已在运行不同 ARM SOC (AT91SAM9G45) 的不同平台上成功执行此升级。我比较了这个工作的其他平台和挂起的平台之间的内核配置。唯一的区别是与不同 SOC 相关的区别。内核配置差异如下:
300,301c300,301
< CONFIG_PLATFORM_SLK1=y
< # CONFIG_PLATFORM_SLK2 is not set
---
> # CONFIG_PLATFORM_SLK1 is not set
> CONFIG_PLATFORM_SLK2=y
421c421
< CONFIG_ARM_APPENDED_DTB_FILE="arch/arm/boot/dts/slk1.dtb"
---
> CONFIG_ARM_APPENDED_DTB_FILE="arch/arm/boot/dts/slk2.dtb"
1061c1061
< # CONFIG_MTD_M25P80 is not set
---
> CONFIG_MTD_M25P80=y
1311,1314c1311
< CONFIG_NET_VENDOR_MICREL=y
< # CONFIG_KS8842 is not set
< # CONFIG_KS8851 is not set
< # CONFIG_KS8851_MLL is not set
---
> # CONFIG_NET_VENDOR_MICREL is not set
2414c2411,2450
< # CONFIG_USB_GADGET is not set
---
> CONFIG_USB_GADGET=y
> # CONFIG_USB_GADGET_DEBUG is not set
> # CONFIG_USB_GADGET_DEBUG_FILES is not set
> # CONFIG_USB_GADGET_DEBUG_FS is not set
> CONFIG_USB_GADGET_VBUS_DRAW=2
> CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
>
> #
> # USB Peripheral Controller
> #
> # CONFIG_USB_AT91 is not set
> CONFIG_USB_ATMEL_USBA=y
> # CONFIG_USB_FUSB300 is not set
> # CONFIG_USB_FOTG210_UDC is not set
> # CONFIG_USB_GR_UDC is not set
> # CONFIG_USB_R8A66597 is not set
> # CONFIG_USB_PXA27X is not set
> # CONFIG_USB_MV_UDC is not set
> # CONFIG_USB_MV_U3D is not set
> # CONFIG_USB_M66592 is not set
> # CONFIG_USB_BDC_UDC is not set
> # CONFIG_USB_NET2272 is not set
> # CONFIG_USB_GADGET_XILINX is not set
> # CONFIG_USB_DUMMY_HCD is not set
> # CONFIG_USB_CONFIGFS is not set
> # CONFIG_USB_ZERO is not set
> # CONFIG_USB_AUDIO is not set
> # CONFIG_USB_ETH is not set
> # CONFIG_USB_G_NCM is not set
> # CONFIG_USB_GADGETFS is not set
> # CONFIG_USB_FUNCTIONFS is not set
> # CONFIG_USB_MASS_STORAGE is not set
> # CONFIG_USB_G_SERIAL is not set
> # CONFIG_USB_MIDI_GADGET is not set
> # CONFIG_USB_G_PRINTER is not set
> # CONFIG_USB_CDC_COMPOSITE is not set
> # CONFIG_USB_G_ACM_MS is not set
> # CONFIG_USB_G_MULTI is not set
> # CONFIG_USB_G_HID is not set
> # CONFIG_USB_G_DBGP is not set
2584,2585c2620,2621
< # CONFIG_RTC_DRV_AT91RM9200 is not set
< CONFIG_RTC_DRV_AT91SAM9=y
---
> CONFIG_RTC_DRV_AT91RM9200=y
> # CONFIG_RTC_DRV_AT91SAM9 is not set
2599c2635
< # CONFIG_AT_HDMAC is not set
---
> CONFIG_AT_HDMAC=y
3058c3094
< CONFIG_DEBUG_UART_PHYS=0xffffee00
---
> CONFIG_DEBUG_UART_PHYS=0xfffff200
如果我启动到 shell(使用 init=/bin/sh),我可以运行“/sbin/init -i”并且系统正常启动(init 的 PID 不是 1)。但是,“exec /sbin/init”或“exec /sbin/init -i”挂起。
关于如何找出 init 挂在哪里有什么想法吗?
答案1
我想我已经找到了内核挂起的原因。当 init 关闭控制台设备 (/dev/console) 时,atmel_serial 驱动程序将禁用 UART 发送器。然后,来自内核的下一个 printk 挂起,忙于等待 THR 为空。此错误已在上游 4.4-at91 分支中修复(https://github.com/linux4sam/linux-at91/commit/0a1757cfa5ba3b46f6ee7a74ddb7a5c0bd5d7c2f)