[Buildroot] [PATCH v2 1/1] configs/stm32f469_disco: fix kernel bootup

Arnout Vandecappelle arnout at mind.be
Wed Jun 16 21:08:49 UTC 2021



On 07/06/2021 18:31, Dario Binacchi via buildroot wrote:
> As described by [1], the kernel generated by the configuration for the
> STM32f469 Discovery board is buggy. Using a newer kernel, as suggested
> by [1], increases the dtb and Kernel image size. In particular, the
> 5.12 version of the kernel generates a dtb and a kernel image whose sum
> exceeds the 2 MByte of the flash module.
> 
> So I decided to replace the afboot-stm32 bootloader in the flash with
> U-boot to easily boot the system from sdcard without having to worry

 This is pretty unfortunate, since this is pretty much the flagship platform for
showcasing XIP support in the kernel.

 However, the current situation is broken, so *something* needs to be done.

 I've experimented a bit with kernel config options but also wasn't able to
reduce it to below 2MB. The biggest improvement I got was 150K by removing
keyboard and mouse support. We could probably also et below 2MB by removing the
block layer, the SD card driver, and the ext4 filesystem - but then there's not
much left any more...

 Maybe with LTO, but that requires clang at the moment.

 Therefore, applied to master, thanks, with two modifications, see below.

[snip]
> diff --git a/configs/stm32f469_disco_defconfig b/configs/stm32f469_disco_defconfig
> index 9760d51878..8701ccbc02 100644
> --- a/configs/stm32f469_disco_defconfig
> +++ b/configs/stm32f469_disco_defconfig
> @@ -1,19 +1,22 @@
>  BR2_arm=y
>  BR2_cortex_m4=y
> -BR2_GLOBAL_PATCH_DIR="board/stmicroelectronics/stm32f469-disco/patches"
> -BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_11=y

 Even though 5.12 is the default, we really need it explicitly here. Otherwise,
the next linux bump will break it.

> -BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/common/stm32f4xx/stm32-post-build.sh"
> +BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/common/stm32f4xx/stm32-post-build.sh board/stmicroelectronics/stm32f469-disco/post-build.sh"
> +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
> +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32f469-disco/genimage.cfg"
>  BR2_LINUX_KERNEL=y
>  BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> -BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11"
> +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.12"

 There's a 5.12.11 now in stable so I took that one.

 Regards,
 Arnout

>  BR2_LINUX_KERNEL_DEFCONFIG="stm32"
> -BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm/configs/dram_0x00000000.config"
> +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm/configs/dram_0x00000000.config board/stmicroelectronics/stm32f469-disco/linux.fragment"
>  BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y
> -BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="xipImage"
> +BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage"
>  BR2_LINUX_KERNEL_DTS_SUPPORT=y
>  BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f469-disco"
>  BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config"
> -BR2_TARGET_ROOTFS_INITRAMFS=y
> +BR2_TARGET_ROOTFS_EXT2=y
> +BR2_TARGET_ROOTFS_EXT2_SIZE="32M"
>  # BR2_TARGET_ROOTFS_TAR is not set
> -BR2_TARGET_AFBOOT_STM32=y
> +BR2_TARGET_UBOOT=y
> +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32f469-discovery"
> +BR2_PACKAGE_HOST_GENIMAGE=y
>  BR2_PACKAGE_HOST_OPENOCD=y
> 



More information about the buildroot mailing list