Skip to content

Kernel: T9170: support compressed modules when searching module firmware - #1261

Merged
sever-sever merged 1 commit into
vyos:rollingfrom
c-po:kernel-firmware-fix
Aug 6, 2026
Merged

Kernel: T9170: support compressed modules when searching module firmware#1261
sever-sever merged 1 commit into
vyos:rollingfrom
c-po:kernel-firmware-fix

Conversation

@c-po

@c-po c-po commented Aug 6, 2026

Copy link
Copy Markdown
Member

Change summary

Commit 21c7e66 ("Kernel: T5641: enable module compression to save disk space") which enabled module compression using XZ missed that when we search modules for firmware inclusion, the pattern was hardcoded to *.ko instead of .ko - this has been fixed.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Commit 21c7e66 ("Kernel: T5641: enable module compression to save disk
space") which enabled module compression using XZ missed that when we search
modules for firmware inclusion, the pattern was hardcoded to *.ko instead of
*.ko* - this has been fixed.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved firmware metadata discovery to recognize compressed kernel module files in addition to standard .ko files.

Walkthrough

The firmware build now accepts compressed kernel module filenames when it uses modinfo to collect firmware requirements.

Changes

Firmware metadata discovery

Layer / File(s) Summary
Expand module search pattern
scripts/package-build/linux-kernel/build-linux-firmware.sh
Line 23 now matches .ko files and compressed .ko* variants during firmware metadata collection.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: support compressed kernel modules during firmware searches.
Description check ✅ Passed The description accurately explains the compressed module matching bug, the fix, and related task.
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
✨ Simplify code
  • Create PR with simplified code

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

@mergify mergify Bot added the rolling label Aug 6, 2026
@mergify mergify Bot assigned c-po Aug 6, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@scripts/package-build/linux-kernel/build-linux-firmware.sh`:
- Line 23: Update the firmware collection command assigned to FW_FILES to quote
the kernel module search path and '*.ko*' pattern, preventing shell expansion,
and replace plain xargs with find’s filename-safe -exec modinfo {} + (or an
equivalent null-delimited pipeline). Preserve the existing grep and awk
extraction behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 5a9ba8ac-c56e-433e-b2a9-828af3889b85

📥 Commits

Reviewing files that changed from the base of the PR and between 0f03d0a and f7f5b17.

📒 Files selected for processing (1)
  • scripts/package-build/linux-kernel/build-linux-firmware.sh
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • ansible/ansible (manual)
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: codeql-analysis-call / Analyze (python)
  • GitHub Check: Mergify Merge Queue
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary
🧰 Additional context used
🪛 Shellcheck (0.11.0)
scripts/package-build/linux-kernel/build-linux-firmware.sh

[warning] 23-23: Use 'find .. -print0 | xargs -0 ..' or 'find .. -exec .. +' to allow non-alphanumeric filenames.

(SC2038)


[info] 23-23: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 23-23: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 23-23: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 23-23: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 23-23: Double quote to prevent globbing and word splitting.

(SC2086)


[warning] 23-23: Quote the parameter to -name so the shell won't interpret it.

(SC2061)


[info] 23-23: Use ./glob or -- glob so names with dashes won't become options.

(SC2035)

🔍 Remote MCP vyos.dev

Relevant task context

  • T9170 title: “Kernel: missing firmware files after enabling module compression”
  • Status: “In progress”; priority: “Normal”; issue type: bug.
  • The task reports *.ko finds 0 files, while *.ko* finds 272 compressed modules under kernel/drivers/net. It proposes changing the find pattern to -name '*.ko*', exactly matching this PR’s change.
  • The task’s only comment links to GitHub PR #1261, whereas the PR context references PR #1239; this may warrant verification.


# Retrieve firmware blobs from source files
FW_FILES=$(find ${KERNEL_DIR}/debian/linux-image-${KERNEL_VERSION}${KERNEL_SUFFIX}/lib/modules/${KERNEL_VERSION}${KERNEL_SUFFIX}/kernel/drivers/net -name *.ko | xargs modinfo | grep "^firmware:" | awk '{print $2}')
FW_FILES=$(find ${KERNEL_DIR}/debian/linux-image-${KERNEL_VERSION}${KERNEL_SUFFIX}/lib/modules/${KERNEL_VERSION}${KERNEL_SUFFIX}/kernel/drivers/net -name *.ko* | xargs modinfo | grep "^firmware:" | awk '{print $2}')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Quote the pattern and avoid plain xargs.

Bash expands *.ko* before find receives it. If the working directory contains a matching filename, find can receive the filename instead of the pattern. This can omit compressed modules or fail the command. Because scripts/package-build/linux-kernel/build.py:212-216 runs this script with check=True, the firmware build can abort.

Quote the path and pattern. Use -exec modinfo {} + or -print0 | xargs -0 for filename-safe processing.

Proposed fix
-FW_FILES=$(find ${KERNEL_DIR}/debian/linux-image-${KERNEL_VERSION}${KERNEL_SUFFIX}/lib/modules/${KERNEL_VERSION}${KERNEL_SUFFIX}/kernel/drivers/net -name *.ko* | xargs modinfo | grep "^firmware:" | awk '{print $2}')
+FW_FILES=$(find "${KERNEL_DIR}/debian/linux-image-${KERNEL_VERSION}${KERNEL_SUFFIX}/lib/modules/${KERNEL_VERSION}${KERNEL_SUFFIX}/kernel/drivers/net" \
+    -name '*.ko*' -exec modinfo {} + | grep "^firmware:" | awk '{print $2}')
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
FW_FILES=$(find ${KERNEL_DIR}/debian/linux-image-${KERNEL_VERSION}${KERNEL_SUFFIX}/lib/modules/${KERNEL_VERSION}${KERNEL_SUFFIX}/kernel/drivers/net -name *.ko* | xargs modinfo | grep "^firmware:" | awk '{print $2}')
FW_FILES=$(find "${KERNEL_DIR}/debian/linux-image-${KERNEL_VERSION}${KERNEL_SUFFIX}/lib/modules/${KERNEL_VERSION}${KERNEL_SUFFIX}/kernel/drivers/net" \
-name '*.ko*' -exec modinfo {} + | grep "^firmware:" | awk '{print $2}')
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 23-23: Use 'find .. -print0 | xargs -0 ..' or 'find .. -exec .. +' to allow non-alphanumeric filenames.

(SC2038)


[info] 23-23: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 23-23: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 23-23: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 23-23: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 23-23: Double quote to prevent globbing and word splitting.

(SC2086)


[warning] 23-23: Quote the parameter to -name so the shell won't interpret it.

(SC2061)


[info] 23-23: Use ./glob or -- glob so names with dashes won't become options.

(SC2035)

🤖 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 `@scripts/package-build/linux-kernel/build-linux-firmware.sh` at line 23,
Update the firmware collection command assigned to FW_FILES to quote the kernel
module search path and '*.ko*' pattern, preventing shell expansion, and replace
plain xargs with find’s filename-safe -exec modinfo {} + (or an equivalent
null-delimited pipeline). Preserve the existing grep and awk extraction
behavior.

Source: Linters/SAST tools

@hedrok hedrok 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.

Approve. Fix of search pattern.
I think both points from coderabbit are worth fixing (quoting '.ko' and using -exec), but it is not a new problem, so the PR can be merged as is.

@mergify

mergify Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@sever-sever sever-sever left a comment

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.

Fix

@sever-sever
sever-sever merged commit 7633417 into vyos:rolling Aug 6, 2026
11 checks passed
@vyos-bot vyos-bot Bot added mirror-initiated This PR initiated for mirror sync workflow mirror-completed and removed mirror-initiated This PR initiated for mirror sync workflow labels Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants