Skip to content

Mono gateway dk#9640

Open
tomazzaman wants to merge 15 commits intoarmbian:mainfrom
we-are-mono:mono-gateway-dk
Open

Mono gateway dk#9640
tomazzaman wants to merge 15 commits intoarmbian:mainfrom
we-are-mono:mono-gateway-dk

Conversation

@tomazzaman
Copy link
Copy Markdown

@tomazzaman tomazzaman commented Apr 7, 2026

Description

Add board support for the Mono Gateway Development Kit, a networking gateway based on the NXP LS1046A SoC (quad Cortex-A72, arm64) with 3x 1GbE SGMII, 2x 10GbE SFP+, eMMC, QSPI NOR, and I2C peripherals.

This introduces a new board family (ls1046a) and a board-specific extension (gateway-dk-ask) for NXP ASK hardware offloading.

What's included

  • Board config (gateway-dk.conf) — board definition with boot chain pinned to Mono U-Boot/ATF/RCW forks
  • Family config (ls1046a.conf) — LS1046A SoC family: NXP SDK kernel (lf-6.12.y), FMAN microcode, ATF+RCW+U-Boot boot chain
  • ASK extension (gateway-dk-ask.sh) — cross-compiles kernel modules (CDX, FCI, auto-bridge) and builds userspace tools (fmlib, fmc, libfci, libcli, dpa-app, cmm) for NXP data-plane acceleration. Packages everything as a single gateway-dk-ask .deb for OTA upgrades
  • BSP files — board-specific kernel modules (SFP-LED, LP5812 LED driver), fan control (EMC2305), boot LED indicator
  • Kernel patches — INA234 power monitor support, Mono Gateway DK device tree
  • Kernel config — hardened for production (KASLR, FORTIFY_SOURCE, PSTORE/MTD for crash logs, netfilter/nftables for gateway use)

Architecture

The family config is designed for reuse — all board-specific values (boot chain URLs, platform name, RCW path, bootenv) are set by the board config via ${VAR:?} guards. A second LS1046A board can be added without modifying family files.

The ASK extension is optional (ENABLE_ASK=no to build a basic networking image without hardware offloading).

How Has This Been Tested?

  • Full image build with ./compile.sh build BOARD=gateway-dk BRANCH=current BUILD_DESKTOP=no BUILD_MINIMAL=yes RELEASE=trixie
  • Boot on Mono Gateway DK hardware (eMMC)
  • All 3x 1GbE SGMII ports operational
  • Both 10GbE SFP+ ports operational (fiber and DAC)
  • ASK hardware offloading functional (CDX, CMM, FMAN)
  • Fan control (EMC2305) with dynamic hwmon discovery
  • SFP-LED and LP5812 LED drivers loaded and functional
  • OTA upgrade path tested (apt upgrade with gateway-dk-ask .deb)

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

  • New Features
    • Added support for the Mono Gateway Development Kit (LS1046A) platform.
    • New boot environment and kernel configurations tailored for the board.
    • Board device tree, kernel drivers for SFP LEDs and LP5812 LED controller, and INA234 power monitoring.
    • Boot LED service and LED control script.
    • Automated fancontrol generator and service integration.
    • Optional ASK hardware offload flow with kernel modules and userspace packaging.

Tomaz Zaman and others added 9 commits April 3, 2026 15:14
Add support for the Mono Gateway Development Kit, a networking gateway
based on the NXP LS1046A SoC (quad Cortex-A72) with 3x 1GbE SGMII,
2x 10GbE SFP+, eMMC, QSPI NOR, and extensive I2C peripherals.

New family: ls1046a
- NXP QorIQ kernel (lf-6.12.y) with DPAA/FMAN networking
- Custom boot chain: RCW + ATF + U-Boot (Mono forks, commit-pinned)
- FMAN microcode at 4MB eMMC offset for network initialization
- Extlinux boot via U-Boot distroboot
- Fan control (EMC2305 + cluster_thermal) with dynamic hwmon discovery

New extension: ls1046a-ask
- NXP ASK (Application Solutions Kit) hardware offloading
- Kernel modules: CDX, FCI, auto-bridge (cross-compiled from ASK repo)
- Userspace: fmlib, fmc, libfci, libcli, dpa-app, cmm
- Patched system libraries: libnetfilter-conntrack, libnfnetlink,
  iptables (QOSMARK), iproute2 (EtherIP/4RD)
- CMM daemon with systemd service (guarded by /dev/cdx_ctrl)
- All ASK sources and patches fetched from we-are-mono/ASK repo

Kernel patches:
- INA234 power sensor driver (backport, accepted upstream)
- Mono Gateway DK device tree

Signed-off-by: Tomaz Zaman <tomaz@mono.si>
Add support for the Mono Gateway Development Kit, a networking gateway
based on the NXP LS1046A SoC (quad Cortex-A72) with 3x 1GbE SGMII,
2x 10GbE SFP+, eMMC, QSPI NOR, and extensive I2C peripherals.

New family: ls1046a
- NXP QorIQ kernel (lf-6.12.y) with DPAA/FMAN networking
- Custom boot chain: RCW + ATF + U-Boot (Mono forks, commit-pinned)
- FMAN microcode at 4MB eMMC offset for network initialization
- Extlinux boot via U-Boot distroboot
- Fan control (EMC2305 + cluster_thermal) with dynamic hwmon discovery

New extension: gateway-dk-ask
- NXP ASK (Application Solutions Kit) hardware offloading
- Kernel modules: CDX, FCI, auto-bridge (cross-compiled from ASK repo)
- Board-specific modules: SFP-LED, TI LP5812 LED matrix controller
- Userspace: fmlib, fmc, libfci, libcli, dpa-app, cmm
- Patched system libraries: libnetfilter-conntrack, libnfnetlink,
  iptables (QOSMARK), iproute2 (EtherIP/4RD)
- CMM daemon with systemd service (guarded by /dev/cdx_ctrl)
- All ASK sources and patches fetched from we-are-mono/ASK repo

Kernel patches:
- INA234 power sensor driver (accepted upstream, pending release)
- Mono Gateway DK device tree

Signed-off-by: Tomaz Zaman <tomaz@mono.si>
- Pin kernel to tag:lf-6.12.49-2.2.0 instead of rolling branch:lf-6.12.y
- Lower CPUMAX to 1600000 to match actual hardware limit
- Switch ASK branch from master to mt-6.12.y
- Remove iproute2 from patched libraries (no longer needed)
- Remove fmc source CR/LF fixup (fixed upstream)
- Clean up module build dir path handling
- Consolidate U-Boot/ATF/RCW comments
- Remove stale duplicate extension ls1046a-ask.sh
- Board config: drop redundant SERIALCON, add HAS_VIDEO_OUTPUT=no
  and KERNEL_TEST_TARGET=current
- Family config: replace hardcoded gateway_dk with LS1046A_PLAT
  variable in ATF/RCW build commands
- BSP scripts: add set -e, validate LED sysfs paths before writing
- BSP: fix generate-fancontrol-conf execute permission
- Systemd services: replace fragile hwmon0 and DefaultDependencies=no
  with systemd-udev-settle.service dependency
- Extension: add EXIT trap for module builddir cleanup on failure
- Remove vim from family_tweaks (user preference, not board dep)
- Move board-specific BSP (fan control) from family to board config
- Consolidate LED module-load into single gateway-dk-leds.conf
- Make BOOTSOURCE/ATFSOURCE/RCW_SOURCE overridable via ${VAR:-default}
- Replace echo-return pattern with declare -g in ensure_fman_ucode_cached
- Replace custom ask_ensure_cached with fetch_from_repo in post_family_config
- Use mktemp -d instead of /tmp/ask-build-$$
- Add proper git-format headers and Signed-off-by to DTS patch
- Fix DTS Makefile alphabetical ordering (after fsl-ls1046a, not fsl-ls1012a)
- Fix copyright year to 2026
- Document board-specific ethact/ethprime in bootenv
- Document apt-mark hold rationale for patched ASK libraries
- Add comment explaining NXP LS1043A platform ID for DPAA1 SoCs
- Remove iproute2 from CLAUDE.md (no patches exist in ASK repo)
Combine all ASK components (kernel modules + userspace tools + configs)
into a single gateway-dk-ask .deb, version-locked to the kernel. This
enables apt-based upgrades without reflashing.

- Modules cross-compiled on host, staged for later packaging
- Userspace built in chroot, snapshotted into package tree
- Patched library .debs saved to output/debs for distribution
- Single postinst handles depmod, ldconfig, daemon-reload, apt-mark hold
- Remove autotools dependency (libfci/cmm now use plain Makefiles)
- CMM extra CFLAGS passed as env var to avoid overriding Makefile defaults
Use kernel_ver+YYYYMMDD version scheme so bugfix-only ASK rebuilds
produce a newer package even when the kernel hasn't changed. Relax
the kernel dependency from exact match (=) to minimum version (>=)
so the updated ASK package installs without requiring a new kernel.
Board/family separation:
- Move boot chain URLs (U-Boot, ATF, RCW) from family to board config
- Family config now requires board to set all platform-specific variables
- Split bootenv into family-generic ls1046a.txt and board-specific gateway-dk.txt
- Move fancontrol/lm-sensors install and IP forwarding to board config
- Delete unused family-level BSP files (packages/bsp/ls1046a/)

Extension hardening:
- Replace bare git clone with fetch_from_repo (fmlib, fmc, libcli, FMAN ucode)
- Replace trap EXIT with Armbian add_cleanup_handler API
- Add exit_with_error to all chroot build commands and depmod
- Add prerm/postrm scripts to ASK .deb package
- Remove unnecessary host build deps (chroot-only libraries)
- Compute kernel version once (ASK_KERNEL_VER), remove 3x duplication
- Quote variables in chroot command strings
- Use GIT_CONFIG_COUNT env vars instead of git config --global
- Move conntrack sysctl to packages/bsp/ (no inline heredocs)
- Fix DEBIAN/control comment (dpkg-deb rejects # comments)
- Make ASK extension optional (ENABLE_ASK=yes by default)
- Use BOOTENV_FILE for mkenvimage (was hardcoded to ls1046a.txt)

Kernel config:
- Enable KASLR, FORTIFY_SOURCE, HARDENED_USERCOPY
- Disable SLUB_TINY (switch to standard SLUB)
- Enable NF_REJECT_IPV4, IP_NF_TARGET_REJECT, NFT_REJECT, NET_SCH_INGRESS
- Enable NET_ACT_POLICE, NET_ACT_GACT, NF_FLOW_TABLE, NFT_LIMIT, NFT_REDIR
- Enable PSTORE + MTD_PSTORE with pstore.backend=mtdoops boot args
- Enable SOFTLOCKUP_DETECTOR, DEBUG_FS_DISALLOW_MOUNT
- Disable PM_DEBUG, UIO drivers, MLX4/MLX5, HFSPLUS, UFS
- Switch NO_HZ_FULL to NO_HZ_IDLE (matches NXP reference)

Driver fixes:
- sfp-led: move debug_count into per-port struct
- sfp-led: replace rtnl_lock with rtnl_trylock to prevent deadlock
- sfp-led: consistent pushd/make pattern (matches lp5812)

Patches:
- DTS: fix typo "genenerator", remove redundant status="okay"
- DTS: update header comment, remove unused PWM include
- DTS: update patch hunk line counts
- INA234: remove Yocto Upstream-Status header
Lock ASK source to a release tag instead of tracking a branch
for reproducible builds.
@tomazzaman tomazzaman requested review from a team and igorpecovnik as code owners April 7, 2026 18:53
@tomazzaman tomazzaman requested review from schwar3kat and removed request for a team April 7, 2026 18:53
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

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: 623b2041-f9ea-477b-9cec-b6d3b0964692

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

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds Mono Gateway DK support for LS1046A: board/family configs, bootenvs, kernel defconfigs and DTB, bootchain/RCW/ATF/FM microcode integration, ASK build/packaging extension, new kernel drivers (LP5812, SFP LED), BSP packages, services, and helper scripts/patches.

Changes

Cohort / File(s) Summary
Board & Bootenv
config/boards/gateway-dk.conf, config/bootenv/gateway-dk.txt, config/bootenv/ls1046a.txt
New board metadata and build/source pins, boot environment variables (console, addresses, mtdparts), optional ASK toggle, and post-family hooks to install modules, LED service, sysctl, and fan services.
Family & Build Logic
config/sources/families/ls1046a.conf
New LS1046A family script: kernel/branch selection, FMAN microcode fetch/cache, RCW/ATF orchestration, custom U‑Boot postprocess (build RCW/PBL/FIP), eMMC layout writer, and family post-install tweaks.
Kernel Config & Patches / DTS
config/kernel/linux-ls1046a-current.config, config/kernel/linux-ls1046a-ask-current.config, patch/kernel/archive/ls1046a-6.12/*
Adds kernel defconfigs and patches: INA234 hwmon support, large mono-gateway-dk DTS and DTB Makefile target.
ASK Build Extension
extensions/gateway-dk-ask.sh
New, extensive extension to fetch/pin ASK repos, support local bind-mounts, stage kernel patches, cross-build ASK kernel modules, build userspace components in chroot, rebuild patched Debian libs, and package/install a combined gateway-dk-ask .deb.
BSP Packages & Services
packages/bsp/gateway-dk/*
Adds conntrack sysctl, boot LED script and systemd unit, fancontrol generator script and unit, service units and install hooks, and helper packaging files.
LP5812 LED Driver
packages/bsp/gateway-dk/leds-lp5812.c, .../leds-lp5812.h, .../leds-lp5812.mk
New I2C kernel driver and header for TI LP5812 multicolor LED controller plus module Makefile for building/installing the module.
SFP LED Monitor Driver
packages/bsp/gateway-dk/sfp-led.c, .../sfp-led.mk
New platform driver monitoring SFP EEPROM/DDM and netdev state to drive link/activity LEDs with blink/activity logic; includes module Makefile.
Packaging/Helpers & Makefiles
packages/bsp/gateway-dk/*.service, packages/bsp/gateway-dk/*scripts*, packages/bsp/gateway-dk/*.mk
Service unit files, runtime helper scripts (LED/fancontrol), and Makefile wrappers for module builds and runtime configuration.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Host as Host Build System
  participant ASKRepo as ASK Repo (git / file://)
  participant Kernel as Kernel Build System
  participant Modules as Kernel Modules Builder
  participant Packager as .deb Packager
  participant Target as Target Rootfs (chroot)

  Host->>ASKRepo: fetch or bind-mount ASK sources
  Host->>Kernel: stage ASK kernel patches into userpatches
  Host->>Kernel: build kernel (produce headers)
  Kernel-->>Modules: provide kernel headers & build env
  Host->>Modules: cross-compile ASK kernel modules (.ko)
  Modules-->>Packager: stage .ko and userspace artifacts
  Host->>Packager: build gateway-dk-ask .deb (control + maint scripts)
  Packager->>Target: install .deb via chroot (dpkg -i)
  Target-->>Host: run depmod, enable services, install configs
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Poem

🐰 I nibble patches, stitch a DTB seam bright,
LEDs blink, fans hum into the night,
Modules compile, packages hop into place,
ASK and boot chains settle in their space,
A tiny hop — the gateway wakes with light.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 34.04% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Mono gateway dk' is extremely vague and generic, lacking specific information about what the change accomplishes. Replace with a more descriptive title such as 'Add Mono Gateway Development Kit board support' or 'Add LS1046A Mono Gateway DK board and ASK extension' to clearly convey the primary change.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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 05 Milestone: Second quarter release size/large PR with 250 lines or more Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Framework Framework components Patches Patches related to kernel, U-Boot, ... BSP Board Support Packages labels Apr 7, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (1)
packages/bsp/gateway-dk/sfp-led.mk (1)

1-12: Minor inconsistency with leds-lp5812.mk.

This Makefile uses SRC := $(PWD) and M=$(SRC), while leds-lp5812.mk uses M=$(PWD) directly. Both work, but consider aligning them for consistency.

Align with leds-lp5812.mk style
 obj-m := sfp-led.o
 
-SRC := $(PWD)
+ccflags-y := -I$(src)
 
 all:
-	$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules
+	$(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules
 
 modules_install:
-	$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
+	$(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules_install
 
 clean:
-	$(MAKE) -C $(KERNEL_SRC) M=$(SRC) clean
+	$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bsp/gateway-dk/sfp-led.mk` around lines 1 - 12, Replace the
indirection using the SRC variable in sfp-led.mk: remove the SRC := $(PWD) line
and change the make invocations that use M=$(SRC) to use M=$(PWD) directly
(i.e., update the all, modules_install and clean targets), matching the style
used in leds-lp5812.mk for consistency while keeping the existing obj-m :=
sfp-led.o line unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@config/sources/families/ls1046a.conf`:
- Around line 154-160: The family_tweaks() function currently copies the FMAN
blob into "${SDCARD}/lib/firmware/" which bypasses the override path; update the
copy target to "${SDCARD}/lib/firmware/updates/${FMAN_UCODE_FILE}" and ensure
the updates directory exists (create "${SDCARD}/lib/firmware/updates/" before
the cp). Keep the existing calls (display_alert, ensure_fman_ucode_cached) and
only change the mkdir -p and cp destination to use the "updates" subdirectory so
the firmware overrides package-provided firmware correctly.

In `@extensions/gateway-dk-ask.sh`:
- Around line 289-290: The gateway-dk-ask package currently snapshots ASK
artifacts but leaves patched .debs emitted to output/debs so an OTA install of
gateway-dk-ask will not install the patched
libnetfilter-conntrack/libnfnetlink/iptables and cmm falls back to upstream
userspace; update the build flow so build_ask_patched_libraries produces or
embeds the patched .deb artifacts into the gateway-dk-ask OTA artifact (or makes
gateway-dk-ask a meta-package that lists and carries those exact .deb files as
bundled dependencies), ensure the code paths that call
build_ask_patched_libraries (e.g., where gateway-dk-ask is assembled) copy or
include output/debs into the package snapshot instead of only emitting them
separately, and repeat this change for the other occurrences noted (lines
mentioned in the review) so an OTA install of gateway-dk-ask always installs the
patched netfilter userspace required by cmm.
- Around line 312-317: The package currently copies cmm.service at build time
but never enables it for OTA installs; update the package maintainer scripts so
postinst runs systemctl daemon-reload && systemctl enable cmm.service (guarded
to only run when systemctl exists and respecting
ConditionPathExists=/dev/cdx_ctrl), and add symmetric cleanup in prerm
(systemctl disable --now cmm.service if present) so upgrades/installs on
existing boxes enable/disable the unit correctly; apply the same change pattern
for the other unit installation blocks referenced (lines 347-370 and 401-408).
- Around line 71-79: post_family_config__ask_kernel_patch currently copies the
ASK kernel patch into the global `${SRC}/userpatches/...` which persists across
builds; instead make the patch staging local to the ASK build (e.g. under
`${ASK_CACHE_DIR}` or a per-build directory like
`${BUILD_DIR}/userpatches/kernel/ls1046a-${KERNEL_MAJOR_MINOR}`) and only run
the staging when ASK is enabled; update the function to check the build flag
(ENABLE_ASK) before copying, change the destination from
`${SRC}/userpatches/kernel/archive/ls1046a-${KERNEL_MAJOR_MINOR}` to a
non-global path (e.g.
`${ASK_CACHE_DIR}/staged/userpatches/kernel/ls1046a-${KERNEL_MAJOR_MINOR}`), and
ensure any temporary staging is cleaned up after the build so the global
checkout is not modified.

In `@packages/bsp/gateway-dk/generate-fancontrol-conf.service`:
- Around line 1-13: The unit exposes a risk where a stale /etc/fancontrol from a
previous boot can cause fancontrol.service to start with invalid hwmon paths;
update the generator script invoked by ExecStart
(/usr/local/bin/generate-fancontrol-conf) to remove any existing /etc/fancontrol
at startup and also ensure it deletes /etc/fancontrol on failure before exiting
so the fancontrol.service ConditionPathExists check won't be fooled; reference
the generator script, /etc/fancontrol, and fancontrol.service when implementing
the startup rm and cleanup-on-error logic.

---

Nitpick comments:
In `@packages/bsp/gateway-dk/sfp-led.mk`:
- Around line 1-12: Replace the indirection using the SRC variable in
sfp-led.mk: remove the SRC := $(PWD) line and change the make invocations that
use M=$(SRC) to use M=$(PWD) directly (i.e., update the all, modules_install and
clean targets), matching the style used in leds-lp5812.mk for consistency while
keeping the existing obj-m := sfp-led.o line unchanged.
🪄 Autofix (Beta)

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 07405779-db9f-4f6a-a79e-e583c6d9f09f

📥 Commits

Reviewing files that changed from the base of the PR and between 216dfe6 and 62b1262.

📒 Files selected for processing (18)
  • config/boards/gateway-dk.conf
  • config/bootenv/gateway-dk.txt
  • config/bootenv/ls1046a.txt
  • config/kernel/linux-ls1046a-current.config
  • config/sources/families/ls1046a.conf
  • extensions/gateway-dk-ask.sh
  • packages/bsp/gateway-dk/99-ls1046a-conntrack.conf
  • packages/bsp/gateway-dk/gateway-dk-leds.service
  • packages/bsp/gateway-dk/gateway-dk-leds.sh
  • packages/bsp/gateway-dk/generate-fancontrol-conf
  • packages/bsp/gateway-dk/generate-fancontrol-conf.service
  • packages/bsp/gateway-dk/leds-lp5812.c
  • packages/bsp/gateway-dk/leds-lp5812.h
  • packages/bsp/gateway-dk/leds-lp5812.mk
  • packages/bsp/gateway-dk/sfp-led.c
  • packages/bsp/gateway-dk/sfp-led.mk
  • patch/kernel/archive/ls1046a-6.12/001-hwmon-ina2xx-Add-INA234-support.patch
  • patch/kernel/archive/ls1046a-6.12/002-arm64-dts-Add-Mono-Gateway-DK-device-tree.patch

- Place FMAN firmware in /lib/firmware/updates/ (correct override convention)
- Enable cmm.service in postinst for OTA installs
- Delete stale /etc/fancontrol before regenerating (hwmon numbers may change)
- Remove SRC indirection in sfp-led.mk (use M=$(PWD) directly, matches lp5812.mk)
- Document why patched libs are separate debs (system package overrides)
- Document userpatches/ as standard Armbian extension patch staging
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@extensions/gateway-dk-ask.sh`:
- Around line 26-27: The ASK_HOST_TRIPLET is computed at source-time from
KERNEL_COMPILER and can be empty if KERNEL_COMPILER isn't set yet; move the
derivation into a later hook so it runs after family/board config is applied.
Remove the top-level declare -g ASK_HOST_TRIPLET="${KERNEL_COMPILER%-}" and
instead compute and export ASK_HOST_TRIPLET inside a post-family-config hook
(e.g., post_family_config or extension_finish_config__ask_enable_headers) by
deriving ASK_HOST_TRIPLET="${KERNEL_COMPILER%-}" there and marking it
global/declared as needed so downstream code (library paths, functions that
reference ASK_HOST_TRIPLET) sees a non-empty triplet. Ensure the hook runs in
the same shell scope so other extension logic using ASK_HOST_TRIPLET gets the
correct value.
- Around line 389-390: The current ask_version variable uses only the date
(local ask_version="${kernel_ver}+$(date +%Y%m%d)") causing same-day rebuilds to
produce identical versions; update the assignment for ask_version to include a
finer-grained timestamp or unique build identifier (e.g., use date +%Y%m%d%H%M%S
or incorporate a short git commit hash from the ASK repo via git rev-parse
--short HEAD, or a BUILD_COUNTER) so each build yields a unique version string;
change the code that sets local ask_version (reference the ask_version variable
and kernel_ver) to append the chosen unique suffix and ensure any logging or
packaging steps that consume ask_version continue to use the new value.
🪄 Autofix (Beta)

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bcfe0743-4be6-411d-b2c8-0406137f8c76

📥 Commits

Reviewing files that changed from the base of the PR and between 62b1262 and 0aca94e.

📒 Files selected for processing (4)
  • config/sources/families/ls1046a.conf
  • extensions/gateway-dk-ask.sh
  • packages/bsp/gateway-dk/generate-fancontrol-conf
  • packages/bsp/gateway-dk/sfp-led.mk
✅ Files skipped from review due to trivial changes (2)
  • packages/bsp/gateway-dk/sfp-led.mk
  • packages/bsp/gateway-dk/generate-fancontrol-conf
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/sources/families/ls1046a.conf

KERNEL_COMPILER is not set when extension files are sourced.
Move ASK_HOST_TRIPLET derivation into extension_finish_config
where arch config has already run.
@rpardini
Copy link
Copy Markdown
Member

rpardini commented Apr 7, 2026

Only problem I can immediately see is that the extension modifies the kernel -- thus needs a separate LINUXFAMILY if it is activated -- otherwise image builds will be fine, but when deployed to apt repo there will be conflicts (two different linux-image packages with same name).

@tomazzaman
Copy link
Copy Markdown
Author

Only problem I can immediately see is that the extension modifies the kernel -- thus needs a separate LINUXFAMILY if it is activated -- otherwise image builds will be fine, but when deployed to apt repo there will be conflicts (two different linux-image packages with same name).

Makes sense, didn't think of this at all. Will add a separate LINUXFAMILY.

When ASK is enabled, the extension applies an extra kernel patch, producing
a different kernel binary. Override LINUXFAMILY to ls1046a-ask so the kernel
.deb gets a distinct name (linux-image-current-ls1046a-ask) that won't
collide with non-ASK builds in the apt repo.

- Add post_family_config hook to override LINUXFAMILY and LINUXCONFIG
- Symlink kernel config (same config, different name)
- Use dynamic ${BRANCH}-${LINUXFAMILY} in ASK .deb Depends
- Fix cleanup handler to not fail under set -e
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
extensions/gateway-dk-ask.sh (1)

68-73: Add validation for KERNEL_COMPILER before deriving triplet.

If KERNEL_COMPILER is unset when this hook runs, ASK_HOST_TRIPLET becomes empty, causing malformed library paths (e.g., /usr/lib//libfm-arm.a). While the Armbian framework typically sets this earlier, adding validation improves robustness.

🛡️ Suggested defensive validation
 function extension_finish_config__ask_enable_headers() {
 	declare -g INSTALL_HEADERS="yes"
 	# Derive multiarch triplet here (not at source time) — KERNEL_COMPILER is set by arch config
+	[[ -z "${KERNEL_COMPILER}" ]] && exit_with_error "KERNEL_COMPILER not set; cannot derive ASK_HOST_TRIPLET"
 	declare -g ASK_HOST_TRIPLET="${KERNEL_COMPILER%-}"
 	display_alert "ASK extension" "enabling kernel headers for module builds" "info"
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@extensions/gateway-dk-ask.sh` around lines 68 - 73, In
extension_finish_config__ask_enable_headers, KERNEL_COMPILER may be unset
causing ASK_HOST_TRIPLET to be empty and malformed paths; add a defensive check
for an empty or unset KERNEL_COMPILER before deriving ASK_HOST_TRIPLET, and if
missing call display_alert with an error context (referencing "ASK extension" or
similar) and abort/return non-zero to prevent continuation, otherwise derive
ASK_HOST_TRIPLET="${KERNEL_COMPILER%-}" as existing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@extensions/gateway-dk-ask.sh`:
- Around line 68-73: In extension_finish_config__ask_enable_headers,
KERNEL_COMPILER may be unset causing ASK_HOST_TRIPLET to be empty and malformed
paths; add a defensive check for an empty or unset KERNEL_COMPILER before
deriving ASK_HOST_TRIPLET, and if missing call display_alert with an error
context (referencing "ASK extension" or similar) and abort/return non-zero to
prevent continuation, otherwise derive ASK_HOST_TRIPLET="${KERNEL_COMPILER%-}"
as existing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4c8bad0b-e49d-4821-9ecc-5cdf7b6dab4a

📥 Commits

Reviewing files that changed from the base of the PR and between af52a13 and 5d6aa8a.

📒 Files selected for processing (2)
  • config/kernel/linux-ls1046a-ask-current.config
  • extensions/gateway-dk-ask.sh
✅ Files skipped from review due to trivial changes (1)
  • config/kernel/linux-ls1046a-ask-current.config

Fail early with a clear error if KERNEL_COMPILER is not set
when deriving the multiarch triplet.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
extensions/gateway-dk-ask.sh (2)

409-409: Dependency version uses >= which may allow incompatible kernel upgrades.

The dependency linux-image-${BRANCH}-${LINUXFAMILY} (>= ${kernel_ver}) allows installing a newer kernel without rebuilding gateway-dk-ask. However, ASK kernel modules are compiled against a specific kernel version and may fail to load if the kernel ABI changes.

Consider using a stricter version match or documenting this constraint:

-Depends: linux-image-${BRANCH}-${LINUXFAMILY} (>= ${kernel_ver}), libxml2, libpcap0.8
+Depends: linux-image-${BRANCH}-${LINUXFAMILY} (= ${kernel_ver}), libxml2, libpcap0.8

Alternatively, if looser coupling is intentional, the modules could use DKMS for rebuild-on-kernel-upgrade.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@extensions/gateway-dk-ask.sh` at line 409, The Depends entry for
gateway-dk-ask currently allows newer kernels via
"linux-image-${BRANCH}-${LINUXFAMILY} (>= ${kernel_ver})", which can break
kernel modules; change this to require an exact kernel package match by using a
strict equality constraint (e.g., linux-image-${BRANCH}-${LINUXFAMILY} (=
${kernel_ver})) or otherwise pin to the exact ABI/version variable
(${kernel_ver}) in the Depends line, or alternatively document/implement DKMS
support so modules are rebuilt on kernel upgrades; update the Depends
declaration referencing BRANCH, LINUXFAMILY and kernel_ver accordingly.

86-86: Consider using KERNELPATCHDIR variable instead of hardcoding the path.

The hardcoded path archive/ls1046a-${KERNEL_MAJOR_MINOR} matches the family config's KERNELPATCHDIR value. However, using the variable directly would improve maintainability and follow the DRY principle:

Suggested change
-	local patch_dst="${SRC}/userpatches/kernel/archive/ls1046a-${KERNEL_MAJOR_MINOR}"
+	local patch_dst="${SRC}/userpatches/kernel/${KERNELPATCHDIR}"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@extensions/gateway-dk-ask.sh` at line 86, The local variable patch_dst
currently hardcodes the path "archive/ls1046a-${KERNEL_MAJOR_MINOR}"; change it
to use the existing KERNELPATCHDIR variable instead (i.e., set patch_dst to
"${SRC}/${KERNELPATCHDIR}") so the script follows DRY and uses the family config
value; update the assignment where patch_dst is defined and ensure any
subsequent usage of patch_dst still works with the new value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@extensions/gateway-dk-ask.sh`:
- Line 409: The Depends entry for gateway-dk-ask currently allows newer kernels
via "linux-image-${BRANCH}-${LINUXFAMILY} (>= ${kernel_ver})", which can break
kernel modules; change this to require an exact kernel package match by using a
strict equality constraint (e.g., linux-image-${BRANCH}-${LINUXFAMILY} (=
${kernel_ver})) or otherwise pin to the exact ABI/version variable
(${kernel_ver}) in the Depends line, or alternatively document/implement DKMS
support so modules are rebuilt on kernel upgrades; update the Depends
declaration referencing BRANCH, LINUXFAMILY and kernel_ver accordingly.
- Line 86: The local variable patch_dst currently hardcodes the path
"archive/ls1046a-${KERNEL_MAJOR_MINOR}"; change it to use the existing
KERNELPATCHDIR variable instead (i.e., set patch_dst to
"${SRC}/${KERNELPATCHDIR}") so the script follows DRY and uses the family config
value; update the assignment where patch_dst is defined and ensure any
subsequent usage of patch_dst still works with the new value.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cf5dcb30-6de7-48df-8fe7-9fc5edcd1f1d

📥 Commits

Reviewing files that changed from the base of the PR and between 5d6aa8a and 70d60c2.

📒 Files selected for processing (1)
  • extensions/gateway-dk-ask.sh

- Use ${KERNELPATCHDIR} instead of hardcoded path for userpatches staging
- Expand comment on >= kernel dependency to explain rationale clearly
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

🚫 Missing required board assets

This PR adds new board configuration(s). Required assets must already exist in github/armbian/armbian.github.io.
They are required by Armbian Imager to ensure all boards are displayed with proper images.

  • Board images: board-images/<board>.png (1920x1080 px transparent)
  • Vendor logos: board-vendor-logos/<vendor>-logo.png (512x512 px transparent)

Missing items

  • Board image missing for gateway-dk

    • Expected: board-images/gateway-dk.png
    • Fix: add the file to armbian/armbian.github.io (folder board-images/)
  • Vendor logo missing for vendor mono (used by board gateway-dk)

    • Expected: board-vendor-logos/mono-logo.png
    • Fix: add the file to armbian/armbian.github.io (folder board-vendor-logos/)
    • Naming rules: lowercase, dashes (e.g. kobol-logo.png, not Kobol_logo.png)

Once the missing files are added (or a PR is opened in armbian/armbian.github.io), re-run this check.

@armbian armbian deleted a comment from github-actions bot Apr 8, 2026
@armbian armbian deleted a comment from github-actions bot Apr 8, 2026
@armbian armbian deleted a comment from github-actions bot Apr 8, 2026
@armbian armbian deleted a comment from github-actions bot Apr 8, 2026
@armbian armbian deleted a comment from github-actions bot Apr 8, 2026
@armbian armbian deleted a comment from github-actions bot Apr 8, 2026
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.

Could be more nits here and there but generally looks good. Let's see what CI says...

@github-actions github-actions bot added the Ready to merge Reviewed, tested and ready for merge label Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

✅ 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 8, 2026
@tomazzaman
Copy link
Copy Markdown
Author

tomazzaman commented Apr 8, 2026

Also adding board image and logo for the Armbian imager here, so we keep it in one thread.

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 Framework Framework components Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

3 participants