Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bsp: use kernel version argument in ABL postinst scripts (fixes #10108) - #10109

#10109
Merged
igorpecovnik merged 2 commits into
armbian:mainarmbian/build:mainfrom
rorystandley:fix-abl-postinst-kernel-version-10108rorystandley/build:fix-abl-postinst-kernel-version-10108Copy head branch name to clipboard
Jul 15, 2026
Merged

bsp: use kernel version argument in ABL postinst scripts (fixes #10108)#10109
igorpecovnik merged 2 commits into
armbian:mainarmbian/build:mainfrom
rorystandley:fix-abl-postinst-kernel-version-10108rorystandley/build:fix-abl-postinst-kernel-version-10108Copy head branch name to clipboard

Conversation

@rorystandley

@rorystandley rorystandley commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

The zz-update-abl-kernel postinst hooks located kernel, initrd and dtb paths via shell wildcards (/boot/vmlinuz-*-sm8250 etc.). Once a second kernel version is installed, the globs expand to multiple files:

  • mkbootimg receives multiple ramdisk arguments and aborts with ValueError: Unrecognized arguments, failing the kernel postinst and blocking kernel upgrades
  • gzip/cat silently concatenate multiple kernels and dtbs into the boot image

Debian kernel hooks in /etc/kernel/postinst.d/ receive the kernel version as $1, so the scripts now use it to build exact paths. When invoked manually without the argument, they fall back to the newest installed kernel (sort -V, so e.g. 6.18.35 ranks above 6.9.1). The scripts now also fail early with a clear error if the kernel or ramdisk image is missing.

All six ABL BSP scripts get the same fix for consistency: xiaomi-elish, oneplus-kebab, ayn-thor, ayn-odin2, ayn-odin2mini, ayn-odin2portal. Note that only xiaomi-elish and oneplus-kebab currently install the hook via their board config (install -Dm655 ... $destination/etc/kernel/postinst.d/ in config/boards/*.conf); the AYN scripts carry the same latent bug.

Lint-driven cleanup: extraargs and abl_boot_partition_label are initialised before source /boot/armbianEnv.txt in xiaomi-elish and oneplus-kebab to satisfy the shellcheck gate (SC2154, flagged now that these files are touched). Behaviour-safe: the scripts already guard on [ -n "$abl_boot_partition_label" ], and this also stops stray environment values leaking into the boot image cmdline.

GitHub issue reference: #10108
Jira reference number: N/A — community bugfix

How Has This Been Tested?

  • bash -n on all six scripts
  • CI-equivalent shellcheck run (shellcheck --shell=bash --severity=warning --exclude=SC2034,SC2207,SC2046,SC2086,SC2206) — all six clean
  • Multi-kernel /boot simulation with three installed versions (6.9.1 / 6.18.10 / 6.18.35): the old glob expands to 3 files; with the fix, the hook-argument path resolves exactly one kernel/initrd pair, and the no-argument fallback picks 6.18.35 (newest by sort -V), not 6.9.1 (lexical winner)
  • Hardware confirmation on xiaomi-elish would be welcome — I don't have a device; perhaps @xiaobaoaaaaaa (issue reporter) could verify

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

Summary by CodeRabbit

  • Bug Fixes
    • Improved kernel image generation to use a single, explicit kernel and ramdisk version instead of wildcard matches.
    • Added validation so boot image creation now fails early if the selected kernel or ramdisk file is missing.
    • When no version is provided, the newest installed matching kernel is selected automatically.
    • Updated several device boot image flows to work reliably with Debian kernel-hook invocations.

The zz-update-abl-kernel postinst hooks located kernel, initrd and dtb
paths via shell wildcards (/boot/vmlinuz-*-sm8250 etc). Once a second
kernel version is installed, the globs expand to multiple files:

- mkbootimg receives multiple ramdisk arguments and aborts with
  "ValueError: Unrecognized arguments", failing the kernel postinst
- gzip/cat silently concatenate multiple kernels and dtbs into the
  boot image

Debian kernel hooks pass the kernel version as $1, so use it to build
exact paths. When invoked manually without the argument, fall back to
the newest installed kernel (sort -V). Fail early with a clear error
if the kernel or ramdisk is missing. Initialise extraargs and
abl_boot_partition_label before sourcing armbianEnv.txt to satisfy
the shellcheck lint gate (SC2154).

Applies to all six ABL BSPs: xiaomi-elish, oneplus-kebab, ayn-thor,
ayn-odin2, ayn-odin2mini, ayn-odin2portal.

Fixes: armbian#10108
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • Needs review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5b3e427f-2392-4f2a-b619-685a88a23845

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Six board-specific zz-update-abl-kernel scripts (ayn-odin2, ayn-odin2mini, ayn-odin2portal, ayn-thor, oneplus-kebab, xiaomi-elish) are modified to accept an optional kernel version argument, resolving the newest installed matching kernel when omitted, validating kernel/ramdisk existence, and using version-specific paths in mkbootimg instead of wildcard expansion.

Changes

ABL Kernel Script Version Resolution

Layer / File(s) Summary
ayn-odin2 kernel/ramdisk resolution
packages/bsp/ayn-odin2/zz-update-abl-kernel
Adds version argument with fallback to newest installed sm8550-arm64 kernel, existence checks, and version-specific kernel/dtb/ramdisk paths in mkbootimg.
ayn-odin2mini kernel/ramdisk resolution
packages/bsp/ayn-odin2mini/zz-update-abl-kernel
Adds version argument with fallback, existence checks, and version-specific gzip/dtb concatenation with updated mkbootimg wiring.
ayn-odin2portal kernel/ramdisk resolution
packages/bsp/ayn-odin2portal/zz-update-abl-kernel
Adds version argument with fallback, existence checks, and version-specific image build inputs replacing wildcard paths.
ayn-thor kernel/ramdisk resolution
packages/bsp/ayn-thor/zz-update-abl-kernel
Adds version argument with fallback, existence checks, version-specific gzip/dtb concatenation, and updated mkbootimg ramdisk argument.
oneplus-kebab kernel/ramdisk resolution
packages/bsp/oneplus-kebab/zz-update-abl-kernel
Adds version argument with fallback, existence checks, version-specific gzip/dtb concatenation, initializes extraargs and abl_boot_partition_label, and updates mkbootimg wiring.
xiaomi-elish kernel/ramdisk resolution
packages/bsp/xiaomi-elish/zz-update-abl-kernel
Adds version argument with fallback, existence checks, and version-specific gzip/composite steps with updated mkbootimg invocation.

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

Possibly related issues

Suggested labels: Hardware

Suggested reviewers: paolosabatino, amazingfate, sven-ola, prahal, pyavitz

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: ABL BSP scripts now use a kernel version argument instead of wildcards.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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 the size/medium PR with more then 50 and less then 250 lines label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Hey @rorystandley! 👋

Thanks for submitting your first pull request to the Armbian project — we're excited to have you contributing! 🧡
Your effort doesn’t just improve Armbian — it benefits the entire community of users and developers.

If you'd like to stay informed about project updates or collaborate more closely with the team,
you can optionally share some personal contact preferences at armbian.com/update-data.
This helps us keep in touch without relying solely on GitHub notifications.

Also, don’t forget to ⭐ star the repo if you haven’t already — and welcome aboard! 🚀

@github-actions github-actions Bot added 08 Milestone: Third quarter release Needs review Seeking for review BSP Board Support Packages labels Jul 2, 2026
@rorystandley

Copy link
Copy Markdown
Contributor Author

Ready for review - could someone add the "needs review" label? I can't set it myself. Thanks

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/bsp/ayn-odin2/zz-update-abl-kernel (1)

3-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Version resolution and validation logic looks correct.

Falls back to the latest installed kernel via sort -V, and fails fast with clear messages if kernel/ramdisk are missing. This resolves the wildcard-expansion problem described in the PR.

One maintainability note: this exact ~17-line block (only the SoC suffix differs) is duplicated verbatim across all six zz-update-abl-kernel scripts in this PR. Consider extracting it into a shared snippet/function sourced by each board script to avoid future drift (e.g., a bug fix applied to one board getting missed in the others).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bsp/ayn-odin2/zz-update-abl-kernel` around lines 3 - 19, The version
resolution and validation block in the zz-update-abl-kernel script is duplicated
across multiple board variants, which will make future fixes easy to miss.
Extract this shared logic into a reusable helper or sourced snippet, then have
each board-specific script call it while only keeping the SoC-specific kernel
pattern or identifiers local. Keep the existing version="$1", fallback lookup
with sort -V, and kernel/ramdisk validation behavior centralized so all scripts
stay in sync.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/bsp/ayn-odin2/zz-update-abl-kernel`:
- Around line 3-19: The version resolution and validation block in the
zz-update-abl-kernel script is duplicated across multiple board variants, which
will make future fixes easy to miss. Extract this shared logic into a reusable
helper or sourced snippet, then have each board-specific script call it while
only keeping the SoC-specific kernel pattern or identifiers local. Keep the
existing version="$1", fallback lookup with sort -V, and kernel/ramdisk
validation behavior centralized so all scripts stay in sync.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 37bb7758-8c84-41f5-b71f-f107080b308e

📥 Commits

Reviewing files that changed from the base of the PR and between a0e9e38 and 592df16.

📒 Files selected for processing (6)
  • packages/bsp/ayn-odin2/zz-update-abl-kernel
  • packages/bsp/ayn-odin2mini/zz-update-abl-kernel
  • packages/bsp/ayn-odin2portal/zz-update-abl-kernel
  • packages/bsp/ayn-thor/zz-update-abl-kernel
  • packages/bsp/oneplus-kebab/zz-update-abl-kernel
  • packages/bsp/xiaomi-elish/zz-update-abl-kernel

@rorystandley

Copy link
Copy Markdown
Contributor Author

Re the CodeRabbit nitpick about the duplicated version-resolution block: it's a fair point, but these hooks are standalone scripts shipped to each device's rootfs (the board configs install them into /etc/kernel/postinst.d/), so there's no shared location on the target to source a helper from. Centralising it would mean shipping an extra BSP file and touching the board configs, and the scripts were already near-identical before this change (the whole mkbootimg invocation etc), so I've kept to the existing per-board pattern to keep this fix minimal and easy to review. Happy to do a consolidation follow-up PR if maintainers think it's worth it.

@github-actions github-actions Bot added the Ready to merge Reviewed, tested and ready for merge label Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot removed the Needs review Seeking for review label Jul 15, 2026
@igorpecovnik
igorpecovnik merged commit e576410 into armbian:main Jul 15, 2026
11 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 Milestone: Third quarter release BSP Board Support Packages Ready to merge Reviewed, tested and ready for merge size/medium PR with more then 50 and less then 250 lines

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.