How to generate a raw UBI image with 2 UBI volumes?
1
vote
1
answer
525
views
I am working on an embedded Linux (kernel-5.24), where UBIFS is used as filesystem for both rootfs and user configuration data.
Now I am trying to generate one single UBI image to burn the NAND FLASH (128MB) directly from within factory.
As I said, there are 2 UBI volumes in my system, one is rootfs (rootfs.ubifs), the other is for user configuration (usrconf.ubifs), and the ubinize.cfg is as follows,
[ubifs_volume]
mode=ubi
image=rootfs.ubifs
vol_id=0
vol_size=56MiB
vol_type=dynamic
vol_alignment=1
vol_name=rootfs
[usrconf_volume]
mode=ubi
image=usrconf.ubifs
vol_id=1
vol_size=56MiB
vol_type=dynamic
vol_alignment=1
vol_name=usrconf
vol_flags=autoresize
Now my question is how to combine the rootfs.ubifs
file and usrconf.ubifs
file into one rawubi.img
to burn the FLASH? Where should I put the 2 files into the final rawubi.img
?
== Updated with more tests ==
I changed the ubinize.cfg as follows (set usrconf
volume to static
and vol_id=0
, rootfs
volume as vol_id=1
)
[usrconf_volume]
mode=ubi
image=usrconf.ubifs
vol_id=0
vol_size=56MiB
vol_type=static
vol_alignment=1
vol_name=usrconf
[ubifs_volume]
mode=ubi
image=rootfs.ubifs
vol_id=1
vol_size=56MiB
vol_type=dynamic
vol_alignment=1
vol_name=rootfs
vol_flags=autoresize
ubinize -m 2048 -p 128KiB -s 512 -O 2048 ./ubinize.cfg -v -o rawubi.img
After burned the generated rawubi.img
to NAND FLASH, I booted the Linux with root=ubi0:rootfs rootfstype=ubifs
, and hit following error,
[ 2.671151] UBIFS (ubi0:1): Mounting in unauthenticated mode
[ 2.677163] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 70
[ 2.706562] UBIFS error (ubi0:1 pid 1): ubifs_read_node: bad node type (255 but expected 9)
[ 2.715237] UBIFS error (ubi0:1 pid 1): ubifs_read_node: bad node at LEB 187:115776, LEB mapping status 0
[ 2.725139] Not a node, first 24 bytes:
[ 2.725148] 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
It seemed that the FLASH is NOT populated with the data of rootfs.ubifs
when rootfs volume is changed to vol_id=1
.
Asked by wangt13
(631 rep)
Oct 3, 2023, 01:25 PM
Last activity: Oct 5, 2023, 07:55 AM
Last activity: Oct 5, 2023, 07:55 AM