add ARM FDPIC support
cover add ARM FDPIC support
This series adds support for ARM FDPIC for noMMU boards. This is a combination of Ben Wolsieffer, Dario Binacchi and my work.
Tested on a STM32F746 Disco board without stability issues.
Ben Wolsieffer (7):
Revert: "arch: drop now useless support for FDPIC"
arch: don't enable FDPIC binaries by default
arch: make FDPIC dependent on toolchain support arch/arm: add support for FDPIC boot/uboot: pass -mno-fdpic if FDPIC is enabled
linux: pass -mno-fdpic if FDPIC is enabled package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC
Dario Binacchi (1):
configs/stm32f746_disco_sd: new defconfig
Waldemar Brodkorb (1):
package/busybox: remove STATIC from busybox-minimal.config
arch/Config.in | 15 +++++++++ .../stm32f746-disco/extlinux.conf | 4 +++ .../stm32f746-disco/flash_sd.sh | 22 +++++++++++++ .../stm32f746-disco/genimage.cfg | 27 ++++++++++++++++ .../stm32f746-disco/linux.fragment | 13 ++++++++ .../patches/linux-headers/linux-headers.hash | 1 + .../stm32f746-disco/patches/linux/linux.hash | 2 ++ .../stm32f746-disco/patches/uboot/uboot.hash | 2 ++ .../stm32f746-disco/post-build.sh | 4 +++ .../stm32f746-disco/readme.txt | 31 ++++++++++++++++++ boot/uboot/uboot.mk | 5 +++ configs/stm32f746_disco_sd_defconfig | 32 +++++++++++++++++++ linux/linux.mk | 8 ++++- package/Makefile.in | 6 ++++ package/busybox/busybox-minimal.config | 2 +- package/uclibc/Config.in | 2 +- package/uclibc/uclibc.mk | 7 ++++ toolchain/Config.in | 4 +++ 18 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 board/stmicroelectronics/stm32f746-disco/extlinux.conf create mode 100755 board/stmicroelectronics/stm32f746-disco/flash_sd.sh create mode 100644 board/stmicroelectronics/stm32f746-disco/genimage.cfg create mode 100644 board/stmicroelectronics/stm32f746-disco/linux.fragment create mode 120000 board/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash create mode 100644 board/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash create mode 100644 board/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash create mode 100755 board/stmicroelectronics/stm32f746-disco/post-build.sh create mode 100644 board/stmicroelectronics/stm32f746-disco/readme.txt create mode 100644 configs/stm32f746_disco_sd_defconfig
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/9 Revert: "arch: drop now useless support for FDPIC"
From: Ben Wolsieffer <[email protected]>
This reverts commit 58dcd28dfbed481becb822b009583a63efbc6ffa.
ARM supports FDPIC, so this code is needed once again.
--- arch/Config.in | 14 ++++++++++++++ package/uclibc/uclibc.mk | 7 +++++++ 2 files changed, 21 insertions(+)
arch/Config.in +14 -0
@@ -12,6 +12,9 @@ config BR2_SOFT_FLOAT config BR2_USE_MMU bool +config BR2_ARCH_HAS_FDPIC_SUPPORT + bool + choice prompt "Target Architecture" default BR2_i386
@@ -430,6 +433,7 @@ endif choice prompt "Target Binary Format" default BR2_BINFMT_ELF if BR2_USE_MMU + default BR2_BINFMT_FDPIC if BR2_ARCH_HAS_FDPIC_SUPPORT default BR2_BINFMT_FLAT config BR2_BINFMT_ELF
@@ -441,6 +445,16 @@ config BR2_BINFMT_ELF and executables used across different architectures and operating systems. +config BR2_BINFMT_FDPIC + bool "FDPIC" + depends on BR2_ARCH_HAS_FDPIC_SUPPORT + select BR2_BINFMT_SUPPORTS_SHARED + help + ELF FDPIC binaries are based on ELF, but allow the individual + load segments of a binary to be located in memory + independently of each other. This makes this format ideal for + use in environments where no MMU is available. + config BR2_BINFMT_FLAT bool "FLAT" depends on !BR2_USE_MMU
package/uclibc/uclibc.mk +7 -0
@@ -57,6 +57,13 @@ UCLIBC_LOCALES = \ endif # noMMU binary formats +ifeq ($(BR2_BINFMT_FDPIC),y) +define UCLIBC_BINFMT_CONFIG + $(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_FLAT,$(@D)/.config) + $(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_FLAT_SEP_DATA,$(@D)/.config) + $(call KCONFIG_ENABLE_OPT,UCLIBC_FORMAT_FDPIC_ELF,$(@D)/.config) +endef +endif ifeq ($(BR2_BINFMT_FLAT),y) define UCLIBC_BINFMT_CONFIG $(call KCONFIG_ENABLE_OPT,UCLIBC_FORMAT_FLAT)
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/9 arch: don't enable FDPIC binaries by default
In reply to Waldemar BrodkorbFrom: Ben Wolsieffer <[email protected]>
FDPIC support is being added as a new option for an existing architecture (ARM), so we don't want to suddenly change the default.
--- arch/Config.in | 1 - 1 file changed, 1 deletion(-)
arch/Config.in +0 -1
@@ -433,7 +433,6 @@ endif choice prompt "Target Binary Format" default BR2_BINFMT_ELF if BR2_USE_MMU - default BR2_BINFMT_FDPIC if BR2_ARCH_HAS_FDPIC_SUPPORT default BR2_BINFMT_FLAT config BR2_BINFMT_ELF
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/9 arch: make FDPIC dependent on toolchain support
In reply to Waldemar BrodkorbFrom: Ben Wolsieffer <[email protected]>
FDPIC support on ARM requires a certain target name, and therefore is only currently available with the Buildroot toolchain. In addition, only uClibc-ng supports FDPIC on ARM at the moment.
This may need to become more complicated if we end up in a situation where each libc supports FDPIC on a different set of architectures.
--- arch/Config.in | 1 + toolchain/Config.in | 4 ++++ 2 files changed, 5 insertions(+)
arch/Config.in +1 -0
@@ -447,6 +447,7 @@ config BR2_BINFMT_ELF config BR2_BINFMT_FDPIC bool "FDPIC" depends on BR2_ARCH_HAS_FDPIC_SUPPORT + depends on BR2_TOOLCHAIN_SUPPORTS_FDPIC select BR2_BINFMT_SUPPORTS_SHARED help ELF FDPIC binaries are based on ELF, but allow the individual
toolchain/Config.in +4 -0
@@ -48,6 +48,7 @@ choice config BR2_TOOLCHAIN_BUILDROOT bool "Buildroot toolchain" depends on BR2_ARCH_HAS_TOOLCHAIN_BUILDROOT + select BR2_TOOLCHAIN_SUPPORTS_FDPIC if BR2_TOOLCHAIN_USES_UCLIBC config BR2_TOOLCHAIN_EXTERNAL bool "External toolchain"
@@ -307,6 +308,9 @@ config BR2_TOOLCHAIN_HAS_OPENMP config BR2_TOOLCHAIN_SUPPORTS_PIE bool +config BR2_TOOLCHAIN_SUPPORTS_FDPIC + bool + config BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY bool "Copy gconv libraries" depends on BR2_TOOLCHAIN_USES_GLIBC
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 4/9 arch/arm: add support for FDPIC
In reply to Waldemar BrodkorbFrom: Ben Wolsieffer <[email protected]>
Linux on ARM supports FDPIC binaries intended for use on no-MMU systems. This patch enables support for building a toolchain that produces FDPIC binaries.
The target name for a FDPIC toolchain must be arm-<vendor>-uclinuxfdpiceabi, which doesn't follow the standard format and requires a special case.
According to the kernel help for CONFIG_BINFMT_ELF_FDPIC, "It is also possible to run FDPIC ELF binaries on MMU linux," so FDPIC support is available on all ARM platforms, not just no-MMU.
--- arch/Config.in | 1 + package/Makefile.in | 6 ++++++ 2 files changed, 7 insertions(+)
arch/Config.in +1 -0
@@ -39,6 +39,7 @@ config BR2_arceb config BR2_arm bool "ARM (little endian)" + select BR2_ARCH_HAS_FDPIC_SUPPORT # MMU support is set by the subarchitecture file, arch/Config.in.arm help ARM is a 32-bit reduced instruction set computer (RISC)
package/Makefile.in +6 -0
@@ -39,7 +39,13 @@ $(error BR2_TOOLCHAIN_BUILDROOT_VENDOR cannot be 'unknown'. \ endif # Compute GNU_TARGET_NAME +# FDPIC on ARM requires a special target name: it has no OS field and must +# use the suffix -uclinuxfdpiceabi. +ifeq ($(BR2_arm)$(BR2_armeb):$(BR2_BINFMT_FDPIC),y:y) +GNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-uclinuxfdpiceabi +else GNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)-$(LIBC)$(ABI) +endif # FLAT binary format needs uclinux, except RISC-V which needs the # regular linux name.
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 5/9 boot/uboot: pass -mno-fdpic if FDPIC is enabled
In reply to Waldemar BrodkorbFrom: Ben Wolsieffer <[email protected]>
If the FDPIC ABI is enabled by default in the toolchain, it must be explicitly disabled when building U-Boot.
--- boot/uboot/uboot.mk | 5 +++++ 1 file changed, 5 insertions(+)
boot/uboot/uboot.mk +5 -0
@@ -172,6 +172,11 @@ UBOOT_MAKE_OPTS += \ HOSTLDFLAGS="$(HOST_LDFLAGS)" \ $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS)) +# Disable FDPIC if enabled by default in toolchain +ifeq ($(BR2_BINFMT_FDPIC),y) +UBOOT_MAKE_OPTS += KCFLAGS=-mno-fdpic +endif + ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y) UBOOT_DEPENDENCIES += arm-trusted-firmware ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF),y)
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 6/9 linux: pass -mno-fdpic if FDPIC is enabled
In reply to Waldemar BrodkorbFrom: Ben Wolsieffer <[email protected]>
If the FDPIC ABI is enabled by default in the toolchain, it must be explicitly disabled when building the kernel.
--- linux/linux.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
linux/linux.mk +7 -1
@@ -163,6 +163,7 @@ endif LINUX_MAKE_FLAGS = \ HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS))) $(HOST_LDFLAGS)" \ ARCH=$(KERNEL_ARCH) \ + KCFLAGS="$(LINUX_CFLAGS)" \ INSTALL_MOD_PATH=$(TARGET_DIR) \ CROSS_COMPILE="$(TARGET_CROSS)" \ WERROR=0 \
@@ -184,7 +185,12 @@ endif # sanitize the arguments passed from user space in registers. # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82435 ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y) -LINUX_MAKE_ENV += KCFLAGS=-Wno-attribute-alias +LINUX_CFLAGS += -Wno-attribute-alias +endif + +# Disable FDPIC if enabled by default in toolchain +ifeq ($(BR2_BINFMT_FDPIC),y) +LINUX_CFLAGS += -mno-fdpic endif ifeq ($(BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT),y)
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 7/9 package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC
In reply to Waldemar BrodkorbFrom: Ben Wolsieffer <[email protected]>
NPTL is supported on no-MMU ARM systems if FDPIC binaries are used.
--- package/uclibc/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/uclibc/Config.in +1 -1
@@ -78,7 +78,7 @@ choice config BR2_PTHREADS_NATIVE bool "Native POSIX Threading (NPTL)" - depends on BR2_USE_MMU + depends on BR2_USE_MMU || ((BR2_arm || BR2_armeb) && BR2_BINFMT_FDPIC) select BR2_TOOLCHAIN_HAS_THREADS select BR2_TOOLCHAIN_HAS_THREADS_NPTL
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 8/9 package/busybox: remove STATIC from busybox-minimal.config
In reply to Waldemar BrodkorbWith FDPIC we want a shared busybox executable even with noMMU. Static is already handled by busybox.mk for static toolchains.
--- package/busybox/busybox-minimal.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/busybox/busybox-minimal.config +1 -1
@@ -40,7 +40,7 @@ CONFIG_FEATURE_SYSLOG=y # # Build Options # -CONFIG_STATIC=y +# CONFIG_STATIC is not set # CONFIG_PIE is not set # CONFIG_NOMMU is not set # CONFIG_BUILD_LIBBUSYBOX is not set
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 9/9 configs/stm32f746_disco_sd: new defconfig
In reply to Waldemar BrodkorbFrom: Dario Binacchi <[email protected]>
The commit adds support for STM32F746G-DISCO board. The discovery kit is a complete demonstration and development platform for STMicroelectronics Arm Cortex-M7-core-based STM32F746NG.
Board support package includes the following components:
- mainline Linux kernel 5.15.165
- mainline U-Boot 2024.07
- default packages from buildroot
--- DEVELOPERS | 2 ++ .../stm32f746-disco/extlinux.conf | 4 +++ .../stm32f746-disco/flash_sd.sh | 22 +++++++++++++ .../stm32f746-disco/genimage.cfg | 27 ++++++++++++++++ .../stm32f746-disco/linux.fragment | 13 ++++++++ .../patches/linux-headers/linux-headers.hash | 1 + .../stm32f746-disco/patches/linux/linux.hash | 2 ++ .../stm32f746-disco/patches/uboot/uboot.hash | 2 ++ .../stm32f746-disco/post-build.sh | 4 +++ .../stm32f746-disco/readme.txt | 31 ++++++++++++++++++ configs/stm32f746_disco_sd_defconfig | 32 +++++++++++++++++++ 11 files changed, 140 insertions(+) create mode 100644 board/stmicroelectronics/stm32f746-disco/extlinux.conf create mode 100755 board/stmicroelectronics/stm32f746-disco/flash_sd.sh create mode 100644 board/stmicroelectronics/stm32f746-disco/genimage.cfg create mode 100644 board/stmicroelectronics/stm32f746-disco/linux.fragment create mode 120000 board/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash create mode 100644 board/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash create mode 100644 board/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash create mode 100755 board/stmicroelectronics/stm32f746-disco/post-build.sh create mode 100644 board/stmicroelectronics/stm32f746-disco/readme.txt create mode 100644 configs/stm32f746_disco_sd_defconfig
DEVELOPERS +2 -0
@@ -3304,7 +3304,9 @@ F: package/ngrep/ N: Waldemar Brodkorb <[email protected]> F: board/qemu/riscv32-virt/ +F: board/stmicroelectronics/stm32f746-disco/ F: configs/qemu_riscv32_nommu_virt_defconfig +F: configs/stm32f746_disco_sd_defconfig F: package/asterisk/ F: package/evilwm/ F: package/fbv/
board/stmicroelectronics/stm32f746-disco/extlinux.conf new file +4 -0
@@ -0,0 +1,4 @@ +label stm32f746-disco-buildroot + kernel /zImage + devicetree /stm32f746-disco.dtb + append console=ttySTM0,115200 root=/dev/mmcblk0p2 rw rootwait consoleblank=0 ignore_loglevel
board/stmicroelectronics/stm32f746-disco/flash_sd.sh new file +22 -0
@@ -0,0 +1,22 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + OUTPUT_DIR=output +else + OUTPUT_DIR=$1 +fi + +if ! test -d "${OUTPUT_DIR}" ; then + echo "ERROR: no output directory specified." + echo "Usage: $0 OUTPUT_DIR" + exit 1 +fi + +"${OUTPUT_DIR}"/host/bin/openocd -f board/stm32f746g-disco.cfg \ + -c "init" \ + -c "reset init" \ + -c "flash probe 0" \ + -c "flash info 0" \ + -c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \ + -c "reset run" \ + -c "shutdown"
board/stmicroelectronics/stm32f746-disco/genimage.cfg new file +27 -0
@@ -0,0 +1,27 @@ +image boot.vfat { + vfat { + files = { + "zImage", + "stm32f746-disco.dtb", + "extlinux" + } + } + + size = 16M +} + +image sdcard.img { + hdimage { + } + + partition u-boot { + partition-type = 0xC + image = "boot.vfat" + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + size = 32M + } +}
board/stmicroelectronics/stm32f746-disco/linux.fragment new file +13 -0
@@ -0,0 +1,13 @@ +# CONFIG_PREEMPT is not set +# CONFIG_MULTIUSER is not set +# CONFIG_TIMERFD is not set +CONFIG_SET_MEM_PARAM=y +CONFIG_DRAM_BASE=0xC0000000 +CONFIG_DRAM_SIZE=0x01000000 +# CONFIG_GCC_PLUGINS is not set +# CONFIG_XIP_KERNEL is not set +# CONFIG_BLK_DEV is not set +# CONFIG_COMPAT_BRK is not set +# CONFIG_PROC_SYSCTL is not set +# CONFIG_CRYPTO is not set +CONFIG_RCU_TRACE=y
board/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash new file +1 -0
@@ -0,0 +1 @@ +../linux/linux.hash
board/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash new file +2 -0
@@ -0,0 +1,2 @@ +# Locally calculated +sha256 a36dd3e82ceb634afded31f2656568f57c4d9c4b399859f298b18116df11c6fe linux-5.15.165.tar.xz
board/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash new file +2 -0
@@ -0,0 +1,2 @@ +# Locally calculated +sha256 f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f u-boot-2024.07.tar.bz2
board/stmicroelectronics/stm32f746-disco/post-build.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +BOARD_DIR="$(dirname "$0")" + +install -m 0644 -D "${BOARD_DIR}"/extlinux.conf "${BINARIES_DIR}"/extlinux/extlinux.conf
board/stmicroelectronics/stm32f746-disco/readme.txt new file +31 -0
@@ -0,0 +1,31 @@ +STM32F746-DISCO +=================== + +This tutorial describes how to use the predefined Buildroot +configuration for the STM32F746-DISCO evaluation platform. + +Building +-------- + + make stm32f746_disco_sd_defconfig + make + +Flashing +-------- + + ./board/stmicroelectronics/stm32f746-disco/flash_sd.sh output/ + +It will flash the U-boot bootloader. + +Creating SD card +---------------- + +Buildroot prepares an "sdcard.img" image in the output/images/ directory, +ready to be dumped on a SD card. Launch the following command as root: + + dd if=output/images/sdcard.img of=/dev/<your-sd-device> + +*** WARNING! This will destroy all the card content. Use with care! *** + +For details about the medium image layout and its content, see the +definition in board/stmicroelectronics/stm32f746-disco/genimage.cfg.
configs/stm32f746_disco_sd_defconfig new file +32 -0
@@ -0,0 +1,32 @@ +BR2_arm=y +BR2_cortex_m7=y +BR2_BINFMT_FDPIC=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y +BR2_GLOBAL_PATCH_DIR="board/stmicroelectronics/stm32f746-disco/patches" +BR2_DOWNLOAD_FORCE_CHECK_HASHES=y +BR2_INIT_TINYINIT=y +BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/stm32f746-disco/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32f746-disco/genimage.cfg" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.165" +BR2_LINUX_KERNEL_DEFCONFIG="stm32" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/stmicroelectronics/stm32f746-disco/linux.fragment" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f746-disco" +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_SIZE="32M" +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.07" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32f746-disco" +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_OPENOCD=y
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 9/9] configs/stm32f746_disco_sd: new defconfig
Hello Waldemar,
Quoted 254 lines · Waldemar Brodkorb
From: Dario Binacchi <[email protected]>
The commit adds support for STM32F746G-DISCO board. The discovery kit is a complete demonstration and development platform for STMicroelectronics Arm Cortex-M7-core-based STM32F746NG.
Board support package includes the following components:
- mainline Linux kernel 5.15.165
- mainline U-Boot 2024.07
- default packages from buildrootSigned-off-by Dario Binacchi <[email protected]>Signed-off-by Waldemar Brodkorb <[email protected]>--- DEVELOPERS | 2 ++ .../stm32f746-disco/extlinux.conf | 4 +++ .../stm32f746-disco/flash_sd.sh | 22 +++++++++++++ .../stm32f746-disco/genimage.cfg | 27 ++++++++++++++++ .../stm32f746-disco/linux.fragment | 13 ++++++++ .../patches/linux-headers/linux-headers.hash | 1 + .../stm32f746-disco/patches/linux/linux.hash | 2 ++ .../stm32f746-disco/patches/uboot/uboot.hash | 2 ++ .../stm32f746-disco/post-build.sh | 4 +++ .../stm32f746-disco/readme.txt | 31 ++++++++++++++++++ configs/stm32f746_disco_sd_defconfig | 32 +++++++++++++++++++ 11 files changed, 140 insertions(+) create mode 100644 board/stmicroelectronics/stm32f746-disco/extlinux.conf create mode 100755 board/stmicroelectronics/stm32f746-disco/flash_sd.sh create mode 100644 board/stmicroelectronics/stm32f746-disco/genimage.cfg create mode 100644 board/stmicroelectronics/stm32f746-disco/linux.fragment create mode 120000 board/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash create mode 100644 board/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash create mode 100644 board/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash create mode 100755 board/stmicroelectronics/stm32f746-disco/post-build.sh create mode 100644 board/stmicroelectronics/stm32f746-disco/readme.txt create mode 100644 configs/stm32f746_disco_sd_defconfigDEVELOPERS +2
-0@@ -3304,7 +3304,9 @@ F: package/ngrep/ N: Waldemar Brodkorb <[email protected]> F: board/qemu/riscv32-virt/ +F: board/stmicroelectronics/stm32f746-disco/ F: configs/qemu_riscv32_nommu_virt_defconfig +F: configs/stm32f746_disco_sd_defconfig F: package/asterisk/ F: package/evilwm/ F: package/fbv/board/stmicroelectronics/stm32f746-disco/extlinux.conf new file +4
-0@@ -0,0 +1,4 @@ +label stm32f746-disco-buildroot + kernel /zImage + devicetree /stm32f746-disco.dtb + append console=ttySTM0,115200 root=/dev/mmcblk0p2 rw rootwait consoleblank=0 ignore_loglevelboard/stmicroelectronics/stm32f746-disco/flash_sd.sh new file +22
-0@@ -0,0 +1,22 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + OUTPUT_DIR=output +else + OUTPUT_DIR=$1 +fi + +if ! test -d "${OUTPUT_DIR}" ; then + echo "ERROR: no output directory specified." + echo "Usage: $0 OUTPUT_DIR" + exit 1 +fi + +"${OUTPUT_DIR}"/host/bin/openocd -f board/stm32f746g-disco.cfg \ + -c "init" \ + -c "reset init" \ + -c "flash probe 0" \ + -c "flash info 0" \ + -c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \ + -c "reset run" \ + -c "shutdown"board/stmicroelectronics/stm32f746-disco/genimage.cfg new file +27
-0@@ -0,0 +1,27 @@ +image boot.vfat { + vfat { + files = { + "zImage", + "stm32f746-disco.dtb", + "extlinux" + } + } + + size = 16M +} + +image sdcard.img { + hdimage { + } + + partition u-boot { + partition-type = 0xC + image = "boot.vfat" + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + size = 32M + } +}board/stmicroelectronics/stm32f746-disco/linux.fragment new file +13
-0@@ -0,0 +1,13 @@ +# CONFIG_PREEMPT is not set +# CONFIG_MULTIUSER is not set +# CONFIG_TIMERFD is not set +CONFIG_SET_MEM_PARAM=y +CONFIG_DRAM_BASE=0xC0000000 +CONFIG_DRAM_SIZE=0x01000000 +# CONFIG_GCC_PLUGINS is not set +# CONFIG_XIP_KERNEL is not set +# CONFIG_BLK_DEV is not set +# CONFIG_COMPAT_BRK is not set +# CONFIG_PROC_SYSCTL is not set +# CONFIG_CRYPTO is not set +CONFIG_RCU_TRACE=yboard/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash new file +1
-0@@ -0,0 +1 @@ +../linux/linux.hashboard/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash new file +2
-0@@ -0,0 +1,2 @@ +# Locally calculated +sha256 a36dd3e82ceb634afded31f2656568f57c4d9c4b399859f298b18116df11c6fe linux-5.15.165.tar.xzboard/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash new file +2
-0@@ -0,0 +1,2 @@ +# Locally calculated +sha256 f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f u-boot-2024.07.tar.bz2board/stmicroelectronics/stm32f746-disco/post-build.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +BOARD_DIR="$(dirname "$0")" + +install -m 0644 -D "${BOARD_DIR}"/extlinux.conf "${BINARIES_DIR}"/extlinux/extlinux.confboard/stmicroelectronics/stm32f746-disco/readme.txt new file +31
-0@@ -0,0 +1,31 @@ +STM32F746-DISCO +=================== + +This tutorial describes how to use the predefined Buildroot +configuration for the STM32F746-DISCO evaluation platform. + +Building +-------- + + make stm32f746_disco_sd_defconfig + make + +Flashing +-------- + + ./board/stmicroelectronics/stm32f746-disco/flash_sd.sh output/ + +It will flash the U-boot bootloader. + +Creating SD card +---------------- + +Buildroot prepares an "sdcard.img" image in the output/images/ directory, +ready to be dumped on a SD card. Launch the following command as root: + + dd if=output/images/sdcard.img of=/dev/<your-sd-device> + +*** WARNING! This will destroy all the card content. Use with care! *** + +For details about the medium image layout and its content, see the +definition in board/stmicroelectronics/stm32f746-disco/genimage.cfg.configs/stm32f746_disco_sd_defconfig new file +32
-1@@ -0,0 +1,32 @@ +BR2_arm=y +BR2_cortex_m7=y +BR2_BINFMT_FDPIC=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y +BR2_GLOBAL_PATCH_DIR="board/stmicroelectronics/stm32f746-disco/patches" +BR2_DOWNLOAD_FORCE_CHECK_HASHES=y +BR2_INIT_TINYINIT=y +BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/stm32f746-disco/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32f746-disco/genimage.cfg" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.165" +BR2_LINUX_KERNEL_DEFCONFIG="stm32" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/stmicroelectronics/stm32f746-disco/linux.fragment" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f746-disco" +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_SIZE="32M" +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.07" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32f746-disco" +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_OPENOCD=y --
Quoted 2 lines
2.30.2
Great work!
Support for FDPIC makes for a more stable system. The board test did not reveal any problems with shell command execution as was previously the case.
I did, however, make some modifications to the patch:
- I added my name back to the DEVELOPER file, as in v4
(https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/).
I think when you applied this patch this part was lost. Do you agree
that we can both be maintainers for this file?
- As Thomas suggested, I removed the VFAT partition.
I would submit the whole series as version 2 where I would only modify this patch.
What do you think? Do you agree?
Thanks and regards,
Dario
Signature · 21 lines
Dario Binacchi Senior Embedded Linux Developer [email protected] __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 [email protected] www.amarulasolutions.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 9/9] configs/stm32f746_disco_sd: new defconfig
Hi Dario,
Dario Binacchi wrote,
Quoted 265 lines
Hello Waldemar,
Quoted 254 lines · Waldemar Brodkorb
From: Dario Binacchi <[email protected]>
The commit adds support for STM32F746G-DISCO board. The discovery kit is a complete demonstration and development platform for STMicroelectronics Arm Cortex-M7-core-based STM32F746NG.
Board support package includes the following components:
- mainline Linux kernel 5.15.165
- mainline U-Boot 2024.07
- default packages from buildrootSigned-off-by Dario Binacchi <[email protected]>Signed-off-by Waldemar Brodkorb <[email protected]>--- DEVELOPERS | 2 ++ .../stm32f746-disco/extlinux.conf | 4 +++ .../stm32f746-disco/flash_sd.sh | 22 +++++++++++++ .../stm32f746-disco/genimage.cfg | 27 ++++++++++++++++ .../stm32f746-disco/linux.fragment | 13 ++++++++ .../patches/linux-headers/linux-headers.hash | 1 + .../stm32f746-disco/patches/linux/linux.hash | 2 ++ .../stm32f746-disco/patches/uboot/uboot.hash | 2 ++ .../stm32f746-disco/post-build.sh | 4 +++ .../stm32f746-disco/readme.txt | 31 ++++++++++++++++++ configs/stm32f746_disco_sd_defconfig | 32 +++++++++++++++++++ 11 files changed, 140 insertions(+) create mode 100644 board/stmicroelectronics/stm32f746-disco/extlinux.conf create mode 100755 board/stmicroelectronics/stm32f746-disco/flash_sd.sh create mode 100644 board/stmicroelectronics/stm32f746-disco/genimage.cfg create mode 100644 board/stmicroelectronics/stm32f746-disco/linux.fragment create mode 120000 board/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash create mode 100644 board/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash create mode 100644 board/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash create mode 100755 board/stmicroelectronics/stm32f746-disco/post-build.sh create mode 100644 board/stmicroelectronics/stm32f746-disco/readme.txt create mode 100644 configs/stm32f746_disco_sd_defconfigDEVELOPERS +2
-0@@ -3304,7 +3304,9 @@ F: package/ngrep/ N: Waldemar Brodkorb <[email protected]> F: board/qemu/riscv32-virt/ +F: board/stmicroelectronics/stm32f746-disco/ F: configs/qemu_riscv32_nommu_virt_defconfig +F: configs/stm32f746_disco_sd_defconfig F: package/asterisk/ F: package/evilwm/ F: package/fbv/board/stmicroelectronics/stm32f746-disco/extlinux.conf new file +4
-0@@ -0,0 +1,4 @@ +label stm32f746-disco-buildroot + kernel /zImage + devicetree /stm32f746-disco.dtb + append console=ttySTM0,115200 root=/dev/mmcblk0p2 rw rootwait consoleblank=0 ignore_loglevelboard/stmicroelectronics/stm32f746-disco/flash_sd.sh new file +22
-0@@ -0,0 +1,22 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + OUTPUT_DIR=output +else + OUTPUT_DIR=$1 +fi + +if ! test -d "${OUTPUT_DIR}" ; then + echo "ERROR: no output directory specified." + echo "Usage: $0 OUTPUT_DIR" + exit 1 +fi + +"${OUTPUT_DIR}"/host/bin/openocd -f board/stm32f746g-disco.cfg \ + -c "init" \ + -c "reset init" \ + -c "flash probe 0" \ + -c "flash info 0" \ + -c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \ + -c "reset run" \ + -c "shutdown"board/stmicroelectronics/stm32f746-disco/genimage.cfg new file +27
-0@@ -0,0 +1,27 @@ +image boot.vfat { + vfat { + files = { + "zImage", + "stm32f746-disco.dtb", + "extlinux" + } + } + + size = 16M +} + +image sdcard.img { + hdimage { + } + + partition u-boot { + partition-type = 0xC + image = "boot.vfat" + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + size = 32M + } +}board/stmicroelectronics/stm32f746-disco/linux.fragment new file +13
-0@@ -0,0 +1,13 @@ +# CONFIG_PREEMPT is not set +# CONFIG_MULTIUSER is not set +# CONFIG_TIMERFD is not set +CONFIG_SET_MEM_PARAM=y +CONFIG_DRAM_BASE=0xC0000000 +CONFIG_DRAM_SIZE=0x01000000 +# CONFIG_GCC_PLUGINS is not set +# CONFIG_XIP_KERNEL is not set +# CONFIG_BLK_DEV is not set +# CONFIG_COMPAT_BRK is not set +# CONFIG_PROC_SYSCTL is not set +# CONFIG_CRYPTO is not set +CONFIG_RCU_TRACE=yboard/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash new file +1
-0@@ -0,0 +1 @@ +../linux/linux.hashboard/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash new file +2
-0@@ -0,0 +1,2 @@ +# Locally calculated +sha256 a36dd3e82ceb634afded31f2656568f57c4d9c4b399859f298b18116df11c6fe linux-5.15.165.tar.xzboard/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash new file +2
-0@@ -0,0 +1,2 @@ +# Locally calculated +sha256 f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f u-boot-2024.07.tar.bz2board/stmicroelectronics/stm32f746-disco/post-build.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +BOARD_DIR="$(dirname "$0")" + +install -m 0644 -D "${BOARD_DIR}"/extlinux.conf "${BINARIES_DIR}"/extlinux/extlinux.confboard/stmicroelectronics/stm32f746-disco/readme.txt new file +31
-0@@ -0,0 +1,31 @@ +STM32F746-DISCO +=================== + +This tutorial describes how to use the predefined Buildroot +configuration for the STM32F746-DISCO evaluation platform. + +Building +-------- + + make stm32f746_disco_sd_defconfig + make + +Flashing +-------- + + ./board/stmicroelectronics/stm32f746-disco/flash_sd.sh output/ + +It will flash the U-boot bootloader. + +Creating SD card +---------------- + +Buildroot prepares an "sdcard.img" image in the output/images/ directory, +ready to be dumped on a SD card. Launch the following command as root: + + dd if=output/images/sdcard.img of=/dev/<your-sd-device> + +*** WARNING! This will destroy all the card content. Use with care! *** + +For details about the medium image layout and its content, see the +definition in board/stmicroelectronics/stm32f746-disco/genimage.cfg.configs/stm32f746_disco_sd_defconfig new file +32
-1@@ -0,0 +1,32 @@ +BR2_arm=y +BR2_cortex_m7=y +BR2_BINFMT_FDPIC=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y +BR2_GLOBAL_PATCH_DIR="board/stmicroelectronics/stm32f746-disco/patches" +BR2_DOWNLOAD_FORCE_CHECK_HASHES=y +BR2_INIT_TINYINIT=y +BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/stm32f746-disco/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32f746-disco/genimage.cfg" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.165" +BR2_LINUX_KERNEL_DEFCONFIG="stm32" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/stmicroelectronics/stm32f746-disco/linux.fragment" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f746-disco" +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_SIZE="32M" +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.07" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32f746-disco" +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_OPENOCD=y --Quoted 2 lines
2.30.2
Great work!
Support for FDPIC makes for a more stable system. The board test did not reveal any problems with shell command execution as was previously the case.
Quoted 5 lines
I did, however, make some modifications to the patch:
- I added my name back to the DEVELOPER file, as in v4
(https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/).
I think when you applied this patch this part was lost. Do you agree
that we can both be maintainers for this file?
Sure.
Quoted 5 lines
- As Thomas suggested, I removed the VFAT partition.
I would submit the whole series as version 2 where I would only modify this patch.
What do you think? Do you agree?
Sure feel free to sent a v2 with your modifications.
Thanks
Waldemar
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot