Open main menu

DAVE Developer's Wiki β

Changes

DESK-MX6-L/Deployment/Standalone boot

8,644 bytes added, 8 January
no edit summary
from<section begin="History" />
{| style="border-collapse:collapse; "
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
|-
!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"|VersionIssue Date!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"|Issue DateNotes|-| 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" |{{oldid|14111|2021/07/16}}| 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" |First DESK release|-| 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" |{{oldid|16034|2022/02/13}}| 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" |{{oldid|16993|2022/04/22}}| 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" |DESK-MX6-L 3.0.0 release |-!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" |2023/04/07! 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:white#000000"|NotesDESK-MX6-L 4.0.0 release
|-
|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"|1.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"|Oct 2020
|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"|First DESK release
 
|}
<section end="History" /><section begin="Body" />
==Standalone boot==
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 ===
It is supposed that the proper filenames are configured on U-Boot variables. Those files should be available on TFTP server. In the following examples, we use the boot images: <pre>spl=desk-mx-l/desk-mx6-l-4.0.0_mx6qdldesk_spi_SPLubootimg=desk-mx-l/desk-mx6-l-4.0.0_mx6qdldesk_spi_u-boot.imgbootfile=desk-mx-l/desk-mx6-l-4.0.0_uImagefdtfile=udesk-mx-l/desk-mx6-l-4.0.0_imx6q-sbcx-cb0012.dtb</pre> We assume that the following environment variables are present in U-Boot====too:
<pre>load_spl=tftp ${loadaddr} ${spl}load_uboot=tftp ${loaddr} ${ubootimg}spi_update_spl=sf probe; sf erase 0 10000;sf write ${loadaddr} 400 ${filesize}spi_update_uboot=sf probe; sf erase 10000 f0000;sf write ${loadaddr} 10000 ${filesize}</pre> ====U-Boot==== Update to the latest uU-boot Boot version allows usage of uU-boot Boot environment variables available.
<pre class="workstation-terminal">
=> run loadload_splUsing FEC deviceTFTP from server 192.168.0.125; our IP address is 192.168.0.90Filename 'desk-mx-l/desk-mx6-l-4.0.0_mx6qdldesk_spi_SPL'.Load address: 0x12000000Loading: ############ 560.5 KiB/sdoneBytes transferred = 56320 (dc00 hex)=> run spi_update_splSF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiBSF: 65536 bytes @ 0x0 Erased: OKdevice 0 offset 0x400, size 0xdc00SF: 56320 bytes @ 0x400 Written: OK=> run load_uboot
Using FEC device
TFTP from server 192.168.0.13125; our IP address is 192.168.0.90Filename 'sdvxdesk-mx-l/udesk-boot/sdvxmx6-l-14.0.0_mx6dl_sfczg_spi_u0_mx6qdldesk_spi_u-boot.imximg'.
Load address: 0x12000000
Loading: #################################################################
################################################################# ## 11009.4 MiB8 KiB/s
done
Bytes transferred = 671788 569864 (a402c 8b208 hex)=> run spi_updatespi_update_ubootSF: Detected S25FL256S s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiBSF: 983040 bytes @ 0x10000 Erased: OKdevice 0 offset 0x10000, size 0x8b208SF: 569864 bytes @ 0x10000 Written: OK
=>
</pre>
====kernel image and device tree====
We assume that the following environment variables are present in uU-bootBoot:
<pre>
<pre class="workstation-terminal">
=> sf probe; run loadk spi_updatek loadfdt spi_updatefdt
SF: Detected S25FL256S s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
Using FEC device
TFTP from server 192.168.0.13125; our IP address is 192.168.0.9890Filename 'sdvxdesk-mx-l/linux/sdvxdesk-mx6-l-14.0.0_lite_uImage0_uImage'.
Load address: 0x12000000
Loading: #################################################################
#################################################################
#################################################################
################################################################# ################################################################# ################################################################# ################################################################# ######### 1.6 2 MiB/s
done
Bytes transferred = 6437016 7031520 (623898 6b4ae0 hex)SF: 8388608 bytes @ 0x200000 Erased: OKdevice 0 offset 0x200000, size 0x6b4ae0SF: 7031520 bytes @ 0x200000 Written: OK
Using FEC device
TFTP from server 192.168.0.13125; our IP address is 192.168.0.8990Filename 'sdvxdesk-mx-l/linux/sdvxdesk-mx6-l-14.0.0_lite_imx6dl0_imx6q-sfczgsbcx-cb0043cb0012.dtb'.
Load address: 0x18000000
Loading: ########### 1564.2 MiB5 KiB/s
done
Bytes transferred = 42547 53760 (a633 d200 hex)SF: 524288 bytes @ 0x180000 Erased: OKdevice 0 offset 0x180000, size 0xd200SF: 53760 bytes @ 0x180000 Written: OK
=>
</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> utilityand 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>[[DESK-MX6-L | DESK-MX6-L]])* 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@imx6qxelkdesk-mx6:~# kobs-ng -x -v -w sdvxdesk-1mx6-l-4.0.0_mx6dl_sfczg_nand_u-boot.imx0_mx6qdldesk_nand_SPL
MTD CONFIG:
chip_0_device_path = "/dev/mtd0"
boot_stream_1_address = 0
boot_stream_2_address = 0
secondary_boot_stream_off_in_MB = 64
-- We add the 1k-padding to the uboot.
.tmp_kobs_ng: verifying using key '00000000000000000000000000000000'
====================================================
mtd: opened '/dev/mtd0' - '(null)'
mtd: max_boot_stream_size_in_bytes = 3670016524288mtd: boot_stream_size_in_bytes = 67281257344mtd: boot_stream_size_in_pages = 32928mtd: #1 0x00100000 - 0x00480000 0x00180000 (0x001a442c0x0010e000)mtd: #2 0x00480000 0x00180000 - 0x00800000 0x00200000 (0x0052442c0x0018e000)
FCB
m_u32Checksum = 0x00000000
m_u32EraseThreshold = 0
m_u32Firmware1_startingPage = 512
m_u32Firmware2_startingPage = 2304768 m_u32PagesInFirmware1 = 32928 m_u32PagesInFirmware2 = 32928
m_u32DBBTSearchAreaStartAddress = 256
m_u32BadBlockMarkerByte = 2028
m_u32Version = 0x01000000
m_u32DBBTNumOfPages = 0
Firmware: image #0 @ 0x100000 size 0xa4800 0xe000 - available 0x3800000x80000Firmware: image #1 @ 0x480000 0x180000 size 0xa4800 0xe000 - available 0x3800000x80000
-------------- 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 - 0x001a48000x0010e000
mtd: erasing @0:0x100000-0x120000
mtd: erasing @0:0x120000-0x140000We write one page for save guard. *mtd: erasing @0:0x140000-0x160000mtdWritting .tmp_kobs_ng: erasing #1 @0:0x1600000x00180000 -0x1800000x0018e000
mtd: erasing @0:0x180000-0x1a0000
mtd: erasing @0:0x1a0000-0x1c0000
mtd: The last page is not full : 1068
mtd: We write one page for save guard. *
mtd: Writting .tmp_kobs_ngroot@desk-mx6: ~#1 @flash_erase /dev/mtd1 0 0: 0x00480000 - 0x00524800mtd: erasing Erasing 128 Kibyte @0:0x4800005e0000 --0x4a0000100 % complete mtd: erasing root@0desk-mx6:0x4a0000~# nandwrite -0x4c0000mtd: erasing @0:0x4c0000p /dev/mtd1 desk-mx6-l-0x4e0000mtd: erasing @4.0:0x4e0000.0_mx6qdldesk_nand_u-0x500000boot.img mtd: erasing @Writing data to block 0:0x500000-0x520000at offset 0x0mtd: erasing @0:0x520000-0x540000Writing data to block 1 at offset 0x20000mtd: The last page is not full : 1068Writing data to block 2 at offset 0x40000mtd: We write one page for save guard. *Writing data to block 3 at offset 0x60000root@imx6qxelk:~#Writing data to block 4 at offset 0x80000
</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.04.13210; our IP address is 192.168.04.9863Filename 'sdvxdesk-mx-l/linux/sdvxdesk-mx6-l-14.0.0_lite_uImage0_uImage'.
Load address: 0x12000000
Loading: #################################################################
#################################################################
#################################################################
################################################################# 1.4 ################################################################# ################################################################# ################################################################# ################################################################# ########### 2 MiB/s
done
Bytes transferred = 6437016 8038640 (623898 7aa8f0 hex)
NAND erase.part: device 0 offset 0xc00000, size 0x800000
OK
NAND write: device 0 offset 0xc00000, size 0x6238980x7aa8f0 6437016 8038640 bytes written: OK
Using FEC device
TFTP from server 192.168.04.13210; our IP address is 192.168.04.8963Filename 'sdvxdesk-mx-l/linux/sdvxdesk-mx6-l-14.0.0_lite_imx6dl0_imx6dl-sfczgsbcx-cb0043cb0012.dtb'.
Load address: 0x18000000
Loading: ########### 525980.4 5 KiB/s
done
Bytes transferred = 42547 52247 (a633 cc17 hex)
NAND erase.part: device 0 offset 0xa00000, size 0x100000
OK
NAND write: device 0 offset 0xa00000, size 0xa6330xcc17 42547 52247 bytes written: OK=>
</pre>
=== Program boot images into eMMC ===
 ====uU-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 loadload_spl Using FEC deviceTFTP from server 192.168.4.240; our IP address is 192.168.4.49Filename 'desk-mx-l/desk-mx6-l-4.0.0_mx6qdldesk_SPL'.Load address: 0x12000000Loading: ############ 1.1 MiB/sdoneBytes transferred = 60416 (ec00 hex)=> run mmc_update_spl switch to partitions #0, OKmmc0 is current device (SD) MMC write: dev # 0, block # 2, count 119 ... 119 blocks written: OK=> run load_uboot
Using FEC device
TFTP from server 192.168.04.13240; our IP address is 192.168.04.8949Filename 'sdvxdesk-mx-l/udesk-boot/sdvxmx6-l-14.0.0_mx6dl_sfczg_u0_mx6qdldesk_u-boot.imximg'.
Load address: 0x12000000
Loading: #################################################################
################################################################# ##
1.5 MiB/s
done
Bytes transferred = 671788 624932 (a402c 98924 hex)=> run mmc_updatemmc_update_uboot
switch to partitions #0, OK
mmc2(part 0) mmc0 is current device (eMMCSD)
MMC write: dev # 20, block # 2138, count 1313 1221 ... 1313 1221 blocks written: OK=>
</pre>
Load uU-boot Boot binary form from an <code>SD</code> card:
<pre class="workstation-terminal">
Hit ENTER within 1 seconds to stop autoboot
=> fatload mmc 0:1 ${loadaddr} sdvxdesk-1.0.1_mx6dlaxel_umx6-boot.imxreading sdvxl-14.0.1_mx6dlaxel_u-boot.imx0_mx6qdldesk_SPL671788 56320 bytes read in 50 20 ms (122.8 7 MiB/s)
=> mmc dev 2
switch to partitions #0, OK
mmc2(part 0) is current device (eMMC)
=> run mmc_updatemmc_update_splswitch to partitions #0, OKmmc2 is current device (eMMC) MMC write: dev # 2, block # 2, count 111 ... 111 blocks written: OK=> fatload mmc 0:1 ${loadaddr} desk-mx6-l-4.0.0_mx6qdldesk_u-boot.img569864 bytes read in 45 ms (12.1 MiB/s)=> mmc dev 2
switch to partitions #0, OK
mmc2(part 0) is current device (eMMC)
=> run mmc_update_uboot
switch to partitions #0, OK
mmc2 is current device (eMMC)
MMC write: dev # 2, block # 2138, count 1313 1114 ... 1313 1114 blocks written: OK
=>
</pre>
====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 sdvxdesk-1mx6-l-4.0.1_lite_uImage0_mx6qdldesk_uImage=> setenv fdtfile sdvxdesk-mx6-l-14.0.1_lite_imx6dl0_mx6qdldesk_imx6dl-sdv03sbcx-cb002acb0012.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_guideDESK-MX6-L/General/Booting_from_NFS |Quick start guideBooting from nfs]]wiki page.* 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@sdvx-liteimx6qdlxelk:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00800000 00200000 00020000 "nand-SPL"mtd1: 00600000 00020000 "nand-uboot"mtd1mtd2: 00100000 00020000 "nand-env1"mtd2mtd3: 00100000 00020000 "nand-env2"mtd3mtd4: 00100000 00020000 "nand-fdt"mtd4mtd5: 00100000 00020000 "nand-spare"mtd5mtd6: 00800000 00020000 "nand-kernel"mtd6mtd7: 00600000 00400000 00020000 "nand-splash"mtd7mtd8: 3e600000 1e800000 00020000 "nand-ubi"root@sdvx-liteimx6qdlxelk:~#
</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}}
* Format and initialize ''nand-ubi'' partition, which in our case is <code>mtd7mtd8</code>, using [[Memory Tecnology Device (MTD)#UBI|UBI]] with:
<pre>
ubiformat /dev/mtd7mtd8ubiattach -m 78
ubimkvol /dev/ubi0 -N rootfs -m
</pre>
<pre class="workstation-terminal">
root@sdvxdesk-litemx6:~# ubiformat /dev/mtd7mtd8ubiformat: mtd7 mtd8 (nand), size 1048576000 bytes (1000.0 MiB), 8000 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 byteslibscan: scanning eraseblock 7999 -- 100 % complete ubiformat: 8000 eraseblocks have valid erase counter, mean value is 1116ubiformat: formatting eraseblock 7999 -- 100 % complete root@sdvxdesk-litemx6:~# ubiattach -m 78[ 1714 201.823600648474] UBIubi0: attaching mtd7 to ubi0mtd8[ 1726 203.415587638158] UBIubi0: scanning is finished[ 1726 203.483765658702] UBIubi0: attached mtd7 mtd8 (name "nand-ubi", size 1000 MiB) to ubi0[ 1726 203.491062664827] UBIubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes[ 1726 203.498301672513] UBIubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048[ 1726 203.505030679330] UBIubi0: VID header offset: 2048 (aligned 2048), data offset: 4096[ 1726 203.512430687928] UBIubi0: good PEBs: 8000, bad PEBs: 0, corrupted PEBs: 0[ 1726 203.518861694456] UBIubi0: user volume: 0, internal volumes: 1, max. volumes count: 128[ 1726 203.526025702103] UBIubi0: max/mean erase counter: 3121/2117, WL threshold: 4096, image sequence number: 623070258493697587[ 1726 203.535433711974] UBIubi0: available PEBs: 7836, total reserved PEBs: 164, PEBs reserved for bad PEB handling: 160[ 1726 203.545260721987] UBIubi0: background thread "ubi_bgt0d" started, PID 714635UBI 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@sdvxdesk-litemx6:~# 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@sdvxdesk-litemx6:~# mkdir -p /mnt/nandroot@sdvxdesk-litemx6:~# mount -t ubifs ubi0_0 /mnt/nand[ 1810 226.301461375941] UBIFS(ubi0:0): default file-system created[ 1810 226.381545] UBIFS (ubi0:0): Mounting in unauthenticated mode[ 226.308952387403] UBIFS(ubi0:0): background thread "ubifs_bgt0_0" started, PID 717641[ 1810 226.452274421704] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"[ 1810 226.459421429128] UBIFS(ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes[ 1810 226.469398440000] UBIFS(ubi0:0): FS size: 992698368 bytes (946 MiB, 7818 LEBs), max 7836 LEBs, journal size 33521664 bytes (31 MiB, 264 LEBs)[ 1810 226.480976452510] UBIFS(ubi0:0): reserved for root: 4952683 bytes (4836 KiB)[ 1810 226.487210459239] UBIFS(ubi0:0): media format: w4w5/r0 (latest is w4w5/r0), UUID 99D0F3C62AC18D3A-5955E457-4B3047E0-9E2D9BD1-72202281BD3078A7C3483B73, small LPT model
</pre>
<pre>
tar xvjf sdvxdave-1.0.1_imageimage-devel-sdvxdesk-litemx6.tar.bz2 -C /mnt/nand
</pre>
<pre>
umount /mnt/nand/
ubidetach -m 78
</pre>
<pre class="workstation-terminal">
root@sdvxdesk-litemx6:~# umount /mnt/nand/[ 2446 238.743091072434] UBIFS(ubi0:0): un-mount UBI device 0, volume 0[ 2446 238.749670077232] UBIFS(ubi0:0): background thread "ubifs_bgt0_0" stopsroot@sdvxdesk-litemx6:~# ubidetach -m 78[ 2450 240.738153786549] UBIubi0: detaching mtd7 from ubi0mtd8[ 2450 240.759527798612] UBIubi0: mtd7 mtd8 is detached from ubi0
</pre>
<pre>
nand_args=setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw ubi.mtd=78
</pre>
=== Program root file system into eMMC flash ===
* Boot the system via SD or NFS as described in the e [[(<KIT>)#Quick_start_guideDESK-MX6-L/General/Booting_from_NFS |Quick start guideBooting from nfs]]wiki page
* 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@sdvxdesk-litemx6:~# ./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@sdvx-lite:~#
</pre>
<pre class="workstation-terminal">
root@sdvxdesk-litemx6:~# mount /dev/mmcblk2p1 /mnt/emmc
[ 40.988575] FAT-fs (mmcblk2p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
root@sdvxdesk-litemx6:~# cd /mnt/emmcroot@sdvxdesk-litemx6:/mnt/emmc# cp /tftpboot/sdvxdesk-mx/linux/sdvxdesk-mx-14.0.10*dtb .root@sdvxdesk-litemx6:/mnt/emmc# cp /tftpboot/sdvxdesk-mx/linux/sdvxdesk-1mx-4.0.10*uImage .root@sdvxdesk-litemx6:/mnt/emmc# cp /tftpboot/sdvxdesk-mx/linux/splash_image.bmp .root@sdvxdesk-litemx6:/mnt/emmc# cdroot@sdvxdesk-litemx6:~# umount /mnt/emmc
</pre>
<pre class="workstation-terminal">
root@sdvxdesk-litemx6:~# mount /dev/mmcblk2p2 /mnt/emmc
[ 1810.899327] EXT4-fs (mmcblk2p2): mounted filesystem with ordered data mode. Opts: (null)
root@sdvxdesk-litemx6:~# cd /mnt/emmcroot@sdvxdesk-litemx6:/mnt/emmc#
</pre>
<pre>
tar xvjf sdvxdave-1.0.1_imageimage-devel-sdvxdesk-litemx6.tar.bz2-C /mnt/emmc
</pre>
<pre class="workstation-terminal">
root@sdvxdesk-litemx6:/mnt/emmc# cdroot@sdvxdesk-litemx6:~# umount /mnt/emmcroot@sdvxdesk-litemx6:~# 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">
</pre>
=== U-Boot parameters for root file system device ===
Once booted, the kernel looks for a device where reading and starting the root file system. See more information in the [https://man7.org/linux/man-pages/man7/bootparam.7.html man pages].
 
Here below some examples and configuration used in the DAVE's U-Boot environment:
 
==== rfs in NAND ====
The root file system can be programmed into an UBI formatted partition and, for example, the nandargs parameters can be used. The following rows show the standard DAVE's NAND partitioning:<pre class="workstation-terminal">
...
...
[ 3.859646] 9 cmdlinepart partitions found on MTD device gpmi-nand
[ 3.865861] Creating 9 MTD partitions on "gpmi-nand":
[ 3.870924] 0x000000000000-0x000000200000 : "nand-SPL"
[ 3.885045] 0x000000200000-0x000000800000 : "nand-uboot"
[ 3.895099] 0x000000800000-0x000000900000 : "nand-env1"
[ 3.905059] 0x000000900000-0x000000a00000 : "nand-env2"
[ 3.915071] 0x000000a00000-0x000000b00000 : "nand-fdt"
[ 3.925049] 0x000000b00000-0x000000c00000 : "nand-spare"
[ 3.935124] 0x000000c00000-0x000001400000 : "nand-kernel"
[ 3.945057] 0x000001400000-0x000001800000 : "nand-splash"
[ 3.955104] 0x000001800000-0x000040000000 : "nand-ubi"
...
...
</pre>and then the corresponding U-Boot parameter for using the <code>/dev/mtd8</code> device:
 
<code>'''nandargs'''=setenv bootargs ubi.mtd=8 root=ubi0_0 rootfstype=ubifs rw</code>
 
In this configuration, the kernel attachs the UBI partition, mount the UBIFS file system and starts it:<pre class="workstation-terminal">
...
...
[ 5.559821] ubi0: attaching mtd8
[ 7.990342] ubi0: scanning is finished
[ 8.021500] ubi0: attached mtd8 (name "nand-ubi", size 1000 MiB)
[ 8.027595] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 8.034504] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 8.041299] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 8.048291] ubi0: good PEBs: 8000, bad PEBs: 0, corrupted PEBs: 0
[ 8.054414] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[ 8.061644] ubi0: max/mean erase counter: 63/52, WL threshold: 4096, image sequence number: 819217695
[ 8.070886] ubi0: available PEBs: 0, total reserved PEBs: 8000, PEBs reserved for bad PEB handling: 160
[ 8.080359] ubi0: background thread "ubi_bgt0d" started, PID 157
[ 8.164282] UBIFS (ubi0:0): Mounting in unauthenticated mode
[ 8.170156] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 163
[ 8.210063] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[ 8.217549] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 8.227505] UBIFS (ubi0:0): FS size: 992698368 bytes (946 MiB, 7818 LEBs), journal size 33521664 bytes (31 MiB, 264 LEBs)
[ 8.238514] UBIFS (ubi0:0): reserved for root: 4952683 bytes (4836 KiB)
[ 8.245169] UBIFS (ubi0:0): media format: w5/r0 (latest is w5/r0), UUID BEC33049-213B-4D02-A9CE-5F0D7EB5DAA8, small LPT model
[ 8.257174] VFS: Mounted root (ubifs filesystem) on device 0:14.
...
...
</pre>
 
==== rfs in SD card ====
The root file system can be programmed into an SD card partition and, for example, the mmcargs parameters can be used. The following row in an example to use an SD card with two partition:<pre class="workstation-terminal">
...
...
[ 5.061660] mmc0: new high speed SDHC card at address aaaa
[ 5.071528] mmcblk0: mmc0:aaaa SC16G 14.8 GiB
[ 5.071528] mmcblk0: mmc0:aaaa SC16G 14.8 GiB
[ 5.088454] mmcblk0: p1 p2
...
...
</pre>and then the corresponding U-Boot parameters for using the <code>/dev/mmcblk0p2</code> partition (which is typically the second ext4 formatted SD partition):
 
<code>'''mmcargs'''=setenv bootargs root=${mmcroot}</code>
 
<code>'''mmcroot'''=/dev/mmcblk0p2 rootwait rw</code>
 
In this configuration the kernel mounts the root file system correctly in this way:<pre class="workstation-terminal">
...
...
[ 5.681176] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 5.689678] VFS: Mounted root (ext3 filesystem) on device 179:2.
[ 5.707149] devtmpfs: mounted
[ 5.713124] Freeing unused kernel memory: 1024K
...
...
</pre>
----
[[Category:AXEL Lite]]
8,221
edits