From c7f08c54cbeed27b876b45d1460f53a27a771376 Mon Sep 17 00:00:00 2001 From: Cyril Brulebois Date: Sat, 20 Nov 2021 14:29:12 +0100 Subject: [PATCH] Adjust support for CM3/CM4 devices. See raspi-firmware's README.Debian for details but basically: both CM3 and CM4 in mainline have a DTB filename that's not expected by the bootloader, so we need to tell the bootloader about the appropriate DTB filename for those models specifically. Do that via /etc/default/raspi-firmware-custom, adding a model filter for some families: - [cm3] for raspi_3_* builds; - [cm4] for raspi_4_* builds. Hint users of regular Pi devices into getting rid of those lines if they notice them. --- generate-recipe.py | 13 ++++++++++++- raspi_master.yaml | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/generate-recipe.py b/generate-recipe.py index a8f428f..5b15e81 100755 --- a/generate-recipe.py +++ b/generate-recipe.py @@ -122,6 +122,14 @@ if suite == 'buster': else: touch_machine_id = '' +# Compute Module support: +if version == '3': + cm_dev, cm_dtb = 'cm3', 'bcm2837-rpi-cm3-io3.dtb' +elif version == '4': + cm_dev, cm_dtb = 'cm4', 'bcm2711-rpi-cm4-io.dtb' +else: + cm_dev, cm_dtb = '', '' + ### Write results: @@ -157,7 +165,10 @@ with open('raspi_master.yaml', 'r') as in_file: .replace('__WIRELESS_FIRMWARE__', wireless_firmware) \ .replace('__SERIAL_CONSOLE__', serial) \ .replace('__HOST__', hostname) \ - .replace('__TOUCH_MACHINE_ID__', touch_machine_id) + .replace('__TOUCH_MACHINE_ID__', touch_machine_id) \ + .replace('__CM_DEV__', cm_dev) \ + .replace('__CM_DTB__', cm_dtb) \ + .replace('__VERSION__', version) out_text = align_replace(out_text, '__FIX_FIRMWARE_PKG_NAME__', fix_firmware_cmds) out_text = align_replace(out_text, '__EXTRA_ROOT_SHELL_CMDS__', extra_root_shell_cmds) diff --git a/raspi_master.yaml b/raspi_master.yaml index 6c2ae37..da51e08 100644 --- a/raspi_master.yaml +++ b/raspi_master.yaml @@ -169,3 +169,18 @@ steps: shell: | rm -f /etc/machine-id /var/lib/dbus/machine-id __TOUCH_MACHINE_ID__ + + # Insert a model filter for some families, to make sure users of Compute + # Module devices have a chance to boot our image without manual config: + - chroot: / + shell: | + if [ -n "__CM_DEV__" ] && [ -n "__CM_DTB__" ]; then + cat >> /etc/default/raspi-firmware-custom <