This shows you the differences between two versions of the page.
ass:laboratoare:02:tasks:03 [2023/07/17 18:51] radu.mantu created |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 03. [??p] Booting Linux from the FIT image ==== | ||
- | |||
- | <note important> | ||
- | There is a possibility that loading your FIP with the TechNexion fork of **uuu** will not work. If so, use the mainline **uuu** (that you've been using in the previous session) for booting your system and the fork from the previous task for flashing the eMMC. | ||
- | </note> | ||
- | |||
- | == Step 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> | ||
- | |||
- | == Step 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. 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. | ||
- | |||
- | <note tip> | ||
- | If ''fatls'' listed the contents of a FAT partition's directory, what can we use to load a file from said FAT partition? Seek ''help'' if in doubt. | ||
- | </note> | ||
- | |||
- | == Step 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 ''0x 8000 0000'' (i.e.: 2GB, 1GB offset in RAM): | ||
- | |||
- | <code> | ||
- | u-boot=> # mark 0x 8000 0000 as the starting address of a device tree | ||
- | u-boot=> fdt addr 0x80000000 | ||
- | |||
- | u-boot=> # show contents of specific nodes in the RAM-based DTB | ||
- | u-boot=> fdt list / | ||
- | / { | ||
- | timestamp = <0x64b55028>; | ||
- | description = "ASS - Linux FIT image for Pico Pi"; | ||
- | #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 to serial output. | ||
- | </note> | ||
- | |||
- | == Step 4: Boot Linux from the FIT image == | ||
- | |||
- | Use the ''bootm'' command, passing it the starting address of the FIT image. \\ | ||
- | And now things get interesting... | ||
- | |||