package/rpi-firmware: rework boot/config file handling
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
Try to be less smart (focused on the one target/one use-case), instead reduce the rpi-firmware package to a selectable list of (verbatim) installed firmware files.
- change rpi-firmware config handling from rpi-variant/rpi-flavour choices to bootcode.bin, pi-default/-extended/-cut-down and pi4-/default/-extended/-cut-down selection
- add BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE option to select installable config.txt file
- remove config.txt modify code/handling from raspberry post-image.sh script
- add different customized config.txt files to the raspberry board section
- change raspberry defconfigs to select appropiate rpi-firmware and config.txt files
- change genimage-raspberrypi4.cfg/genimage-raspberrypi4-64.cfg to use start4.elf and fixup4.dat
With this changes a better support for custom use-cases should be possible, specially multi-target SD cards as suggested by Stefan Agner ([1]).
[1] http://lists.busybox.net/pipermail/buildroot/2021-February/303318.html
---
Changes v1 -> v2:
- update genimage-raspberrypi4.cfg/genimage-raspberrypi4-64.cfg to use start4.elf and fixup4.dat
--- .../raspberrypi/config_0w.txt | 7 +- board/raspberrypi/config_3.txt | 26 +++++++ board/raspberrypi/config_3_64bit.txt | 30 +++++++ board/raspberrypi/config_3_qt5we.txt | 26 +++++++ board/raspberrypi/config_4.txt | 26 +++++++ board/raspberrypi/config_4_64bit.txt | 30 +++++++ board/raspberrypi/config_default.txt | 23 ++++++ .../raspberrypi/genimage-raspberrypi4-64.cfg | 4 +- board/raspberrypi/genimage-raspberrypi4.cfg | 4 +- board/raspberrypi/post-image.sh | 33 -------- configs/raspberrypi0_defconfig | 3 + configs/raspberrypi0w_defconfig | 4 +- configs/raspberrypi2_defconfig | 3 + configs/raspberrypi3_64_defconfig | 4 +- configs/raspberrypi3_defconfig | 4 +- configs/raspberrypi3_qt5we_defconfig | 4 +- configs/raspberrypi4_64_defconfig | 4 +- configs/raspberrypi4_defconfig | 2 +- configs/raspberrypi_defconfig | 3 + package/rpi-firmware/Config.in | 78 ++++++++----------- package/rpi-firmware/rpi-firmware.mk | 53 ++++++++++--- 21 files changed, 270 insertions(+), 101 deletions(-) rename package/rpi-firmware/config.txt => board/raspberrypi/config_0w.txt (79%) create mode 100644 board/raspberrypi/config_3.txt create mode 100644 board/raspberrypi/config_3_64bit.txt create mode 100644 board/raspberrypi/config_3_qt5we.txt create mode 100644 board/raspberrypi/config_4.txt create mode 100644 board/raspberrypi/config_4_64bit.txt create mode 100644 board/raspberrypi/config_default.txt
board/raspberrypi/config_0w.txt renamed from package/rpi-firmware/config.txt +4 -3
@@ -1,11 +1,9 @@ # Please note that this is only a sample, we recommend you to change it to fit # your needs. -# You should override this file using a post-build script. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. # See http://buildroot.org/manual.html#rootfs-custom # and http://elinux.org/RPiconfig for a description of config.txt syntax -# We always use the same names, the real used variant is selected by -# BR2_PACKAGE_RPI_FIRMWARE_{DEFAULT,X,CD} choice start_file=start.elf fixup_file=fixup.dat
@@ -23,3 +21,6 @@ disable_overscan=1 gpu_mem_256=100 gpu_mem_512=100 gpu_mem_1024=100 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-bt
board/raspberrypi/config_3.txt new file +26 -0
@@ -0,0 +1,26 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start.elf +fixup_file=fixup.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-bt
board/raspberrypi/config_3_64bit.txt new file +30 -0
@@ -0,0 +1,30 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start.elf +fixup_file=fixup.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-bt + +# enable 64bits support +arm_64bit=1 +
board/raspberrypi/config_3_qt5we.txt new file +26 -0
@@ -0,0 +1,26 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start.elf +fixup_file=fixup.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=200 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-bt
board/raspberrypi/config_4.txt new file +26 -0
@@ -0,0 +1,26 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start4.elf +fixup_file=fixup4.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-bt
board/raspberrypi/config_4_64bit.txt new file +30 -0
@@ -0,0 +1,30 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start4.elf +fixup_file=fixup4.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-bt + +# enable 64bits support +arm_64bit=1 +
board/raspberrypi/config_default.txt new file +23 -0
@@ -0,0 +1,23 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start.elf +fixup_file=fixup.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100
board/raspberrypi/genimage-raspberrypi4-64.cfg +2 -2
@@ -4,8 +4,8 @@ image boot.vfat { "bcm2711-rpi-4-b.dtb", "rpi-firmware/cmdline.txt", "rpi-firmware/config.txt", - "rpi-firmware/fixup.dat", - "rpi-firmware/start.elf", + "rpi-firmware/fixup4.dat", + "rpi-firmware/start4.elf", "rpi-firmware/overlays", "Image" }
board/raspberrypi/genimage-raspberrypi4.cfg +2 -2
@@ -4,8 +4,8 @@ image boot.vfat { "bcm2711-rpi-4-b.dtb", "rpi-firmware/cmdline.txt", "rpi-firmware/config.txt", - "rpi-firmware/fixup.dat", - "rpi-firmware/start.elf", + "rpi-firmware/fixup4.dat", + "rpi-firmware/start4.elf", "rpi-firmware/overlays", "zImage" }
board/raspberrypi/post-image.sh +0 -33
@@ -7,39 +7,6 @@ BOARD_NAME="$(basename ${BOARD_DIR})" GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARD_NAME}.cfg" GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" -for arg in "$@" -do - case "${arg}" in - --add-miniuart-bt-overlay) - if ! grep -qE '^dtoverlay=' "${BINARIES_DIR}/rpi-firmware/config.txt"; then - echo "Adding 'dtoverlay=miniuart-bt' to config.txt (fixes ttyAMA0 serial console)." - cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt" - -# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console -dtoverlay=miniuart-bt -__EOF__ - fi - ;; - --aarch64) - # Run a 64bits kernel (armv8) - sed -e '/^kernel=/s,=.*,=Image,' -i "${BINARIES_DIR}/rpi-firmware/config.txt" - if ! grep -qE '^arm_64bit=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then - cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt" - -# enable 64bits support -arm_64bit=1 -__EOF__ - fi - ;; - --gpu_mem_256=*|--gpu_mem_512=*|--gpu_mem_1024=*) - # Set GPU memory - gpu_mem="${arg:2}" - sed -e "/^${gpu_mem%=*}=/s,=.*,=${gpu_mem##*=}," -i "${BINARIES_DIR}/rpi-firmware/config.txt" - ;; - esac - -done - # Pass an empty rootpath. genimage makes a full copy of the given rootpath to # ${GENIMAGE_TMP}/root so passing TARGET_DIR would be a waste of time and disk # space. We don't rely on genimage to build the rootfs image, just to insert a
configs/raspberrypi0_defconfig +3 -0
@@ -20,6 +20,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-zero" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi0/config_default.txt" # BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set # Required tools to create the SD image
configs/raspberrypi0w_defconfig +3 -1
@@ -16,6 +16,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-zero-w" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi0w/config_0w.txt" # Required tools to create the SD image BR2_PACKAGE_HOST_DOSFSTOOLS=y
@@ -29,4 +32,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi0w/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi0w/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay"
configs/raspberrypi2_defconfig +3 -0
@@ -22,6 +22,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2709-rpi-2-b" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi/config_default.txt" # BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set # Required tools to create the SD image
configs/raspberrypi3_64_defconfig +3 -1
@@ -21,6 +21,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi- BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi3-64/config_3_64bit.txt" # Required tools to create the SD image BR2_PACKAGE_HOST_DOSFSTOOLS=y
@@ -34,4 +37,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3-64/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3-64/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--aarch64 --add-miniuart-bt-overlay"
configs/raspberrypi3_defconfig +3 -1
@@ -21,6 +21,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2710-r BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi3/config_3.txt" # Required tools to create the SD image BR2_PACKAGE_HOST_DOSFSTOOLS=y
@@ -34,4 +37,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay"
configs/raspberrypi3_qt5we_defconfig +3 -1
@@ -31,6 +31,9 @@ BR2_PACKAGE_QT5BASE_PNG=y BR2_PACKAGE_QT5WEBENGINE=y BR2_PACKAGE_QT5WEBENGINE_PROPRIETARY_CODECS=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi3/config_3_qt5we.txt" BR2_PACKAGE_RPI_USERLAND=y BR2_PACKAGE_CA_CERTIFICATES=y BR2_PACKAGE_NTP=y
@@ -48,4 +51,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="400M" BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay --gpu_mem_1024=200"
configs/raspberrypi4_64_defconfig +3 -1
@@ -21,6 +21,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2711-rpi-4-b" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi4-64/config_4.txt" + BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y # Required tools to create the SD image
@@ -35,4 +38,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi4-64/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi4-64/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay --aarch64"
configs/raspberrypi4_defconfig +1 -1
@@ -22,6 +22,7 @@ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi4/config_4.txt" # Required tools to create the SD image BR2_PACKAGE_HOST_DOSFSTOOLS=y
@@ -35,4 +36,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi4/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi4/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay"
configs/raspberrypi_defconfig +3 -0
@@ -21,6 +21,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-c BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi/config_default.txt" # BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set # Required tools to create the SD image
package/rpi-firmware/Config.in +34 -44
97 lines not on this page · raw message
package/rpi-firmware/rpi-firmware.mk +42 -11
67 lines not on this page · raw message
Signature · 1 line
2.30.0
PATCH v2 2/2 package/rpi-firmware: add option for the debug set of start/fixup boot files
Add option for the debug set of start/fixup boot files.
---
Changes v1 -> v2:
- new patch
--- package/rpi-firmware/Config.in | 10 ++++++++++ package/rpi-firmware/rpi-firmware.mk | 8 ++++++++ 2 files changed, 18 insertions(+)
package/rpi-firmware/Config.in +10 -0
@@ -35,6 +35,11 @@ config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD The cut-down set of files for versions Zero/1/2/3 (only features required to boot a Linux kernel). +config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_DB + bool "rpi 0/1/2/3 (debug)" + help + The debug set of files for versions Zero/1/2/3. + config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4 bool "rpi 4 (default)" help
@@ -53,6 +58,11 @@ config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_CD The cut-down set of files for versions 4 (only features required to boot a Linux kernel). +config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_DB + bool "rpi 4 (debug)" + help + The debug set of files for versions 4. + config BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE string "Patch to a file stored as boot/config.txt" help
package/rpi-firmware/rpi-firmware.mk +8 -0
@@ -26,6 +26,10 @@ ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD),y) RPI_FIRMWARE_FILES += start_cd.elf fixup_cd.dat endif +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_DB),y) +RPI_FIRMWARE_FILES += start_db.elf fixup_db.dat +endif + ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4),y) RPI_FIRMWARE_FILES += start4.elf fixup4.dat endif
@@ -38,6 +42,10 @@ ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_CD),y) RPI_FIRMWARE_FILES += start4cd.elf fixup4cd.dat endif +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_DB),y) +RPI_FIRMWARE_FILES += start4db.elf fixup4db.dat +endif + define RPI_FIRMWARE_INSTALL_BIN for firmwbin in $(RPI_FIRMWARE_FILES); do \ $(INSTALL) -D -m 0644 $(@D)/boot/$${firmwbin} $(BINARIES_DIR)/rpi-firmware/$${firmwbin} || exit 1; \
Signature · 1 line
2.30.0
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
In reply to Peter SeidererQuoted 20 lines · Peter Seiderer
Try to be less smart (focused on the one target/one use-case), instead reduce the rpi-firmware package to a selectable list of (verbatim) installed firmware files.
- change rpi-firmware config handling from rpi-variant/rpi-flavour choices to bootcode.bin, pi-default/-extended/-cut-down and pi4-/default/-extended/-cut-down selection
- add
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILEoption to select installable config.txt file- remove config.txt modify code/handling from raspberry
post-image.shscript- add different customized config.txt files to the raspberry board section
- change raspberry defconfigs to select appropiate rpi-firmware and config.txt files
Quoted 8 lines
- change genimage-raspberrypi4.cfg/genimage-raspberrypi4-64.cfg to use start4.elf and fixup4.dat
With this changes a better support for custom use-cases should be possible, specially multi-target SD cards as suggested by Stefan Agner ([1]).
[1] http://lists.busybox.net/pipermail/buildroot/2021-February/303318.html
Thanks for the patch! This seems to fit my use case nicely.
--
Stefan
Quoted 696 lines
Signed-off-by Peter Seiderer <[email protected]>---
Changes v1 -> v2:
- update genimage-raspberrypi4.cfg/genimage-raspberrypi4-64.cfg to use start4.elf and fixup4.dat--- .../raspberrypi/config_0w.txt | 7 +- board/raspberrypi/config_3.txt | 26 +++++++ board/raspberrypi/config_3_64bit.txt | 30 +++++++ board/raspberrypi/config_3_qt5we.txt | 26 +++++++ board/raspberrypi/config_4.txt | 26 +++++++ board/raspberrypi/config_4_64bit.txt | 30 +++++++ board/raspberrypi/config_default.txt | 23 ++++++ .../raspberrypi/genimage-raspberrypi4-64.cfg | 4 +- board/raspberrypi/genimage-raspberrypi4.cfg | 4 +- board/raspberrypi/post-image.sh | 33 -------- configs/raspberrypi0_defconfig | 3 + configs/raspberrypi0w_defconfig | 4 +- configs/raspberrypi2_defconfig | 3 + configs/raspberrypi3_64_defconfig | 4 +- configs/raspberrypi3_defconfig | 4 +- configs/raspberrypi3_qt5we_defconfig | 4 +- configs/raspberrypi4_64_defconfig | 4 +- configs/raspberrypi4_defconfig | 2 +- configs/raspberrypi_defconfig | 3 + package/rpi-firmware/Config.in | 78 ++++++++----------- package/rpi-firmware/rpi-firmware.mk | 53 ++++++++++--- 21 files changed, 270 insertions(+), 101 deletions(-) rename package/rpi-firmware/config.txt => board/raspberrypi/config_0w.txt (79%) create mode 100644 board/raspberrypi/config_3.txt create mode 100644 board/raspberrypi/config_3_64bit.txt create mode 100644 board/raspberrypi/config_3_qt5we.txt create mode 100644 board/raspberrypi/config_4.txt create mode 100644 board/raspberrypi/config_4_64bit.txt create mode 100644 board/raspberrypi/config_default.txtboard/raspberrypi/config_0w.txt renamed from package/rpi-firmware/config.txt +4
-3@@ -1,11 +1,9 @@ # Please note that this is only a sample, we recommend you to change it to fit # your needs. -# You should override this file using a post-build script. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. # See http://buildroot.org/manual.html#rootfs-custom # and http://elinux.org/RPiconfig for a description of config.txt syntax -# We always use the same names, the real used variant is selected by -# BR2_PACKAGE_RPI_FIRMWARE_{DEFAULT,X,CD} choice start_file=start.elf fixup_file=fixup.dat@@ -23,3 +21,6 @@ disable_overscan=1 gpu_mem_256=100 gpu_mem_512=100 gpu_mem_1024=100 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-btboard/raspberrypi/config_3.txt new file +26
-0@@ -0,0 +1,26 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start.elf +fixup_file=fixup.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-btboard/raspberrypi/config_3_64bit.txt new file +30
-0@@ -0,0 +1,30 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start.elf +fixup_file=fixup.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-bt + +# enable 64bits support +arm_64bit=1 +board/raspberrypi/config_3_qt5we.txt new file +26
-0@@ -0,0 +1,26 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start.elf +fixup_file=fixup.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=200 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-btboard/raspberrypi/config_4.txt new file +26
-0@@ -0,0 +1,26 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start4.elf +fixup_file=fixup4.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-btboard/raspberrypi/config_4_64bit.txt new file +30
-0@@ -0,0 +1,30 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start4.elf +fixup_file=fixup4.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-bt + +# enable 64bits support +arm_64bit=1 +board/raspberrypi/config_default.txt new file +23
-0@@ -0,0 +1,23 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start.elf +fixup_file=fixup.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100board/raspberrypi/genimage-raspberrypi4-64.cfg +2
-2@@ -4,8 +4,8 @@ image boot.vfat { "bcm2711-rpi-4-b.dtb", "rpi-firmware/cmdline.txt", "rpi-firmware/config.txt", - "rpi-firmware/fixup.dat", - "rpi-firmware/start.elf", + "rpi-firmware/fixup4.dat", + "rpi-firmware/start4.elf", "rpi-firmware/overlays", "Image" }board/raspberrypi/genimage-raspberrypi4.cfg +2
-2@@ -4,8 +4,8 @@ image boot.vfat { "bcm2711-rpi-4-b.dtb", "rpi-firmware/cmdline.txt", "rpi-firmware/config.txt", - "rpi-firmware/fixup.dat", - "rpi-firmware/start.elf", + "rpi-firmware/fixup4.dat", + "rpi-firmware/start4.elf", "rpi-firmware/overlays", "zImage" }board/raspberrypi/post-image.sh +0
-6@@ -7,39 +7,6 @@ BOARD_NAME="$(basename ${BOARD_DIR})" GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARD_NAME}.cfg" GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" -for arg in "$@" -do - case "${arg}" in - --add-miniuart-bt-overlay) - if ! grep -qE '^dtoverlay=' "${BINARIES_DIR}/rpi-firmware/config.txt"; then - echo "Adding 'dtoverlay=miniuart-bt' to config.txt (fixes ttyAMA0serial console)."
board/raspberrypi/post-image.sh +0
-22- cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt" - -# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console -dtoverlay=miniuart-bt -__EOF__ - fi - ;; - --aarch64) - # Run a 64bits kernel (armv8) - sed -e '/^kernel=/s,=.*,=Image,' -i "${BINARIES_DIR}/rpi-firmware/config.txt" - if ! grep -qE '^arm_64bit=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then - cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt" - -# enable 64bits support -arm_64bit=1 -__EOF__ - fi - ;; - --gpu_mem_256=*|--gpu_mem_512=*|--gpu_mem_1024=*) - # Set GPU memory - gpu_mem="${arg:2}" - sed -e "/^${gpu_mem%=*}=/s,=.*,=${gpu_mem##*=}," -i"
${BINARIES_DIR}/rpi-firmware/config.txt"board/raspberrypi/post-image.sh +0
-5- ;; - esac - -done - # Pass an empty rootpath. genimage makes a full copy of the given rootpath to # ${GENIMAGE_TMP}/root so passing TARGET_DIR would be a waste of time and disk # space. We don't rely on genimage to build the rootfs image, just to insert aconfigs/raspberrypi0_defconfig +3
-0@@ -20,6 +20,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-zero" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi0/config_default.txt" # BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set # Required tools to create the SD imageconfigs/raspberrypi0w_defconfig +3
-1@@ -16,6 +16,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-zero-w" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi0w/config_0w.txt" # Required tools to create the SD image BR2_PACKAGE_HOST_DOSFSTOOLS=y@@ -29,4 +32,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi0w/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi0w/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay"configs/raspberrypi2_defconfig +3
-0@@ -22,6 +22,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2709-rpi-2-b" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi/config_default.txt" # BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set # Required tools to create the SD imageconfigs/raspberrypi3_64_defconfig +0
-0@@ -21,6 +21,9 @@BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=yBR2_PACKAGE_RPI_FIRMWARE=y
configs/raspberrypi3_64_defconfig +3
-1+BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi3-64/config_3_64bit.txt" # Required tools to create the SD image BR2_PACKAGE_HOST_DOSFSTOOLS=y@@ -34,4 +37,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3-64/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3-64/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--aarch64 --add-miniuart-bt-overlay"configs/raspberrypi3_defconfig +0
-0@@ -21,6 +21,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2710-rpi-3-bbcm2710-rpi-3-b-plus bcm2710-r
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=yBR2_PACKAGE_RPI_FIRMWARE=y
configs/raspberrypi3_defconfig +3
-1+BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi3/config_3.txt" # Required tools to create the SD image BR2_PACKAGE_HOST_DOSFSTOOLS=y@@ -34,4 +37,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay"configs/raspberrypi3_qt5we_defconfig +3
-1@@ -31,6 +31,9 @@ BR2_PACKAGE_QT5BASE_PNG=y BR2_PACKAGE_QT5WEBENGINE=y BR2_PACKAGE_QT5WEBENGINE_PROPRIETARY_CODECS=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi3/config_3_qt5we.txt" BR2_PACKAGE_RPI_USERLAND=y BR2_PACKAGE_CA_CERTIFICATES=y BR2_PACKAGE_NTP=y@@ -48,4 +51,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="400M" BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay --gpu_mem_1024=200"configs/raspberrypi4_64_defconfig +3
-1@@ -21,6 +21,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2711-rpi-4-b" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi4-64/config_4.txt" + BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y # Required tools to create the SD image@@ -35,4 +38,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi4-64/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi4-64/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay --aarch64"configs/raspberrypi4_defconfig +1
-1@@ -22,6 +22,7 @@ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_RPI_FIRMWARE=y BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi4/config_4.txt" # Required tools to create the SD image BR2_PACKAGE_HOST_DOSFSTOOLS=y@@ -35,4 +36,3 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi4/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi4/post-image.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay"configs/raspberrypi_defconfig +0
-0@@ -21,6 +21,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-bbcm2708-rpi-b-plus bcm2708-rpi-c
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=yBR2_PACKAGE_RPI_FIRMWARE=y
configs/raspberrypi_defconfig +3
-0+BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi/config_default.txt" # BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set # Required tools to create the SD imagepackage/rpi-firmware/Config.in +32
-39@@ -11,63 +11,53 @@ config BR2_PACKAGE_RPI_FIRMWARE if BR2_PACKAGE_RPI_FIRMWARE -choice - bool "rpi variant" +config BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN + bool "rpi 0/1/2/3 bootcode.bin" help - The Raspberry Pi 4 introduced a slightly different naming - convention and set of boot files. This option controls which - format to use. + The bootcode.bin for versions Zero/1/2/3 (not needed on rpi4, + because it has been replaced by boot code in the onboard + EEPROM). config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI - bool "rpi 0/1/2/3" + bool "rpi 0/1/2/3 (default)" help - The default set of files, for versions pre-4 + The default set of files for versions Zero/1/2/3. -config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4 - bool "rpi 4" +config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_X + bool "rpi 0/1/2/3 (extended)" help - The Raspberry Pi 4 files -endchoice + The extended set of files for versions Zero/1/2/3 (additional + GPU features, eg. more audio/video codecs). -choice - bool "Firmware to boot" - default BR2_PACKAGE_RPI_FIRMWARE_DEFAULT +config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD + bool "rpi 0/1/2/3 (cut-down)" help - There are three different firmware files: - - the default firmware, that enables standard GPU - features; - - the extended firmware, that enables additional GPU - features (eg. more audio/video codecs); - - the cut-down firmware, for emergency situations, with - only features required to boot a Linux kernel. - -config BR2_PACKAGE_RPI_FIRMWARE_DEFAULT - bool "default" + The cut-down set of files for versions Zero/1/2/3 (only + features required to boot a Linux kernel). + +config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4 + bool "rpi 4 (default)" + help + The default set of files for versions 4 (standard GPU + features). + +config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X + bool "rpi 4 (extended)" help - The default firmware, that enables standard GPU features. + The extended set of files for versions 4 (additional GPU + features, eg. more audio/video codecs). -config BR2_PACKAGE_RPI_FIRMWARE_X - bool "extended ('x', more codecs)" +config BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_CD + bool "rpi 4 (cut-down)" help - The extended firmware, that enables additional GPU features - (eg. more audio/video codecs). + The cut-down set of files for versions 4 (only features + required to boot a Linux kernel). -config BR2_PACKAGE_RPI_FIRMWARE_CD - bool "cut-down ('cd', emergency)" +config BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE + string "Patch to a file stored as boot/config.txt" help - The cut-down firmware, for emergency situations, with only - features required to boot a Linux kernel. - -endchoice - -config BR2_PACKAGE_RPI_FIRMWARE_BOOT - string - default "" if BR2_PACKAGE_RPI_FIRMWARE_DEFAULT &&
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PIpackage/rpi-firmware/Config.in +0
-1- default "4" if BR2_PACKAGE_RPI_FIRMWARE_DEFAULT &&
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4package/rpi-firmware/Config.in +0
-1- default "_x" if BR2_PACKAGE_RPI_FIRMWARE_X &&
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PIpackage/rpi-firmware/Config.in +0
-1- default "4x" if BR2_PACKAGE_RPI_FIRMWARE_X &&
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4package/rpi-firmware/Config.in +0
-1- default "_cd" if BR2_PACKAGE_RPI_FIRMWARE_CD &&
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PIpackage/rpi-firmware/Config.in +0
-1- default "4cd" if BR2_PACKAGE_RPI_FIRMWARE_CD &&
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4package/rpi-firmware/Config.in +2
-0+ Path to a file stored as config.txt in the boot partiton + of the generated SD card image. config BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTBS bool "Install Device Tree Blobs (DTBs)"package/rpi-firmware/rpi-firmware.mk +37
-0@@ -10,6 +10,46 @@ RPI_FIRMWARE_LICENSE = BSD-3-Clause RPI_FIRMWARE_LICENSE_FILES = boot/LICENCE.broadcom RPI_FIRMWARE_INSTALL_IMAGES = YES +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN),y) +RPI_FIRMWARE_FILES += bootcode.bin +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI),y) +RPI_FIRMWARE_FILES += start.elf fixup.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_X),y) +RPI_FIRMWARE_FILES += startx.elf fixupx.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD),y) +RPI_FIRMWARE_FILES += start_cd.elf fixup_cd.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4),y) +RPI_FIRMWARE_FILES += start4.elf fixup4.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X),y) +RPI_FIRMWARE_FILES += start4x.elf fixup4x.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_CD),y) +RPI_FIRMWARE_FILES += start4cd.elf fixup4cd.dat +endif + +define RPI_FIRMWARE_INSTALL_BIN + for firmwbin in $(RPI_FIRMWARE_FILES); do \ + $(INSTALL) -D -m 0644 $(@D)/boot/$${firmwbin} $(BINARIES_DIR)/rpi-firmware/$${firmwbin} || exit 1; \ + done +endef + +ifneq ($(BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE),) +define RPI_FIRMWARE_INSTALL_CONFIG + $(INSTALL) -D -m 0644 $(BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE)$(BINARIES_DIR)/rpi-firmware/config.txt
package/rpi-firmware/rpi-firmware.mk +3
-2+endef +endif + ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTBS),y) define RPI_FIRMWARE_INSTALL_DTB $(foreach dtb,$(wildcard $(@D)/boot/*.dtb), \@@ -41,19 +81,10 @@ define RPI_FIRMWARE_INSTALL_TARGET_CMDS endef endif # INSTALL_VCDBG -ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI),y) -# bootcode.bin is not used on rpi4, because it has been replaced byboot code in the onboard EEPROM
package/rpi-firmware/rpi-firmware.mk +0
-2-define RPI_FIRMWARE_INSTALL_BOOTCODE_BIN - $(INSTALL) -D -m 0644 $(@D)/boot/bootcode.bin$(BINARIES_DIR)/rpi-firmware/bootcode.bin
package/rpi-firmware/rpi-firmware.mk +0
-4-endef -endif - define RPI_FIRMWARE_INSTALL_IMAGES_CMDS - $(INSTALL) -D -m 0644 package/rpi-firmware/config.txt$(BINARIES_DIR)/rpi-firmware/config.txt
$(INSTALL) -D -m 0644package/rpi-firmware/cmdline.txt
$(BINARIES_DIR)/rpi-firmware/cmdline.txtpackage/rpi-firmware/rpi-firmware.mk +0
-1- $(INSTALL) -D -m 0644$(@D)/boot/start$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).elf $(BINARIES_DIR)/rpi-firmware/start.elf
package/rpi-firmware/rpi-firmware.mk +0
-1- $(INSTALL) -D -m 0644$(@D)/boot/fixup$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).dat $(BINARIES_DIR)/rpi-firmware/fixup.dat
package/rpi-firmware/rpi-firmware.mk +2
-1- $(RPI_FIRMWARE_INSTALL_BOOTCODE_BIN) + $(RPI_FIRMWARE_INSTALL_BIN) + $(RPI_FIRMWARE_INSTALL_CONFIG) $(RPI_FIRMWARE_INSTALL_DTB) $(RPI_FIRMWARE_INSTALL_DTB_OVERLAYS) endef
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
In reply to Peter SeidererPeter, All,
On 2021-02-16 21:11 +0100, Peter Seiderer spake thusly:
Quoted 23 lines
Try to be less smart (focused on the one target/one use-case), instead reduce the rpi-firmware package to a selectable list of (verbatim) installed firmware files.
- change rpi-firmware config handling from rpi-variant/rpi-flavour choices to bootcode.bin, pi-default/-extended/-cut-down and pi4-/default/-extended/-cut-down selection
- add
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILEoption to select installable config.txt file- remove config.txt modify code/handling from raspberry
post-image.shscript- add different customized config.txt files to the raspberry board section
- change raspberry defconfigs to select appropiate rpi-firmware and config.txt files
- change genimage-raspberrypi4.cfg/genimage-raspberrypi4-64.cfg to use start4.elf and fixup4.dat
Quoted 7 lines
With this changes a better support for custom use-cases should be possible, specially multi-target SD cards as suggested by Stefan Agner ([1]).
[1] http://lists.busybox.net/pipermail/buildroot/2021-February/303318.html
Signed-off-by Peter Seiderer <[email protected]>
So I have started looking at this patch, and although I think it is going in the right direction, there are two things I am not very happy with...
I'm not saying they would be definite blockers, just that I'd like we think a bit more about it.
So, the first thing that bugs me, are all the varions config.txt files that are mostly identical, except of a few tweaks:
- dtoverlay=miniuart-bt or not
- arm_64bit=1 or not
And the arm_64bit=1 can be automatically added when Buildroot is configured for BR2_aarch64=y anyway.
And of course, a single outlier, the qt5we example, that has gpu_mem_1024=200...
Still, that makes me nervous to mostly duplicate all those config.txt...
The second thing leaves me thinking is the new config option that points to the config.txt to use. My first reaction was 'hell-no, this belongs to the post-image script and we should have it passed with BR2_ROOTFS_POST_SCRIPT_ARGS="board/rpiXXX/config_XXX.txt".'
But them this means that the rpi post-image script diverges from the others; the few others I've had a look at are just callinggenimage without amy preparation whatsoever. The rpi one is already diverging, as it creates a temporary empty rootpath (commit ee47fea5781) and currently has a few options that none of the others have.
Getting rid of the existing options --miniuart, --aarch64, et al. is a nice thing, because it helps get it more inline with the others...
But still, I am not too fond of this new BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE option...
And really, both issues are really just me wondering if we can't do better...
So, let's keep the qt5 example aside, and see what we can do. What if we'd go with the following:
- keep a single, generic config.txt in rpi-firmware, and install that,
- if BR2_aarch64=y, add arm_64bit=1
- add an option to rpi-firmware:
config BR2_PKG_RPI_FW_DTOVERLAY_LIST
string "DT overlays to load"
depends on BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS help
Space-separated list of DT overlays to be loaded from config.txt.
For example, miniuart-bt on rpi0w to restore the serial console.
and if this option is not empty, construct the list of dtoverlay and add it to config.txt.
- eventually, adapt the defconfigs with that list of dtoverlays
Thoughts?
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
Hello Yann,
Quoted 90 lines · Yann E. MORIN
Peter, All,
On 2021-02-16 21:11 +0100, Peter Seiderer spake thusly:
Quoted 23 lines
Try to be less smart (focused on the one target/one use-case), instead reduce the rpi-firmware package to a selectable list of (verbatim) installed firmware files.
- change rpi-firmware config handling from rpi-variant/rpi-flavour choices to bootcode.bin, pi-default/-extended/-cut-down and pi4-/default/-extended/-cut-down selection
- add
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILEoption to select installable config.txt file- remove config.txt modify code/handling from raspberry
post-image.shscript- add different customized config.txt files to the raspberry board section
- change raspberry defconfigs to select appropiate rpi-firmware and config.txt files
- change genimage-raspberrypi4.cfg/genimage-raspberrypi4-64.cfg to use start4.elf and fixup4.dat
Quoted 7 lines
With this changes a better support for custom use-cases should be possible, specially multi-target SD cards as suggested by Stefan Agner ([1]).
[1] http://lists.busybox.net/pipermail/buildroot/2021-February/303318.html
Signed-off-by Peter Seiderer <[email protected]>So I have started looking at this patch, and although I think it is going in the right direction, there are two things I am not very happy with...
I'm not saying they would be definite blockers, just that I'd like we think a bit more about it.
So, the first thing that bugs me, are all the varions config.txt files that are mostly identical, except of a few tweaks:
- dtoverlay=miniuart-bt or not
- arm_64bit=1 or notAnd the arm_64bit=1 can be automatically added when Buildroot is configured for BR2_aarch64=y anyway.
And of course, a single outlier, the qt5we example, that has gpu_mem_1024=200...
Still, that makes me nervous to mostly duplicate all those config.txt...
The second thing leaves me thinking is the new config option that points to the config.txt to use. My first reaction was 'hell-no, this belongs to the post-image script and we should have it passed with BR2_ROOTFS_POST_SCRIPT_ARGS="board/rpiXXX/config_XXX.txt".'
But them this means that the rpi post-image script diverges from the others; the few others I've had a look at are just callinggenimage without amy preparation whatsoever. The rpi one is already diverging, as it creates a temporary empty rootpath (commit
ee47fea5781) and currently has a few options that none of the others have.Getting rid of the existing options --miniuart, --aarch64, et al. is a nice thing, because it helps get it more inline with the others...
But still, I am not too fond of this new
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILEoption...And really, both issues are really just me wondering if we can't do better...
So, let's keep the qt5 example aside, and see what we can do. What if we'd go with the following:
- keep a single, generic config.txt in rpi-firmware, and install that,
- if BR2_aarch64=y, add arm_64bit=1
- add an option to rpi-firmware:
config
BR2_PKG_RPI_FW_DTOVERLAY_LIST
string "DT overlays to load"
depends onBR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYShelp
Space-separated list of DT overlays to be loaded from config.txt.
Quoted 6 lines
For example, miniuart-bt on rpi0w to restore the serial console.
and if this option is not empty, construct the list of dtoverlay and add it to config.txt.
- eventually, adapt the defconfigs with that list of dtoverlays
...but back to the direction of trying to being smart..., which can work for 90% of the buildroot defconfig cases, but will not work for the rest of the buildroot ones (one at the moment) and not for customized ones (none dtoverlay extensions, multi-bootable SD-Cards, ...)...
Regards,
Peter
Quoted 6 lines
Thoughts?
Regards,
Yann E. MORIN.
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
Peter, All,
On 2021-03-08 23:14 +0100, Peter Seiderer spake thusly:
Quoted 5 lines · Yann E. MORIN
Quoted 4 lines
On 2021-02-16 21:11 +0100, Peter Seiderer spake thusly:
Quoted 3 lines
Try to be less smart (focused on the one target/one use-case), instead reduce the rpi-firmware package to a selectable list of (verbatim) installed firmware files.
[--SNIP--]
Quoted 20 lines
Quoted 20 lines
So, let's keep the qt5 example aside, and see what we can do. What if we'd go with the following:
- keep a single, generic config.txt in rpi-firmware, and install that,
- if BR2_aarch64=y, add arm_64bit=1
- add an option to rpi-firmware:
config
BR2_PKG_RPI_FW_DTOVERLAY_LIST
string "DT overlays to load"
depends onBR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYShelp
Space-separated list of DT overlays to be loaded from config.txt.For example, miniuart-bt on rpi0w to restore the serial console.
and if this option is not empty, construct the list of dtoverlay and add it to config.txt.
Quoted 6 lines
Quoted 1 line
- eventually, adapt the defconfigs with that list of dtoverlays
...but back to the direction of trying to being smart..., which can work for 90% of the buildroot defconfig cases, but will not work for the rest of the buildroot ones (one at the moment) and not for customized ones (none dtoverlay extensions, multi-bootable SD-Cards, ...)...
I would think quite the opposite, in fact: with an otion, it's up to the user to specify what DT overlays to load; this is more flexible than a config.txt file.
For fixup.dat and start/elf, we'd still use your changes, of course.
And for arm_64bit=1 this is really a non-option: if we build for 64-bit then we *must* have arm_64bit=1, while if we build for 32-bit, the we *must not* have arm_64bit=1.
The only case that this indeed does not cover, is the case where the user wants to pas their completely customsied config.txt that totally differs from ours. In that case, they can still do so with a post-build script that copies their config.txt over ours in BINARIES_DIR.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
Hello Yann,
Quoted 31 lines · Yann E. MORIN
Peter, All,
On 2021-03-08 23:14 +0100, Peter Seiderer spake thusly:
Quoted 5 lines · Yann E. MORIN
Quoted 4 lines
On 2021-02-16 21:11 +0100, Peter Seiderer spake thusly:
Quoted 3 lines
Try to be less smart (focused on the one target/one use-case), instead reduce the rpi-firmware package to a selectable list of (verbatim) installed firmware files.
[--SNIP--]
Quoted 22 lines
Quoted 21 lines
So, let's keep the qt5 example aside, and see what we can do. What if we'd go with the following:
- keep a single, generic config.txt in rpi-firmware, and install that,
- if BR2_aarch64=y, add arm_64bit=1
- add an option to rpi-firmware:
config
BR2_PKG_RPI_FW_DTOVERLAY_LIST
string "DT overlays to load"
depends onBR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYShelp
Space-separated list of DT overlays to be loaded from config.txt.For example, miniuart-bt on rpi0w to restore the serial console.
and if this option is not empty, construct the list of dtoverlay and add it to config.txt.
- eventually, adapt the defconfigs with that list of dtoverlays
Quoted 8 lines
Quoted 4 lines
...but back to the direction of trying to being smart..., which can work for 90% of the buildroot defconfig cases, but will not work for the rest of the buildroot ones (one at the moment) and not for customized ones (none dtoverlay extensions, multi-bootable SD-Cards, ...)...
I would think quite the opposite, in fact: with an otion, it's up to the user to specify what DT overlays to load; this is more flexible than a config.txt file.
More flexible than the possibility for a custom config.txt (mind that there are overlays with parameters and more possible options besides the overlays)?
Quoted 11 lines
For fixup.dat and start/elf, we'd still use your changes, of course.
And for arm_64bit=1 this is really a non-option: if we build for 64-bit then we *must* have arm_64bit=1, while if we build for 32-bit, the we *must not* have arm_64bit=1.
The only case that this indeed does not cover, is the case where the user wants to pas their completely customsied config.txt that totally differs from ours. In that case, they can still do so with a post-build script that copies their config.txt over ours in
BINARIES_DIR.
The part with 'override' feels a little bit ugly and would count for me as an argument against the hard-coded logic/overlays-only approach, still believing that sooner or later most/every beyond-buildroot-defconfig-only user will use a hand-crafted config.txt file...
Regards,
Peter
Quoted 4 lines
Regards,
Yann E. MORIN.
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
Peter, All,
On 2021-03-09 21:32 +0100, Peter Seiderer spake thusly:
Quoted 23 lines · Yann E. MORIN
Quoted 22 lines
On 2021-03-08 23:14 +0100, Peter Seiderer spake thusly:
Quoted 5 lines · Yann E. MORIN
Quoted 4 lines
On 2021-02-16 21:11 +0100, Peter Seiderer spake thusly:
Quoted 3 lines
Try to be less smart (focused on the one target/one use-case), instead reduce the rpi-firmware package to a selectable list of (verbatim) installed firmware files.
[--SNIP--]
Quoted 15 lines
Quoted 15 lines
So, let's keep the qt5 example aside, and see what we can do. What if we'd go with the following:
- keep a single, generic config.txt in rpi-firmware, and install that,
- if BR2_aarch64=y, add arm_64bit=1
- add an option to rpi-firmware:
config
BR2_PKG_RPI_FW_DTOVERLAY_LIST
string "DT overlays to load"
depends onBR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYShelp
Space-separated list of DT overlays to be loaded from config.txt.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
For example, miniuart-bt on rpi0w to restore the serial console.
and if this option is not empty, construct the list of dtoverlay and add it to config.txt.
- eventually, adapt the defconfigs with that list of dtoverlays
[--SNIP--]
Quoted 2 lines
More flexible than the possibility for a custom config.txt (mind that there are overlays with parameters and more possible options besides the overlays)?
[--SNIP--]
Quoted 4 lines
The part with 'override' feels a little bit ugly and would count for me as an argument against the hard-coded logic/overlays-only approach, still believing that sooner or later most/every beyond-buildroot-defconfig-only user will use a hand-crafted config.txt file...
OK, so here's my new proposal:
- keep your BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE, which points to a default, basic one, not unlike the busybox default config:
default "package/rpi-firmware/config.txt"
- package/rpi-firmware/config.txt is just the common part of all the config.txt you currently had in your patch
- rpi-firmware.mk will add arm_64bit=1 as needed, based on BR2_aarch64=y, because that *really* is not an option.
- add BR2_PKG_RPI_FW_DTOVERLAY_LIST as I suggest above, which is not empty, will be copied as is to dtoverlay
- change the defconfig files to just set:
BR2_PKG_RPI_FW_DTOVERLAY_LIST="miniuart-bt"
That way, we get best of both worlds:
- we avoid duplication of the config.txt, and we can still customise it a bit with just "easy stuff" that we need for our example defconfigs,
- users can stil point to their custom, fine-tuned config.txt (in which case they will probably not set BR2_PKG_RPI_FW_DTOVERLAY_LIST)
Thoughts?
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
Peter, All,
On 2021-03-09 22:29 +0100, Yann E. MORIN spake thusly:
[--SNIP--]
Quoted 5 lines
OK, so here's my new proposal:
- keep your
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE, which points to a default, basic one, not unlike the busybox default config:
default "package/rpi-firmware/config.txt"
I meant: "not unlike what we do with the busybox default config"
Sorry for any confusion...
Regards,
Yann E. MORIN.
Quoted 37 lines
-
package/rpi-firmware/config.txtis just the common part of all the config.txt you currently had in your patch- rpi-firmware.mk will add arm_64bit=1 as needed, based on BR2_aarch64=y, because that *really* is not an option.
- add
BR2_PKG_RPI_FW_DTOVERLAY_LISTas I suggest above, which is not empty, will be copied as is to dtoverlay- change the defconfig files to just set:
BR2_PKG_RPI_FW_DTOVERLAY_LIST="miniuart-bt"That way, we get best of both worlds:
- we avoid duplication of the config.txt, and we can still customise it a bit with just "easy stuff" that we need for our example defconfigs,
- users can stil point to their custom, fine-tuned config.txt (in which case they will probably not set
BR2_PKG_RPI_FW_DTOVERLAY_LIST)Thoughts?
Regards,
Yann E. MORIN.Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
In reply to Yann E. MORINHello Yann,
Quoted 59 lines · Yann E. MORIN
Peter, All,
On 2021-03-09 21:32 +0100, Peter Seiderer spake thusly:
Quoted 23 lines · Yann E. MORIN
Quoted 22 lines
On 2021-03-08 23:14 +0100, Peter Seiderer spake thusly:
Quoted 5 lines · Yann E. MORIN
Quoted 4 lines
On 2021-02-16 21:11 +0100, Peter Seiderer spake thusly:
Quoted 3 lines
Try to be less smart (focused on the one target/one use-case), instead reduce the rpi-firmware package to a selectable list of (verbatim) installed firmware files.
[--SNIP--]
Quoted 15 lines
Quoted 15 lines
So, let's keep the qt5 example aside, and see what we can do. What if we'd go with the following:
- keep a single, generic config.txt in rpi-firmware, and install that,
- if BR2_aarch64=y, add arm_64bit=1
- add an option to rpi-firmware:
config
BR2_PKG_RPI_FW_DTOVERLAY_LIST
string "DT overlays to load"
depends onBR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYShelp
Space-separated list of DT overlays to be loaded from config.txt.Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
For example, miniuart-bt on rpi0w to restore the serial console.
and if this option is not empty, construct the list of dtoverlay and add it to config.txt.
- eventually, adapt the defconfigs with that list of dtoverlays
[--SNIP--]
Quoted 2 lines
More flexible than the possibility for a custom config.txt (mind that there are overlays with parameters and more possible options besides the overlays)?
[--SNIP--]
Quoted 4 lines
The part with 'override' feels a little bit ugly and would count for me as an argument against the hard-coded logic/overlays-only approach, still believing that sooner or later most/every beyond-buildroot-defconfig-only user will use a hand-crafted config.txt file...
OK, so here's my new proposal:
- keep your
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE, which points to a default, basic one, not unlike the busybox default config:
default "package/rpi-firmware/config.txt"-
package/rpi-firmware/config.txtis just the common part of all the config.txt you currently had in your patch- rpi-firmware.mk will add arm_64bit=1 as needed, based on BR2_aarch64=y, because that *really* is not an option.
- add
BR2_PKG_RPI_FW_DTOVERLAY_LISTas I suggest above, which is not empty, will be copied as is to dtoverlay- change the defconfig files to just set:
BR2_PKG_RPI_FW_DTOVERLAY_LIST="miniuart-bt"
Quoted 8 lines
That way, we get best of both worlds:
- we avoid duplication of the config.txt, and we can still customise it a bit with just "easy stuff" that we need for our example defconfigs,
- users can stil point to their custom, fine-tuned config.txt (in which case they will probably not set
BR2_PKG_RPI_FW_DTOVERLAY_LIST)
Finally found time for a new iteration of the patch set:
- fixed two bugs
- changed the firmware list handling to one-assignment style
- changed the firmware install to make-level foreach loop
- changed the dtb overlay install to make-level foreach loop
- kept the verbatim BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE option, as your suggestion missed one more point where the config.txt files diverge (aside from dtoverlay=miniuart-bt and arm_64bit=1), the start_file=start.elf/fixup_file=fixup.dat or start_file=start4.elf/ fixup_file=fixup4.dat as the firmware files are now copied verbatim..., and still confident that the principal of taking a verbatim copy of a given file is more flexible than implementing some more or less smart logic...
Regards,
Peter
Quoted 6 lines
Thoughts?
Regards,
Yann E. MORIN.
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
Peter, All,
On 2021-03-18 23:25 +0100, Peter Seiderer spake thusly:
Quoted 35 lines · Yann E. MORIN
Quoted 18 lines
OK, so here's my new proposal:
- keep your
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE, which points to a default, basic one, not unlike the busybox default config:
default "package/rpi-firmware/config.txt"-
package/rpi-firmware/config.txtis just the common part of all the config.txt you currently had in your patch- rpi-firmware.mk will add arm_64bit=1 as needed, based on BR2_aarch64=y, because that *really* is not an option.
- add
BR2_PKG_RPI_FW_DTOVERLAY_LISTas I suggest above, which is not empty, will be copied as is to dtoverlay- change the defconfig files to just set:
BR2_PKG_RPI_FW_DTOVERLAY_LIST="miniuart-bt"Quoted 8 lines
That way, we get best of both worlds:
- we avoid duplication of the config.txt, and we can still customise it a bit with just "easy stuff" that we need for our example defconfigs,
- users can stil point to their custom, fine-tuned config.txt (in which case they will probably not set
BR2_PKG_RPI_FW_DTOVERLAY_LIST)Finally found time for a new iteration of the patch set:
- fixed two bugs
- changed the firmware list handling to one-assignment style
- changed the firmware install to make-level foreach loop
- changed the dtb overlay install to make-level foreach loop
Quoted 8 lines
- kept the verbatim
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILEoption, as your suggestion missed one more point where the config.txt files diverge (aside from dtoverlay=miniuart-bt and arm_64bit=1), the start_file=start.elf/fixup_file=fixup.dat or start_file=start4.elf/ fixup_file=fixup4.dat as the firmware files are now copied verbatim..., and still confident that the principal of taking a verbatim copy of a given file is more flexible than implementing some more or less smart logic...
But now, you will notice that all the config.txt will load the default fixups/start_file blobs appropriate for the hardware, so they do not need to be specified. The rpi docs state they are "an advanced option".
Also, I wonder why we specify a memory split. 100M for the GPU seems arbitrary. We should keep the defaults unless there is a reason not to, and thus not specify any.
We're now left with just the qt5we defconfig that differs just because a bit more memory is allocated tp the GPU on the 1GB+ models. But if we indeed drop setting the memory split between CPU/GPU, then we no longer need a special config.txt for qt5we either, at the expense of a bit of memory on the ARM side (but that should be OK as it is OK for smaller RAMs...).
As for the 64-bit thing: I insist that we *must* enforce it to be set to the proper value, i.e. 0 (or not set) for 32-bit builds, and 1 for 64-bit builds, because that variable is not an option: its value really depends on theconfiguration of the build, not on users' customisation will.
Eventually, we're left with the dtoverlay variable. Appending the value of that variable, if set, verbatim into the config.txt is not trying to be too smart, I believe. ;-)
So we can have a single config.txt, with a very easy way for users to base off that with dtoverlay customisations, and if they need more tricks, they can provide their own config.txt and/or their own post-build script, to apply whatever customisations they need.
At the very extreme, if the BR2_PKG_RPI_FW_DTOVERLAY_LIST variable is still seen as being too smart, then I think we could maybe have two config.txt: one that loads the miniuart-bt dtoverlay, and one that does not.
And finally, we should get rid of the commented-out initramfs setting. I don't want that we document the file; rather, I want users to read the documentation at the source, i.e. the rpi foundation-maintained docs:
https://www.raspberrypi.org/documentation/configuration/config-txt/README.md
https://www.raspberrypi.org/documentation/configuration/boot_folder.md
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
Hello Yann, All,
Quoted 47 lines · Yann E. MORIN
Peter, All,
On 2021-03-18 23:25 +0100, Peter Seiderer spake thusly:
Quoted 35 lines · Yann E. MORIN
Quoted 18 lines
OK, so here's my new proposal:
- keep your
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE, which points to a default, basic one, not unlike the busybox default config:
default "package/rpi-firmware/config.txt"-
package/rpi-firmware/config.txtis just the common part of all the config.txt you currently had in your patch- rpi-firmware.mk will add arm_64bit=1 as needed, based on BR2_aarch64=y, because that *really* is not an option.
- add
BR2_PKG_RPI_FW_DTOVERLAY_LISTas I suggest above, which is not empty, will be copied as is to dtoverlay- change the defconfig files to just set:
BR2_PKG_RPI_FW_DTOVERLAY_LIST="miniuart-bt"Quoted 8 lines
That way, we get best of both worlds:
- we avoid duplication of the config.txt, and we can still customise it a bit with just "easy stuff" that we need for our example defconfigs,
- users can stil point to their custom, fine-tuned config.txt (in which case they will probably not set
BR2_PKG_RPI_FW_DTOVERLAY_LIST)Finally found time for a new iteration of the patch set:
- fixed two bugs
- changed the firmware list handling to one-assignment style
- changed the firmware install to make-level foreach loop
- changed the dtb overlay install to make-level foreach loopQuoted 8 lines
- kept the verbatim
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILEoption, as your suggestion missed one more point where the config.txt files diverge (aside from dtoverlay=miniuart-bt and arm_64bit=1), the start_file=start.elf/fixup_file=fixup.dat or start_file=start4.elf/ fixup_file=fixup4.dat as the firmware files are now copied verbatim..., and still confident that the principal of taking a verbatim copy of a given file is more flexible than implementing some more or less smart logic...
Quoted 3 lines
But now, you will notice that all the config.txt will load the default fixups/start_file blobs appropriate for the hardware, so they do not need to be specified. The rpi docs state they are "an advanced option".
But it does not hurt (and is a good hint/starting point for how to use the other available files provided by rpi-firmware), and I would call the buildroot users advanced (in comparison to the plain raspian users) ;-)
Quoted 4 lines
Also, I wonder why we specify a memory split. 100M for the GPU seems arbitrary. We should keep the defaults unless there is a reason not to, and thus not specify any.
Not part of this patch set/discussion, but for sure something to improve (in a preliminary patch or afterwards)...
Quoted 7 lines
We're now left with just the qt5we defconfig that differs just because a bit more memory is allocated tp the GPU on the 1GB+ models. But if we indeed drop setting the memory split between CPU/GPU, then we no longer need a special config.txt for qt5we either, at the expense of a bit of memory on the ARM side (but that should be OK as it is OK for smaller RAMs...).
And the kernel image name....
Quoted 7 lines
As for the 64-bit thing: I insist that we *must* enforce it to be set to the proper value, i.e. 0 (or not set) for 32-bit builds, and 1 for 64-bit builds, because that variable is not an option: its value really depends on theconfiguration of the build, not on users' customisation will.
Quoted 8 lines
Eventually, we're left with the dtoverlay variable. Appending the value of that variable, if set, verbatim into the config.txt is not trying to be too smart, I believe. ;-)
So we can have a single config.txt, with a very easy way for users to base off that with dtoverlay customisations, and if they need more tricks, they can provide their own config.txt and/or their own post-build script, to apply whatever customisations they need.
Still do not see the advantage of tweaking one config.txt file to suit the different use cases instead of a configure option for selecting a verbatim copied one (we store different genimage files too instead of tweaking one to fit)....
What is so bad about providing a RPI_FIRMWARE_CONFIG_FILE option (similar as already done for uboot, kernel, busybox, uclibc,...)? An option which is easily explained to buildroot users compared to '...you must adjust a script to copy (or tweak) some file to some specific location....'?
Quoted 5 lines
At the very extreme, if the
BR2_PKG_RPI_FW_DTOVERLAY_LISTvariable is still seen as being too smart, then I think we could maybe have two config.txt: one that loads the miniuart-bt dtoverlay, and one that does not.
See above, already provided by RPI_FIRMWARE_CONFIG_FILE option...
Quoted 7 lines
And finally, we should get rid of the commented-out initramfs setting. I don't want that we document the file; rather, I want users to read the documentation at the source, i.e. the rpi foundation-maintained docs:
https://www.raspberrypi.org/documentation/configuration/config-txt/README.md
https://www.raspberrypi.org/documentation/configuration/boot_folder.md
Not part of this patch set/discussion, but for sure something to improve (in a preliminary patch or afterwards)...
Regards,
Peter
Quoted 5 lines
Regards,
Yann E. MORIN.
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
In reply to Peter SeidererPeter, All,
Second part of the review... ;-)
On 2021-02-16 21:11 +0100, Peter Seiderer spake thusly:
Quoted 23 lines
Try to be less smart (focused on the one target/one use-case), instead reduce the rpi-firmware package to a selectable list of (verbatim) installed firmware files.
- change rpi-firmware config handling from rpi-variant/rpi-flavour choices to bootcode.bin, pi-default/-extended/-cut-down and pi4-/default/-extended/-cut-down selection
- add
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILEoption to select installable config.txt file- remove config.txt modify code/handling from raspberry
post-image.shscript- add different customized config.txt files to the raspberry board section
- change raspberry defconfigs to select appropiate rpi-firmware and config.txt files
- change genimage-raspberrypi4.cfg/genimage-raspberrypi4-64.cfg to use start4.elf and fixup4.dat
Quoted 7 lines
With this changes a better support for custom use-cases should be possible, specially multi-target SD cards as suggested by Stefan Agner ([1]).
[1] http://lists.busybox.net/pipermail/buildroot/2021-February/303318.html
Signed-off-by Peter Seiderer <[email protected]>
[--SNIP--]
Quoted 25 lines
package/rpi-firmware/rpi-firmware.mk +17
-0@@ -10,6 +10,46 @@ RPI_FIRMWARE_LICENSE = BSD-3-Clause RPI_FIRMWARE_LICENSE_FILES = boot/LICENCE.broadcom RPI_FIRMWARE_INSTALL_IMAGES = YES +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN),y) +RPI_FIRMWARE_FILES += bootcode.bin +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI),y) +RPI_FIRMWARE_FILES += start.elf fixup.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_X),y) +RPI_FIRMWARE_FILES += startx.elf fixupx.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD),y) +RPI_FIRMWARE_FILES += start_cd.elf fixup_cd.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4),y)
package/rpi-firmware/rpi-firmware.mk RPI_FIRMWARE_LICENSE = BSD-3-Clause · line 39
Quoted 10 lines
package/rpi-firmware/rpi-firmware.mk +10
-0+RPI_FIRMWARE_FILES += start4.elf fixup4.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X),y) +RPI_FIRMWARE_FILES += start4x.elf fixup4x.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_CD),y) +RPI_FIRMWARE_FILES += start4cd.elf fixup4cd.dat +endif
What about:
RPI_FIRMWARE_FILES = \
$(if $(BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN),bootcode.bin) \
$(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI),start.elf fixup.dat) \
$(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_X),startx.elf fixupx.dat) \
$(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD),start_cd.elf fixup_cd.dat) \
$(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4),start4.elf fixup4.dat) \
$(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X),start4x.elf fixup4x.dat) \
$(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_CD),start4cd.elf fixup4cd.dat)Or alternatively:
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN) += bootcode.bin
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI) += start.elf fixup.dat
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_X) += startx.elf fixupx.dat
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD) += start_cd.elf fixup_cd.dat
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4) += start4.elf fixup4.dat
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X) += start4x.elf fixup4x.dat
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_CD) += start4cd.elf fixup4cd.dat
define RPI_FIRMWARE_INSTALL_BIN
$(foreach f,$(RPI_FIRMWARE_FILES_y),
$(INSTALL) -D -m 0644 $(@D)/$(f) $(BINARIES_DIR)/rpi-firmware/$(f)
)
endefpackage/rpi-firmware/rpi-firmware.mk RPI_FIRMWARE_LICENSE = BSD-3-Clause · line 44
Quoted 4 lines
package/rpi-firmware/rpi-firmware.mk +4
-0+define RPI_FIRMWARE_INSTALL_BIN + for firmwbin in $(RPI_FIRMWARE_FILES); do \ + $(INSTALL) -D -m 0644 $(@D)/boot/$${firmwbin} $(BINARIES_DIR)/rpi-firmware/$${firmwbin} || exit 1; \ + done
Use a make-level $(foreach) loop rather than a shell loop (see example above).
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
Hello Yann,
Quoted 85 lines · Yann E. MORIN
Peter, All,
Second part of the review... ;-)
On 2021-02-16 21:11 +0100, Peter Seiderer spake thusly:
Quoted 23 lines
Try to be less smart (focused on the one target/one use-case), instead reduce the rpi-firmware package to a selectable list of (verbatim) installed firmware files.
- change rpi-firmware config handling from rpi-variant/rpi-flavour choices to bootcode.bin, pi-default/-extended/-cut-down and pi4-/default/-extended/-cut-down selection
- add
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILEoption to select installable config.txt file- remove config.txt modify code/handling from raspberry
post-image.shscript- add different customized config.txt files to the raspberry board section
- change raspberry defconfigs to select appropiate rpi-firmware and config.txt files
- change genimage-raspberrypi4.cfg/genimage-raspberrypi4-64.cfg to use start4.elf and fixup4.dat
Quoted 7 lines
With this changes a better support for custom use-cases should be possible, specially multi-target SD cards as suggested by Stefan Agner ([1]).
[1] http://lists.busybox.net/pipermail/buildroot/2021-February/303318.html
Signed-off-by Peter Seiderer <[email protected]>[--SNIP--]
Quoted 25 lines
package/rpi-firmware/rpi-firmware.mk +17
-0@@ -10,6 +10,46 @@ RPI_FIRMWARE_LICENSE = BSD-3-Clause RPI_FIRMWARE_LICENSE_FILES = boot/LICENCE.broadcom RPI_FIRMWARE_INSTALL_IMAGES = YES +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN),y) +RPI_FIRMWARE_FILES += bootcode.bin +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI),y) +RPI_FIRMWARE_FILES += start.elf fixup.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_X),y) +RPI_FIRMWARE_FILES += startx.elf fixupx.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD),y) +RPI_FIRMWARE_FILES += start_cd.elf fixup_cd.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4),y)package/rpi-firmware/rpi-firmware.mk RPI_FIRMWARE_LICENSE = BSD-3-Clause · line 39
Quoted 10 lines
package/rpi-firmware/rpi-firmware.mk +10
-0+RPI_FIRMWARE_FILES += start4.elf fixup4.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X),y) +RPI_FIRMWARE_FILES += start4x.elf fixup4x.dat +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_CD),y) +RPI_FIRMWARE_FILES += start4cd.elf fixup4cd.dat +endifWhat about:
RPI_FIRMWARE_FILES = \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN),bootcode.bin) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI),start.elf fixup.dat) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_X),startx.elf fixupx.dat) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD),start_cd.elf fixup_cd.dat) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4),start4.elf fixup4.dat) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X),start4x.elf fixup4x.dat) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_CD),start4cd.elf fixup4cd.dat)Or alternatively:
Quoted 7 lines
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN) += bootcode.bin
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI) += start.elf fixup.dat
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_X) += startx.elf fixupx.dat
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD) += start_cd.elf fixup_cd.dat
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4) += start4.elf fixup4.dat
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X) += start4x.elf fixup4x.dat
RPI_FIRMWARE_FILES_$(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_CD) += start4cd.elf fixup4cd.datUnsettled which of the three versions is the nicest one, seems a matter of taste (and a matter of trading more lines against long lines), and personal not much of a friend of the '.._y' pattern...
Quoted 7 lines
define RPI_FIRMWARE_INSTALL_BIN
$(foreach f,$(RPI_FIRMWARE_FILES_y),
$(INSTALL) -D -m 0644 $(@D)/$(f) $(BINARIES_DIR)/rpi-firmware/$(f)
)
endefQuoted 7 lines
package/rpi-firmware/rpi-firmware.mk RPI_FIRMWARE_LICENSE = BSD-3-Clause · line 44
Quoted 4 lines
package/rpi-firmware/rpi-firmware.mk +4
-0+define RPI_FIRMWARE_INSTALL_BIN + for firmwbin in $(RPI_FIRMWARE_FILES); do \ + $(INSTALL) -D -m 0644 $(@D)/boot/$${firmwbin} $(BINARIES_DIR)/rpi-firmware/$${firmwbin} || exit 1; \ + doneUse a make-level $(foreach) loop rather than a shell loop (see example above).
Definitely an improvement as it avoids the '|| exit 1;' part...
Will rework the patch accordingly...
Regards,
Peter
Quoted 4 lines
Regards,
Yann E. MORIN.
PATCH v2 1/2 package/rpi-firmware: rework boot/config file handling
Peter, All,
On 2021-03-09 21:25 +0100, Peter Seiderer spake thusly:
Quoted 9 lines · Yann E. MORIN
Quoted 8 lines
On 2021-02-16 21:11 +0100, Peter Seiderer spake thusly:
package/rpi-firmware/rpi-firmware.mk RPI_FIRMWARE_LICENSE = BSD-3-Clause · line 19
Quoted 7 lines
package/rpi-firmware/rpi-firmware.mk +7
-0+ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN),y) +RPI_FIRMWARE_FILES += bootcode.bin +endif + +ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI),y) +RPI_FIRMWARE_FILES += start.elf fixup.dat +endif
[--SNIP--]
Quoted 9 lines
Quoted 9 lines
What about:
RPI_FIRMWARE_FILES = \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN),bootcode.bin) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI),start.elf fixup.dat) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_X),startx.elf fixupx.dat) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD),start_cd.elf fixup_cd.dat) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4),start4.elf fixup4.dat) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X),start4x.elf fixup4x.dat) \ $(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_CD),start4cd.elf fixup4cd.dat)
Quoted 3 lines
Unsettled which of the three versions is the nicest one, seems a matter of taste (and a matter of trading more lines against long lines), and personal not much of a friend of the '.._y' pattern...
Then I think the one-assignment (kept above) is the one I'd prefer over the many-conditional-assignments.
[--SNIP--]
Quoted 4 lines
Quoted 2 lines
Use a make-level $(foreach) loop rather than a shell loop (see example above).
Definitely an improvement as it avoids the '|| exit 1;' part... Will rework the patch accordingly...
Thanks.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'