Skip to content

gateway-dk-ask: build kernel modules in-tree for CI compatibility#9650

Merged
rpardini merged 1 commit intoarmbian:mainfrom
we-are-mono:fix/ask-ci-headers-packaging
Apr 11, 2026
Merged

gateway-dk-ask: build kernel modules in-tree for CI compatibility#9650
rpardini merged 1 commit intoarmbian:mainfrom
we-are-mono:fix/ask-ci-headers-packaging

Conversation

@tomazzaman
Copy link
Copy Markdown

@tomazzaman tomazzaman commented Apr 10, 2026

On Armbian CI, kernel builds and image assembly run on different runners. The ASK extension's post_install_kernel_debs module build assumed the kernel source worktree was available, which fails on the image runner.

Fix: build all ASK kernel modules (CDX, FCI, auto-bridge, sfp-led, lp5812) in-tree during kernel compilation. Module sources are copied into the kernel tree during custom_kernel_config (after patching, before olddefconfig), following the pattern used by existing Armbian drivers (e.g., Khadas meson-s4t7). Modules ship inside linux-image .deb automatically.

Changes

  • Add custom_kernel_config hook to copy module sources into the kernel tree and enable CONFIG_ASK_* options
  • Kbuild files for CDX/FCI/auto-bridge come from the ASK repo
  • Board-specific modules (sfp-led, lp5812) use Kbuild files from BSP dir
  • Kconfig wired into drivers/net/ethernet/freescale/ (inserted before endif)
  • kernel_config_modifying_hashes invalidates kernel cache when ASK source changes
  • Remove post_install_kernel_debs module build (no longer needed)
  • Remove pre_package_kernel_headers hook (no longer needed)
  • gateway-dk-ask .deb becomes userspace-only (tools, configs, services)
  • Pin ASK repo to commit with Kbuild files

Why custom_kernel_config instead of kernel_copy_extra_sources

kernel_copy_extra_sources runs before kernel_maybe_clean, which does git clean -xfdq when CLEAN_LEVEL=make-kernel — wiping all copied files. custom_kernel_config runs after patching and cleaning, before olddefconfig, so files survive.

How Has This Been Tested?

  • Full image build with ARTIFACT_IGNORE_CACHE=yes CLEAN_LEVEL=make-kernel,images,debs
  • Verified linux-image .deb contains all 5 .ko.zst modules under kernel/drivers/net/ethernet/freescale/ask/
  • Verified gateway-dk-ask .deb contains no kernel modules (userspace only)
  • Boot on Mono Gateway Development Kit hardware — all modules load, CDX + CMM operational
  • ASK hardware offloading functional (verified with traffic forwarding)

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
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • Refactor
    • Integrated kernel modules (sfp-led, lp5812 LED drivers) into the kernel build process, moving them from separate userspace builds to in-kernel compilation.
    • Module installation and autoload configuration now handled by the kernel package.
    • Updated ASK branch pinning to a specific commit.

On Armbian CI, kernel builds and image assembly run on different runners.
The ASK extension's post_install_kernel_debs module build assumed the
kernel source worktree was available, which fails on the image runner.

Fix: build all ASK kernel modules (CDX, FCI, auto-bridge, sfp-led,
lp5812) in-tree during kernel compilation. Module sources are copied into
the kernel tree during custom_kernel_config (after patching, before
olddefconfig), following the pattern used by existing Armbian drivers.
Modules ship inside linux-image .deb automatically.

Changes:
- Add custom_kernel_config hook to copy module sources and enable configs
- Kbuild files for CDX/FCI/auto-bridge come from the ASK repo
- Board-specific modules (sfp-led, lp5812) use Kbuild files from BSP dir
- Remove post_install_kernel_debs module build (no longer needed)
- gateway-dk-ask .deb becomes userspace-only (tools, configs, services)
- Pin ASK repo to commit with Kbuild files
@tomazzaman tomazzaman requested review from a team and igorpecovnik as code owners April 10, 2026 18:17
@tomazzaman tomazzaman requested review from matthijskooijman and removed request for a team April 10, 2026 18:17
@github-actions github-actions bot added 05 Milestone: Second quarter release size/medium PR with more then 50 and less then 250 lines labels Apr 10, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 702ae980-f3cc-4a55-a61d-2ede26392333

📥 Commits

Reviewing files that changed from the base of the PR and between 4cd04e6 and a5bf11e.

📒 Files selected for processing (6)
  • extensions/gateway-dk-ask.sh
  • packages/bsp/gateway-dk/ask-kconfig-board-modules.patch
  • packages/bsp/gateway-dk/leds-lp5812.Kbuild
  • packages/bsp/gateway-dk/leds-lp5812.mk
  • packages/bsp/gateway-dk/sfp-led.Kbuild
  • packages/bsp/gateway-dk/sfp-led.mk
💤 Files with no reviewable changes (2)
  • packages/bsp/gateway-dk/sfp-led.mk
  • packages/bsp/gateway-dk/leds-lp5812.mk

📝 Walkthrough

Walkthrough

This pull request migrates kernel module builds from host-based cross-compilation to in-tree kernel integration. The extension script is refactored to copy module sources into the kernel tree during configuration, removing separate host build logic. Supporting Kbuild files replace standalone Makefiles, and new Kconfig options enable board-specific modules (SFP LED controller and LP5812 LED matrix driver).

Changes

Cohort / File(s) Summary
Build System Integration & Extension Script Refactoring
extensions/gateway-dk-ask.sh
Major refactoring: removed host kernel module cross-compilation (cleanup_ask_module_builddir(), post_install_kernel_debs__build_ask_modules()); added in-tree kernel integration during custom_kernel_config__ask_modules() (copies sources, patches Kconfig/Makefile, enables module options); replaced extension_finish_config__ask_enable_headers() with extension_finish_config__ask_setup(); updated .deb metadata and removed depmod calls from postinst/postrm; introduced robust runtime kernel version derivation from /lib/modules/; pinned ASK_BRANCH to specific commit.
Kernel Module Configuration
packages/bsp/gateway-dk/ask-kconfig-board-modules.patch
Added two new Kconfig tristate options under NXP_ASK: ASK_SFP_LED (GPIO-based SFP link/activity LED for Mono Gateway DK) and ASK_LEDS_LP5812 (TI LP5812 LED matrix driver), both depending on LEDS_CLASS && I2C.
In-Tree Build Configuration
packages/bsp/gateway-dk/leds-lp5812.Kbuild, packages/bsp/gateway-dk/sfp-led.Kbuild
Added Kbuild files to conditionally compile modules when corresponding Kconfig options (CONFIG_ASK_LEDS_LP5812, CONFIG_ASK_SFP_LED) are enabled; includes source directory compiler flags.
Legacy Host Build Files (Removed)
packages/bsp/gateway-dk/leds-lp5812.mk, packages/bsp/gateway-dk/sfp-led.mk
Deleted standalone Makefiles that previously delegated host-based module builds to the kernel build system, now superseded by in-tree Kbuild integration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Modules march into the kernel tree,
No more cross-compile, now we're free!
Kbuild files dance where Makefiles used to be,
LEDs glow bright in harmony.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 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: migrating ASK kernel modules from being built externally to being built in-tree for CI compatibility, which is the primary objective of the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@github-actions github-actions bot added Needs review Seeking for review Framework Framework components BSP Board Support Packages labels Apr 10, 2026
@tomazzaman tomazzaman mentioned this pull request Apr 10, 2026
13 tasks
@HeyMeco
Copy link
Copy Markdown
Collaborator

HeyMeco commented Apr 10, 2026

Looks good to me. Only comment from my side would be to move the enable extension from board to family config.

@rpardini agree?

Copy link
Copy Markdown
Member

@rpardini rpardini left a comment

Choose a reason for hiding this comment

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

Nice. Let's get this in and see what CI thinks.

It is worth fixing the framework hook-wise so this is done less painful way in the future (fix the make/git-clean vs copy hook ordering) -- it would also be needed for eg refactoring wifi drivers to extensions.

@github-actions github-actions bot added the Ready to merge Reviewed, tested and ready for merge label Apr 10, 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 Apr 10, 2026
@rpardini
Copy link
Copy Markdown
Member

move the enable extension from board to family config

At this stage, 1 board, 1 family, 1 extension, so, little difference, lets see what the future brings. Will happen naturally.

@rpardini rpardini added the Build Executing build train (permission needed) label Apr 10, 2026
@rpardini
Copy link
Copy Markdown
Member

Adding the Build tag seems to do nothing for some reason (maybe it needs a push to trigger it). Let's merge and see in main

@rpardini rpardini merged commit fdef407 into armbian:main Apr 11, 2026
13 checks passed
@tomazzaman tomazzaman deleted the fix/ask-ci-headers-packaging branch April 11, 2026 10:31
@tomazzaman
Copy link
Copy Markdown
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release BSP Board Support Packages Build Executing build train (permission needed) Framework Framework components 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.

3 participants