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.
This commit is contained in:
Cyril Brulebois
2021-11-20 14:29:12 +01:00
parent 500ffff06c
commit c7f08c54cb
2 changed files with 27 additions and 1 deletions

View File

@@ -122,6 +122,14 @@ if suite == 'buster':
else: else:
touch_machine_id = '' 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: ### Write results:
@@ -157,7 +165,10 @@ with open('raspi_master.yaml', 'r') as in_file:
.replace('__WIRELESS_FIRMWARE__', wireless_firmware) \ .replace('__WIRELESS_FIRMWARE__', wireless_firmware) \
.replace('__SERIAL_CONSOLE__', serial) \ .replace('__SERIAL_CONSOLE__', serial) \
.replace('__HOST__', hostname) \ .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, '__FIX_FIRMWARE_PKG_NAME__', fix_firmware_cmds)
out_text = align_replace(out_text, '__EXTRA_ROOT_SHELL_CMDS__', extra_root_shell_cmds) out_text = align_replace(out_text, '__EXTRA_ROOT_SHELL_CMDS__', extra_root_shell_cmds)

View File

@@ -169,3 +169,18 @@ steps:
shell: | shell: |
rm -f /etc/machine-id /var/lib/dbus/machine-id rm -f /etc/machine-id /var/lib/dbus/machine-id
__TOUCH_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 <<EOF
# The following makes sure a Pi CM__VERSION__ device can be booted without any
# extra configuration (see raspi-firmware's README.debian for details). If
# you're using a regular Pi __VERSION__ device, you can safely remove the following
# two lines:
[__CM_DEV__]
device_tree=__CM_DTB__
EOF
fi