imx: rom api: fix image offset computation
Subsystems (3)
PATCH v2 1/1 imx: rom api: fix image offset computation
When not booting from FlexSPI, the offset computation is:
offset = image_offset + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000;
When booting from SD card or eMMC user partition, image_offset is 0x8000. It is useless to add and remove 0x8000.
When booting from other device, image_offset is 0 so this computation is wrong.
Simplfy this computation to work on all booting devices.
---
Changes from v2:
* Previous version was wrong.
arch/arm/mach-imx/spl_imx_romapi.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/arm/mach-imx/spl_imx_romapi.c +1 -6
@@ -83,12 +83,7 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image,printf ("image offset 0x%x, pagesize 0x%x, ivt offset 0x%x\n" , image_offset, pagesize, offset); -if (((rom_bt_dev >>16 ) &0xff ) ==BT_DEV_TYPE_FLEXSPINOR ) - offset =CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR *512 ; -else - offset = image_offset + -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR *512 -0x8000 ; - + offset =CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR *512 ; size =ALIGN (sizeof (struct image_header ), pagesize); ret = g_rom_api->download_image ((u8 *)header, offset, size, ((uintptr_t )header) ^ offset ^ size);
Signature · 1 line
2.26.2
PATCH v2 1/1 imx: rom api: fix image offset computation
Quoted 7 lines
When not booting from FlexSPI, the offset computation is:
offset =image_offset+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR* 512 -0x8000; When booting from SD card or eMMC user partition,image_offsetis0x8000. It is useless to add and remove0x8000.
When booting from other device,image_offsetis 0 so this computation is wrong. Simplfy this computation to work on all booting devices.Signed-off-by S?bastien Szymanski <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v2 1/1 imx: rom api: fix image offset computation
Hi S?bastien,
Quoted 12 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of sbabic at denx.de
Sent: 2020?6?9? 1:22
To: S?bastien Szymanski <[email protected]>; u- boot at lists.denx.de
Subject: [EXT] [PATCH v2 1/1] imx: rom api: fix image offset computationCaution: EXT Email
Quoted 2 lines
When not booting from FlexSPI, the offset computation is:
offset =image_offset+
Quoted 8 lines
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR* 512Quoted 3 lines
-
0x8000; When booting from SD card or eMMC user partition,image_offsetis0x8000. It is useless to add and remove0x8000. When booting from other device,image_offsetis 0 so this computation iswrong.
Quoted 2 lines
Simplfy this computation to work on all booting devices.
Signed-off-by S?bastien Szymanski <[email protected]>Applied to u-boot-imx, master, thanks !
I just notice this patch. Can you elaborate the problem you met?
Because from my view, your change is wrong.
1. Removing the image_offset will break secondary (redundant) boot support for sd and emmc.
2. When booting from emmc boot partition, the image_offset is 0. But the flash.bin generated by mkimage with imximage-8mp-lpddr4.cfg is for sd. It expects to be burn at 32KB offset. The fit offset 0x60000 has already included the 32KB offset. So when you burn this flash.bin to emmc boot partition at offset 0, the fit offset should subtract the 32KB (0x60000 - 0x8000).
Best regards,
Ye Li
Quoted 12 lines
Best regards,
Stefano Babic--
==========================================================
===========
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
==========================================================
===========
PATCH v2 1/1 imx: rom api: fix image offset computation
Hi,
Quoted 23 lines · Ye Li
Hi S?bastien,
Quoted 12 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of sbabic at denx.de
Sent: 2020?6?9? 1:22
To: S?bastien Szymanski <[email protected]>; u- boot at lists.denx.de
Subject: [EXT] [PATCH v2 1/1] imx: rom api: fix image offset computationCaution: EXT Email
Quoted 2 lines
When not booting from FlexSPI, the offset computation is:
offset =image_offset+Quoted 8 lines
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR* 512Quoted 3 lines
-
0x8000; When booting from SD card or eMMC user partition,image_offsetis0x8000. It is useless to add and remove0x8000. When booting from other device,image_offsetis 0 so this computation iswrong.
Quoted 2 lines
Simplfy this computation to work on all booting devices.
Signed-off-by S?bastien Szymanski <[email protected]>Applied to u-boot-imx, master, thanks !
Quoted 7 lines
I just notice this patch. Can you elaborate the problem you met?
Because from my view, your change is wrong.
1. Removing theimage_offsetwill break secondary (redundant) boot support for sd and emmc.
2. When booting from emmc boot partition, theimage_offsetis 0. But the flash.bin generated by mkimage with imximage-8mp-lpddr4.cfg is for sd. It expects to be burn at 32KB offset. The fit offset0x60000has already included the 32KB offset. So when you burn this flash.bin to emmc boot partition at offset 0, the fit offset should subtract the 32KB (0x60000-0x8000).
You are right !
When I tried, I used a .cfg file without SECOND_LOADER and flashed proper U-Boot "by hand" at offset 0x60000 which is wrong.
Stefano, can you drop my patch please ?
Sorry :/
Regards,
Quoted 15 lines
Best regards,
Ye LiQuoted 12 lines
Best regards,
Stefano Babic--
==========================================================
===========
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
==========================================================
===========
Signature · 2 lines
S?bastien Szymanski, Armadeus Systems Software engineer
PATCH v2 1/1 imx: rom api: fix image offset computation
Quoted 34 lines · S?bastien Szymanski
Hi,
Quoted 23 lines · Ye Li
Hi S?bastien,
Quoted 12 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of sbabic at denx.de
Sent: 2020?6?9? 1:22
To: S?bastien Szymanski <[email protected]>; u- boot at lists.denx.de
Subject: [EXT] [PATCH v2 1/1] imx: rom api: fix image offset computationCaution: EXT Email
Quoted 2 lines
When not booting from FlexSPI, the offset computation is:
offset =image_offset+Quoted 8 lines
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR* 512Quoted 3 lines
-
0x8000; When booting from SD card or eMMC user partition,image_offsetis0x8000. It is useless to add and remove0x8000. When booting from other device,image_offsetis 0 so this computation iswrong.
Quoted 2 lines
Simplfy this computation to work on all booting devices.
Signed-off-by S?bastien Szymanski <[email protected]>Applied to u-boot-imx, master, thanks !
Quoted 7 lines
I just notice this patch. Can you elaborate the problem you met?
Because from my view, your change is wrong.
1. Removing theimage_offsetwill break secondary (redundant) boot support for sd and emmc.
2. When booting from emmc boot partition, theimage_offsetis 0. But the flash.bin generated by mkimage with imximage-8mp-lpddr4.cfg is for sd. It expects to be burn at 32KB offset. The fit offset0x60000has already included the 32KB offset. So when you burn this flash.bin to emmc boot partition at offset 0, the fit offset should subtract the 32KB (0x60000-0x8000).
Quoted 5 lines
You are right !
When I tried, I used a .cfg file withoutSECOND_LOADERand flashed proper U-Boot "by hand" at offset0x60000which is wrong.Stefano, can you drop my patch please ?
I revert it immediately - thanks Ye to have checked this before I send my PR.
Stefano
Quoted 22 lines
Sorry :/
Regards,
Quoted 15 lines
Best regards,
Ye LiQuoted 12 lines
Best regards,
Stefano Babic--
==========================================================
===========
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
==========================================================
===========
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================