RAMDISK: EOF while reading compressed data

ramfs boot failure RAMDISK: EOF while reading compressed data


Uncompressing Linux… done, booting the kernel.
Booting Linux on physical CPU 0x0

NET: Registered protocol family 17
can: controller area network core (rev 20170425 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20170425)
can: broadcast manager protocol (rev 20170425 t)
can: netlink gateway (rev 20170425) max_hops=1
Registering SWP/SWPB emulation handler
hctosys: unable to open rtc device (rtc0)
ALSA device list:
No soundcards found.
RAMDISK: bzip2 image found at block 0
RAMDISK: EOF while reading compressed data
mmc1: new high speed MMC card at address 0001
List of all partitions:
mmcblk1: mmc1:0001 8GUF4R 7.28 GiB
0100 65536 ram0
(driver?)
mmcblk1boot0: mmc1:0001 8GUF4R partition 1 31.9 MiB
0101 65536 ram1
mmcblk1boot1: mmc1:0001 8GUF4R partition 2 31.9 MiB
(driver?)
mmcblk1rpmb: mmc1:0001 8GUF4R partition 3 4.00 MiB
0102 65536 ram2
(driver?)
mmcblk1: p1 p2
0103 65536 ram3
(driver?)
0104 65536 ram4
(driver?)
0105 65536 ram5
(driver?)
0106 65536 ram6
(driver?)
0107 65536 ram7
(driver?)
1f00 5120 mtdblock0
(driver?)
1f01 128 mtdblock1
(driver?)
1f02 10752 mtdblock2
(driver?)
1f03 384 mtdblock3
(driver?)
b300 15558144 mmcblk0
driver: mmcblk
b301 32768 mmcblk0p1 00000000-01

b302 65536 mmcblk0p2 00000000-02

b303 262144 mmcblk0p3 00000000-03

b308 7634944 mmcblk1
driver: mmcblk
b309 40960 mmcblk1p1 00000000-01

b30a 32768 mmcblk1p2 00000000-02

b320 4096 mmcblk1rpmb
(driver?)
b318 32640 mmcblk1boot1
(driver?)
b310 32640 mmcblk1boot0
(driver?)
No filesystem could mount root, tried:
ext4

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
CPU0: stopping
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.140-xilinx-v2018.2 #8
Hardware name: Xilinx Zynq Platform
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (dump_stack+0xa8/0xc8)
[] (dump_stack) from [] (handle_IPI+0xd8/0x1a0)
[] (handle_IPI) from [] (gic_handle_irq+0x84/0x90)
[] (gic_handle_irq) from [] (__irq_svc+0x6c/0xa8)
Exception stack(0xc0a01f18 to 0xc0a01f60)
1f00: 00000000 00000000
1f20: 2ef8a000 00000000 ef8d0340 c0a30c28 ef8d0340 00000000 568e15db 56faa8a5
1f40: 00000000 00000000 fffffff5 c0a01f68 c04d3e54 c04d3e7c 60000013 ffffffff
[] (__irq_svc) from [] (cpuidle_enter_state+0xf8/0x1d4)
[] (cpuidle_enter_state) from [] (do_idle+0x148/0x1a8)
[] (do_idle) from [] (cpu_startup_entry+0x18/0x1c)
[] (cpu_startup_entry) from [] (start_kernel+0x300/0x360)
[] (start_kernel) from [<0800807c>] (0x800807c)
—[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
##########
setenv rootfs_img rootfs.ext4.bz2
setenv sd_bootramargs ‘ c o n s o l e i n i t r d = {console} initrd= consoleinitrd={rootfs_addr},${rootfs_size} root=/dev/ram0 rw rootwait rootfstype=ext4’

setenv rootfs_size 0x4000000
setenv rootfs_addr 0x10000000

最终发现是因为kernel 进行解析 rootfs.ext4.bz2 压缩文件时,会去0x10000000 地址按照 0x4000000大小进行解压加载,但是我的rootfs.ext4.bz2 文件只有 9M 左右,解析时也会解析超过9M的空间内容(因为0x4000000 是64M)。在超过9M空间内数据是乱码的,所以会读取到无法控制的数据,例如EOF结束符号。就认为出现异常。导致ramfs启动失败。

解决方式1:
rootfs_size 按照实际rootfs.ext4.bz2 文件大小进行设置。
这样每次启动就要手动或者自动获取rootfs.ext4.bz2大小给环境变量。麻烦
解决方式2:
在加载 rootfs.ext4.bz2 文件之前先清除ram的空间。
mw.b ${rootfs_addr} 0 ${rootfs_size}
修改如下:
添加环境变量
step1: fatload mmc s d d e v b o o t : {sd_dev_boot}: sddevboot:{sd_part_boot} ${kernel_addr} ${kernel_image};
step2: fatload mmc s d d e v b o o t : {sd_dev_boot}: sddevboot:{sd_part_boot} ${bootdtb_addr} ${devicetree_image};
step3: sd_load_rootfs=mw.b ${rootfs_addr} 0 ${rootfs_size}; fatload mmc s d d e v b o o t : {sd_dev_boot}: sddevboot:{sd_part_boot} ${rootfs_addr} r o o t f s i m g ; s t e p 4 : s e t e n v b o o t a r g s ′ {rootfs_img}; step4: setenv bootargs ' rootfsimg;step4:setenvbootargs{console} initrd= r o o t f s a d d r , {rootfs_addr}, rootfsaddr,{rootfs_size} root=/dev/ram0 rw rootwait rootfstype=ext4’

我这边使用fatload 加载镜像

你可能感兴趣的:(linux,服务器)