[help] Calculation of size for nor_parts

Mylene Josserand Mylene.Josserand at navocap.com
Tue Mar 26 12:29:22 EDT 2013


Hi everyone,


I need some help about the calculation of some sizes. I did not know if 
I have to post my problem in the barebox list or in the kernelnewbies 
list. Sorry in advance if I would have to post it in kernelnewbie list !


In fact, I have a nor divided in two parts : nor0 and nor1 of 32 Mo each.

In my barebox config file, I have :
nor_parts="256k(barebox)ro,128k(bareboxenv),2432k(kernel),-(rootfs)"


Now, my kernel has a size bigger than 2432 Ko.
To update it, I have calculated the size like this :

Kernel size : 2 788 152 bytes. Block size : 128 000 bytes.
2 788 152 / 128 000 = 21.78 so it must have 22 blocks of 128 Ko.
22 * 128 = 2816 Ko.

So I changed the bootargs line with :
nor_parts="256k(barebox)ro,128k(bareboxenv),2816k(kernel),-(rootfs)"


---> Is it right ? Is it the good way to do it ?


With this modification, if I have understood, I have to split my rootfs 
in two part because it did not fit anymore in the nor0. So I will have 
one part of the rootfs in nor0.rootfs and another part in nor1.
I have some problems to understand how to split it in two parts. I have 
tried to split the rootfs.ubi with the size of nor0.rootfs :
nor0.rootfs = 256+128+2816 = 3200 Ko
And my nor0 partition size is 32 Mo so, for me, the nor0.rootfs size is 
28 800 Ko and the rest of the rootfs must be in the nor1.


---> Is it correct too ?


To do it, I have used the command "dd" like this :
sudo dd if=rootfs.ubi of=rootfs_1.ubi bs=1024 count=28125
sudo dd if=rootfs.ubi of=rootfs_2.ubi bs=1024 skip=28125

With that, my rootfs1.ubi has the size of 28 800 Ko and rootfs2.ubi the 
rest (so, in my case, 1739776 bytes).

When I reflash my board, I have these errors on boot :
- some PEBs corrupted
- a kernel panic about mounting rootfs

[...]
Creating 1 MTD partitions on "mxc_nand":
0x000000000000-0x000020000000 : "nand"
UBI: attaching mtd3 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    130944 bytes
UBI: smallest flash I/O unit:    1
UBI: VID header offset:          64 (aligned 64)
UBI: data offset:                128
UBI warning: ubi_scan: 13 PEBs are corrupted
corrupted PEBs are: 231 232 233 234 235 236 237 238 240 241 242 243 244
UBI: volume 0 ("nvp-rootfs") re-sized from 231 to 483 LEBs
UBI: attached mtd3 to ubi0
[...]
UBIFS: mounted UBI device 0, volume 0, name "nvp-rootfs"
UBIFS: mounted read-only
UBIFS: file system size:   61936512 bytes (60484 KiB, 59 MiB, 473 LEBs)
UBIFS: journal size:       8380416 bytes (8184 KiB, 7 MiB, 64 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root:  0 bytes (0 KiB)
UBIFS error (pid 1): ubifs_read_node: bad node type (255 but expected 9)
UBIFS error (pid 1): ubifs_read_node: bad node at LEB 230:108664
UBIFS error (pid 1): ubifs_iget: failed to read inode 1, error -22
List of all partitions:
1f00             256 mtdblock0 (driver?)
1f01             128 mtdblock1 (driver?)
1f02            2816 mtdblock2 (driver?)
1f03           62336 mtdblock3 (driver?)
1f04          524288 mtdblock4 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on 
unknown-block(0,0)


I think that I made some mistakes in my calculation (or maybe it is not 
the good way to do it) but I can not find some examples in Internet so I 
hope that someone could help me to understand it ! :)


Thank you in advance !


Best regards,

-- 
Mylène JOSSERAND
Navocap



More information about the barebox mailing list