Skip to content

Btrfs migration 4: build stamping#98

Draft
Yury-MonZon wants to merge 7 commits into
devfrom
build-stamping
Draft

Btrfs migration 4: build stamping#98
Yury-MonZon wants to merge 7 commits into
devfrom
build-stamping

Conversation

@Yury-MonZon

@Yury-MonZon Yury-MonZon commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Build stamping for the image (depends on #96).

  • Capture this image build's git state and a BUILD_ID (CI-provided, or a UTC timestamp fallback) and write both into /etc/os-release of @Minimal before it is snapshotted to @Minimal_stock, so every profile inherits them via COW.
  • Resolve the os-release symlink so the real file is edited in place.
  • The MOTD and login banner now report the build ID instead of a decoded timestamp.

Stack (merge bottom-up)

@Yury-MonZon Yury-MonZon changed the title Stamp git info and build ID into the image Btrfs migration 4: build stamping Jun 30, 2026
@Yury-MonZon Yury-MonZon marked this pull request as draft June 30, 2026 23:11

@alchark alchark left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split out the fixups to motd and set-hostname-and-banner.sh into a separate commit directly on top of the dev branch and let us merge it, as it's not tied to the Btrfs logic.

For the build ID though - we can't record it at the rootfs generation stage, because a rootfs can be reused in multiple builds when e.g. only U-Boot changes between them, meaning that all the later builds will record an incorrect build ID. Let's give it more thought.

@Yury-MonZon Yury-MonZon force-pushed the build-stamping branch 2 times, most recently from 0e1480c to ec54542 Compare July 1, 2026 08:40
@Yury-MonZon

Copy link
Copy Markdown
Contributor Author

Agreed, done. I'll keep this as draft until we figure out better solution. Thanks!

Define the subvolume layout (@, @home, @var-log, @var-cache,
@snapshots, boot) with per-subvolume mount options, keep /boot
uncompressed so U-Boot can read the kernel/dtb/initrd, and factor out
root device retrieval into a helper.

Generate the BLS boot entries, deriving the devicetreedir/overlay
prefix from each entry's root subvolume so U-Boot resolves the
in-entry paths correctly, with FDT_SUBVOL_PREFIX as an override.

Install btrfs-progs and btrfs-compsize.
journald's append-heavy writes fragment badly under btrfs
copy-on-write. Pre-create the journal directory with NODATACOW while
it is still empty so the journal files written on first boot inherit
it.
Once the rootfs and kernel are fully deployed, take a read-only
snapshot of @ into .snapshots/@_Factory-Image for rollback. It
captures @ only; the nested subvolumes (boot/home/var-*) are
separate and excluded.
Build a read-only @Minimal_stock golden base, then derive one
read-only @<Profile>_stock per profile (Desktop, TV-Media-Box,
Router) and a writable @<Profile> snapshot of each. @minimal itself
is re-created as a writable child of @Minimal_stock so it matches the
other profiles instead of being the parentless build origin.

Profile-specific overlays move under overlays/profile-<name>/, and
profile naming is finalised (stock bases, Desktop replaces KDE).
Capture this image build's git state and a BUILD_ID (CI-provided, or
a UTC timestamp fallback) and write both into /etc/os-release of
@minimal before it is snapshotted to @Minimal_stock, so every profile
inherits them via COW. Resolve the os-release symlink so the real
file is edited in place. The MOTD and login banner now report the
build ID instead of a decoded timestamp.
Base automatically changed from btrfs-profiles to dev July 1, 2026 12:11
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