Changes

Jump to: navigation, search

Standalone boot (XUELK)

2,555 bytes added, 14:13, 2 March 2020
Storing root file system into NAND flash
{{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}}
=== Flashing the root file system from a tarball archive ===
This example is using a <code>tarball</code> compressed archive to be extracted into a formatted and mounted UBI File System.
* Format and initialize ''nand-ubi'' partition, which in our case is <code>mtd7</code>, using [[Memory Tecnology Device (MTD)#UBI|UBI]] with:
You can now safely reboot or turn off the system.
=== Creating and flashing a UBI root file system image ===
This example is using the <code>UBI tools</code> compressed archive to be extracted into a formatted and mounted UBI File System.
 
* Prepare and initialize a ''UBI'' image to be flashed with:
 
<pre>
mkfs.ubifs
ubinize
</pre>
 
E.g. preparing an image for an SLC NAND with:
* 2048 bytes page size (parameter <code>-m</code>)
* 126976 bytes LEB size (parameter <code>-e</code>)
* 4095 LEBs (parameter <code>-c</code>)
* an already extracted root file system into the directory <code>xuelk-2.0.1-rfs</code>
 
<pre class="board-terminal">
root@sbc-lynx:~# mkfs.ubifs -m 2048 -e 126976 -c 4095 -r xuelk-2.0.1-rfs -o xuelk-2.0.1_lynx-image-core-sbc-lynx.ubifs
</pre>
 
the output file is then:
 
<pre>
root@sbc-lynx:~# ls -la xuelk-2.0.1_lynx-image-core-sbc-lynx.ubifs
-rw-r--r-- 1 root root 41140224 Mar 2 2020 xuelk-2.0.1_lynx-image-core-sbc-lynx.ubifs
root@sbc-lynx:~#
</pre>
 
The ''ubifs'' file can be used for creating a UBI image using <code>ubinize</code> with a proper configuration file:
 
<pre class="board-terminal">
root@sbc-lynx:~# cat lynx-ubi.cfg
[rootfs]
mode=ubi
image=xuelk-2.0.1_lynx-image-core-sbc-lynx.ubifs
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
vol_alignment=1
root@sbc-lynx:~# ubinize -o xuelk-2.0.1_lynx-image-core-sbc-lynx.img -m 2048 -p 128KiB -s 2048 lynx-ubi.cfg
ubinize: volume size was not specified in section "rootfs", assume minimum to fit image "xuelk-2.0.1_lynx-image-core-sbc-lynx.ubifs"41140224 bytes (39.2 MiB)
root@sbc-lynx:~# ls -la xuelk-2.0.1_lynx-image-core-sbc-lynx.img
-rw-r--r-- 1 root root 42729472 Mar 2 2020 xuelk-2.0.1_lynx-image-core-sbc-lynx.img
root@sbc-lynx:~#
</pre>
 
Then, the ''UBI image'' can be directly flashed on NAND using <code>ubiformat</code>:
 
<pre class="board-terminal">
root@sbc-lynx:~# ubiformat /dev/mtd7 -f xuelk-2.0.1_lynx-image-core-sbc-lynx.img
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 50
ubiformat: flashing eraseblock 325 -- 100 % complete
ubiformat: formatting eraseblock 7999 -- 100 % complete
root@sbc-lynx:~#
</pre>
 
You can now safely reboot or turn off the system.
 
=== u.boot configuration ===
In U-Boot environment check the following variable, which must contain the same MTD partition number used above
8,139
edits

Navigation menu