Skip to contentSkip to conversation

rpi-firmware: support multiple cmdline.txt

PATCH New Olivier Benjamin via buildroot 1 participant 1 message May 7, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpi-firmware: support multiple cmdline.txt

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.

---
 package/rpi-firmware/Config.in       |  9 +++++++++
 package/rpi-firmware/rpi-firmware.mk | 10 ++++++++++
 2 files changed, 19 insertions(+)
package/rpi-firmware/Config.in +9 -0
index 42982514f8..e21af594ed 100644
@@ -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
package/rpi-firmware/rpi-firmware.mk +10 -0
index 17b7c0cbca..84aa69540f 100644
@@ -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)
Signature · 6 lines
2.48.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot