This shows you the differences between two versions of the page.
— |
ass:labs-2025:02:tasks:03 [2025/08/05 13:07] (current) florin.stancu created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ==== 03. Booting Linux from the FIT image ==== | ||
+ | |||
+ | Start up your board. Use ''uuu'' to supply it with a valid firmware image package: | ||
+ | |||
+ | <code bash> | ||
+ | uuu -b spl flash.bin | ||
+ | </code> | ||
+ | |||
+ | Connect to the serial cable (the DEBUG one), then open a terminal (recall: ''/dev/ttyACM0'' on Linux -- usually!), e.g. using ''picocom'' (don't forget to set baudrate to ''115200''!) and power on the board via the USB-C cable! | ||
+ | |||
+ | === Task 3.1 List eMMC partition contents === | ||
+ | |||
+ | First things first: let's check if the flashing process was succesful. Reload your FIP using **uuu** and get back into the U-Boot shell. | ||
+ | |||
+ | <code> | ||
+ | u-boot=> # list MMC devices (or rather, the slots) | ||
+ | u-boot=> mmc list | ||
+ | FSL_SDHC: 0 (eMMC) | ||
+ | FSL_SDHC: 1 | ||
+ | |||
+ | u-boot=> # select MMC device 0 | ||
+ | u-boot=> mmc dev 0 | ||
+ | switch to partitions #0, OK | ||
+ | mmc0(part 0) is current device | ||
+ | |||
+ | u-boot=> # show partitions on currently selected MMC device | ||
+ | u-boot=> mmc part | ||
+ | |||
+ | Partition Map for MMC device 0 -- Partition Type: DOS | ||
+ | |||
+ | Part Start Sector Num Sectors UUID Type | ||
+ | 1 20480 184320 5a0f642d-01 83 | ||
+ | | ||
+ | u-boot=> # show contents of / directory on MMC device 0, partition 1 | ||
+ | u-boot=> # assuming that the partition in question is FAT | ||
+ | u-boot=> fatls mmc 0:1 | ||
+ | 72709475 linux.itb | ||
+ | |||
+ | 1 file(s), 0 dir(s) | ||
+ | </code> | ||
+ | |||
+ | === Task 3.2. Load the FIT image in RAM === | ||
+ | |||
+ | In order for U-Boot to parse the FIT image and extract its components at their respective ''load'' addresses, we first need to bring the entire FIT image in main memory (use the ''load'' or ''fatload'' command for this). Choose a load address where the FIT image will not overlap with any of the three components when unpacked, or with the relocated **bl33** code, e.g. ''>= %%0x90000000%%''. | ||
+ | |||
+ | <note tip> | ||
+ | Run ''help load'' for syntax. | ||
+ | </note> | ||
+ | |||
+ | === Task 3.3. Investigate contents of FIT image === | ||
+ | |||
+ | This step is optional, but gives us the chance to see how U-Boot can parse a DTB file and extract its information. In the following example we assume that you've loaded the FIT image at address ''%%0x81000000%%'' (i.e.: 64MB offset in DRAM): | ||
+ | |||
+ | <code> | ||
+ | u-boot=> # mark 0x80000000 as the starting address of a device tree | ||
+ | u-boot=> fdt addr 0x90000000 | ||
+ | |||
+ | u-boot=> # show contents of specific nodes in the RAM-based DTB | ||
+ | u-boot=> fdt list / | ||
+ | / { | ||
+ | timestamp = <0x64b55028>; | ||
+ | description = "Linux FIT image for FRDM iMX93"; | ||
+ | #address-cells = <0x00000001>; | ||
+ | images { | ||
+ | }; | ||
+ | configurations { | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | u-boot=> fdt list /configurations | ||
+ | configurations { | ||
+ | default = "normal-boot"; | ||
+ | normal-boot { | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | u-boot=> fdt list /configurations/normal-boot | ||
+ | normal-boot { | ||
+ | description = "Normal boot config"; | ||
+ | kernel = "kernel"; | ||
+ | fdt = "fdt"; | ||
+ | ramdisk = "initrd"; | ||
+ | }; | ||
+ | </code> | ||
+ | |||
+ | <note important> | ||
+ | Be careful **not to list the contents of specific image nodes**, such as ''/images/kernel''. The ''fdt list'' command will print out the entire ''data'' attribute, meaning it will dump the entire kernel image (several megabytes) to serial output, which would take a couple of hours!! | ||
+ | </note> | ||
+ | |||
+ | === Task 3.4. Boot Linux from the FIT image === | ||
+ | |||
+ | Use the ''bootm <loaded_fdt_address>'' command, passing it the starting address of the FIT image. | ||
+ | |||
+ | Linux should start displaying kernel messages! | ||