DESK-MX6UL-L/Deployment/Standalone boot

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes

2021/07/20

First DESK-MX6UL-L release

2022/03/16

DESK-MX6UL-L 3.0.0 release

2023/05/04

DESK-MX6UL-L 4.0.0 release
2025/12/17 DESK-MX6UL-L 6.0.0 release


Standalone boot[edit | edit source]

Introduction[edit | edit source]

This document was written and tested with the software/hardware combination described in the history table above. However, it contains general concepts that can be adapted on any DAVE Embedded Systems' Linux platform.


200px-Emblem-important.svg.png

The following programming examples are intended for laboratory usage or for preliminary deployment strategy.

A complete deployment strategy has to be carefully identifiyed taking into account the overall arguments like: boot speed, safe boot, recovery mechanisms, watchdog supervisor, etc.


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 two 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[edit | edit source]

U-Boot[edit | edit source]

Update to the latest U-Boot version allows usage of u-boot environment variables available.

=> run load_spl
Using ethernet@2188000 device
TFTP from server 192.168.0.125; our IP address is 192.168.0.90
Filename 'desk-mx6ul-l/SPL'.
Load address: 0x80800000
Loading: #############
         248 KiB/s
done
Bytes transferred = 64512 (fc00 hex)
=> run spi_update
  spi_update_spl spi_update_uboot spi_updatefdt spi_updatek spi_updatesplash
=> run spi_update_spl
SF: Detected is25lp128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
SF: 65536 bytes @ 0x0 Erased: OK
device 0 offset 0x400, size 0xfc00
SF: 64512 bytes @ 0x400 Written: OK
=> run load_uboot
Using ethernet@2188000 device
TFTP from server 192.168.0.125; our IP address is 192.168.0.90
Filename 'desk-mx6ul-l/u-boot.img'.
Load address: 0x80800000
Loading: #################################################################
         #################################################################
         ##########################
         268.6 KiB/s
done
Bytes transferred = 794660 (c2024 hex)
=> run spi_update_uboot
SF: Detected is25lp128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
SF: 851968 bytes @ 0x10000 Erased: OK
device 0 offset 0x10000, size 0xc2024
SF: 794660 bytes @ 0x10000 Written: OK
=>

kernel image and device tree[edit | edit source]

We assume that the environment variables in U-Boot are properly configured:

env default spi_loadk
env default spi_loadfdt
env default spi_updatek
env default spi_updatefdt
env default spi_nand
saveenv
  • Update the bootfile and fdtfile 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
sf probe; run loadk spi_updatek loadfdt spi_updatefdt

E.g.:

=> run loadk spi_updatek loadfdt spi_updatefdt
Using ethernet@2188000 device
TFTP from server 192.168.0.125; our IP address is 192.168.0.90
Filename 'desk-mx6ul-l/uImage'.
Load address: 0x80800000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################
         267.6 KiB/s
done
Bytes transferred = 10401080 (9eb538 hex)
SF: 11534336 bytes @ 0x200000 Erased: OK
device 0 offset 0x200000, size 0x9eb538
SF: 10401080 bytes @ 0x200000 Written: OK
Using ethernet@2188000 device
TFTP from server 192.168.0.125; our IP address is 192.168.0.90
Filename 'desk-mx6ul-l/imx6ul-axelulite-cb003a.dtb'.
Load address: 0x83000000
Loading: #######
         209 KiB/s
done
Bytes transferred = 32964 (80c4 hex)
SF: 524288 bytes @ 0x180000 Erased: OK
device 0 offset 0x180000, size 0x80c4
SF: 32964 bytes @ 0x180000 Written: OK
=>

then save the new boot configuration from SPI:

=> setenv bootcmd run spi_nand
=> saveenv

Program root file system into NAND flash[edit | edit source]

  • boot the system via SD or NFS as described in the Booting from NFS
  • 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 MTD partitions can be dumped with /proc/mtd (the partition's name should be self-explanatory)
root@desk-mx6ul-axelulite:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00200000 00080000 "nand-SPL"
mtd1: 00600000 00080000 "nand-uboot"
mtd2: 00100000 00080000 "nand-env1"
mtd3: 00100000 00080000 "nand-env2"
mtd4: 00100000 00080000 "nand-fdt"
mtd5: 00100000 00080000 "nand-spare"
mtd6: 00c00000 00080000 "nand-kernel"
mtd7: 00400000 00080000 "nand-splash"
mtd8: 7e400000 00080000 "nand-ubi"
mtd9: 00010000 00010000 "spi-SPL"
mtd10: 000f0000 00010000 "spi-uboot"
mtd11: 00040000 00010000 "spi-env1"
mtd12: 00040000 00010000 "spi-env2"
mtd13: 00080000 00010000 "spi-dtb"
mtd14: 00b00000 00010000 "spi-kernel"
mtd15: 00200000 00010000 "spi-splash"
mtd16: 00100000 00010000 "spi-free"
root@desk-mx6ul-axelulite:~#


200px-Emblem-important.svg.png

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 /proc/mtd to match your specific layout


  • Format and initialize nand-ubi partition, which in our case is mtd8, using UBI with:
ubiformat /dev/mtd8
ubiattach -m 8
ubimkvol /dev/ubi0 -N rootfs -m

E.g.

root@desk-mx6ul-axelulite:~# ubiformat /dev/mtd8
ubiformat: mtd8 (nand), size 109051904 bytes (104.0 MiB), 832 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 831 -- 100 % complete  
ubiformat: 832 eraseblocks have valid erase counter, mean value is 39
ubiformat: formatting eraseblock 831 -- 100 % complete  
root@desk-mx6ul-axelulite:~# ubiattach -m 8
UBI device number 0, total 832 LEBs (105644032 bytes, 100.7 MiB), available 808 LEBs (102596608 bytes, 97.8 MiB), LEB size 126976 bytes (124.0 KiB)
root@desk-mx6ul-axelulite:~# ubimkvol /dev/ubi0 -N rootfs -m
Set volume size to 102596608
Volume ID 0, size 808 LEBs (102596608 bytes, 97.8 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs", alignment 1
  • Now mount the UBI volume using UBIFS in a temporary directory
mkdir -p /mnt/nand
mount -t ubifs ubi0_0 /mnt/nand

E.g.:

root@desk-mx6ul-axelulite:~# mkdir -p /mnt/nand
root@desk-mx6ul-axelulite:~# mount -t ubifs ubi0_0 /mnt/nand/
root@desk-mx6ul-axelulite:~# dmesg | tail -n 7
[   86.268589] UBIFS (ubi0:0): Mounting in unauthenticated mode
[   86.272276] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 276
[   86.302293] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[   86.302349] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[   86.302377] UBIFS (ubi0:0): FS size: 101199872 bytes (96 MiB, 797 LEBs), max 808 LEBs, journal size 5079040 bytes (4 MiB, 40 LEBs)
[   86.302411] UBIFS (ubi0:0): reserved for root: 4779919 bytes (4667 KiB)
[   86.302431] UBIFS (ubi0:0): media format: w5/r0 (latest is w5/r0), UUID 36C676F6-9160-4334-B687-9CEE57A30FEF, small LPT model
  • you can now extract the root file system into that directory
tar xvjf dave-image-minimal-desk-mx6ul-axelulite-fsl-imx-fb.tar.bz2 -C /mnt/nand/
  • finally, you need to cleanly umount and detach the MTD partition
umount /mnt/nand/
ubidetach -m 8

E.g.

root@desk-mx6ul-axelulite:~# umount /mnt/nand/
root@desk-mx6ul-axelulite:~# ubidetach -m 8
root@desk-mx6ul-axelulite:~# dmesg | tail -n 4
[  105.493236] UBIFS (ubi0:0): un-mount UBI device 0
[  105.493401] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" stops
[  109.963440] ubi0: detaching mtd8
[  109.971275] ubi0: mtd8 is detached

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

nandargs=setenv bootargs ubi.mtd=8 root=ubi0_0 rootfstype=ubifs rw