Open main menu

DAVE Developer's Wiki β

Changes

DESK-XZ7-L/Deployment/Standalone boot

23 bytes removed, 09:55, 21 November 2022
no edit summary
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
|-
|!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000"|{{oldid|17xxx|17xxx}}|!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000"|Q1 2023|!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000"|DESK-XZ7-L 1.0.0 release
|-
|}
We'll explain how to program and configure a <SOM> to boot in standalone mode, without the need for a system microSD card or an NFS server, with three options:
* booting with SD only
** in this configuration the whole system will boot without the need for a NOR/NAND flashes storage, all images and the root file system will be fetched from the SD card
* booting with NOR and NAND internal storage
** in this configuration the primary boot images will be fetched from NOR flash storage, while the root file system will be fetched from NAND flash
* booting with SD only
** in this configuration the whole system will boot without the need for a NOR/NAND flashes storage, all images and the root file system will be fetched from the SD card
 
=== Program boot images into internal storage ===
==== Program the NOR flash ====
=====u-Boot=====
 
Update to the latest u-boot version allows usage of u-boot environment variables available.
 
<pre class="workstation-terminal">
=> run load
</pre>
 
=====fit image =====
We assume that the following environment variables are present in u-boot:
 
<pre>
loadk=tftpboot ${loadaddr} ${serverip}:${bootfile}
loadfdt=tftpboot ${fdtaddr} ${serverip}:${fdtfile}
spi_updatek=sf erase 200000 800000; sf write ${loadaddr} 200000 ${filesize}
spi_updatefdt=sf erase 180000 80000; sf write ${fdtaddr} 180000 ${filesize}
spi_loadk=sf read ${loadaddr} 200000 800000
spi_loadfdt=sf read ${fdtaddr} 180000 80000
spi_nand=sf probe; run spi_loadk spi_loadfdt nandargs addcons addmisc; if run configid_fixupfdt; then bootm ${loadaddr} - ${fdtaddr}; fi
</pre>
 
* Update the <code>bootfile</code> and <code>fdtfile</code> environment variables to fit the filename as found inside the TFTP server.
* Program kernel and device tree on NOR flash with the following U-Boot command
 
<pre class="board-terminal">
sf probe; run loadk spi_updatek loadfdt spi_updatefdt
</pre>
 
E.g.:
 
<pre class="workstation-terminal">
=> sf probe; run loadk spi_updatek loadfdt spi_updatefdt
</pre>
 
Reboot the system and configure U-Boot to apply the new configuration
 
<pre class="workstation-terminal">
=> setenv bootcmd run spi_nand
=> saveenv
</pre>
 
==== Program root file system into NAND flash ====
* Boot the system via SD or NFS as described in the e [[(<KIT>)#Quick_start_guide|Quick start guide]]
* By default, the NAND is already partitioned to allow booting from NAND-only (see next section) and, thus, some partitions are reserved for u-boot and kernel images. Here we won't modify this default configuration. The [[Memory Tecnology Device (MTD)|MTD]] partitions can be dumped with <code>/proc/mtd</code> (the partition's name should be self-explanatory)
<pre class="workstation-terminal">
</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/mtd0
ubiattach -m 0
ubimkvol /dev/ubi0 -N rootfs -m
</pre>
 
E.g.
 
<pre class="workstation-terminal">
root@bora:~# ubiformat /dev/mtd0
</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="workstation-terminal">
root@bora:~# mkdir -p /mnt/nand
root@bora:~# mount -t ubifs ubi0_0 /mnt/nand
</pre>
* you can now extract the root file system into that directory
<pre>
tar xvjf -C /mnt/nand
</pre>
 
* finally, you need to cleanly umount and detach the MTD partition
 
<pre>
umount /mnt/nand/
ubidetach -m 0
</pre>
 
E.g.
 
<pre class="workstation-terminal">
root@bora:~# umount /mnt/nand/
[ 2446.743091] UBIFS: un-mount UBI device 0, volume 0
[ 2446.749670] UBIFS: background thread "ubifs_bgt0_0" stops
root@bora:~# ubidetach -m
[ 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=0
</pre>
=== Program boot images into SD card ===
<pre class="workstation-terminal">
root@bora:/mnt/sd# cd
root@bora:~# umount /mnt/sd
root@bora:~# reboot
</pre>
=== Program boot images into internal storage ===
==== Program the NOR flash ====
=====u-Boot=====
 
Update to the latest u-boot version allows usage of u-boot environment variables available.
 
<pre class="workstation-terminal">
=> run load
</pre>
 
=====fit image =====
We assume that the following environment variables are present in u-boot:
 
<pre>
loadk=tftpboot ${loadaddr} ${serverip}:${bootfile}
loadfdt=tftpboot ${fdtaddr} ${serverip}:${fdtfile}
spi_updatek=sf erase 200000 800000; sf write ${loadaddr} 200000 ${filesize}
spi_updatefdt=sf erase 180000 80000; sf write ${fdtaddr} 180000 ${filesize}
spi_loadk=sf read ${loadaddr} 200000 800000
spi_loadfdt=sf read ${fdtaddr} 180000 80000
spi_nand=sf probe; run spi_loadk spi_loadfdt nandargs addcons addmisc; if run configid_fixupfdt; then bootm ${loadaddr} - ${fdtaddr}; fi
</pre>
 
* Update the <code>bootfile</code> and <code>fdtfile</code> environment variables to fit the filename as found inside the TFTP server.
* Program kernel and device tree on NOR flash with the following U-Boot command
 
<pre class="board-terminal">
sf probe; run loadk spi_updatek loadfdt spi_updatefdt
</pre>
 
E.g.:
 
<pre class="workstation-terminal">
=> sf probe; run loadk spi_updatek loadfdt spi_updatefdt
</pre>
 
Reboot the system and configure U-Boot to apply the new configuration
 
<pre class="workstation-terminal">
=> setenv bootcmd run spi_nand
=> saveenv
</pre>
 
==== Program root file system into NAND flash ====
* Boot the system via SD or NFS as described in the e [[(<KIT>)#Quick_start_guide|Quick start guide]]
* By default, the NAND is already partitioned to allow booting from NAND-only (see next section) and, thus, some partitions are reserved for u-boot and kernel images. Here we won't modify this default configuration. The [[Memory Tecnology Device (MTD)|MTD]] partitions can be dumped with <code>/proc/mtd</code> (the partition's name should be self-explanatory)
<pre class="workstation-terminal">
</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/mtd0
ubiattach -m 0
ubimkvol /dev/ubi0 -N rootfs -m
</pre>
 
E.g.
 
<pre class="workstation-terminal">
root@bora:~# ubiformat /dev/mtd0
</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="workstation-terminal">
root@bora:~# mkdir -p /mnt/nand
root@bora:~# mount -t ubifs ubi0_0 /mnt/nand
</pre>
* you can now extract the root file system into that directory
<pre>
tar xvjf -C /mnt/nand
</pre>
 
* finally, you need to cleanly umount and detach the MTD partition
 
<pre>
umount /mnt/nand/
ubidetach -m 0
</pre>
 
E.g.
 
<pre class="workstation-terminal">
root@bora:~# umount /mnt/nand/
[ 2446.743091] UBIFS: un-mount UBI device 0, volume 0
[ 2446.749670] UBIFS: background thread "ubifs_bgt0_0" stops
root@bora:~# ubidetach -m
[ 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=0
</pre>
----
[[Category:BORA]]
8,256
edits