Changes

Jump to: navigation, search

DESK-MX6-L/Deployment/Standalone boot

2,437 bytes added, 09:02, 12 October 2020
Standalone boot
=== Program boot images into NOR flash ===
 
It is supposed tat the proper filenames are configured on u-boot variables. In the following examples, we use the boot images:
 
<pre>
spl=desk-mx-l/SPL
ubootimg=desk-mx-l/u-boot.img
bootfile=desk-mx-l/uImage
fdtfile=desk-mx-l/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====
<pre class="workstation-terminal">
=> run loadload_spl
Using FEC device
TFTP from server 192.168.0.13125; our IP address is 192.168.0.90Filename 'sdvxdesk-mx-l/u-bootSPL'.Load address: 0x12000000Loading: ############ 560.5 KiB/sdvx-1sdoneBytes 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_ubootUsing FEC deviceTFTP from server 192.168.0.125; our IP address is 192.168.0.0_mx6dl_sfczg_spi_u90Filename 'desk-mx-l/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>
<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 'sdvx/linuxdesk-mx-l/sdvx-1.0.0_lite_uImageuImage'.
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 'sdvx/linuxdesk-mx-l/sdvx-1.0.0_lite_imx6dlimx6q-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>
====u-Boot====
u-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 u-boot image on NAND storing all information needed by bootrom to identify the NAND as a boot device.
Here below an example:
* uses a rfs with <b>kobs-ng</b> utility available on it (e.g. DAVE's rfs provided with <KIT>)
* copy the related u-boot imx image file on nfs /home/root (for example)
* execute ''kobs-ng '' passing the parameters for flashing u-boot on NAND* erase and program the second stage using ''flash_erase'' and ''nandwrite''
<pre class="workstation-terminal">
root@imx6qxelkimx6qdlxelk:~# kobs-ng -x -v -w sdvxdesk-mx-1.0.0_mx6dl_sfczg_nand_u-boot.imx0_mx6qdlaxel_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@imx6qdlxelk: ~#1 @flash_erase /dev/mtd1 0 0: 0x00480000 - 0x00524800mtd: erasing Erasing 128 Kibyte @0:0x4800005e0000 --0x4a0000100 % completemtd: erasing root@0imx6qdlxelk:0x4a0000~# nandwrite -0x4c0000mtd: erasing @p /dev/mtd1 desk-mx-1.0:0x4c0000.0_mx6qdlaxel_nand_u-0x4e0000boot.imgmtd: erasing @Writing data to block 0:0x4e0000-0x500000at offset 0x0mtd: erasing @0:0x500000-0x520000Writing data to block 1 at offset 0x20000mtd: erasing @0:0x520000-0x540000Writing data to block 2 at offset 0x40000mtd: The last page is not full : 1068Writing data to block 3 at offset 0x60000mtd: We write one page for save guard. *Writing data to block 4 at offset 0x80000root@imx6qxelkimx6qdlxelk:~#
</pre>
U-Boot > run loadk nand_updatek loadfdt nand_updatefdt
Using FEC device
TFTP from server 192.168.0.13; our IP address is 192.168.0.98Filename 'sdvx/linuxdesk-mx-l/sdvx-1.0.0_lite_uImageuImage'.
Load address: 0x12000000
Loading: #################################################################
#################################################################
#################################################################
################################################################# ################################################################# ######### 1.4 2 MiB/s
done
Bytes transferred = 6437016 7031520 (623898 6b4ae0 hex)
NAND erase.part: device 0 offset 0xc00000, size 0x800000
OK
NAND write: device 0 offset 0xc00000, size 0x6238980x6b4ae0 6437016 7031520 bytes written: OK
Using FEC device
TFTP from server 192.168.0.13; our IP address is 192.168.0.8990Filename 'sdvx/linuxdesk-mx-l/sdvx-1.0.0_lite_imx6dlimx6q-sfczgsbcx-cb0043cb0012.dtb'.
Load address: 0x18000000
Loading: ########### 525564.4 5 KiB/s
done
Bytes transferred = 42547 53760 (a633 d200 hex)
NAND erase.part: device 0 offset 0xa00000, size 0x100000
OK
NAND write: device 0 offset 0xa00000, size 0xa6330xd200 42547 53760 bytes written: OK
=>
</pre>
<pre class="workstation-terminal">
=> run loadload_spl
Using FEC device
TFTP from server 192.168.0.13125; our IP address is 192.168.0.8990Filename 'sdvx/udesk-mx-bootl/sdvx-1.0.0_mx6dl_sfczg_u-boot.imxSPL'.
Load address: 0x12000000
Loading: ################################################################# ################################################################# ## 1560.5 MiBKiB/s
done
Bytes transferred = 671788 56320 (a402c dc00 hex)=> run mmc_updatemmc_update_spl
switch to partitions #0, OK
mmc2(part 0) is current device (eMMC)
MMC write: dev # 2, block # 2, count 1313 ... 1313 blocks written: OK
=> run load_uboot
Using FEC device
TFTP from server 192.168.0.125; our IP address is 192.168.0.90
Filename 'desk-mx-l/u-boot.img'.
Load address: 0x12000000
Loading: #################################################################
###############################################
1009.8 KiB/s
done
Bytes transferred = 569864 (8b208 hex)
=> run mmc_update_uboot
switch to partitions #0, OK
mmc2 is current device (SD)
 
MMC write: dev # 0, block # 138, count 1114 ... 1114 blocks written: OK
=>
</pre>
<pre class="workstation-terminal">
Hit ENTER within 1 seconds to stop autoboot
=> fatload mmc 0:1 ${loadaddr} sdvx-1.0.1_mx6dlaxel_u-boot.imxreading sdvx-1.0.1_mx6dlaxel_u-boot.imxSPL671788 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 (SD) MMC write: dev # 2, block # 2, count 111 ... 111 blocks written: OK=> fatload mmc 0:1 ${loadaddr} 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 (SD)
MMC write: dev # 2, block # 2138, count 1313 1114 ... 1313 1114 blocks written: OK
=>
</pre>
<pre class="workstation-terminal">
=> setenv normalboot mmcboot
=> setenv bootfile sdvx-1.0.1_lite_uImageuImage=> setenv fdtfile sdvx-1.0.1_lite_imx6dlimx6dl-sdv03sbcx-cb002acb0012.dtb
=> setenv splashfile splash_image.bmp
</pre>
* 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">
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>
<pre>
ubiformat /dev/mtd7mtd8ubiattach -m 78
ubimkvol /dev/ubi0 -N rootfs -m
</pre>
<pre class="workstation-terminal">
root@sdvx-liteimx6qdlxelk:~# 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 bytes
libscan: scanning eraseblock 7999 -- 100 % complete
ubiformat: 8000 eraseblocks have valid erase counter, mean value is 1
ubiformat: formatting eraseblock 7999 -- 100 % complete
root@sdvx-liteimx6qdlxelk:~# ubiattach -m 78[ 1714.823600] UBI: attaching mtd7 mtd8 to ubi0
[ 1726.415587] UBI: scanning is finished
[ 1726.483765] UBI: attached mtd7 mtd8 (name "nand-ubi", size 1000 MiB) to ubi0
[ 1726.491062] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 1726.498301] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 1726.545260] UBI: background thread "ubi_bgt0d" started, PID 714
UBI device number 0, total 8000 LEBs (1015808000 bytes, 968.8 MiB), available 7836 LEBs (994983936 bytes, 948.9 MiB), LEB size 126976 bytes (124.0 KiB)
root@sdvx-liteimx6qdlxelk:~# ubimkvol /dev/ubi0 -N rootfs -m
Set volume size to 994983936
Volume ID 0, size 7836 LEBs (994983936 bytes, 948.9 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs", alignment 1
<pre class="workstation-terminal">
root@sdvx-liteimx6qdlxelk:~# mkdir -p /mnt/nandroot@sdvx-liteimx6qdlxelk:~# 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
<pre>
tar xvjf sdvxaxel-1.0.1_imageimage-develqt5-sdvx-liteimx6qdlxelk.tar.tar.bz2 -C /mnt/nand
</pre>
<pre>
umount /mnt/nand/
ubidetach -m 78
</pre>
<pre class="workstation-terminal">
root@sdvx-liteimx6qdlxelk:~# umount /mnt/nand/
[ 2446.743091] UBIFS: un-mount UBI device 0, volume 0
[ 2446.749670] UBIFS: background thread "ubifs_bgt0_0" stops
root@sdvx-liteimx6qdlxelk:~# ubidetach -m 78[ 2450.738153] UBI: detaching mtd7 mtd8 from ubi0[ 2450.759527] UBI: mtd7 mtd8 is detached from ubi0
</pre>
<pre class="workstation-terminal">
root@sdvx-liteimx6qdlxelk:~# ./sdcard-partition.sh /dev/mmcblk2
SD total size: 3776KB
[ 1341.905014] mmcblk2: p1 p2
Writing superblocks and filesystem accounting information: done
root@sdvx-liteimx6qdlxelk:~#
</pre>
<pre class="workstation-terminal">
root@sdvx-liteimx6qdlxelk:~# mount /dev/mmcblk2p1 /mnt/emmc
[ 40.988575] FAT-fs (mmcblk2p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
root@sdvx-liteimx6qdlxelk:~# cd /mnt/emmcroot@sdvx-liteimx6qdlxelk:/mnt/emmc# cp /tftpboot/sdvxdesk-mx/linux/sdvxdesk-mx-1.0.10*dtb .root@sdvx-liteimx6qdlxelk:/mnt/emmc# cp /tftpboot/sdvxdesk-mx/linux/sdvxdesk-mx-1.0.10*uImage .root@sdvx-liteimx6qdlxelk:/mnt/emmc# cp /tftpboot/sdvxdesk-mx/linux/splash_image.bmp .root@sdvx-liteimx6qdlxelk:/mnt/emmc# cdroot@sdvx-liteimx6qdlxelk:~# umount /mnt/emmc
</pre>
<pre class="workstation-terminal">
root@sdvx-liteimx6qdlxelk:~# mount /dev/mmcblk2p2 /mnt/emmc
[ 1810.899327] EXT4-fs (mmcblk2p2): mounted filesystem with ordered data mode. Opts: (null)
root@sdvx-liteimx6qdlxelk:~# cd /mnt/emmcroot@sdvx-liteimx6qdlxelk:/mnt/emmc#
</pre>
<pre>
tar xvjf sdvxaxel-1.0.1_imageimage-develqt5-sdvx-liteimx6qdlxelk.tar.tar.bz2
</pre>
<pre class="workstation-terminal">
root@sdvx-liteimx6qdlxelk:/mnt/emmc# cdroot@sdvx-liteimx6qdlxelk:~# umount /mnt/emmcroot@sdvx-liteimx6qdlxelk:~# reboot
</pre>
8,221
edits

Navigation menu