Skip to contentSkip to conversation

arm: mx6: specify SPL padding

PATCH New Stefan Agner 4 participants 6 messages Nov 15, 2016 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: mx6: specify SPL padding

From: Stefan Agner <[email protected]>

When building SPL with eMMC boot support, specify standard padding for payload to match the load sector during boot. This allows to use the u-boot-with-spl.imx build target to generate a direcly flashable image which can be flashed using:

dd if=u-boot-with-spl.imx of=/dev/mmcblk0 bs=512 skip=2

---

 include/configs/imx6_spl.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/configs/imx6_spl.h +6 -0
index 76d1ca0..ca3ed19 100644
@@ -42,6 +42,12 @@
 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
 #define CONFIG_SYS_MONITOR_LEN  (CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS/2*1024)
 #define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+/*
+ * SPL starts at 1KB (ROM offset), hence we need to pad SPL up to 68KB so
+ * that payload (U-Boot) will be at 69KB (sector 138) on the eMMC/SD card.
+ * Required for targets such as u-boot-with-spl.imx.
+ */
+#define CONFIG_SPL_PAD_TO			0x11000
 #endif
 
 /* SATA support */
Signature · 1 line
2.10.2
#1 lore raw

PATCH 1/1 arm: mx6: specify SPL padding

Hi Stefan

Quoted 28 lines · Stefan Agner

From: Stefan Agner <[email protected]>

When building SPL with eMMC boot support, specify standard padding for payload to match the load sector during boot. This allows to use the u-boot-with-spl.imx build target to generate a direcly flashable image which can be flashed using:

? dd if=u-boot-with-spl.imx of=/dev/mmcblk0 bs=512 skip=2

---

?include/configs/imx6_spl.h | 6 ++++++
?1 file changed, 6 insertions(+)

include/configs/imx6_spl.h +0 -0
index 76d1ca0..ca3ed19 100644
@@ -42,6 +42,12 @@

?#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
?#define CONFIG_SYS_MONITOR_LEN??(CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS/2*1024) ?#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+/*
+ * SPL starts at 1KB (ROM offset), hence we need to pad SPL up to 68KB so

Quoted 8 lines

+ * that payload (U-Boot) will be at 69KB (sector 138) on the eMMC/SD card.
+ * Required for targets such as u-boot-with-spl.imx.
+ */
+#define CONFIG_SPL_PAD_TO 0x11000
?#endif
?
?/* SATA support */

This has been brought up already:
https://www.mail-archive.com/u-boot at lists.denx.de/msg228246.html I agreed with Marek that this might disrupt other boot sources (NOR/SPI/ ...) which may or may not decide to use another offset between SPL and U-Boot.
Thus it is advisable to move that define to the individual board configuration where one knows for what boot device one wants to use the combined u-boot-with-spl.imx binary.

Max

P.S. Sorry for the noise to your individual mail addresses, I had issues getting to the mailinglist through gmane.

#2 lore raw

PATCH 1/1 arm: mx6: specify SPL padding

Quoted 40 lines · Max Krummenacher

Hi Stefan

Quoted 28 lines · Stefan Agner

From: Stefan Agner <[email protected]>

When building SPL with eMMC boot support, specify standard padding for payload to match the load sector during boot. This allows to use the u-boot-with-spl.imx build target to generate a direcly flashable image which can be flashed using:

? dd if=u-boot-with-spl.imx of=/dev/mmcblk0 bs=512 skip=2

---

?include/configs/imx6_spl.h | 6 ++++++
?1 file changed, 6 insertions(+)

include/configs/imx6_spl.h +0 -0
index 76d1ca0..ca3ed19 100644
@@ -42,6 +42,12 @@

?#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
?#define CONFIG_SYS_MONITOR_LEN??(CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS/2*1024) ?#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+/*
+ * SPL starts at 1KB (ROM offset), hence we need to pad SPL up to 68KB so

Quoted 8 lines

+ * that payload (U-Boot) will be at 69KB (sector 138) on the eMMC/SD card.
+ * Required for targets such as u-boot-with-spl.imx.
+ */
+#define CONFIG_SPL_PAD_TO 0x11000
?#endif
?
?/* SATA support */

Quoted 8 lines

This has been brought up already:
https://www.mail-archive.com/u-boot at lists.denx.de/msg228246.html I agreed with Marek that this might disrupt other boot sources (NOR/SPI/ ...) which may or may not decide to use another offset between SPL and U-Boot.
Thus it is advisable to move that define to the individual board configuration where one knows for what boot device one wants to use the combined u-boot-with-spl.imx binary.

I'm going to have to disagree with Marek here then. Looking over the explanation in include/configs/imx6_spl.h we have:
1KiB up front "wasted" for a partition table
4KiB up next for the ROM-mandated header
64KiB for SPL itself, which is our max size, unconditionally set above this bit of context. But it is the lowest common denominator in terms of IRAM size in the families.

Which brings us to the SPL_PAD_TO above, 68KiB. We cannot go lower than this. No one is changing any of this either today nor setting SPL_PAD_TO so
u-boot-with-spl.imx isn't usable today. None of this breaks using separate files.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161115/35a1f471/attachment.sig>
#3 lore raw

PATCH 1/1 arm: mx6: specify SPL padding

Quoted 58 lines · Tom Rini
Quoted 40 lines · Max Krummenacher

Hi Stefan

Quoted 28 lines · Stefan Agner

From: Stefan Agner <[email protected]>

When building SPL with eMMC boot support, specify standard padding for payload to match the load sector during boot. This allows to use the u-boot-with-spl.imx build target to generate a direcly flashable image which can be flashed using:

? dd if=u-boot-with-spl.imx of=/dev/mmcblk0 bs=512 skip=2

---

?include/configs/imx6_spl.h | 6 ++++++
?1 file changed, 6 insertions(+)

include/configs/imx6_spl.h +0 -0
index 76d1ca0..ca3ed19 100644
@@ -42,6 +42,12 @@

?#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
?#define CONFIG_SYS_MONITOR_LEN??(CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS/2*1024) ?#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+/*
+ * SPL starts at 1KB (ROM offset), hence we need to pad SPL up to 68KB so

Quoted 8 lines

+ * that payload (U-Boot) will be at 69KB (sector 138) on the eMMC/SD card.
+ * Required for targets such as u-boot-with-spl.imx.
+ */
+#define CONFIG_SPL_PAD_TO 0x11000
?#endif
?
?/* SATA support */

Quoted 8 lines

This has been brought up already:
https://www.mail-archive.com/u-boot at lists.denx.de/msg228246.html I agreed with Marek that this might disrupt other boot sources (NOR/SPI/ ...) which may or may not decide to use another offset between SPL and U-Boot.
Thus it is advisable to move that define to the individual board configuration where one knows for what boot device one wants to use the combined u-boot-with-spl.imx binary.

I'm going to have to disagree with Marek here then. Looking over the explanation in include/configs/imx6_spl.h we have:
1KiB up front "wasted" for a partition table
4KiB up next for the ROM-mandated header
64KiB for SPL itself, which is our max size, unconditionally set above this bit of context. But it is the lowest common denominator in terms of IRAM size in the families.

Quoted 5 lines

Which brings us to the SPL_PAD_TO above, 68KiB. We cannot go lower than this. No one is changing any of this either today nor setting SPL_PAD_TO so
u-boot-with-spl.imx isn't usable today. None of this breaks using separate files.

I agree here, the pad seems pretty natural and should be usable across boot devices. In fact, it probably should not be inside CONFIG_SPL_MMC_SUPPORT, but at the top along with CONFIG_SPL_MAX_SIZE.

So far, include/config_fallbacks.h defined SPL_PAD_TO to 64KiB, which renders u-boot-with-spl.imx unusable for SD/eMMC boot. Other boot devices probably know a similar define (CONFIG_SYS_NAND_U_BOOT_OFFS). Judging from existing board files it does not seem that anybody relied on that 64kB padding so far... I guess if a board with a different boot device wants to make use of u-boot-with-spl.imx, then it should make sure that the offset is set correctly in its board file (e.g. using #define CONFIG_SYS_NAND_U_BOOT_OFFS SPL_PAD_TO).

Marek?

--
Stefan

#4 lore raw

PATCH 1/1 arm: mx6: specify SPL padding

Quoted 78 lines · Stefan Agner
Quoted 58 lines · Tom Rini
Quoted 38 lines · Max Krummenacher

Hi Stefan

Quoted 35 lines · Stefan Agner

From: Stefan Agner <[email protected]>

When building SPL with eMMC boot support, specify standard padding for payload to match the load sector during boot. This allows to use the u-boot-with-spl.imx build target to generate a direcly flashable image which can be flashed using:

dd if=u-boot-with-spl.imx of=/dev/mmcblk0 bs=512 skip=2

---

 include/configs/imx6_spl.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/configs/imx6_spl.h +2 -0
index 76d1ca0..ca3ed19 100644
@@ -42,6 +42,12 @@
 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
 #define
 CONFIG_SYS_MONITOR_LEN  (CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS/2*1024)
 #define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+/*
+ * SPL starts at 1KB (ROM offset), hence we need to pad SPL up to

68KB so
+ * that payload (U-Boot) will be at 69KB (sector 138) on the eMMC/SD card.
+ * Required for targets such as u-boot-with-spl.imx.
+ */
+#define CONFIG_SPL_PAD_TO 0x11000
#endif

Quoted 10 lines
Quoted 1 line

/* SATA support */

This has been brought up already:
https://www.mail-archive.com/u-boot at lists.denx.de/msg228246.html I agreed with Marek that this might disrupt other boot sources (NOR/SPI/ ...) which may or may not decide to use another offset between SPL and U-Boot.
Thus it is advisable to move that define to the individual board configuration where one knows for what boot device one wants to use the combined u-boot-with-spl.imx binary.

I'm going to have to disagree with Marek here then. Looking over the explanation in include/configs/imx6_spl.h we have:
1KiB up front "wasted" for a partition table
4KiB up next for the ROM-mandated header
64KiB for SPL itself, which is our max size, unconditionally set above this bit of context. But it is the lowest common denominator in terms of IRAM size in the families.

Quoted 5 lines

Which brings us to the SPL_PAD_TO above, 68KiB. We cannot go lower than this. No one is changing any of this either today nor setting SPL_PAD_TO so
u-boot-with-spl.imx isn't usable today. None of this breaks using separate files.

I agree here, the pad seems pretty natural and should be usable across boot devices. In fact, it probably should not be inside CONFIG_SPL_MMC_SUPPORT, but at the top along with CONFIG_SPL_MAX_SIZE.

So far, include/config_fallbacks.h defined SPL_PAD_TO to 64KiB, which renders u-boot-with-spl.imx unusable for SD/eMMC boot. Other boot devices probably know a similar define (CONFIG_SYS_NAND_U_BOOT_OFFS). Judging from existing board files it does not seem that anybody relied on that 64kB padding so far... I guess if a board with a different boot device wants to make use of u-boot-with-spl.imx, then it should make sure that the offset is set correctly in its board file (e.g. using #define CONFIG_SYS_NAND_U_BOOT_OFFS SPL_PAD_TO).

Quoted 1 line

Marek?

I'm fine with it, esp. now that the other boot media are checked. Thanks

Signature · 2 lines
Best regards,
Marek Vasut
#5 lore raw

PATCH 1/1 arm: mx6: specify SPL padding

Quoted 79 lines · Marek Vasut
Quoted 78 lines · Stefan Agner
Quoted 58 lines · Tom Rini
Quoted 38 lines · Max Krummenacher

Hi Stefan

Quoted 35 lines · Stefan Agner

From: Stefan Agner <[email protected]>

When building SPL with eMMC boot support, specify standard padding for payload to match the load sector during boot. This allows to use the u-boot-with-spl.imx build target to generate a direcly flashable image which can be flashed using:

dd if=u-boot-with-spl.imx of=/dev/mmcblk0 bs=512 skip=2

---

 include/configs/imx6_spl.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/configs/imx6_spl.h +2 -0
index 76d1ca0..ca3ed19 100644
@@ -42,6 +42,12 @@
 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
 #define
 CONFIG_SYS_MONITOR_LEN  (CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS/2*1024)
 #define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+/*
+ * SPL starts at 1KB (ROM offset), hence we need to pad SPL up to

68KB so
+ * that payload (U-Boot) will be at 69KB (sector 138) on the eMMC/SD card.
+ * Required for targets such as u-boot-with-spl.imx.
+ */
+#define CONFIG_SPL_PAD_TO 0x11000
#endif

Quoted 10 lines
Quoted 1 line

/* SATA support */

This has been brought up already:
https://www.mail-archive.com/u-boot at lists.denx.de/msg228246.html I agreed with Marek that this might disrupt other boot sources (NOR/SPI/ ...) which may or may not decide to use another offset between SPL and U-Boot.
Thus it is advisable to move that define to the individual board configuration where one knows for what boot device one wants to use the combined u-boot-with-spl.imx binary.

I'm going to have to disagree with Marek here then. Looking over the explanation in include/configs/imx6_spl.h we have:
1KiB up front "wasted" for a partition table
4KiB up next for the ROM-mandated header
64KiB for SPL itself, which is our max size, unconditionally set above this bit of context. But it is the lowest common denominator in terms of IRAM size in the families.

Quoted 5 lines

Which brings us to the SPL_PAD_TO above, 68KiB. We cannot go lower than this. No one is changing any of this either today nor setting SPL_PAD_TO so
u-boot-with-spl.imx isn't usable today. None of this breaks using separate files.

I agree here, the pad seems pretty natural and should be usable across boot devices. In fact, it probably should not be inside CONFIG_SPL_MMC_SUPPORT, but at the top along with CONFIG_SPL_MAX_SIZE.

So far, include/config_fallbacks.h defined SPL_PAD_TO to 64KiB, which renders u-boot-with-spl.imx unusable for SD/eMMC boot. Other boot devices probably know a similar define (CONFIG_SYS_NAND_U_BOOT_OFFS). Judging from existing board files it does not seem that anybody relied on that 64kB padding so far... I guess if a board with a different boot device wants to make use of u-boot-with-spl.imx, then it should make sure that the offset is set correctly in its board file (e.g. using #define CONFIG_SYS_NAND_U_BOOT_OFFS SPL_PAD_TO).

Quoted 3 lines
Quoted 1 line

Marek?

I'm fine with it, esp. now that the other boot media are checked. Thanks

Ok, I will send a v2 which moves it outside CONFIG_SPL_MMC_SUPPORT.

--
Stefan