[U-Boot] [PATCH v2 00/12] sunxi: arm64 binary size fixes

Hi,
As we discussed already, this is the list of options that we will need to disable by default.
I also added to the mix a size check, which even though it's not really optimal, is temporary and will be removed in a future (and hopefully close) release.
Tom, is this still something we can merge for 2018.01?
Thanks! Maxime
Changes from v1: - Fixed a couple of nitpicks - Rebased on top of current master - Fixed a build error with boards using DFU
Andre Heider (1): sunxi: imply CONFIG_OF_LIBFDT_OVERLAY
Maxime Ripard (11): dfu: select HASH cmd: crc32: Disable by default on sunXi cmd: unzip: Disable by default on sunXi cmd: loadb: Disable by default on sunXi cmd: loads: Disable by default on sunXi cmd: misc: Disable by default on sunXi video: bpp8: Disable by default on sunXi video: bpp16: Disable by default on sunXi net: regex: Disable by default on sunXi Makefile: Add size check to the u-boot.itb make target sunxi: Add limit with the MMC environment
Makefile | 1 + arch/arm/Kconfig | 1 + cmd/Kconfig | 5 +++++ configs/CHIP_defconfig | 1 - configs/CHIP_pro_defconfig | 1 - drivers/dfu/Kconfig | 1 + drivers/video/Kconfig | 2 ++ include/configs/sunxi-common.h | 10 ++++++++++ lib/Kconfig | 1 + 9 files changed, 21 insertions(+), 2 deletions(-)

The DFU code relies on the HASH config option. Make sure it is always there by selecting it.
Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- drivers/dfu/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig index 56a98f5273ce..fa27efbb4053 100644 --- a/drivers/dfu/Kconfig +++ b/drivers/dfu/Kconfig @@ -2,6 +2,7 @@ menu "DFU support"
config USB_FUNCTION_DFU bool + select HASH
if CMD_DFU config DFU_TFTP

The sunXi arm64 build has overflown, leading to the main U-boot binary overwriting the environment when flashing the new image, or even worse, overwriting itself when we're calling saveenv.
Disable this command that is not critical until we can adress the issue properly.
Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- cmd/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/cmd/Kconfig b/cmd/Kconfig index 83dc778e46f1..a79788b085e5 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -397,6 +397,7 @@ menu "Memory commands" config CMD_CRC32 bool "crc32" select HASH + default n if ARCH_SUNXI default y help Compute CRC32.

The sunXi arm64 build has overflown, leading to the main U-boot binary overwriting the environment when flashing the new image, or even worse, overwriting itself when we're calling saveenv.
Disable this command that is not critical until we can adress the issue properly.
Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- cmd/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/cmd/Kconfig b/cmd/Kconfig index a79788b085e5..49e4b9f1953b 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -539,6 +539,7 @@ config CMD_LZMADEC
config CMD_UNZIP bool "unzip" + default n if ARCH_SUNXI default y if CMD_BOOTI help Uncompress a zip-compressed memory region.

The sunXi arm64 build has overflown, leading to the main U-boot binary overwriting the environment when flashing the new image, or even worse, overwriting itself when we're calling saveenv.
Disable this command that is not critical until we can adress the issue properly.
Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- cmd/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/cmd/Kconfig b/cmd/Kconfig index 49e4b9f1953b..c1609bc9007e 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -748,6 +748,7 @@ config CMD_I2C
config CMD_LOADB bool "loadb" + default n if ARCH_SUNXI default y help Load a binary file over serial line.

The sunXi arm64 build has overflown, leading to the main U-boot binary overwriting the environment when flashing the new image, or even worse, overwriting itself when we're calling saveenv.
Disable this command that is not critical until we can adress the issue properly.
Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- cmd/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/cmd/Kconfig b/cmd/Kconfig index c1609bc9007e..87511aa5b15c 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -755,6 +755,7 @@ config CMD_LOADB
config CMD_LOADS bool "loads" + default n if ARCH_SUNXI default y help Load an S-Record file over serial line

The sunXi arm64 build has overflown, leading to the main U-boot binary overwriting the environment when flashing the new image, or even worse, overwriting itself when we're calling saveenv.
Disable this command that is not critical until we can adress the issue properly.
Reviewed-by: Andre Przywara andre.przywara@arm.com Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- cmd/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/cmd/Kconfig b/cmd/Kconfig index 87511aa5b15c..28ceb417683c 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1138,6 +1138,7 @@ config CMD_GETTIME # TODO: rename to CMD_SLEEP config CMD_MISC bool "sleep" + default n if ARCH_SUNXI default y help Delay execution for some time

The sunXi arm64 build has overflown, leading to the main U-boot binary overwriting the environment when flashing the new image, or even worse, overwriting itself when we're calling saveenv.
Disable this command that is not critical until we can adress the issue properly.
Reviewed-by: Anatolij Gustschin agust@denx.de Reviewed-by: Andre Przywara andre.przywara@arm.com Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- drivers/video/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 45a105db06ae..a267c9acfecb 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -38,6 +38,7 @@ config BACKLIGHT_GPIO config VIDEO_BPP8 bool "Support 8-bit-per-pixel displays" depends on DM_VIDEO + default n if ARCH_SUNXI default y if DM_VIDEO help Support drawing text and bitmaps onto a 8-bit-per-pixel display.

The sunXi arm64 build has overflown, leading to the main U-boot binary overwriting the environment when flashing the new image, or even worse, overwriting itself when we're calling saveenv.
Disable this command that is not critical until we can adress the issue properly.
Reviewed-by: Anatolij Gustschin agust@denx.de Reviewed-by: Andre Przywara andre.przywara@arm.com Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- drivers/video/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index a267c9acfecb..2fc0defcd0d1 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -49,6 +49,7 @@ config VIDEO_BPP8 config VIDEO_BPP16 bool "Support 16-bit-per-pixel displays" depends on DM_VIDEO + default n if ARCH_SUNXI default y if DM_VIDEO help Support drawing text and bitmaps onto a 16-bit-per-pixel display.

The sunXi arm64 build has overflown, leading to the main U-boot binary overwriting the environment when flashing the new image, or even worse, overwriting itself when we're calling saveenv.
Disable this option that is not critical until we can adress the issue properly.
Reviewed-by: Andre Przywara andre.przywara@arm.com Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- lib/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/lib/Kconfig b/lib/Kconfig index 00ac650e741d..710deb7a6303 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -57,6 +57,7 @@ config PANIC_HANG
config REGEX bool "Enable regular expression support" + default n if ARCH_SUNXI default y if NET help If this variable is defined, U-Boot is linked against the

From: Andre Heider a.heider@gmail.com
fdt overlay support is useful for all sunxi boards, enable per default and remove it from sunxi defconfigs.
Signed-off-by: Andre Heider a.heider@gmail.com Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- arch/arm/Kconfig | 1 + configs/CHIP_defconfig | 1 - configs/CHIP_pro_defconfig | 1 - 3 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 001ece3cf140..645bff5702cf 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -748,6 +748,7 @@ config ARCH_SUNXI select USE_TINY_PRINTF imply CMD_GPT imply FAT_WRITE + imply OF_LIBFDT_OVERLAY imply PRE_CONSOLE_BUFFER imply SPL_GPIO_SUPPORT imply SPL_LIBCOMMON_SUPPORT diff --git a/configs/CHIP_defconfig b/configs/CHIP_defconfig index 062ac76e6d66..2452d42a873c 100644 --- a/configs/CHIP_defconfig +++ b/configs/CHIP_defconfig @@ -20,4 +20,3 @@ CONFIG_AXP_ALDO4_VOLT=3300 CONFIG_USB_EHCI_HCD=y CONFIG_USB_MUSB_GADGET=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y -CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/CHIP_pro_defconfig b/configs/CHIP_pro_defconfig index f47aead6f904..02e79b5bb510 100644 --- a/configs/CHIP_pro_defconfig +++ b/configs/CHIP_pro_defconfig @@ -25,4 +25,3 @@ CONFIG_AXP_ALDO4_VOLT=3300 CONFIG_USB_EHCI_HCD=y CONFIG_USB_MUSB_GADGET=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y -CONFIG_OF_LIBFDT_OVERLAY=y

The make macro to check if the binary exceeds the board size limit is not called. Make sure that is the case.
Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- Makefile | 1 + 1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile index 4981a2ed6f4a..719521950360 100644 --- a/Makefile +++ b/Makefile @@ -1053,6 +1053,7 @@ u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \
u-boot.itb: u-boot-nodtb.bin dts/dt.dtb $(U_BOOT_ITS) FORCE $(call if_changed,mkfitimage) + $(BOARD_SIZE_CHECK)
u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE $(call if_changed,mkimage)

The MMC environment offset is getting very close to the end of the U-Boot binary now. Since we want to make sure this will not overflow, add a size limit in the board for arm64. arm32 has already that limit enforced in our custom image generation.
Signed-off-by: Maxime Ripard maxime.ripard@free-electrons.com --- include/configs/sunxi-common.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 3855c564f914..6236e129a89d 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -147,6 +147,16 @@ #endif
#if defined(CONFIG_ENV_IS_IN_MMC) + +#ifdef CONFIG_ARM64 +/* + * This is actually (CONFIG_ENV_OFFSET - + * (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)), but the value will be used + * directly in a makefile, without the preprocessor expansion. + */ +#define CONFIG_BOARD_SIZE_LIMIT 0x7e000 +#endif + #if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 /* If we have two devices (most likely eMMC + MMC), favour the eMMC */ #define CONFIG_SYS_MMC_ENV_DEV 1

On Tue, Jan 16, 2018 at 2:14 PM, Maxime Ripard maxime.ripard@free-electrons.com wrote:
Hi,
As we discussed already, this is the list of options that we will need to disable by default.
I also added to the mix a size check, which even though it's not really optimal, is temporary and will be removed in a future (and hopefully close) release.
Tom, is this still something we can merge for 2018.01?
Thanks! Maxime
Changes from v1:
- Fixed a couple of nitpicks
- Rebased on top of current master
- Fixed a build error with boards using DFU
Andre Heider (1): sunxi: imply CONFIG_OF_LIBFDT_OVERLAY
Maxime Ripard (11): dfu: select HASH cmd: crc32: Disable by default on sunXi cmd: unzip: Disable by default on sunXi cmd: loadb: Disable by default on sunXi cmd: loads: Disable by default on sunXi cmd: misc: Disable by default on sunXi video: bpp8: Disable by default on sunXi video: bpp16: Disable by default on sunXi net: regex: Disable by default on sunXi Makefile: Add size check to the u-boot.itb make target sunxi: Add limit with the MMC environment
Reviewed-by: Jagan Teki jagan@openedev.com

On Wed, Jan 24, 2018 at 10:12 PM, Jagan Teki jagannadh.teki@gmail.com wrote:
On Tue, Jan 16, 2018 at 2:14 PM, Maxime Ripard maxime.ripard@free-electrons.com wrote:
Hi,
As we discussed already, this is the list of options that we will need to disable by default.
I also added to the mix a size check, which even though it's not really optimal, is temporary and will be removed in a future (and hopefully close) release.
Tom, is this still something we can merge for 2018.01?
Thanks! Maxime
Changes from v1:
- Fixed a couple of nitpicks
- Rebased on top of current master
- Fixed a build error with boards using DFU
Andre Heider (1): sunxi: imply CONFIG_OF_LIBFDT_OVERLAY
Maxime Ripard (11): dfu: select HASH cmd: crc32: Disable by default on sunXi cmd: unzip: Disable by default on sunXi cmd: loadb: Disable by default on sunXi cmd: loads: Disable by default on sunXi cmd: misc: Disable by default on sunXi video: bpp8: Disable by default on sunXi video: bpp16: Disable by default on sunXi net: regex: Disable by default on sunXi Makefile: Add size check to the u-boot.itb make target sunxi: Add limit with the MMC environment
Reviewed-by: Jagan Teki jagan@openedev.com
Applied to u-boot-sunxi/master, thanks!
participants (2)
-
Jagan Teki
-
Maxime Ripard