Open main menu

DAVE Developer's Wiki β

Changes

DESK-XZ7-L/Deployment/Standalone boot

2,822 bytes removed, 09:53, 21 November 2022
no edit summary
** 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>
=====fit image =====
We assume that the following environment variables are present in u-boot:
</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)
* 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/mtd7mtd0ubiattach -m 70
ubimkvol /dev/ubi0 -N rootfs -m
</pre>
<pre class="workstation-terminal">
root@sdvx-litebora:~# ubiformat /dev/mtd0
</pre>
* Now mount the UBI volume using [[Memory Tecnology Device (MTD)#UBIFS|UBIFS]] in a temporary directory
<pre class="workstation-terminal">
root@sdvx-litebora:~# mkdir -p /mnt/nandroot@sdvx-litebora:~# 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>
umount /mnt/nand/
ubidetach -m 70
</pre>
<pre class="workstation-terminal">
root@sdvx-litebora:~# umount /mnt/nand/
[ 2446.743091] UBIFS: un-mount UBI device 0, volume 0
[ 2446.749670] UBIFS: background thread "ubifs_bgt0_0" stops
root@sdvx-litebora:~# ubidetach -m
[ 2450.738153] UBI: detaching mtd7 from ubi0
[ 2450.759527] UBI: mtd7 is detached from ubi0
<pre>
nand_args=setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw ubi.mtd=70
</pre>
</pre>
====fit image==== We assume that Create the following environment variables are present in u-boot: <pre>mmc_loadk=fatload mmc ${mmcdev}:1 ${loadaddr} ${bootfile}mmc_loadfdt=fatload mmc ${mmcdev}:1 ${fdtaddr} ${fdtfile}mmc_loadsplash=fatload mmc ${mmcdev}:1 ${loadaddr} ${splashfile}; cp.b ${loadaddr} ${splashimage} ${filesize}mmcboot=run mmcargs addcons addmisc; if run mmc_loadk; then if run mmc_loadfdt; then if run configid_fixupfdt; then bootm ${loadaddr} - ${fdtaddr}; fi; fi; fi</pre> Using an SD card or an eMMC device assumes that <code>bootfile</code>, <code>fdtfile</code> and <code>splashfile</code> are stored into fist MMC device partition.  Then, u-boot uses the previous listed commands for reading the binary images and starting the linux bootstrap from the ''MMC part 2'' (which is reserved for the root-file system storage). The following u-boot environment variables are present for this purposes:<pre>mmcargs=setenv bootargs root=${mmcroot}mmcroot=/dev/mmcblk2p2 rootwait rw</pre> =partitions === boot vars ==== The following environment variables should be configured for u-boot properly reading the boot files from the first SD card partition, e.g. <pre class="workstation-terminal">=> setenv normalboot mmcboot=> setenv bootfile </pre> then save the environment and reboot the system to apply the new configuration: <pre class="workstation-terminal">=> saveenvSaving Environment to MMC...Writing to MMC(2)... done=> reset</pre> === Program root file system into SD card === 
* Boot the system via SD or NFS as described in the e [[(<KIT>)#Quick_start_guide|Quick start guide]]
* eMMC SD device has to be partitioned and properly formatted choosing the <code>file system</code> for each partition
* an example of SD partitioning script is the following one:
==== FAT32 partition ====
<pre>
#!/bin/sh
<pre class="workstation-terminal">
root@sdvx-litebora:~# ./sdcard-partition.sh /dev/mmcblk2
SD total size: 3776KB
[ 1341.905014] mmcblk2: p1 p2
Writing superblocks and filesystem accounting information: done
root@sdvx-litebora:~#
</pre>
* create a mount point and mount the first partition
<pre>
root@bora:~# mkdir -p /mnt/emmcsdroot@bora:~# mount /dev/mmcblk2p1 mmcblk0p1 /mnt/emmcsd
</pre>
<pre class="workstation-terminal">
root@sdvx-litebora:~# mount cp images/devlinux/mmcblk0p2 BOOT.BIN /mnt/sdroot@sdvx-litebora:~# cd /mnt/emmcroot@sdvx-lite:/mnt/emmc# cp images/tftpbootlinux/xxxxx image.root@sdvx-lite:ub /mnt/emmc# cdsdroot@sdvx-litebora:~# umount cp images/linux/boot.scr /mnt/emmcsd
</pre>
* now mount ==== Program root file system into SD card ====Now, you can extract the EXT4 volume in the temporary root file system into that directory
E.g.:* mount the <code>ext3/ext4</code> volume in the temporary directory
<pre class="workstation-terminal">
root@sdvx-litebora:~# mount /dev/mmcblk2p2 mmcblk0p2 /mnt/emmcsd
[ 1810.899327] EXT4-fs (mmcblk2p2): mounted filesystem with ordered data mode. Opts: (null)
root@sdvx-litebora:~# cd /mnt/emmcroot@sdvx-lite:/mnt/emmc#
</pre>
* you can now extract the root file system into that directory <preclass="workstation-terminal">root@bora:~# tar xvjf sdvx-1xf images/linux/rootfs.0tar.1_image-devel-sdvxgz -lite.tar.bz2C /mnt/sd
</pre>
<pre class="workstation-terminal">
root@sdvx-litebora:/mnt/emmcsd# cdroot@sdvx-litebora:~# umount /mnt/emmcsdroot@sdvx-litebora:~# reboot
</pre>
</pre>
==== ext4 partition ====
For using an <b>ext4</b> partition also for boot files, it is possibile to change the formatting script:
 
{ echo ${boot_start},${boot_size},'''83''',-; echo ${rfs_start},${rfs_size},83,-; } | sfdisk --force ${node}
 
and formatting the first partition using ''mkfs.ext4''
 
mkfs.ext4 -F ${node}${part}1 -Lboot
 
then, the u-boot <code>environment</code> has to be properly configured:
 
<pre class="workstation-terminal">
=> setenv mmc_loadk 'ext4load mmc ${mmcdev}:1 ${loadaddr} ${bootfile}'
=> setenv mmc_loadfdt 'ext4load mmc ${mmcdev}:1 ${fdtaddr} ${fdtfile}'
=> setenv mmc_loadsplash 'ext4load mmc ${mmcdev}:1 ${loadaddr} ${splashfile}; cp.b ${loadaddr} ${splashimage} ${filesize}'
=> saveenv
</pre>
----
[[Category:BORA]]
8,256
edits