我正在使用带有 initramfs 的 buildroot。它适用于小于 14M 的 uImage。
但是当我添加包并变大时,就会发生这种内核恐慌。
Kernel command line: noinitrd ramdisk_size=30720 console=ttyS0,115200n8 oops=panic panic=10 rdinit=/sbin/init mem=64M ubi.mtd=2 mtdparts=nand0:0x200000@0x0(u-boot),0x1E00000@l
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 44656K/65536K available (3734K kernel code, 277K rwdata, 1212K rodata, 14780K init, 216K bss, 20880K reserved, 0K cma-reserved)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xc4800000 - 0xff800000 ( 944 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc04dce24 (4948 kB)
.init : 0xc04dd000 - 0xc134c000 (14780 kB)
.data : 0xc134c000 - 0xc13915a0 ( 278 kB)
.bss : 0xc13915a0 - 0xc13c77d0 ( 217 kB)
----- snip -----
NET: Registered protocol family 1
Kernel panic - not syncing: write error
CPU: 0 PID: 1 Comm: swapper Not tainted 4.4.207 #2
Hardware name: NUC980
Backtrace:
[<c0012ec0>] (dump_backtrace) from [<c00130ac>] (show_stack+0x18/0x1c)
r6:c392a440 r5:c046f548 r4:c047848c r3:00000000
[<c0013094>] (show_stack) from [<c017e298>] (dump_stack+0x20/0x28)
[<c017e278>] (dump_stack) from [<c0075f28>] (panic+0xb0/0x240)
[<c0075e7c>] (panic) from [<c04dfed4>] (populate_rootfs+0x38/0x250)
r3:00000001 r2:c3f6e050 r1:c046f548 r0:c047848c
r7:c04fb828
[<c04dfe9c>] (populate_rootfs) from [<c00095b8>] (do_one_initcall+0x88/0x1ec)
r10:00000076 r9:00000000 r8:c04dfe9c r7:c04fb828 r6:c392a440 r5:c134fa60
r4:c134fa60
[<c0009530>] (do_one_initcall) from [<c04dde18>] (kernel_init_freeable+0x108/0x1cc)
r10:00000076 r9:c04fb838 r8:c0501384 r7:c04fb828 r6:c13915a0 r5:c13915a0
r4:00000005
[<c04ddd10>] (kernel_init_freeable) from [<c03a7cd0>] (kernel_init+0x10/0xf4)
r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c03a7cc0
r4:00000000
[<c03a7cc0>] (kernel_init) from [<c000fdf8>] (ret_from_fork+0x14/0x3c)
r4:00000000 r3:ffffffff
这是使用的 env.txt
baudrate=115200
bootdelay=1
stderr=serial
stdin=serial
stdout=serial
setspi=sf probe 0 30000000
loadkernel=sf read 0x7fc0 0x200000 0x1E00000
mtdparts=mtdparts=nand0:0x200000@0x0(u-boot),0x1E00000@0x200000(kernel),-(user)
bootargs=noinitrd ramdisk_size=30720 console=ttyS0,115200n8 oops=panic panic=10 rdinit=/sbin/init mem=64M ubi.mtd=2 mtdparts=nand0:0x200000@0x0(u-boot),0x1E00000@0x200000(kernel),-(user) ignore_loglevel
bootcmd=run setspi;run loadkernel;bootm 0x7fc0
uBoot 报告这些 mtdparts
=> mtdparts
device nand0 <nand0>, # parts = 3
#: name size offset mask_flags
0: u-boot 0x00200000 0x00000000 0
1: kernel 0x01e00000 0x00200000 0
2: user 0x06000000 0x02000000 0
active partition: nand0,0 - (u-boot) 0x00200000 @ 0x00000000
NAND布局
0x0000000 - u-boot-spl.bin .5M
0x0080000 - env.txt .5M
0x0100000 - u-boot.bin 1M
0x0200000 - uImage 30M
0x2000000 - application 96M
0x8000000
/proc/iomem 来自工作/较小的 uImage
# cat /proc/iomem
00000000-03ffffff : System RAM
00008000-004d4df3 : Kernel code
00eee000-00f67a9b : Kernel data
b0004000-b0004fff : nuc980-gpio.0
b0008000-b0008fff : nuc980-dma
b0009000-b0009fff : nuc980-dma
b0012000-b0012fff : nuc980-emac0
b0015000-b0015fff : nuc980-ehci
b0015000-b0015fff : ehci_hcd
b0017000-b0017fff : nuc980-ohci.0
b0017000-b0017fff : ohci_hcd
b0018000-b0018fff : nuc980-sdh
b0018000-b0018fff : nuc980-sdh
b001c000-b001ffff : nuc980-crypto
b001c000-b001ffff : nuc980-crypto
b0043000-b0043fff : nuc980-nadc
b0060000-b0060fff : nuc980-qspi0.0
b0060000-b0060fff : nuc980-qspi0
b0061000-b0061fff : nuc980-spi0.0
b0061000-b0061fff : nuc980-spi0
b0090000-b0090fff : nuc980-sc.0
b0090000-b0090fff : nuc980-sc
b0091000-b0091fff : nuc980-sc.1
b0091000-b0091fff : nuc980-sc
15M 构建 BR2_LINUX_KERNEL_LZMA=y, BR2_TARGET_ROOTFS_CPIO_LZMA=y, CONFIG_KERNEL_LZMA=y, CONFIG_RD_LZMA=y, CONFIG_DECOMPRESS_LZMA=y
2871 Oct 7 22:58 u-boot-spl.bin
351360 Oct 7 22:58 u-boot.bin
25330176 Oct 8 13:08 rootfs.cpio
5420787 Oct 8 13:08 rootfs.cpio.lzma
12954944 Oct 8 13:09 uImage
16748928 Oct 8 13:09 Image
在ARM 上 initramfs 的大小限制?提到没有大小限制。
我尝试了几件事,例如在 linux 中增加 CONFIG_BLK_DEV_RAM_SIZE 并在 uboot 中增加 CONFIG_SYS_BOOTM_LEN,但这没有帮助。
我正在使用的 BSP 基于 buildroot 2016.11.1 如果需要更多信息/上下文,请告诉我。TIA