[#5550] fail to flash ubifs.img to nand
Submitted By: Mingquan Pan
Open Date
2009-09-23 06:11:41 Close Date
2009-10-20 05:54:40
Priority:
Medium Assignee:
Barry Song
Status:
Closed Fixed In Release:
N/A
Found In Release:
2010R1 Release:
Category:
N/A Board:
N/A
Processor:
BF537 Silicon Revision:
Is this bug repeatable?:
Yes Resolution:
Fixed
Uboot version or rev.:
Toolchain version or rev.:
09r1-rc9
App binary format:
N/A
Summary: fail to flash ubifs.img to nand
Details:
fail to flash ubifs.img to nand.
I made a ubifs.image from romfs with mkfs.ubifs on host, like:
./mkfs.ubifs -r ../../romfs/ -m 2048 -e 129024 -c 100 -o ubifs.img
and copy this image to target board, but fail to ubiformat it to nand.
root:/> ubiformat /dev/mtd1 -f ubifs.img -s 512 -O 512
ubiformat: mtd1 (NAND), size 130023424 bytes (124.0 MiB), 131072 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 991 -- 100 % complete
ubiformat: 990 eraseblocks have valid erase counter, mean value is 4
ubiformat: bad eraseblocks: 679, 746
ubiformat: error!: file "ubifs.img" (size 6967296 bytes) is not multiple of eraseblock size (131072 bytes)
error 0 (Success)
And I have tried to use ubinize to transform it, like:
root:/> ubinize -o ubi.img -m 2048 -p 128KiB ini_file
test@uclinux55-bf537-cf-spi:..uclinux-dist/logs> cat ~/ini_file
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=20MiB
vol_type=dynamic
vol_name=ubifs0
vol_flag=autoresize
vol_alignment=1
this also fails with :
Undefined instruction
- May be used to emulate instructions that are not defined for
a particular processor implementation.
Deferred Exception context
CURRENT PROCESS:
COMM=ubinize PID=182
CPU = 0
TEXT = 0x006e0040-0x006e9a00 DATA = 0x006e9a04-0x006edccc
BSS = 0x006edccc-0x006ee784 USER-STACK = 0x006eff44
...
The device info is:
root:/> ubinfo
UBI version: 1
Count of UBI devices: 0
UBI control device major/minor: 10:63
root:/> ubiattach /dev/ubi_ctrl -m 1
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd1 to ubi0
UBI: MTD device name: "file system(nand)"
UBI: MTD device size: 124 MiB
UBI: number of good PEBs: 990
UBI: number of bad PEBs: 2
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 977
UBI: total number of reserved PEBs: 13
UBI: number of PEBs reserved for bad PEB handling: 9
UBI: max/mean erase counter: 5/4
UBI: background thread "ubi_bgt0d" started, PID 176
UBI device number 0, total 990 LEBs (127733760 bytes, 121.8 MiB), available 977 LEBs (126056448 bytes, 120.2 MiB), LEB size 129024 bytes (126.0 KiB)
root:/>
Follow-ups
--- Barry Song 2009-10-19 00:34:22
As a step of ubi image building, I think we should run "ubinize" on PC
host but not on targets. Then run "ubiformat" on targets and write the
transformed ubifs.img to /dev/mtdx.
Here I get different result with you:
host:
root@roc-desktop:~# mkfs.ubifs -r test -m 2048 -e 129024 -c 100 -o ubi.img
root@roc-desktop:~# ubinize -o ubi.img -m 2048 -p 128KiB ubifs.conf
root@roc-desktop:~#
target:
root:/> ubiformat /dev/mtd1 -f ubi.img -s 512 -O 512
ubiformat: mtd1 (NAND), size 130023424 bytes (124.0 MiB), 131072 eraseblocks of
131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 991 -- 100 % complete
ubiformat: 907 eraseblocks are supposedly empty
ubiformat: warning!: 85 of 992 eraseblocks contain non-ubifs data
ubiformat: continue? (yes/no) yes
ubiformat: warning!: only 0 of 992 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e
option
ubiformat: continue? (yes/no) yes
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: flashing eraseblock 15 -- 100 % complete
ubiformat: formatting eraseblock 991 -- 100 % complete
-barry
--- Barry Song 2009-10-19 00:59:32
Test show ubifs can work on our system:
root:/> ubiattach /dev/ubi_ctrl -m 0
root:/> ubimkvol /dev/ubi0 -N par1 -s 2MiB
root:/> mount -t ubifs ubi0_0 /mnt/
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size: 1161216 bytes (1134 KiB, 1 MiB, 9 LEBs)
UBIFS: journal size: 903169 bytes (882 KiB, 0 MiB, 5 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 54846 bytes (53 KiB)
root:/> ubinfo
UBI version: 1
Count of UBI devices: 1
UBI control device major/minor: 10:63
Present UBI devices: ubi0
root:/> mount
...
ubi0_0 on /mnt type ubifs (rw,relatime)
But we need to figure out the right setting for mkfs.ubifs and ubinize
according to the hardware feature of nands we are using, then write right image
to nand.
--- Barry Song 2009-10-19 05:02:49
The right configuration for nand on bf537 should be:
host: building ubi image
mkfs.ubifs -r romfs -m 2048 -e 129024 -c 4096 -o ubifs.img
ubinize -o ubi.img -m 2048 -s 512 -p 128KiB ubifs.conf
target:write image, attach and mount:
root:/> flash_eraseall /dev/mtd1
Erasing 128 Kibyte @ 6a0000 -- 5 % complete.^C
root:/> ubiformat /dev/mtd1 -s 512 -f ubi.img
ubiformat: mtd1 (NAND), size 130023424 bytes (124.0 MiB), 131072 eraseblocks of
131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 991 -- 100 % complete
ubiformat: 992 eraseblocks are supposedly empty
ubiformat: flashing eraseblock 15 -- 100 % complete
ubiformat: formatting eraseblock 991 -- 100 % complete
root:/> ubiformat /dev/mtd1 -s 512 -f ubi.img
ubiformat: mtd1 (NAND), size 130023424 bytes (124.0 MiB), 131072 eraseblocks of
131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 615 -- 62 % ^Cmplete anning eraseblock 604 -- 60
% complete
root:/> ubiattach /dev/ubi_ctrl -m 1
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: volume 0 ("rootfs") re-sized from 17 to 979 LEBs
UBI: attached mtd1 to ubi0
UBI: MTD device name: "file system(nand)"
UBI: MTD device size: 124 MiB
UBI: number of good PEBs: 992
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 992
UBI: number of PEBs reserved for bad PEB handling: 9
UBI: max/mean erase counter: 0/0
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 179
UBI device number 0, total 992 LEBs (127991808 bytes, 122.1 MiB), available 0
LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)
root:/> mount -t ubifs ubi0:rootfs /mnt
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size: 124895232 bytes (121968 KiB, 119 MiB, 968 LEBs)
UBIFS: journal size: 9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 0 bytes (0 KiB)
Check the result:
root:/> mount
rootfs on / type rootfs (rw)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
...
ubi0:rootfs on /mnt type ubifs (rw,relatime)
--- Mingquan Pan 2009-10-20 05:54:40
Yeah, after enlarging the stacksize of ubiformat, it is working on my side too.
Close.
Files
Changes
Commits
Dependencies
Duplicates
Associations
Tags
File Name File Type File Size Posted By
No Files Were Found