Changes

Jump to: navigation, search

Standalone boot (XELK)

1,721 bytes added, 11:52, 30 August 2019
no edit summary
!Notes
|-
|{{oldid|7256|2.3.1}}
|June 2017
|[[Axel_Embedded_Linux_Kit_(XELK)#XELK_2.3.1|XELK 2.3.1]]
|
|-
|{{oldid|7341|3.0.01}}
|Nov 2017
|[[Axel_Embedded_Linux_Kit_(XELK)#XELK_3.0.0|XELK 3.0.1]]|XELK 3.0.1||-|4.0.0|Aug 2019|[[Axel_Embedded_Linux_Kit_(XELK)#XELK_4.0.0|XELK 4.0.0]]|XELK 34.0.0
|
|-
== Introduction ==
This document has been written and tested with the software/hardware combination described in the history table above. However it contains general concept that can be adapted on any DAVE Embedded Systems' Linux platformusing the SPL.
We'll explain how to program and configure a [[Category: AxelLite|Axel Lite]] to boot in standalone mode, without the need of a system microSD card or a NFS server, with two options:
* booting with NOR + NAND
** U-Boot will fetch Linux kernel binary images (kernel + device tree) from on-board NOR flash memory, while later the OS will mount the root file system from a NAND partition.
== Update u-boot ==
Update In order to support the latest u-boot version allows usage of u-boot environment SPL, new additional uboot variables availablehave been introduced.
<pre class="board-terminal">
U=> print load_spl load_uboot spi_update_spl spi_update_ubootload_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 boot on NOR SPI ===Uboot can be flashed into NOR following the example below. Firstly, the SPL is fetched from the tftpserver and then it is flashed into the NOR SPL partition. Lastly, the same operation is performed for the uboot image.<pre>=> run loadload_spl
Using FEC device
TFTP from server 192.168.0.1389; our IP address is 192.168.0.9883Filename 'axel/uxelk-boot4.0.0_mx6qdlaxel_spi_SPL'.Load address: 0x12000000Loading: ############ 335 KiB/sdoneBytes transferred = 56320 (dc00 hex)=> run spi_update_spl SF: 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 deviceTFTP from server 192.168.0.89; our IP address is 192.168.0.83Filename 'axel/xelk-24.30.4_mx6qaxel_spi_u0_mx6qdlaxel_spi_u-boot.imximg'.
Load address: 0x12000000
Loading: #################################################################
############################################## 1.5 2 MiB/s
done
Bytes transferred = 566184 493272 (8a3a8 786d8 hex)U-Boot => run spi_updatespi_update_uboot SF: Detected S25FL256S s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiBU-Boot ></pre> === u-boot on NOR SPI === Be sure the ''spi_update'' commands has enough erase and program size definedSF: 983040 bytes @ 0x10000 Erased:OK <pre>U-Boot > setenv spi_update 'sf probe; sf erase device 0 90000;sf write ${loadaddr} 400 90000'offset 0x10000, size 0x786d8</pre> Then update u-boot on NORSF<pre class="board-terminal">U-Boot > run spi_updateSF493272 bytes @ 0x10000 Written: Detected S25FL256S with page size 64 KiB, total 32 MiBU-Boot >OK
</pre>
=== u-boot on NAND ===
The SPL and u-boot image, must be flashed on NAND flash must be programmed using the NXP <code>kobs-ng</code> utility: this . 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 exampleThe following steps are therefore necessary:
* 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 XELK)
* copy the related u-boot imx image file ans SPL files on nfs /home/root (for example)* execute kobs-ng passing the parameters for flashing u-boot the SPL on NAND.* execute nandwrite to flash uboot image on NAND.
<pre class="board-terminal">
root@axel-liteimx6dlxelk:~# kobs-ng -x -v -w xelk-24.3.4_mx6dlaxel_nand_u-boot0.imx0_mx6qdlaxel_nand_SPL
MTD CONFIG:
chip_0_device_path = "/dev/mtd0"
data_sample_time = 6
row_address_size = 3
column_address_size column_a[ 171.755580] nand: nand_erase_nand: attempt to erase a bad block at page 0x00000000ddress_size = 2
read_command_code1 = 0
read_command_code2 = 48
.tmp_kobs_ng: verifying using key '00000000000000000000000000000000'
.tmp_kobs_ng: is a valid bootstream for key '00000000000000000000000000000000'
mtd: use new bch layout raw access mode
mtd: opening: "/dev/mtd0"
NFC geometry :
ECC Strength : 82 Page Size in Bytes : 21122071
Metadata size : 10
ECC Chunk Size in byte : 512
ECC Chunk count : 4
Block Mark Byte Offset : 19992028 Block Mark Bit Offset : 02
====================================================
mtd: opened '/dev/mtd0' - '(null)'
mtd: max_boot_stream_size_in_bytes = 3670016524288mtd: boot_stream_size_in_bytes = 56412849152mtd: boot_stream_size_in_pages = 27624mtd: #1 0x00100000 - 0x00480000 0x00180000 (0x00189ba00x0010c000)mtd: #2 0x00480000 0x00180000 - 0x00800000 0x00200000 (0x00509ba00x0018c000)
FCB
m_u32Checksum = 0x00000000
m_u32TotalInternalDie = 0
m_u32CellType = 0
m_u32EccBlockNEccType = 41
m_u32EccBlock0Size = 512
m_u32EccBlockNSize = 512
m_u32EccBlock0EccType = 41
m_u32MetadataBytes = 10
m_u32NumEccBlocksPerPage = 3
m_u32EraseThreshold = 0
m_u32Firmware1_startingPage = 512
m_u32Firmware2_startingPage = 2304768 m_u32PagesInFirmware1 = 27624 m_u32PagesInFirmware2 = 27624
m_u32DBBTSearchAreaStartAddress = 256
m_u32BadBlockMarkerByte = 19992028 m_u32BadBlockMarkerStartBit = 02
m_u32BBMarkerPhysicalOffset = 2048
m_u32BCHType = 0
m_NANDTMTiming.m_u32TMTiming1_BusyTimeout = 0
m_u32DISBBM = 0
m_u32BBMarkerPhysicalOffsetInSpareData = 0
DBBT
m_u32Checksum = 0x00000000
m_u32Version = 0x01000000
m_u32DBBTNumOfPages = 0
Firmware: image #0 @ 0x100000 size 0x8a000 0xc000 - available 0x3800000x80000Firmware: image #1 @ 0x480000 0x180000 size 0x8a000 0xc000 - available 0x3800000x80000
-------------- Start to write the [ FCB ] -----
mtd: erasing @0:0x0-0x20000
mtd: Writing FCB0 [ @device 0fails MEMERASE (0x0 - 0x20000)mtd:Failed to erase block @0x0 ] (840) *
mtd: erasing @0:0x20000-0x40000
mtd: Writing FCB1 [ @0:0x20000 ] (840) *
mtd: erasing @0:0x60000-0x80000
mtd: Writing FCB3 [ @0:0x60000 ] (840) *
mtd_commit_bcb(FCB): status 01
-------------- Start to write the [ DBBT ] -----
---------- Start to write the [ .tmp_kobs_ng ]----
mtd: Writting .tmp_kobs_ng: #0 @0: 0x00100000 - 0x0018a0000x0010c000
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 -0x1800000x0018c000
mtd: erasing @0:0x180000-0x1a0000
mtd: The last page is not full : 928
mtd: We write one page for save guard. *
mtd: Writting .tmp_kobs_ngroot@imx6qxelk: ~#1 @flash_erase /dev/mtd1 0 0: 0x00480000 - 0x0050a000mtd: erasing Erasing 128 Kibyte @0:0x4800005e0000 --0x4a0000100 % complete mtd: erasing root@0imx6dlxelk:0x4a0000~# nandwrite -0x4c0000mtd: erasing @0:0x4c0000p /dev/mtd1 xelk-0x4e0000mtd: erasing @4.0:0x4e0000.0_mx6qdlaxel_nand_u-0x500000boot.imgmtd: erasing @Writing data to block 0:0x500000-0x520000at offset 0x0mtd: The last page is not full : 928Writing data to block 1 at offset 0x20000mtd: We write one page for save guard. *Writing data to block 2 at offset 0x40000root@axel-lite:~#Writing data to block 3 at offset 0x60000
</pre>
 
For more details, please refer to [[Booting_from_NAND_flash_on_i.MX6-based_platforms|this page]].
* Boot the system via SD or NFS as described into the [[XELK_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)
 
<pre class="board-terminal">
root@axel-liteimx6dlxelk:~# 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: 00400000 00020000 "nand-splash"mtd7mtd8: 1e800000 00020000 "nand-ubi"mtd8mtd9: 00010000 00010000 "spi-SPL"mtd10: 00100000 000f0000 00010000 "spi-uboot"mtd9mtd11: 00040000 00010000 "spi-env1"mtd10mtd12: 00040000 00010000 "spi-env2"mtd11mtd13: 00080000 00010000 "spi-dtb"mtd12mtd14: 00600000 00800000 00010000 "spi-kernel"mtd13mtd15: 00400000 00010000 "spi-splash"mtd14mtd16: 01400000 01200000 00010000 "spi-free"root@axel-lite:~#
</pre>
* 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="board-terminal">
root@axel-lite:~# ubiformat /dev/mtd7mtd8ubiformat: mtd7 mtd8 (nand), size 511705088 bytes (488.0 MiB), 3904 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 3903 -- 100 % complete
ubiformat: 3904 eraseblocks have valid erase counter, mean value is 31
ubiformat: formatting eraseblock 3903 -- 100 % complete
root@axel-lite:~# ubiattach -m 78[ 517.999286] UBI: attaching mtd7 mtd8 to ubi0
[ 524.468201] UBI: scanning is finished
[ 524.498833] UBI: attached mtd7 mtd8 (name "nand-ubi", size 488 MiB) to ubi0
[ 524.505476] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 524.512290] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
<pre>
tar xvjf xelk-24.20.0_axel-fsl-image-qt5-xelk-l.tar.bz2 -C /mnt/nand
</pre>
<pre>
umount /mnt/nand/
ubidetach -m 78
</pre>
[ 575.115560] UBIFS: un-mount UBI device 0, volume 0
[ 575.120424] UBIFS: background thread "ubifs_bgt0_0" stops
root@axel-lite:~# ubidetach -m 78[ 575.171074] UBI: detaching mtd7 mtd8 from ubi0[ 575.182401] UBI: mtd7 mtd8 is detached from ubi0
root@axel-lite:~#
</pre>
<pre>
nand_args=setenv bootargs ubi.mtd=7 8 root=ubi0_0 rootfstype=ubifs rw
</pre>
 
'''Note:''' In Xelk-3.0.0 ''nand_args'' has been replaced by nandargs
== Program boot images ==
<pre class="board-terminal">
U-Boot => sf probe; run loadk spi_updatek loadfdt spi_updatefdtSF: 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.1389; our IP address is 192.168.0.9883Filename 'axel/linux/xelk-24.30.1_uImage0_uImage'.
Load address: 0x12000000
Loading: #################################################################
#################################################################
#################################################################
################################################################# ################################################################# ################################################################# ### 1.6 3 MiB/s
done
Bytes transferred = 5887704 6668104 (59d6d8 65bf48 hex)SF: 8388608 bytes @ 0x200000 Erased: OKdevice 0 offset 0x200000, size 0x65bf48SF: 6668104 bytes @ 0x200000 Written: OK
Using FEC device
TFTP from server 192.168.0.1389; our IP address is 192.168.0.9883Filename 'axel/linux/xelk-24.30.1_imx6q-xelk0_imx6q-lsbcx-2.0.0cb0012.dtbdtb_wl'.
Load address: 0x18000000
Loading: ########### 1604.2 MiB5 KiB/s
done
Bytes transferred = 46326 51400 (b4f6 c8c8 hex)U-Boot >SF: 524288 bytes @ 0x180000 Erased: OKdevice 0 offset 0x180000, size 0xc8c8SF: 51400 bytes @ 0x180000 Written: OK </pre>
<pre class="board-terminal">
U-Boot => setenv bootcmd run spi_nandU-Boot => saveenv
</pre>
<pre>
=> print nand_updatek nand_updatefdt nand_loadk nand_loadfdt nand_nand
nand_updatek=nand erase.part nand-kernel; nand write ${loadaddr} nand-kernel ${filesize}
nand_updatefdt=nand erase.part nand-fdt; nand write ${fdtaddr} nand-fdt ${filesize}
 
nand_loadk=nand read ${loadaddr} nand-kernel
nand_loadfdt=nand read ${fdtaddr} nand-fdt
<pre class="board-terminal">
U-Boot => run loadk nand_updatek loadfdt nand_updatefdt
Using FEC device
TFTP from server 192.168.0.1389; our IP address is 192.168.0.9883Filename 'axel/linux/xelk-24.30.1_uImage0_uImage'.
Load address: 0x12000000
Loading: #################################################################
#################################################################
#################################################################
################################################################# ################################################################# ################################################################# ### 1.6 2 MiB/s
done
Bytes transferred = 5887704 6668104 (59d6d8 65bf48 hex)
NAND erase.part: device 0 offset 0xc00000, size 0x800000
size adjusted to 0x7e0000 (1 bad blocks)Skipping bad block at 0x00d600000x00d00000 Erasing at 0x13c0000 0x13e0000 -- 100% complete.
OK
NAND write: device 0 offset 0xc00000, size 0x59d6d80x65bf48Skip bad block 0x00d600000x00d00000 5887704 6668104 bytes written: OK
Using FEC device
TFTP from server 192.168.0.1389; our IP address is 192.168.0.9883Filename 'axel/linux/xelk-24.30.1_imx6q-xelk0_imx6q-lsbcx-2.0.0cb0012.dtb'.
Load address: 0x18000000
Loading: ########### 1726.3 MiB6 KiB/s
done
Bytes transferred = 46326 51400 (b4f6 c8c8 hex)
NAND erase.part: device 0 offset 0xa00000, size 0x100000
OK
NAND write: device 0 offset 0xa00000, size 0xb4f60xc8c8 46326 51400 bytes written: OKU-Boot =>
</pre>
<pre class="board-terminal">
U-Boot => setenv bootcmd run nand_nandU-Boot => saveenv
</pre>
8,154
edits

Navigation menu