Skip to content

Fix systemd-based OS customisation paths for Raspberry Pi OS Bookworm and newer.#2

Merged
eggfly merged 2 commits into
CardputerZero:mainfrom
dianjixz:main
May 27, 2026
Merged

Fix systemd-based OS customisation paths for Raspberry Pi OS Bookworm and newer.#2
eggfly merged 2 commits into
CardputerZero:mainfrom
dianjixz:main

Conversation

@dianjixz

Copy link
Copy Markdown
Contributor

Summary

Fix systemd-based OS customisation paths for Raspberry Pi OS Bookworm and newer.

Raspberry Pi OS Bookworm changed the firmware/boot partition mount point from /boot to /boot/firmware, so the previous systemd.run=/boot/firstrun.sh kernel command line no longer points to the generated firstrun.sh script on Bookworm+ images.

This PR keeps backward compatibility with Bullseye/Buster and older images by selecting the path based on the target OS release_date.

Changes

  • Add centralized systemd firstrun path selection based on OS release date.
  • Use /boot/firmware/firstrun.sh and /boot/firmware/cmdline.txt for images released on or after 2023-10-11.
  • Keep existing /boot/firstrun.sh and /boot/cmdline.txt behavior for older images or when the release date is unavailable/invalid.
  • Update both customisation write paths:
    • normal image write path in downloadthread
    • fastboot customisation path in fastbootflashthread
  • Update CustomisationGenerator so firstrun cleanup paths are provided by the caller instead of being hard-coded to /boot.
  • Add/update tests covering:
    • legacy /boot/firstrun.sh path selection
    • Bookworm+ /boot/firmware/firstrun.sh path selection
    • correct cmdline.txt cleanup path in generated firstrun.sh
    • fastboot cmdline append behavior for Bookworm+ paths

Background

Raspberry Pi OS Bookworm, released on 2023-10-11, mounts the boot/firmware partition at /boot/firmware instead of /boot.

Without this fix, systemd customisation on Bookworm+ images appends:

systemd.run=/boot/firstrun.sh

but the script is only available from the running OS under /boot/firmware/firstrun.sh, so first-run customisation does not execute correctly.

Compatibility

Older Raspberry Pi OS releases remain unchanged. If release_date is earlier than 2023-10-11, missing, or invalid, the existing /boot paths are still used.

Testing

  • Ran static diff check:
git diff --check
  • Started a CMake configure/test build after installing CMake, but dependency fetch/build was interrupted before completion.
  • The updated tests are included for the customisation generator and fastboot command line behavior.

@eggfly eggfly merged commit 0b297b9 into CardputerZero:main May 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants