Open main menu

DAVE Developer's Wiki β

Changes

DESK-MX6-L/Deployment/Standalone boot

1,842 bytes added, 13:22, 25 February 2022
Updating outputs for DESK-MX6-L 3.0.0 release tested on SBCX
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |Jun 2022
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |U-Boot root file system parameters
|-
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |3.0.0
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |Feb 2022
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |3.0.0 DESK release tested on SBCX
|-
|}
We'll explain how to program and configure a <SOM> to boot in standalone mode, without the need of a system microSD card or an NFS server, with threee three options:
* 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
=== Program boot images into NOR flash ===
{{ImportantMessage|text=This example was not tested with '''DESK-MX6-L 3.0.0''' release as '''SBCX''' do not have NOR flash. Nevertheless provided commands should work on other platforms that do have this storage.}} It is supposed tat that the proper filenames are configured on uU-boot Boot variables. Those files should be available on TFTP server. In the following examples, we use the boot images:
<pre>
</pre>
We assume that the following environment variables are present in uU-boot Boot too:
<pre>
</pre>
====uU-Boot====
Update to the latest uU-boot Boot version allows usage of uU-boot Boot environment variables available.
<pre class="workstation-terminal">
====kernel image and device tree====
We assume that the following environment variables are present in uU-bootBoot:
<pre>
=== Program boot images into NAND flash ===
====uU-Boot====
uU-boot Boot SPL on NAND flash must be programmed using NXP <code>kobs-ng</code> utility and the second stage using the <code>nandwrite</code>: this tool is required for writing the correct uU-boot Boot image on NAND storing all information needed by bootrom to identify the NAND as a boot device.
Here below an example:
* boot the system via SD on NFS
* uses a rfs with <b>kobs-ng</b> utility available on it (e.g. DAVE's rfs provided with <KIT>)
* copy the related uU-boot Boot imx image file on nfs /home/root (for example)* execute ''kobs-ng'' passing the parameters for flashing uU-boot Boot on NAND
* erase and program the second stage using '''flash_erase''' and '''nandwrite'''
<pre class="workstation-terminal">
root@imx6qdlxelkdesk-mx6:~# kobs-ng -x -v -f w desk-mx6-l-13.0.0_mx6qdldesk_nand_SPL
MTD CONFIG:
chip_0_device_path = "/dev/mtd0"
mtd: opened '/dev/mtd0' - '(null)'
mtd: max_boot_stream_size_in_bytes = 524288
mtd: boot_stream_size_in_bytes = 5734461440mtd: boot_stream_size_in_pages = 2830mtd: #1 0x00100000 - 0x00180000 (0x0010e0000x0010f000)mtd: #2 0x00180000 - 0x00200000 (0x0018e0000x0018f000)
FCB
m_u32Checksum = 0x00000000
m_u32Firmware1_startingPage = 512
m_u32Firmware2_startingPage = 768
m_u32PagesInFirmware1 = 2830 m_u32PagesInFirmware2 = 2830
m_u32DBBTSearchAreaStartAddress = 256
m_u32BadBlockMarkerByte = 2028
m_u32Version = 0x01000000
m_u32DBBTNumOfPages = 0
Firmware: image #0 @ 0x100000 size 0xe000 0xf000 - available 0x80000Firmware: image #1 @ 0x180000 size 0xe000 0xf000 - available 0x80000-------------- Start to write the [ FCB ] -----
-------------- Start to write the [ FCB ] -----
mtd: erasing @0:0x0-0x20000
---------- Start to write the [ .tmp_kobs_ng ]----
mtd: Writting .tmp_kobs_ng: #0 @0: 0x00100000 - 0x0010e0000x0010f000
mtd: erasing @0:0x100000-0x120000
mtd: We write one page for save guard. *
mtd: Writting .tmp_kobs_ng: #1 @0: 0x00180000 - 0x0018e0000x0018f000
mtd: erasing @0:0x180000-0x1a0000
mtd: We write one page for save guard. *
root@imx6qdlxelkdesk-mx6:~# flash_erase /dev/mtd1 0 0Erasing 128 Kibyte @ 5e0000 -- 100 % completeroot@imx6qdlxelkdesk-mx6:~# nandwrite -p /dev/mtd1 desk-mx6-l-13.0.0_mx6qdldesk_nand_u-boot.img
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x20000
Writing data to block 3 at offset 0x60000
Writing data to block 4 at offset 0x80000
root@imx6qdlxelk:~#
</pre>
====kernel image and device tree====
We assume that the following environment variables are present in uU-bootBoot:
<pre>
<pre class="workstation-terminal">
U-Boot => run loadk nand_updatek loadfdt nand_updatefdt
Using FEC device
TFTP from server 192.168.4.240; our IP address is 192.168.4.231Filename 'desk-mx-laxel/uImage'.
Load address: 0x12000000
Loading: #################################################################
#################################################################
#################################################################
################################################################# ################################################################# ################################################################# ################################# 1.2 5 MiB/s
done
Bytes transferred = 7031520 8154280 (6b4ae0 7c6ca8 hex)
NAND erase.part: device 0 offset 0xc00000, size 0x800000
OK
NAND write: device 0 offset 0xc00000, size 0x6b4ae00x7c6ca8 7031520 8154280 bytes written: OK
Using FEC device
TFTP from server 192.168.04.13240; our IP address is 192.168.04.90231Filename 'desk-mx-laxel/imx6qimx6dl-sbcx-cb0012.dtb'.
Load address: 0x18000000
Loading: ###########
564858.5 4 KiB/s
done
Bytes transferred = 53760 51910 (d200 cac6 hex)
NAND erase.part: device 0 offset 0xa00000, size 0x100000
OK
NAND write: device 0 offset 0xa00000, size 0xd2000xcac6 53760 51910 bytes written: OK=>
</pre>
=== Program boot images into eMMC ===
{{ImportantMessage|text=This example was not tested with '''DESK-MX6-L 3.0.0''' release as '''SBCX''' do not have internal eMMC. Nevertheless provided commands should work on other platforms that do have this storage.}} ===u=U-Boot====Update to the latest uU-boot Boot version allows usage of uU-boot Boot environment variables available.
<pre>
mmc_update=> printenv mmc_update_spl mmc_update_spl=mmc dev; setexpr blocks ${filesize} / 0x200; setexpr blocks ${blocks} + 1; mmc write ${loadaddr} 2 ${blocks}=> printenv mmc_update_uboot mmc_update_uboot=mmc dev; setexpr blocks ${filesize} / 0x200; setexpr blocks ${blocks} + 1; mmc write ${loadaddr} 0x8a ${blocks}
</pre>
Load uU-boot Boot binary form a <code>tftp</code> server:
<pre class="workstation-terminal">
=> run load_spl
Using FEC device
TFTP from server 192.168.04.125240; our IP address is 192.168.04.9049Filename 'desk-mx-laxel/SPL'.
Load address: 0x12000000
Loading: ############
5601.5 KiB1 MiB/s
done
Bytes transferred = 56320 60416 (dc00 ec00 hex)=> run mmc_update_spl
switch to partitions #0, OK
mmc2(part 0) mmc0 is current device (eMMCSD)
MMC write: dev # 20, block # 2, count 1313 119 ... 1313 119 blocks written: OK=> run load_uboot
Using FEC device
TFTP from server 192.168.04.125240; our IP address is 192.168.04.9049Filename 'desk-mx-laxel/u-boot.img'.
Load address: 0x12000000
Loading: #################################################################
########################################################## 10091.8 KiB5 MiB/s
done
Bytes transferred = 569864 624932 (8b208 98924 hex)=> run mmc_update_uboot
switch to partitions #0, OK
mmc2 mmc0 is current device (eMMCSD)
MMC write: dev # 20, block # 138, count 1114 1221 ... 1114 1221 blocks written: OK=>
</pre>
Load uU-boot Boot binary form from an <code>SD</code> card:
<pre class="workstation-terminal">
====kernel image and device tree====
We assume that the following environment variables are present in uU-bootBoot:
<pre>
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, uU-boot 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 uU-boot Boot environment variables are present for this purposes:
<pre>
mmcargs=setenv bootargs root=${mmcroot}
==== boot vars ====
The following environment variables should be configured for uU-boot Boot properly reading the boot files from the first SD card partition, e.g.
<pre class="workstation-terminal">
=> setenv normalboot mmcboot
=> setenv bootfile uImage
=> setenv fdtfile imx6qimx6dl-sbcx-cb0012.dtb
=> setenv splashfile splash_image.bmp
</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 uU-boot 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">
root@imx6qdlxelk:~# cat /proc/mtd
</pre>
{{ImportantMessage|text=Please note that MTD partition index may change depending of flash device availability, flash device size, uU-boot Boot environment variables or kernel device driver load order. Always take care of looking inside <code>/proc/mtd</code> to match your specific layout}}
<pre class="workstation-terminal">
root@imx6qdlxelkdesk-mx6:~# ubiformat /dev/mtd8
ubiformat: mtd8 (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 148ubiformat: formatting eraseblock 7999 -- 100 % complete root@imx6qdlxelkdesk-mx6:~# ubiattach -m 8[ 1714 360.823600013629] UBIubi0: attaching mtd8 to ubi0[ 1726 361.415587991725] UBIubi0: scanning is finished[ 1726 362.483765009988] UBIubi0: attached mtd8 (name "nand-ubi", size 1000 MiB) to ubi0[ 1726 362.491062016138] UBIubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes[ 1726 362.498301023029] UBIubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048[ 1726 362.505030030324] UBIubi0: VID header offset: 2048 (aligned 2048), data offset: 4096[ 1726 362.512430037598] UBIubi0: good PEBs: 8000, bad PEBs: 0, corrupted PEBs: 0[ 1726 362.518861043702] UBIubi0: user volume: 0, internal volumes: 1, max. volumes count: 128[ 1726 362.526025051238] UBIubi0: max/mean erase counter: 360/249, WL threshold: 4096, image sequence number: 6230702581933293895[ 1726 362.535433060761] UBIubi0: available PEBs: 7836, total reserved PEBs: 164, PEBs reserved for bad PEB handling: 160[ 1726 362.545260070564] UBIubi0: background thread "ubi_bgt0d" started, PID 714636UBI device number 0, total 8000 LEBs (1015808000 bytes, 968.8 7 MiB), available 7836 LEBs (994983936 bytes, 948.9 8 MiB), LEB size 126976 bytes (124.0 KiB)root@imx6qdlxelkdesk-mx6:~# ubimkvol /dev/ubi0 -N rootfs -m
Set volume size to 994983936
Volume ID 0, size 7836 LEBs (994983936 bytes, 948.9 8 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs", alignment 1
</pre>
<pre class="workstation-terminal">
root@imx6qdlxelkdesk-mx6:~# mkdir -p /mnt/nandroot@imx6qdlxelkdesk-mx6:~# mount -t ubifs ubi0_0 /mnt/nand/[ 1810 409.301461697677] UBIFS(ubi0:0): default file-system created[ 1810 409.703241] UBIFS (ubi0:0): Mounting in unauthenticated mode[ 409.308952709114] UBIFS(ubi0:0): background thread "ubifs_bgt0_0" started, PID 717655[ 1810 409.452274742889] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"[ 1810 409.459421750360] UBIFS(ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes[ 1810 409.469398760923] UBIFS(ubi0:0): FS size: 992698368 bytes (946 MiB, 7818 LEBs), journal size 33521664 bytes (31 MiB, 264 LEBs)[ 1810 409.480976772226] UBIFS(ubi0:0): reserved for root: 4952683 bytes (4836 KiB)[ 1810 409.487210778855] UBIFS(ubi0:0): media format: w4w5/r0 (latest is w4w5/r0), UUID 99D0F3C698CA79BD-59552EC2-4B304B4E-9E2DA244-72202281BD3032553E1049FC, small LPT model
</pre>
<pre>
tar xvjf deskdave-image-qt5devel-desk-mx6.tar.bz2 -C /mnt/nand
</pre>
<pre class="workstation-terminal">
root@imx6qdlxelkdesk-mx6:~# umount /mnt/nand/[ 24464485.743091370345] UBIFS(ubi0:0): un-mount UBI device 0, volume 0[ 24464485.749670377962] UBIFS(ubi0:0): background thread "ubifs_bgt0_0" stopsroot@imx6qdlxelkdesk-mx6:~# ubidetach -m 8[ 24504493.738153929166] UBIubi0: detaching mtd8 from ubi0[ 24504493.759527942262] UBIubi0: mtd8 is detached from ubi0
</pre>
=== Program root file system into eMMC flash ===
{{ImportantMessage|text=This example was not tested with '''DESK-MX6-L 3.0.0''' release as '''SBCX''' do not have internal eMMC. Nevertheless provided commands should work on other platforms that do have this storage.}}* Boot the system via SD or NFS as described in the e [[(<KIT>)#Quick_start_guide|Quick start guide]]
* eMMC 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:
<pre class="workstation-terminal">
root@imx6qdlxelkdesk-mx6:~# ./sdcard-partition.sh /dev/mmcblk2
SD total size: 3776KB
[ 1341.905014] mmcblk2: p1 p2
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
 
root@imx6qdlxelk:~#
</pre>
<pre class="workstation-terminal">
root@imx6qdlxelkdesk-mx6:~# mount /dev/mmcblk2p1 /mnt/emmc
[ 40.988575] FAT-fs (mmcblk2p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
root@imx6qdlxelkdesk-mx6:~# cd /mnt/emmcroot@imx6qdlxelkdesk-mx6:/mnt/emmc# cp /tftpboot/desk-mx/linux/desk-mx-1.0.0*dtb .root@imx6qdlxelkdesk-mx6:/mnt/emmc# cp /tftpboot/desk-mx/linux/desk-mx-1.0.0*uImage .root@imx6qdlxelkdesk-mx6:/mnt/emmc# cp /tftpboot/desk-mx/linux/splash_image.bmp .root@imx6qdlxelkdesk-mx6:/mnt/emmc# cdroot@imx6qdlxelkdesk-mx6:~# umount /mnt/emmc
</pre>
<pre class="workstation-terminal">
root@imx6qdlxelkdesk-mx6:~# mount /dev/mmcblk2p2 /mnt/emmc
[ 1810.899327] EXT4-fs (mmcblk2p2): mounted filesystem with ordered data mode. Opts: (null)
root@imx6qdlxelkdesk-mx6:~# cd /mnt/emmcroot@imx6qdlxelkdesk-mx6:/mnt/emmc#
</pre>
<pre>
tar xvjf axeldave-image-qt5devel-imx6qdlxelk.tardesk-mx6.tar.bz2-C /mnt/emmc
</pre>
<pre class="workstation-terminal">
root@imx6qdlxelkdesk-mx6:/mnt/emmc# cdroot@imx6qdlxelkdesk-mx6:~# umount /mnt/emmcroot@imx6qdlxelkdesk-mx6:~# reboot
</pre>
mkfs.ext4 -F ${node}${part}1 -Lboot
then, the uU-boot Boot <code>environment</code> has to be properly configured:
<pre class="workstation-terminal">
...
...
[ 23.884838859646] 9 cmdlinepart partitions found on MTD device gpmi-nand[ 3.865861] Creating 9 MTD partitions on "gpmi-nand":[ 23.889901870924] 0x000000000000-0x000000200000 : "nand-SPL"[ 23.904875885045] 0x000000200000-0x000000800000 : "nand-uboot"[ 23.914921895099] 0x000000800000-0x000000900000 : "nand-env1"[ 23.924903905059] 0x000000900000-0x000000a00000 : "nand-env2"[ 23.934931915071] 0x000000a00000-0x000000b00000 : "nand-fdt"[ 23.944880925049] 0x000000b00000-0x000000c00000 : "nand-spare"[ 23.954958935124] 0x000000c00000-0x000001400000 : "nand-kernel"[ 23.964920945057] 0x000001400000-0x000001800000 : "nand-splash"[ 23.974934955104] 0x000001800000-0x000020000000 0x000040000000 : "nand-ubi"
...
...
...
...
[ 45.708969559821] ubi0: attaching mtd8[ 97.673466990342] ubi0: scanning is finished[ 98.702506021500] ubi0: attached mtd8 (name "nand-ubi", size 488 1000 MiB)[ 98.708522027595] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes[ 98.715452034504] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048[ 98.722260041299] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096[ 98.729329048291] ubi0: good PEBs: 39038000, bad PEBs: 10, corrupted PEBs: 0[ 98.735502054414] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128[ 98.742759061644] ubi0: max/mean erase counter: 1763/1152, WL threshold: 4096, image sequence number: 855057006819217695[ 98.752222070886] ubi0: available PEBs: 160, total reserved PEBs: 38878000, PEBs reserved for bad PEB handling: 79160[ 98.761688080359] ubi0: background thread "ubi_bgt0d" started, PID 140157[ 8.164282] UBIFS (ubi0:0): Mounting in unauthenticated mode[ 98.815346170156] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 141163[ 98.941878210063] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"[ 98.949339217549] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes[ 98.959283227505] UBIFS (ubi0:0): FS size: 480985088 992698368 bytes (458 946 MiB, 3788 7818 LEBs), journal size 24125440 33521664 bytes (23 31 MiB, 190 264 LEBs)[ 98.970279238514] UBIFS (ubi0:0): reserved for root: 4952683 bytes (4836 KiB)[ 98.976924245169] UBIFS (ubi0:0): media format: w4w5/r0 (latest is w5/r0), UUID 759D6A88BEC33049-1C15213B-42934D02-BA54A9CE-6D740D559A465F0D7EB5DAA8, small LPT model[ 98.991302257174] VFS: Mounted root (ubifs filesystem) on device 0:13.[ 9.999829] devtmpfs: mounted[ 10.003881] Freeing unused kernel memory: 1024KINIT: version 214.88 booting
...
...
...
...
[ 3 5.938852] mmc0: host does not support reading read-only switch, assuming write-enable[ 3.952617061660] mmc0: new high speed SDHC card at address aaaa[ 3 5.071528] mmcblk0: mmc0:aaaa SC16G 14.8 GiB[ 5.958846071528] mmcblk0: mmc0:aaaa SC16G 14.8 GiB[ 3 5.972173088454] mmcblk0: p1 p2
...
...
...
...
[ 4 5.782443681176] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)[ 4 5.790648689678] VFS: Mounted root (ext4 ext3 filesystem) on device 179:2.[ 4 5.807855707149] devtmpfs: mounted[ 4 5.811984713124] Freeing unused kernel memory: 1024K
...
...
devwiki_user
120
edits