问题
following bootlin embedded linux course and faced an issue (similar to UBI layout volume not found but my problem is further than original one)
I am creating rootfs and data volume images:
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
then ubinize all that stuff via config
[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
Then loading the image via 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
Have tried several times but kernel still breaks at start, could you advice what's wrong?
UPD:
so current state rootfs issue
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
if I boot linux from sdcard mtd devices are not mounted also, only kernel appears at some level but still with issues
#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"
<<<< I have tried 5 also as kernel param
I am wondering is it an issue with still kernel params as UBI_IOCATT: Invalid argument suggests or UBIFS itself is in a wrong way formatted?
回答1:
So it seems it's fixed
Creating 5 MTD partitions on "atmel_nand":
0x000000000000-0x000000040000 : "bootstrap"
0x000000040000-0x0000000c0000 : "uboot"
0x0000000c0000-0x000000100000 : "env"
0x000000100000-0x000000140000 : "envbackup"
0x000000140000-0x000010000000 : "UBI"
iio iio:device0: Resolution used: 12 bits
iio iio:device0: ADC Touch screen is disabled.
NET: Registered protocol family 10
Segment Routing with IPv6
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
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
Loading compiled-in X.509 certificates
ubi0: attaching mtd4
random: fast init done
ubi0: scanning is finished
ubi0: attached mtd4 (name "UBI", 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: 2034, bad PEBs: 4, 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: 2116305094
ubi0: available PEBs: 1825, total reserved PEBs: 209, PEBs reserved for bad PEB handling: 36
ubi0: background thread "ubi_bgt0d" started, PID 745
input: gpio_keys as /devices/platform/gpio_keys/input/input0
at91_rtc fffffeb0.rtc: setting system clock to 2007-01-01 00:32:09 UTC (1167611529)
cfg80211: Loading compiled-in X.509 certificates for regulatory database
cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
ALSA device list:
No soundcards found.
platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
cfg80211: failed to load regulatory.db
UBIFS (ubi0:3): UBIFS: mounted UBI device 0, volume 3, name "rootfs", R/O mode
UBIFS (ubi0:3): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
UBIFS (ubi0:3): FS size: 7110656 bytes (6 MiB, 56 LEBs), journal size 1396736 bytes (1 MiB, 11 LEBs)
UBIFS (ubi0:3): reserved for root: 0 bytes (0 KiB)
UBIFS (ubi0:3): media format: w4/r0 (latest is w5/r0), UUID FE771C9A-D6FF-4653-B9DD-6054AC1AA0CA, small LPT model
random: crng init done
VFS: Mounted root (ubifs filesystem) readonly on device 0:13.
devtmpfs: mounted
Freeing unused kernel memory: 1024K
starting pid 772, tty '': '/etc/init.d/rcS'
Welcome, mounting virtual fs
UBIFS (ubi0:4): background thread "ubifs_bgt0_4" started, PID 778
UBIFS (ubi0:4): UBIFS: mounted UBI device 0, volume 4, name "data"
UBIFS (ubi0:4): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
UBIFS (ubi0:4): FS size: 7110656 bytes (6 MiB, 56 LEBs), journal size 1396736 bytes (1 MiB, 11 LEBs)
UBIFS (ubi0:4): reserved for root: 0 bytes (0 KiB)
UBIFS (ubi0:4): media format: w4/r0 (latest is w5/r0), UUID EBF59DAC-6C36-427D-B9A4-AD83DFE1AC49, small LPT model
Please press Enter to activate this console.
wrong bootloader, I remade flash layout (bootstrap + correct bootloader), might be also something was corrupted
来源:https://stackoverflow.com/questions/58366301/bootlin-kernel-doesnt-boot-from-ubifs