遵循bootlin 嵌入式 linux 课程并面临一个问题(类似于UBI layout volume not found但我的问题比原来的问题更远)
我正在创建 rootfs 和数据卷映像:
mkfs.ubifs -d ./www/upload -o ../data.ubifs -e 124KiB -m 2048 -c 66
mkfs.ubifs -d ./ -o ../rootfs.ubifs -e 124KiB -m 2048 -c 66
然后通过配置 ubinize 所有这些东西:
[dtb-volume]
peb=0x20000
min_io_size=0x800
mode=ubi
image=at91-sama5d3_xplained.dtb
vol_id=0
vol_size=128KiB
vol_type=static
vol_name=dtb
vol_alignment=1
[kernel-volume]
peb=0x20000
min_io_size=0x800
mode=ubi
image=zImage
vol_id=1
vol_size=5MiB
vol_type=static
vol_name=kernel
vol_alignment=1
[rootfs-volume]
peb=0x20000
min_io_size=0x800
mode=ubi
image=rootfs.ubifs
vol_id=2
vol_size=8MiB
vol_type=dynamic
vol_name=rootfs
vol_alignment=1
[data-volume]
peb=0x20000
min_io_size=0x800
mode=ubi
image=data.ubifs
vol_id=3
vol_size=8MiB
vol_type=dynamic
vol_name=data
vol_alignment=1
ubinize -o ubi.img -p 128KiB -m 2048 config
然后通过 tftp 加载图像:
=> tftp 0x22000000 ubi.img
ethernet@f0028000: PHY present at 7
ethernet@f0028000: Starting autonegotiation...
ethernet@f0028000: Autonegotiation complete
ethernet@f0028000: link up, 100Mbps full-duplex (lpa: 0xcde1)
Using ethernet@f0028000 device
TFTP from server 192.168.10.1; our IP address is 192.168.10.100
Filename 'ubi.img'.
Load address: 0x22000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#######################
1.1 MiB/s
done
Bytes transferred = 8912896 (880000 hex)
=> nand erase 0x140000 0xfec0000
NAND erase: device 0 offset 0x140000, size 0xfec0000
Erasing at 0xffe0000 -- 100% complete.
OK
=> nand write.trimffs 0x22000000 0x140000 0x880000
NAND write: device 0 offset 0x140000, size 0x880000
8912896 bytes written: OK
=> mtdparts
device nand0 <nand0>, # parts = 5
#: name size offset mask_flags
0: bootstrap 0x00040000 0x00000000 1
1: U-Boot 0x00080000 0x00040000 1
2: Env 0x00040000 0x000c0000 0
3: Env_Backup 0x00040000 0x00100000 0
4: UBI 0x0fec0000 0x00140000 0 <<<<<<<<
active partition: nand0,0 - (bootstrap) 0x00040000 @ 0x00000000
defaults:
mtdids :
mtdparts:
=> ubi part UBI
ubi0: detaching mtd1
ubi0: mtd1 is detached
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: attached mtd1 (name "mtd=4", size 254 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 2038, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 4, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1265009246
ubi0: available PEBs: 1816, total reserved PEBs: 222, PEBs reserved for bad PEB handling: 40
=> ubi readvol 0x81000000 kernel
Read 0 bytes from volume kernel to 81000000
No size specified -> Using max size (4278696)
=> ubi readvol 0x82000000 dtb
Read 0 bytes from volume dtb to 82000000
No size specified -> Using max size (34404)
=> printenv
arch=arm
baudrate=115200
board=sama5d3_xplained
board_name=sama5d3_xplained
bootargs=console=ttyS0 rootfstype=ubifs root=ubi0:rootfs ubi.mtd=4 <<<<< {not sure about id 4 here} mtdparts=nand0:256k(bootstrap)ro,512k(U-Boot)ro,256k(Env),256k(Env_Backup),-(UBI)
bootargs_base=console=ttyS0 rootfstype=ubifs root=ubi0:rootfs ubi.mtd=4
bootcmd=fatload mmc 0:1 0x21000000 zImage; fatload mmc 0:1 0x22000000 at91-sama5d3_xplained.dtb; bootz 0x21000000 - 0x22000000
bootcmdtftp=tftp 0x21000000 zImage; tftp 0x22000000 at91-sama5d3_xplained.dtb; bootz 0x21000000 - 0x22000000
bootdelay=3
cpu=armv7
ethact=ethernet@f0028000
ethaddr=12:34:56:ab:cd:ef
fdtcontroladdr=2fb423d0
fileaddr=22000000
filesize=880000
ipaddr=192.168.10.100
mtddevname=bootstrap
mtddevnum=0
mtdids=nand0=nand0
mtdparts=mtdparts=nand0:256k(bootstrap)ro,512k(U-Boot)ro,256k(Env),256k(Env_Backup),-(UBI)
nand_erasesize=20000
nand_oobsize=40
nand_writesize=800
partition=nand0,0
serverip=192.168.10.1
soc=at91
stderr=serial@ffffee00
stdin=serial@ffffee00
stdout=serial@ffffee00
vendor=atmel
Environment size: 1076/131067 bytes
=> bootz 0x81000000 - 0x82000000
data abort
pc : [<2ff4ce28>] lr : [<2ff4e090>]
reloc pc : [<26f00e28>] lr : [<26f02090>]
sp : 2fb42248 ip : 00000000 fp : 2ff4e034
r10: 2ffb71bc r9 : 2fb4bed0 r8 : 2fbbb118
r7 : 00000000 r6 : 2fbbb11c r5 : 00000003 r4 : 2ffb8db4
r3 : 2fbb93bb r2 : 2fb4225c r1 : 2fb42258 r0 : 81000000
Flags: nZCv IRQs off FIQs off Mode SVC_32
Resetting CPU ...
resetting ...
RomBOOT
试了好几次内核还是在启动时中断,你能指点什么是错的吗?
升级版:
所以当前状态 rootfs 问题:
ubi0: attaching mtd4
random: fast init done
ubi0: scanning is finished
ubi0 error: ubi_read_volume_table: the layout volume was not found
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
UBI error: cannot attach mtd4
如果我从 sdcard 启动 linux,mtd 设备也没有安装,只有内核出现在某个级别,但仍然存在问题:
#ubiattach -m 5 /dev/ubi_ctrl
ubi0: attaching mtd5
random: crng init done
ubi0: scanning is finished
ubi0 error: ubi_read_volume_table: the layout volume was not found
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd5, error -22
ubiattach: UBI_IOCATT: Invalid argument
#ubiattach -m 4 /dev/ubi_ctrl
ubi0: attaching mtd4
ubi0: scanning is finished
ubi0 error: ubi_read_volume_table: the layout volume was not found
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
: UBI_IOCATT: Invalid argument
#ubiattach -m 3 /dev/ubi_ctrl
ubi0: attaching mtd3
ubi0: scanning is finished
ubi0 error: ubi_read_volume_table: the layout volume was not found
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd3, error -22
ubiattach: UBI_IOCATT: Invalid argument
#ubiattach -m 2 /dev/ubi_ctrl
ubi0: attaching mtd2
ubi0: scanning is finished
ubi0 error: vtbl_check: too large reserved_pebs 34, good PEBs 6
ubi0 error: vtbl_check: volume table check failed: record 1, error 9
Volume table record 1 dump:
reserved_pebs 34
alignment 1
data_pad 0
vol_type 2
upd_marker 0
name_len 6
name kernel
crc 0xc6d0a3f9
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd2, error -22
ubiattach: UBI_IOCATT: Invalid argument
#ubiattach -m 1 /dev/ubi_ctrl
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0 error: ubi_read_volume_table: the layout volume was not found
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -22
ubiattach: UBI_IOCATT: Invalid argument
# cat /proc/mtd
dev: size erasesize name
mtd0: 00040000 00020000 "at91bootstrap"
mtd1: 00080000 00020000 "bootloader
mtd2: 000c0000 00020000 "bootloader env"
mtd3: 00080000 00020000 "device tree"
mtd4: 00600000 00020000 "kernel"
mtd5: 0f800000 00020000 "rootfs"
<<<< 我也尝试过 5 作为内核参数
我想知道仍然是内核参数作为 UBI_IOCATT: Invalid argumentSuggest 还是 UBIFS 本身的格式错误?