mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-01 21:23:51 -09:00
There are several use cases for installing additional files in the boot
partition that is read by the RPi firmware.
- autoboot.txt is an optional configuration file for the RPi
firmware [1]. Supporting several autoboot files will enable A/B
setups, as using the renameat2() system call with the RENAME_EXCHANGE
flag will let users atomically replace one autoboot configuration
file with the other. This improves reliability in the case of an
update which could potentially be interrupted.
- Multiple cmdline.txt files are useful in the context of a new
[boot_partition] conditional filter introduced in config.txt in
commit [2]. This is useful for A/B systems to have identical BootFS
partitions on both slots, and not have to edit the kernel command line
to ensure the kernel will load the right rootFS after update of the
BootFS.
- rpi-firmware contains DTB overlays for many "standard" hats, but a
custom hat may require a custom overlay.
Although it is possible to install additional files in the boot
partition in the post-image script, it is very convenient to be able to
use the standard RPi post-image script in
board/raspberrypi/post-image.sh. That script looks in
$BINARIES_DIR/rpi-firmware, so it is convenient to be able to place
additional files there.
Add the option BR2_PACKAGE_RPI_FIRMWARE_EXTRA_FILES which is simply a
list of files to be copied to $BINARIES_DIR/rpi-firmware, which will
eventually end up as the boot partition. Make sure that this is done as
the last step of RPI_FIRMWARE_INSTALL_IMAGES_CMDS, so the files can
override files installed by earlier steps.
[1] https://www.raspberrypi.com/documentation/computers/config_txt.html#autoboot-txt
[2] d50b2b32f1
Signed-off-by: Olivier Benjamin <olivier.benjamin@bootlin.com>
Signed-off-by: Arnout Vandecappelle <arnout@rnout.be>
82 lines
3.0 KiB
Makefile
82 lines
3.0 KiB
Makefile
################################################################################
|
|
#
|
|
# rpi-firmware
|
|
#
|
|
################################################################################
|
|
|
|
# Please keep in sync with configs/raspberrypi*_deconfig
|
|
RPI_FIRMWARE_VERSION = 063bcab6c8a90efb0d19f69d88cbbc7ec79cab68
|
|
RPI_FIRMWARE_SITE = $(call github,raspberrypi,firmware,$(RPI_FIRMWARE_VERSION))
|
|
RPI_FIRMWARE_LICENSE = BSD-3-Clause
|
|
RPI_FIRMWARE_LICENSE_FILES = boot/LICENCE.broadcom
|
|
RPI_FIRMWARE_INSTALL_IMAGES = YES
|
|
|
|
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), start_x.elf fixup_x.dat) \
|
|
$(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_CD), start_cd.elf fixup_cd.dat) \
|
|
$(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI_DB), start_db.elf fixup_db.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) \
|
|
$(if $(BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_DB), start4db.elf fixup4db.dat)
|
|
|
|
define RPI_FIRMWARE_INSTALL_BIN
|
|
$(foreach f,$(RPI_FIRMWARE_FILES), \
|
|
$(INSTALL) -D -m 0644 $(@D)/boot/$(f) $(BINARIES_DIR)/rpi-firmware/$(f)
|
|
)
|
|
endef
|
|
|
|
RPI_FIRMWARE_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE))
|
|
ifneq ($(RPI_FIRMWARE_CONFIG_FILE),)
|
|
define RPI_FIRMWARE_INSTALL_CONFIG
|
|
$(INSTALL) -D -m 0644 $(RPI_FIRMWARE_CONFIG_FILE) \
|
|
$(BINARIES_DIR)/rpi-firmware/config.txt
|
|
endef
|
|
endif
|
|
|
|
RPI_FIRMWARE_CMDLINE_FILE = $(call qstrip,$(BR2_PACKAGE_RPI_FIRMWARE_CMDLINE_FILE))
|
|
ifneq ($(RPI_FIRMWARE_CMDLINE_FILE),)
|
|
define RPI_FIRMWARE_INSTALL_CMDLINE
|
|
$(INSTALL) -D -m 0644 $(RPI_FIRMWARE_CMDLINE_FILE) \
|
|
$(BINARIES_DIR)/rpi-firmware/cmdline.txt
|
|
endef
|
|
endif
|
|
|
|
ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTBS),y)
|
|
define RPI_FIRMWARE_INSTALL_DTB
|
|
$(foreach dtb,$(wildcard $(@D)/boot/*.dtb), \
|
|
$(INSTALL) -D -m 0644 $(dtb) $(BINARIES_DIR)/rpi-firmware/$(notdir $(dtb))
|
|
)
|
|
endef
|
|
endif
|
|
|
|
ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS),y)
|
|
define RPI_FIRMWARE_INSTALL_DTB_OVERLAYS
|
|
$(foreach ovldtb,$(wildcard $(@D)/boot/overlays/*.dtbo), \
|
|
$(INSTALL) -D -m 0644 $(ovldtb) $(BINARIES_DIR)/rpi-firmware/overlays/$(notdir $(ovldtb))
|
|
)
|
|
$(INSTALL) -D -m 0644 $(@D)/boot/overlays/overlay_map.dtb $(BINARIES_DIR)/rpi-firmware/overlays/
|
|
touch $(BINARIES_DIR)/rpi-firmware/overlays/README
|
|
endef
|
|
endif
|
|
|
|
RPI_FIRMWARE_EXTRA_FILES = $(call qstrip,$(BR2_PACKAGE_RPI_FIRMWARE_EXTRA_FILES))
|
|
define RPI_FIRMWARE_INSTALL_EXTRA_FILES
|
|
$(foreach f,$(RPI_FIRMWARE_EXTRA_FILES), \
|
|
$(INSTALL) -D -m 0644 $(f) $(BINARIES_DIR)/rpi-firmware/$(notdir $(f))
|
|
)
|
|
endef
|
|
|
|
define RPI_FIRMWARE_INSTALL_IMAGES_CMDS
|
|
$(RPI_FIRMWARE_INSTALL_BIN)
|
|
$(RPI_FIRMWARE_INSTALL_CONFIG)
|
|
$(RPI_FIRMWARE_INSTALL_CMDLINE)
|
|
$(RPI_FIRMWARE_INSTALL_DTB)
|
|
$(RPI_FIRMWARE_INSTALL_DTB_OVERLAYS)
|
|
$(RPI_FIRMWARE_INSTALL_EXTRA_FILES)
|
|
endef
|
|
|
|
$(eval $(generic-package))
|