diff mbox series

[1/1] rpi-firmware: support multiple cmdline.txt

Message ID 20250507160910.121249-1-olivier.benjamin@bootlin.com
State New
Headers show
Series [1/1] rpi-firmware: support multiple cmdline.txt | expand

Commit Message

Olivier Benjamin May 7, 2025, 4:09 p.m. UTC
Add an option in rpi-firmware to support deploying multiple
cmdline files.
This is usefule in the context of a new [boot_partition]
conditional filter introduced in config.txt in this commit:
https://github.com/raspberrypi/rpi-eeprom/commit/d50b2b32f162292ab6e235932075ce00bddda4ae

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.

Signed-off-by: Olivier Benjamin <olivier.benjamin@bootlin.com>
---
 package/rpi-firmware/Config.in       |  9 +++++++++
 package/rpi-firmware/rpi-firmware.mk | 10 ++++++++++
 2 files changed, 19 insertions(+)
diff mbox series

Patch

diff --git a/package/rpi-firmware/Config.in b/package/rpi-firmware/Config.in
index 42982514f8..e21af594ed 100644
--- a/package/rpi-firmware/Config.in
+++ b/package/rpi-firmware/Config.in
@@ -76,6 +76,15 @@  config BR2_PACKAGE_RPI_FIRMWARE_CMDLINE_FILE
 	  Path to a file stored as cmdline.txt in the boot partition
 	  of the generated SD card image.
 
+config BR2_PACKAGE_RPI_FIRMWARE_CMDLINE_FILES
+	string "List of path(s) to file(s) containing cmdline configuration."
+	help
+	  Space-separated path(s) to file(s) that should be stored
+	  in the boot partition. They will be stored under their own
+	  name in rpi-firmware. Useful for A/B setups.
+	  If a path has the same filename as the one in
+	  BR2_PACKAGE_RPI_FIRMWARE_CMDLINE_FILE, this will override.
+
 config BR2_PACKAGE_RPI_FIRMWARE_AUTOBOOT_FILES
 	string "List of path(s) to file(s) containing autoboot configuration."
 	help
diff --git a/package/rpi-firmware/rpi-firmware.mk b/package/rpi-firmware/rpi-firmware.mk
index 17b7c0cbca..84aa69540f 100644
--- a/package/rpi-firmware/rpi-firmware.mk
+++ b/package/rpi-firmware/rpi-firmware.mk
@@ -44,6 +44,15 @@  define RPI_FIRMWARE_INSTALL_CMDLINE
 endef
 endif
 
+RPI_FIRMWARE_CMDLINE_FILES = $(call qstrip,$(BR2_PACKAGE_RPI_FIRMWARE_CMDLINE_FILES))
+ifneq ($(RPI_FIRMWARE_CMDLINE_FILES),)
+define RPI_FIRMWARE_INSTALL_CMDLINES
+	$(foreach f,$(RPI_FIRMWARE_CMDLINE_FILES), \
+		$(INSTALL) -D -m 0644 $(f) $(BINARIES_DIR)/rpi-firmware/$(notdir $(f))
+	)
+endef
+endif
+
 ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTBS),y)
 define RPI_FIRMWARE_INSTALL_DTB
 	$(foreach dtb,$(wildcard $(@D)/boot/*.dtb), \
@@ -95,6 +104,7 @@  define RPI_FIRMWARE_INSTALL_IMAGES_CMDS
 	$(RPI_FIRMWARE_INSTALL_BIN)
 	$(RPI_FIRMWARE_INSTALL_CONFIG)
 	$(RPI_FIRMWARE_INSTALL_CMDLINE)
+	$(RPI_FIRMWARE_INSTALL_CMDLINES)
 	$(RPI_FIRMWARE_INSTALL_AUTOBOOTS)
 	$(RPI_FIRMWARE_INSTALL_DTB)
 	$(RPI_FIRMWARE_INSTALL_DTB_OVERLAYS)