<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi all,<br><br>We are basically trying to mount our inbuilt NAND flash device and write some files onto it using UBI/UBI-FS.<br><br>After running some of the following steps successfully, the linux kernel crashed after running ‘ubimkvol’.<br><br>Please help me if I am doing something wrong in any of the steps below which is causing ubimkvol to be killed. <br><br><br>Flash Size : 800 MB<br>Linux Kernel Version : 3.1.14<br>Page size :
8192<br>Physical Erase Block Size : 1MiB ( We are taking)<br><br><br><span style="font-weight: bold; color: rgb(0, 0, 191);">These are the steps we are following:</span><br><br>1. Create ubifs image by using mkfs.ubifs command<br><br><span style="color: rgb(0, 0, 255);"> #mkfs.ubifs -v -r rootfs -o ubifs.img -m 8192 -e 1032192 -c 788</span><br><br> Description:<br><br> We are taking Physical Erase Block (PEB) size as 1048576 bytes(1MiB)<br><br> -e -- Erase Block Size<br><br> e = (1048576 - 2 * 8192) = 1032192 bytes<br><br> -c --The maximum size, in LEBs, of this file system<br><br> c = 788(see the below calculation)<br><br> PEB Size (SP) =
1048576<br><br> LEB Size (SL) = 1048576 - 2 * 8192 = 1032192<br><br> Total Flash Size = 800 MiB<br><br> Total number of PEBs on the MTD device (P) = 800 MiB/1048576 = 800<br><br> Number of PEBs reserved for bad PEB handling(B) is 1% of P = 8<br><br> The overhead related to storing EC and VID headers in bytes<br> i.e. O = SP - SL = 1048576 - 1032192 = 16384.<br><br> UBI Overhead = (B + 4) * SP + O * (P - B -
4)<br><br> = (8 + 4) * 1048576 + 16384(800 - 8 -4)<br><br> = ~24<br><br> Available PEB's = 800 - 24 = 776 PEB's.<br><br> Calcultion of 'c' = ((Available PEB's)*PEB)/LEB<br><br> = (776 * 1048576)/ 1032192<br><br> = ~ 788 LEB's.<br><br>2. Create ubinize.cfg file and write the contents into
it<br><br> # vi ubinize.cfg<br><br> [ubifs]<br> mode=ubi<br> image=ubifs.img<br> vol_id=0<br> vol_size=512MiB<br> vol_type=dynamic<br> vol_name=rootfs<br> vol_flags=autoresize<br><br> give ubinise command<br><br> <span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 191);">#ubinize -o ubi.img -m 8192 -p 1MiB ubinize.cfg
-v</span></span><br><br> m = 8192 page size.<br><br> p = 1MiB physical erase block<br><br>3. Flash_Erase: Prepares NAND partition; MTD partition 3 needs to be erased<br> and used for UBI file system.<br><br> <span style="color: rgb(0, 0, 191);"> # flash_erase /dev/mtd3 0 0</span><br><br> (0 0) - indicates erases the memory from available first LEB to last LEB<br><br> It displays the following message :<br><br> Erasing 1024 Kibyte @ 31f00000 -- 100 % complete<br><br>4. UBI Formatting :Flash the UBI file system image (ubi.img) to MTD partition "3"<br><br> <span style="color: rgb(0, 0, 255);"> # ubiformat /dev/mtd3 -f ubi.img</span><br><br>5. Ubiattach: Attach MTD device to
UBI<br><br> <span style="color: rgb(0, 0, 191);"># ubiattach /dev/mtd3 -f ubi.img</span><br style="color: rgb(0, 0, 191);"><br>6. ubimkvol : Create an UBI volume - the created volume will be empty<br><br> <span style="color: rgb(0, 0, 191);"> # ubimkvol /dev/ubi0 -N ubifs_volume -m</span><br><br> It displays the following message :<br><br> Set volume size to 813367296<br><br> <span style="color: rgb(255, 0, 0);"> Killed</span><br><br> (log of ubimkvol is attached please find it for further reference)<br><br> <span style="color: rgb(255, 0, 0);">The kernel crashed after running this step.</span><br><br>Thanks in
advance,<br>Charan.<br><br><br><br><br><br><br><br><br><br> <br><br></td></tr></table>