[U-Boot] [RFC 1/1] configs: rk3288: SPL file must fit into 32 KiB

The SPL image for the rk3288 boards has to fit into 32 KiB. This includes 4 KiB for the device tree and up to 2 KiB for the file header.
Without the patch we missed to see that the TinkerBoard spl/u-boot-spl-dtb.bin file is too big.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- include/configs/rk3288_common.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h index c59f5eff7a..7c8d01ec50 100644 --- a/include/configs/rk3288_common.h +++ b/include/configs/rk3288_common.h @@ -23,6 +23,8 @@ #define CONFIG_SYS_INIT_SP_ADDR 0x00100000 #define CONFIG_SYS_LOAD_ADDR 0x00800800 #define CONFIG_SPL_STACK 0xff718000 +/* 32 KiB - 4 KiB for dtb - 2 KiB for file header */ +#define CONFIG_SPL_MAX_SIZE (0x8000 - 0x1800) #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_TPL_BOOTROM_SUPPORT) # define CONFIG_SPL_TEXT_BASE 0x0 #else

On 13.02.2019, at 21:13, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
The SPL image for the rk3288 boards has to fit into 32 KiB. This includes 4 KiB for the device tree and up to 2 KiB for the file header.
Without the patch we missed to see that the TinkerBoard spl/u-boot-spl-dtb.bin file is too big.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Am 13.02.2019 um 21:13 schrieb Heinrich Schuchardt:
The SPL image for the rk3288 boards has to fit into 32 KiB. This includes 4 KiB for the device tree and up to 2 KiB for the file header.
I'm not related to this board (and don't mean to step against this patch), but I have similar problems on socfpga (though with 64 KiB, not 32 KiB) and trying to solve them, so:
How do you know the DTB is 4 KiB maximum? Is there a check for this?
Aside from that, I don't know how it is for rk3288, but socfpga allocates initial stack, heap and 'gd' into the same RAM, so available size check should also substract that from my 64 KiB. How is this handled here?
Regards, Simon
Without the patch we missed to see that the TinkerBoard spl/u-boot-spl-dtb.bin file is too big.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
include/configs/rk3288_common.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h index c59f5eff7a..7c8d01ec50 100644 --- a/include/configs/rk3288_common.h +++ b/include/configs/rk3288_common.h @@ -23,6 +23,8 @@ #define CONFIG_SYS_INIT_SP_ADDR 0x00100000 #define CONFIG_SYS_LOAD_ADDR 0x00800800 #define CONFIG_SPL_STACK 0xff718000 +/* 32 KiB - 4 KiB for dtb - 2 KiB for file header */ +#define CONFIG_SPL_MAX_SIZE (0x8000 - 0x1800) #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_TPL_BOOTROM_SUPPORT) # define CONFIG_SPL_TEXT_BASE 0x0 #else

On 13.02.2019, at 21:19, Simon Goldschmidt simon.k.r.goldschmidt@gmail.com wrote:
Am 13.02.2019 um 21:13 schrieb Heinrich Schuchardt:
The SPL image for the rk3288 boards has to fit into 32 KiB. This includes 4 KiB for the device tree and up to 2 KiB for the file header.
I'm not related to this board (and don't mean to step against this patch), but I have similar problems on socfpga (though with 64 KiB, not 32 KiB) and trying to solve them, so:
How do you know the DTB is 4 KiB maximum? Is there a check for this?
Aside from that, I don't know how it is for rk3288, but socfpga allocates initial stack, heap and 'gd' into the same RAM, so available size check should also substract that from my 64 KiB. How is this handled here?
The RK3288 has ~ 100kB of SRAM, but the BootROM has a size limitation on loading the SPL stage. So stack will always be located beyond the end of the SPL.
Regards, Simon
Without the patch we missed to see that the TinkerBoard spl/u-boot-spl-dtb.bin file is too big. Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
include/configs/rk3288_common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h index c59f5eff7a..7c8d01ec50 100644 --- a/include/configs/rk3288_common.h +++ b/include/configs/rk3288_common.h @@ -23,6 +23,8 @@ #define CONFIG_SYS_INIT_SP_ADDR 0x00100000 #define CONFIG_SYS_LOAD_ADDR 0x00800800 #define CONFIG_SPL_STACK 0xff718000 +/* 32 KiB - 4 KiB for dtb - 2 KiB for file header */ +#define CONFIG_SPL_MAX_SIZE (0x8000 - 0x1800) #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_TPL_BOOTROM_SUPPORT) # define CONFIG_SPL_TEXT_BASE 0x0 #else
U-Boot mailing list U-Boot@lists.denx.de mailto:U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot https://lists.denx.de/listinfo/u-boot

Am 13.02.2019 um 21:26 schrieb Philipp Tomsich:
On 13.02.2019, at 21:19, Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com mailto:simon.k.r.goldschmidt@gmail.com> wrote:
Am 13.02.2019 um 21:13 schrieb Heinrich Schuchardt:
The SPL image for the rk3288 boards has to fit into 32 KiB. This includes 4 KiB for the device tree and up to 2 KiB for the file header.
I'm not related to this board (and don't mean to step against this patch), but I have similar problems on socfpga (though with 64 KiB, not 32 KiB) and trying to solve them, so:
How do you know the DTB is 4 KiB maximum? Is there a check for this?
Aside from that, I don't know how it is for rk3288, but socfpga allocates initial stack, heap and 'gd' into the same RAM, so available size check should also substract that from my 64 KiB. How is this handled here?
The RK3288 has ~ 100kB of SRAM, but the BootROM has a size limitation on loading the SPL stage. So stack will always be located beyond the end of the SPL.
Aha, so it's not comparable to socfgpa in that respect. Thanks for the info!
Regards, Simon

On Wed, Feb 13, 2019 at 09:13:05PM +0100, Heinrich Schuchardt wrote:
The SPL image for the rk3288 boards has to fit into 32 KiB. This includes 4 KiB for the device tree and up to 2 KiB for the file header.
Without the patch we missed to see that the TinkerBoard spl/u-boot-spl-dtb.bin file is too big.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
NAK. To repeat myself in what I said after this patch was already sent, but for the record, we need to leverage CONFIG_SPL_MAX_SIZE (and CONFIG_TPL_MAX_SIZE) with the BOARD_SIZE_CHECK logic (and use said logic more widely) so that we catch this problem everywhere. A guess at max DTB size is not enough. Thanks!

On 13.02.2019, at 21:21, Tom Rini trini@konsulko.com wrote:
On Wed, Feb 13, 2019 at 09:13:05PM +0100, Heinrich Schuchardt wrote:
The SPL image for the rk3288 boards has to fit into 32 KiB. This includes 4 KiB for the device tree and up to 2 KiB for the file header.
Without the patch we missed to see that the TinkerBoard spl/u-boot-spl-dtb.bin file is too big.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
NAK. To repeat myself in what I said after this patch was already sent, but for the record, we need to leverage CONFIG_SPL_MAX_SIZE (and CONFIG_TPL_MAX_SIZE) with the BOARD_SIZE_CHECK logic (and use said logic more widely) so that we catch this problem everywhere. A guess at max DTB size is not enough. Thanks!
Acknowledged.

On 2/13/19 9:23 PM, Philipp Tomsich wrote:
On 13.02.2019, at 21:21, Tom Rini trini@konsulko.com wrote:
On Wed, Feb 13, 2019 at 09:13:05PM +0100, Heinrich Schuchardt wrote:
The SPL image for the rk3288 boards has to fit into 32 KiB. This includes 4 KiB for the device tree and up to 2 KiB for the file header.
Without the patch we missed to see that the TinkerBoard spl/u-boot-spl-dtb.bin file is too big.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
NAK. To repeat myself in what I said after this patch was already sent, but for the record, we need to leverage CONFIG_SPL_MAX_SIZE (and CONFIG_TPL_MAX_SIZE) with the BOARD_SIZE_CHECK logic (and use said logic more widely) so that we catch this problem everywhere. A guess at max DTB size is not enough. Thanks!
Acknowledged.
I have figured out where to put the test but still have to work out the details:
diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h index c59f5eff7a..2d65a58f1e 100644 --- a/include/configs/rk3288_common.h +++ b/include/configs/rk3288_common.h @@ -23,6 +23,8 @@ #define CONFIG_SYS_INIT_SP_ADDR 0x00100000 #define CONFIG_SYS_LOAD_ADDR 0x00800800 #define CONFIG_SPL_STACK 0xff718000 +/* 32 KiB - 2 KiB for file header */ +#define CONFIG_SPL_MAX_SIZE (0x8000 - 0x800) #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_TPL_BOOTROM_SUPPORT) # define CONFIG_SPL_TEXT_BASE 0x0 #else diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 9d5921606e..ccb39eccd1 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -259,6 +259,9 @@ $(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin \ $(if $(CONFIG_SPL_SEPARATE_BSS),,$(obj)/$(SPL_BIN)-pad.bin) \ $(FINAL_DTB_CONTAINER) FORCE $(call if_changed,cat) +ifneq ($(CONFIG_SPL_MAX_SIZE),) + echo TODO A test is needed here TODO +endif
$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-dtb.bin FORCE $(call if_changed,copy)
Regards
Heinrich

On Wed, Feb 13, 2019 at 09:41:30PM +0100, Heinrich Schuchardt wrote:
On 2/13/19 9:23 PM, Philipp Tomsich wrote:
On 13.02.2019, at 21:21, Tom Rini trini@konsulko.com wrote:
On Wed, Feb 13, 2019 at 09:13:05PM +0100, Heinrich Schuchardt wrote:
The SPL image for the rk3288 boards has to fit into 32 KiB. This includes 4 KiB for the device tree and up to 2 KiB for the file header.
Without the patch we missed to see that the TinkerBoard spl/u-boot-spl-dtb.bin file is too big.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
NAK. To repeat myself in what I said after this patch was already sent, but for the record, we need to leverage CONFIG_SPL_MAX_SIZE (and CONFIG_TPL_MAX_SIZE) with the BOARD_SIZE_CHECK logic (and use said logic more widely) so that we catch this problem everywhere. A guess at max DTB size is not enough. Thanks!
Acknowledged.
I have figured out where to put the test but still have to work out the details:
Can I suggest taking the logic of BOARD_SIZE_CHECK and making the limit be an input the function takes?
participants (4)
-
Heinrich Schuchardt
-
Philipp Tomsich
-
Simon Goldschmidt
-
Tom Rini