Changes

Jump to: navigation, search

Standalone boot (SDVX)

3,837 bytes added, 13:03, 1 October 2018
Program root file system into NAND flash
mtd7: 3e600000 00020000 "nand-ubi"
root@sdvx-lite:~#
</pre>
 
{{ImportantMessage|text=Please note that MTD partition index may change depending of flash device availability, flash device size, u-boot environment variables or kernel device driver load order. Always take care of looking inside <code>/proc/mtd</code> to match your specific layout}}
 
 
* Format and initialize ''nand-ubi'' partition, which in our case is <code>mtd7</code>, using [[Memory Tecnology Device (MTD)#UBI|UBI]] with:
 
<pre>
ubiformat /dev/mtd7
ubiattach -m 7
ubimkvol /dev/ubi0 -N rootfs -m
</pre>
 
E.g.
 
<pre class="board-terminal">
root@sdvx-lite:~# ubiformat /dev/mtd7
ubiformat: mtd7 (nand), size 1048576000 bytes (1000.0 MiB), 8000 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 7999 -- 100 % complete
ubiformat: 8000 eraseblocks have valid erase counter, mean value is 1
ubiformat: formatting eraseblock 7999 -- 100 % complete
root@sdvx-lite:~# ubiattach -m 7
[ 1714.823600] UBI: attaching mtd7 to ubi0
[ 1726.415587] UBI: scanning is finished
[ 1726.483765] UBI: attached mtd7 (name "nand-ubi", size 1000 MiB) to ubi0
[ 1726.491062] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 1726.498301] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 1726.505030] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 1726.512430] UBI: good PEBs: 8000, bad PEBs: 0, corrupted PEBs: 0
[ 1726.518861] UBI: user volume: 0, internal volumes: 1, max. volumes count: 128
[ 1726.526025] UBI: max/mean erase counter: 3/2, WL threshold: 4096, image sequence number: 623070258
[ 1726.535433] UBI: available PEBs: 7836, total reserved PEBs: 164, PEBs reserved for bad PEB handling: 160
[ 1726.545260] UBI: background thread "ubi_bgt0d" started, PID 714
UBI device number 0, total 8000 LEBs (1015808000 bytes, 968.8 MiB), available 7836 LEBs (994983936 bytes, 948.9 MiB), LEB size 126976 bytes (124.0 KiB)
root@sdvx-lite:~# ubimkvol /dev/ubi0 -N rootfs -m
Set volume size to 994983936
Volume ID 0, size 7836 LEBs (994983936 bytes, 948.9 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs", alignment 1
</pre>
 
* Now mount the UBI volume using [[Memory Tecnology Device (MTD)#UBIFS|UBIFS]] in a temporary directory
 
<pre>
mkdir -p /mnt/nand
mount -t ubifs ubi0_0 /mnt/nand
</pre>
 
E.g.:
 
<pre class="board-terminal">
root@sdvx-lite:~# mkdir -p /mnt/nand
root@sdvx-lite:~# mount -t ubifs ubi0_0 /mnt/nand
[ 1810.301461] UBIFS: default file-system created
[ 1810.308952] UBIFS: background thread "ubifs_bgt0_0" started, PID 717
[ 1810.452274] UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[ 1810.459421] UBIFS: LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 1810.469398] UBIFS: FS size: 992698368 bytes (946 MiB, 7818 LEBs), journal size 33521664 bytes (31 MiB, 264 LEBs)
[ 1810.480976] UBIFS: reserved for root: 4952683 bytes (4836 KiB)
[ 1810.487210] UBIFS: media format: w4/r0 (latest is w4/r0), UUID 99D0F3C6-5955-4B30-9E2D-72202281BD30, small LPT model
</pre>
 
* you can now extract the root file system into that directory
 
<pre>
tar xvjf xuelk-1.0.0_lynx-image-gui-sbc-lynx.tar.bz2 -C /mnt/nand
</pre>
 
* finally, you need to cleanly umount and detach the MTD partition
 
<pre>
umount /mnt/nand/
ubidetach -m 7
</pre>
 
E.g.
 
<pre class="board-terminal">
root@sdvx-lite:~# umount /mnt/nand/
[ 2446.743091] UBIFS: un-mount UBI device 0, volume 0
[ 2446.749670] UBIFS: background thread "ubifs_bgt0_0" stops
root@sdvx-lite:~# ubidetach -m 7
[ 2450.738153] UBI: detaching mtd7 from ubi0
[ 2450.759527] UBI: mtd7 is detached from ubi0
</pre>
 
You can now safely reboot or turn off the system.
 
In U-Boot environment check the following variable, which must contain the same MTD partition number used above
 
<pre>
nand_args=setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw ubi.mtd=7
</pre>
8,154
edits

Navigation menu