View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004897 | UBoot | U-Boot | public | 2021-10-05 09:10 | 2021-10-05 12:23 |
Reporter | derksen | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Target Version | fsimx8mm-Y2021.04 | Fixed in Version | fsimx8mm-Y2021.04 | ||
Summary | 0004897: fsimx8mm: When loading U-Boot, provide offset values from nboot-info | ||||
Description | fsimx8mm: When loading U-Boot, provide offset values from nboot-info When loading U-Boot, the common SPL infrastructure uses fix offsets for NAND and MMC that are defined in the board configuration, like CONFIG_SYS_NAND_U_BOOT_OFFS or CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR. However we define these values in the nboot-args structure and need to provide them at runtime. This is rather easy for NAND. When U-Boot is loaded from NAND in common/spl/spl_nand.c, function spl_nand_load_image() calls function spl_nand_get_uboot_raw_page() that is only defined as a weak function there. So override this function in our spl.c to provide the value that was read from nboot-info. When loading U-Boot from MMC in common/spl/spl_mmc.c, there is a similar weak function spl_mmc_get_uboot_raw_sector() that we can override in our spl.c. Again we return the value that was read from nboot-info. Unfortunately this is not all. At some place the NXP boot devices like MMC3_BOOT or NAND_BOOT are converted to regular U-Boot boot devices like BOOT_DEVICE_MMC1 or BOOT_DEVICE_NAND. This mapping is done in spl_boot_device() in arch/arm/mach-imx/spl.c. However we need a different mapping. We achieve this by overriding the weak function board_boot_order() and return our own boot order. For a more detailed description for this see the comment before board_boot_order() in board/F+S/fsimx8mm/spl.c. In the past there was a message "Trying to boot from MMC1" in this case which would confuse users. We are actually booting from MMC3 a.k.a. mmc2 (which is already confusing enough). So instead of showing a "Trying" message before the image is booted, we now show only a message if booting this image failed. In NXP's boot process, U-Boot is always part of a single boot image like SPL, ATF etc. Therefore when booting from eMMC, U-Boot is always in the same HW boot partition where the system booted from. But we use more data in our NBoot image, we want to have up to two copies of U-Boot and we assume that U-Boot will grow in the future. So unfortunately U-Boot does not fit into the HW boot partition anymore and we need to move it to the User Partition. Have a function spl_boot_part() that returns the HW partition for U-Boot and is called in spl_mmc_load_image() in common/spl/spl_mmc.c. Add a weak imlpementation there that returns the value as before. Override this by our own version in our spl.c. | ||||
Forum Link | |||||