Skip to content

firmware: move {ARMBIAN/MAINLINE}_FIRMWARE_{SOURCE/BRANCH} to main-config & pin to tag/sha1 - #10654

Open
rpardini wants to merge 1 commit into
armbian:mainfrom
rpardini:pr/firmware-move-ARMBIANMAINLINEFIRMWARESOURCEBRANCH-to-main-config--pin-to-tagsha1
Open

rpardini wants to merge 1 commit into
armbian:mainfrom
rpardini:pr/firmware-move-ARMBIANMAINLINEFIRMWARESOURCEBRANCH-to-main-config--pin-to-tagsha1

Conversation

@rpardini

@rpardini rpardini commented Sep 7, 2026

Copy link
Copy Markdown
Member
  • 🌿 single spot to set where to source firmware
  • 🌴 armbian's still does a branch:master lookup everytime (so it auto-bumps)
  • 🌱 mainline is now pinned to specific release (tag)'s sha1, for faster lookups
  • 🐸 if needed new firmware lands upstream, bump the tag/sha1 manually
    • this should avoid the multiple terabytes of armbian-firmware-full churn

Summary by CodeRabbit

  • Improvements
    • Firmware builds now use centrally configured Armbian firmware sources and branches.
    • Mainline firmware is fetched from a pinned revision for more consistent build results.
    • Firmware packaging supports configurable source and branch references instead of relying on fixed defaults.

…nfig & pin to tag/sha1

- single spot to set where to source firmware
- armbian's still does a branch:master lookup everytime (so it auto-bumps)
- mainline is now pinned to specific release (tag)'s sha1, for faster lookups
- if needed new firmware lands upstream, bump the tag/sha1 manually
  - this should avoid the multiple terabytes of armbian-firmware-full churn
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 44e646af-423c-40ee-80d1-f19ef87a1a3f

📥 Commits

Reviewing files that changed from the base of the PR and between a9ff8fb and 1ea3f15.

📒 Files selected for processing (4)
  • lib/functions/artifacts/artifact-firmware.sh
  • lib/functions/artifacts/artifact-full_firmware.sh
  • lib/functions/compilation/packages/firmware-deb.sh
  • lib/functions/configuration/main-config.sh
💤 Files with no reviewable changes (1)
  • lib/functions/artifacts/artifact-firmware.sh

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change centralizes firmware source and revision settings in global configuration. Firmware preparation and Debian packaging now use these values instead of local defaults and hardcoded revisions.

Changes

Firmware source configuration

Layer / File(s) Summary
Shared firmware settings
lib/functions/configuration/main-config.sh, lib/functions/artifacts/artifact-full_firmware.sh
Defines readonly Armbian firmware source and branch values, pins the mainline firmware commit, and passes the configured mainline revision to firmware metadata.
Firmware package fetching
lib/functions/compilation/packages/firmware-deb.sh
Uses the configured Armbian source and branch and the configured mainline firmware source and revision when fetching firmware.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 1ea3f

Firmware source and revision settings are centralized while mainline firmware is pinned to a specific revision. The supplied changes consistently use the shared settings, with no remaining merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: moving firmware configuration to main-config and pinning the mainline firmware reference.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size/small PR with less then 50 lines 11 Milestone: Fourth quarter release Needs review Seeking for review Framework Framework components labels Sep 7, 2026
@rpardini
rpardini marked this pull request as ready for review September 7, 2026 18:50
# Mainline firmware git version
# used to be 'branch:master', but that caused a lot of churn. Bump this when needed. Use the latest published tag's SHA1.
# Important: use the tag's ref commit, not the the sha1 for the signed tag itself.
declare -g -r MAINLINE_FIRMWARE_BRANCH="${MAINLINE_FIRMWARE_BRANCH:-"commit:2135b2f7714a3a514c989b9728f51f36144cab6f"}" # ref: 'tag:20260810'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's pretty well hidden there.
At some point we may need a dedicated file where all commit hash fixed things are present. Just thinking of drivers_network.sh.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agree. This is something that will likely be forgotten. Perhaps query tags and use latest tag?
image

Seems like a middle ground of the problem.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm. I didn't consider main-config a hidden place, but maybe if we move it to config/sources/common.conf or something?

Ref auto-updating: I was trying to be "kinder" to upstream git servers; listing tags / picking-the-newest is quite the opposite. The check runs for every board build and for every matrix-prepare. Maybe a GHA job (eg "dependabot" or similar, as we already have for Python's requirements.txt) could be enough?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe: linux-firmware does more or less a tag per month (see https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/refs/tags) -- could do a check if current YYYYMM > used-tag then WARN or something.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does more or less a tag per month

That is what I meant. Would probably cover it best - no need to tackle by hand and still relatively solid.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Picking this up — I'd rather resolve the newest tag than warn about a stale one, because listing tags turns out to be much cheaper than it sounds.

git ls-remote --tags --refs <url> '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' against linux-firmware:

  • 0.16s wall
  • with protocol v2 the refspec is pushed to the server (ls-refs ref-prefix), so it answers with the dated tags only — not the repo's whole ref advertisement

So the cost to upstream is one filtered round-trip per build process, which is roughly what resolving branch:main cost before. The pattern is what makes the difference; an unfiltered ls-remote --tags would indeed be the opposite of kind.

Helper, next to git_ls_remote_tag_commit_sha1 in lib/functions/general/git.sh:

# Ask the remote for the newest tag matching a glob, newest by version sort. One round-trip, and
# with protocol v2 the remote does the filtering, so it answers with a handful of refs instead of
# its whole ref advertisement.
# Echoes the tag name, or nothing if the remote has no tag matching the pattern.
# <url> <pattern>
function git_ls_remote_newest_tag() {
	declare url="${1}" pattern="${2}"
	declare ls_remote_output
	# '|| true': finding no matching tag is a normal answer here, not an error; the caller decides.
	ls_remote_output="$(git_ls_remote_logged "newest tag matching '${pattern}'" --tags --refs "${url}" "${pattern}" || true)"
	echo -n "$(awk '{ sub(/^refs\/tags\//, "", $2); print $2 }' <<< "${ls_remote_output}" | sort -V | tail -1)"
}

and in main-config.sh, in place of the hardcoded ref:

	# Mainline firmware git ref.
	# 'branch:main' meant terabytes of armbian-firmware-full churn; a hardcoded sha1 means somebody
	# has to remember to bump it. Track the newest dated release tag instead - linux-firmware cuts a
	# YYYYMMDD tag every few weeks. One ls-remote, filtered by refspec, so with protocol v2 the
	# remote answers with a handful of refs rather than its whole advertisement (~0.2s).
	# Override by setting MAINLINE_FIRMWARE_BRANCH to any 'tag:'/'branch:'/'commit:' ref.
	if [[ -z "${MAINLINE_FIRMWARE_BRANCH}" ]]; then
		declare newest_firmware_tag=""
		if [[ "${OFFLINE_WORK}" != "yes" ]]; then
			newest_firmware_tag="$(git_ls_remote_newest_tag "${MAINLINE_FIRMWARE_SOURCE}" '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]')"
		fi
		if [[ -n "${newest_firmware_tag}" ]]; then
			declare -g MAINLINE_FIRMWARE_BRANCH="tag:${newest_firmware_tag}"
		else
			# OFFLINE_WORK, or the remote had no dated tag: last known good release.
			declare -g MAINLINE_FIRMWARE_BRANCH="commit:2135b2f7714a3a514c989b9728f51f36144cab6f" # ref: 'tag:20260810'
		fi
		display_alert "Mainline firmware ref" "${MAINLINE_FIRMWARE_BRANCH}" "info"
	fi
	declare -g -r MAINLINE_FIRMWARE_BRANCH

The sha1 stays as the OFFLINE_WORK fallback, so offline builds keep working and the pin never silently disappears — it just stops being the thing anyone has to remember to bump.

Tested against the live remote: returns 20260916 (current newest), and returns empty with rc=0 when nothing matches, so it is safe under errexit. bash -n and shellcheck clean.

Two things still open from above, both yours to call:

  • Where it lives — happy with config/sources/common.conf if main-config feels hidden; the code is the same either way.
  • ARMBIAN_FIRMWARE_GIT_SOURCE / ARMBIAN_FIRMWARE_GIT_BRANCH — this PR drops them for ARMBIAN_FIRMWARE_{SOURCE,BRANCH}, and the value shape changes too (master -> branch:master). Anyone setting the old names in userpatches silently falls back to upstream armbian/firmware instead of their fork, with no warning. Worth a compat shim, or at least a display_alert when the old names are set?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nice. What if we do a split:

  1. We use the code above for a GHA job that runs daily and determines the latest tag. We write the tag and unpeeled commit in vars to config/sources/linux-firmware.conf directly (overwrite, no need to parse, etc). If result if different, commit & PR.
  2. In armbian/build we simply source config/sources/linux-firmware.conf and use it.

That way

  • normal operations do not hit the upstream at all (only once, if ever, to fetch the repo).
  • we get auto-updating in reasonable timeframe.

This could also be expanded to "lookup what is the latest release from GitHub releases" that we've been hitting GH api quotes for (aic8800, others, mostly extensions).

@github-actions github-actions Bot added the Work in progress Unfinished / work in progress label Sep 8, 2026
@igorpecovnik igorpecovnik added the Discussion Being discussed - Voice your opinions :) label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

11 Milestone: Fourth quarter release Discussion Being discussed - Voice your opinions :) Framework Framework components Needs review Seeking for review size/small PR with less then 50 lines Work in progress Unfinished / work in progress

Development

Successfully merging this pull request may close these issues.

3 participants