Skip to content

Commit

Permalink
Merge Yellow's RAUC post-install hook with the install hook (#3678)
Browse files Browse the repository at this point in the history
As stated in the docs [1], post-install hook is not executed if the slot
already has an install hook defined. Merge the post-install hook with the
install hook to fix CM5 migration for Yellow.

[1] https://rauc.readthedocs.io/en/latest/using.html#slot-hooks
  • Loading branch information
sairon authored Nov 18, 2024
1 parent b9e66fb commit 78cdaab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
4 changes: 0 additions & 4 deletions buildroot-external/ota/manifest.raucm.gtpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ hooks=install-check;

[image.boot]
filename=boot.vfat
{{- if eq (env "ota_compatible") "haos-yellow" }}
hooks=install;post-install;
{{- else }}
hooks=install;
{{- end }}

[image.kernel]
filename=kernel.img
Expand Down
29 changes: 10 additions & 19 deletions buildroot-external/ota/rauc-hook
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ install_boot() {
cp -f "${BOOT_TMP}"/*.txt "${BOOT_MNT}/" || true
cp -f "${BOOT_TMP}"/grubenv "${BOOT_MNT}"/EFI/BOOT/ || true
fi

# Add CM5 support for Yellow. Can be removed in HAOS 15.
if [ "$RAUC_SYSTEM_COMPATIBLE" = "haos-yellow" ]; then
if ! grep -q "\[cm5\]" "${BOOT_MNT}/config.txt"; then
echo "Adding CM5 config to config.txt"

# Remove old single device_tree config and add CM-specific ones
sed -i '/device_tree=bcm2711-rpi-cm4-ha-yellow.dtb/d; s/\[all\]/\[cm4\]\ndevice_tree=bcm2711-rpi-cm4-ha-yellow.dtb\n\n\[cm5\]\ndevice_tree=bcm2712-rpi-cm5-ha-yellow.dtb\n\n\[all\]/' "${BOOT_MNT}/config.txt"
fi
fi
}

install_spl() {
Expand Down Expand Up @@ -88,25 +98,6 @@ check_grubenv() {
fi
}

post_install_boot() {
BOOT_MNT=/mnt/boot

# Add CM5 support for Yellow. Can be removed in HAOS 15. Make sure manifest.raucm.gtpl is updated.
if [ "$RAUC_SYSTEM_COMPATIBLE" = "haos-yellow" ]; then
# Mount boot
if ! systemctl -q is-active mnt-boot.mount; then
systemctl start mnt-boot.mount
fi

if ! grep -q "\[cm5\]" "${BOOT_MNT}/config.txt"; then
echo "Adding CM5 config to config.txt"

# Remove old single device_tree config and add CM-specific ones
sed -i '/device_tree=bcm2711-rpi-cm4-ha-yellow.dtb/d; s/\[all\]/\[cm4\]\ndevice_tree=bcm2711-rpi-cm4-ha-yellow.dtb\n\n\[cm5\]\ndevice_tree=bcm2712-rpi-cm5-ha-yellow.dtb\n\n\[all\]/' "${BOOT_MNT}/config.txt"
fi
fi
}

post_install_kernel() {
BOOT_MNT=/mnt/boot

Expand Down

0 comments on commit 78cdaab

Please sign in to comment.