Hi Anatolij,

> -----Original Message-----
> From: Anatolij Gustschin <ag...@denx.de>
> Sent: 2019年10月21日 23:22
> To: u-boot@lists.denx.de
> Cc: sba...@denx.de; feste...@gmail.com; dl-uboot-imx
> <uboot-...@nxp.com>; Ye Li <ye...@nxp.com>
> Subject: [PATCH] imx: imx8: fix loading container image from eMMC boot
> partitions
> 
> Booting with images in eMMC hardware boot partition doesn't work because
> the container header is loaded from user partition, thus the loaded data
> doesn't have a valid header. Add partition switching to support booting from
> eMMC boot partitions.

get_boot_device_offset already switched partition, there is no need to add
partition switch logic in get_container_size.

Regards,
Peng.

> 
> Signed-off-by: Anatolij Gustschin <ag...@denx.de>
> ---
>  arch/arm/mach-imx/imx8/image.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-imx/imx8/image.c
> b/arch/arm/mach-imx/imx8/image.c index 58a29e8..b0e9494 100644
> --- a/arch/arm/mach-imx/imx8/image.c
> +++ b/arch/arm/mach-imx/imx8/image.c
> @@ -72,7 +72,20 @@ static int get_container_size(void *dev, int dev_type,
> unsigned long offset)
>       if (dev_type == MMC_DEV) {
>               unsigned long count = 0;
>               struct mmc *mmc = (struct mmc *)dev;
> -
> +             u8 part;
> +
> +             part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
> +             if (part == 7)
> +                     part = 0;
> +             if (part == 1 || part == 2) {
> +                     if (CONFIG_IS_ENABLED(MMC_TINY))
> +                             ret = mmc_switch_part(mmc, part);
> +                     else
> +                             ret = blk_dselect_hwpart(mmc_get_blk_desc(mmc),
> +                                                      part);
> +                     if (ret)
> +                             return ret;
> +             }
>               count = blk_dread(mmc_get_blk_desc(mmc),
>                                 offset / mmc->read_bl_len,
>                                 CONTAINER_HDR_ALIGNMENT / mmc->read_bl_len,
> --
> 2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to