Skip to content
Open
5 changes: 5 additions & 0 deletions config/boards/gateway-dk.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ KERNEL_TEST_TARGET="current"
HAS_VIDEO_OUTPUT="no"
BOOT_FDT_FILE="freescale/mono-gateway-dk.dtb"
BOOTENV_FILE="gateway-dk.txt"
# Remove fake-hwclock: we have a real pcf2131 RTC, util-linux-extra handles sync via udev
PACKAGE_LIST_BOARD_REMOVE="fake-hwclock"

# U-Boot, ATF, and RCW — Mono forks with custom DDR4 config and SERDES
declare -g BOOTSOURCE="https://github.com/we-are-mono/u-boot"
Expand Down Expand Up @@ -55,6 +57,9 @@ function post_family_tweaks__gateway_dk_services() {
display_alert "Installing fancontrol" "emc2305 + cluster_thermal" "info"
chroot_sdcard_apt_get_install fancontrol lm-sensors

# hwclock for RTC management (pcf2131 on I2C)
chroot_sdcard_apt_get_install util-linux-extra

chroot_sdcard systemctl enable gateway-dk-leds.service
chroot_sdcard systemctl enable generate-fancontrol-conf.service
chroot_sdcard systemctl enable fancontrol.service
Expand Down
1 change: 1 addition & 0 deletions config/kernel/linux-ls1046a-current.config
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_MPC8XXX=y
CONFIG_GPIO_SYSCON=y
CONFIG_GPIO_PCA953X=y
CONFIG_POWER_RESET_GPIO=y
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Apr 11, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's check if we have the DTS patch mentioned in the review
find . -name "*002-arm64-dts-Add-Mono-Gateway-DK-device-tree.patch" -o -name "*ls1046a*" | head -20

Repository: armbian/build

Length of output: 394


🏁 Script executed:

# Check the current config file to understand the context
find . -name "linux-ls1046a-current.config" -type f

Repository: armbian/build

Length of output: 101


🏁 Script executed:

# Search for POWER_RESET in any existing config files
rg "CONFIG_POWER_RESET" --type txt

Repository: armbian/build

Length of output: 39


🏁 Script executed:

# Search for references to ARCH_LAYERSCAPE in the repo
rg "ARCH_LAYERSCAPE" --type txt

Repository: armbian/build

Length of output: 39


🏁 Script executed:

# Check the DTS patch to see what it adds
cat -n patch/kernel/archive/ls1046a-6.12/002-arm64-dts-Add-Mono-Gateway-DK-device-tree.patch | sed -n '60,70p'

Repository: armbian/build

Length of output: 338


🏁 Script executed:

# Check the config file around line 446
cat -n config/kernel/linux-ls1046a-current.config | sed -n '440,455p'

Repository: armbian/build

Length of output: 554


🏁 Script executed:

# Look for any other references to POWER_RESET in patches or configs
rg "POWER_RESET" --type-list | head -5

Repository: armbian/build

Length of output: 446


🏁 Script executed:

# Search in all files, not just txt
rg "POWER_RESET" 2>/dev/null | head -20

Repository: armbian/build

Length of output: 2643


🌐 Web query:

Linux 6.12 kernel POWER_RESET Kconfig POWER_RESET_GPIO dependency

💡 Result:

In Linux kernel 6.12, CONFIG_POWER_RESET_GPIO is the Kconfig option for the GPIO power-off driver (drivers/power/reset/gpio-poweroff.c), which toggles a GPIO pin to power off the board. It is located under the "Board level reset or power off" menu in drivers/power/reset/Kconfig. It depends on CONFIG_POWER_RESET (the menuconfig enabling the board-level poweroff/reset drivers) and CONFIG_OF_GPIO (for Device Tree GPIO support). Sources indicate this dependency structure has been consistent from kernels 3.8 through 6.19. Note: There is a separate CONFIG_POWER_RESET_GPIO_RESTART for GPIO-based restart (gpio-restart.c), and RESET_GPIO in drivers/reset/Kconfig (depends on GPIOLIB) for the generic reset controller framework, which is distinct from poweroff.

Citations:


Add CONFIG_POWER_RESET=y to enable the gpio-poweroff functionality.

CONFIG_POWER_RESET_GPIO depends on the parent CONFIG_POWER_RESET option in Linux 6.12. The DTS patch adds a gpio-poweroff device node, but without the parent symbol enabled, this node will be non-functional. This follows the established pattern in Armbian across other boards (filogic-6.16, sunxi kernels) where both symbols are explicitly enabled together.

🔧 Suggested config change
+CONFIG_POWER_RESET=y
 CONFIG_POWER_RESET_GPIO=y
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/kernel/linux-ls1046a-current.config` at line 446, The config enables
CONFIG_POWER_RESET_GPIO but omits its required parent CONFIG_POWER_RESET; update
the kernel config to also enable CONFIG_POWER_RESET so the gpio-poweroff DTS
node becomes functional—ensure both CONFIG_POWER_RESET and
CONFIG_POWER_RESET_GPIO are set to y (mirror the pattern used for other boards)
by adding CONFIG_POWER_RESET=y alongside the existing CONFIG_POWER_RESET_GPIO=y.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@tomazzaman can you run ./compile.sh rewrite-kernel-config BOARD=gateway-dk BRANCH=current and check if the added config persists? Else the suggestion from coderabbit might need to be applied.

This comment was marked as off-topic.

CONFIG_SENSORS_LM75=y
CONFIG_SENSORS_EMC2103=y
CONFIG_SENSORS_EMC2305=y
Expand Down
45 changes: 33 additions & 12 deletions extensions/gateway-dk-ask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Source repos and refs (pinned to match Yocto)
# For local testing: set ASK_REPO="file:///path/to/ASK" — the Docker mount hook below handles it
declare -g ASK_REPO="https://github.com/we-are-mono/ASK.git"
declare -g ASK_BRANCH="commit:44883f88b26478fa2c9beea81702023cbc057f94"
declare -g ASK_BRANCH="commit:8ba7807b15834ae6c0d5a82dddc71dcc367c1f4e"
declare -g FMLIB_REPO="https://github.com/nxp-qoriq/fmlib.git"
declare -g FMLIB_COMMIT="7a58ecaf0d90d71d6b78d3ac7998282a472c4394"
declare -g FMC_REPO="https://github.com/nxp-qoriq/fmc.git"
Expand Down Expand Up @@ -162,7 +162,7 @@ function post_install_kernel_debs__ask_module_autoload() {
# Copy patches into chroot before patched library builds (runs before build_ask_userspace)
function pre_customize_image__000_prepare_ask_patches() {
mkdir -p "${SDCARD}/tmp/ask-patches"
local patch_dirs=("libnetfilter-conntrack" "libnfnetlink" "iptables")
local patch_dirs=("libnetfilter-conntrack" "libnfnetlink")
for pdir in "${patch_dirs[@]}"; do
[[ -d "${ASK_CACHE_DIR}/patches/${pdir}" ]] || exit_with_error "ASK patch directory missing" "${ASK_CACHE_DIR}/patches/${pdir}"
cp "${ASK_CACHE_DIR}/patches/${pdir}/"*.patch "${SDCARD}/tmp/ask-patches/"
Expand All @@ -186,10 +186,12 @@ function pre_customize_image__001_build_ask_userspace() {
[[ -z "${kernel_ver}" ]] && exit_with_error "No kernel version found in ${SDCARD}/lib/modules/"
local kdir="/usr/src/linux-headers-${kernel_ver}"

# Install build dependencies in chroot
# Install build dependencies and runtime packages in chroot
# iptables is a runtime dep — CMM uses QOSMARK rules via our xtables extensions
display_alert "ASK extension" "installing build dependencies" "info"
chroot_sdcard_apt_get_install build-essential \
pkg-config libxml2-dev libpcap-dev libcrypt-dev libtclap-dev
pkg-config libxml2-dev libpcap-dev libcrypt-dev libtclap-dev libxtables-dev \
iptables

# Copy sources into chroot
mkdir -p "${SDCARD}/tmp/ask-userspace"
Expand Down Expand Up @@ -269,6 +271,21 @@ function pre_customize_image__001_build_ask_userspace() {
cp "${ASK_CACHE_DIR}/${ASK_DPA_APP_DIR}/files/etc/cdx_pcd.xml" "${SDCARD}/etc/"
cp "${ASK_CACHE_DIR}/${ASK_DPA_APP_DIR}/files/etc/cdx_sp.xml" "${SDCARD}/etc/"

# --- xtables extensions (standalone .so files, not patching iptables) ---
display_alert "ASK extension" "building xtables extensions" "info"
cp -a "${ASK_CACHE_DIR}/iptables-extensions" "${SDCARD}/tmp/ask-userspace/iptables-extensions"
chroot_sdcard "cd /tmp/ask-userspace/iptables-extensions && \
for src in libxt_*.c; do \
name=\"\${src%.c}\"; \
gcc -shared -fPIC -O2 \
-D_init=\${name}_init \
-I./include \
-o \"\${name}.so\" \"\${src}\" || exit 1; \
done && \
install -d /usr/lib/${ASK_HOST_TRIPLET}/xtables && \
install -m 644 libxt_*.so /usr/lib/${ASK_HOST_TRIPLET}/xtables/" \
|| exit_with_error "xtables extensions build failed"

# --- Patched system libraries (must be before CMM which depends on patched libnetfilter-conntrack) ---
build_ask_patched_libraries

Expand Down Expand Up @@ -307,7 +324,7 @@ function pre_customize_image__001_build_ask_userspace() {
# The postinst re-applies holds on every upgrade. Security updates must be
# tracked and re-patched manually.
display_alert "ASK extension" "pinning patched packages" "info"
chroot_sdcard "apt-mark hold libnetfilter-conntrack3 libnfnetlink0 iptables"
chroot_sdcard "apt-mark hold libnetfilter-conntrack3 libnfnetlink0"

# Install sysctl tuning for conntrack
install -Dm 644 "${SRC}/packages/bsp/gateway-dk/99-ls1046a-conntrack.conf" \
Expand Down Expand Up @@ -359,6 +376,13 @@ function pre_customize_image__001_build_ask_userspace() {
done
done

# xtables extensions (QOSMARK/QOSCONNMARK)
mkdir -p "${pkgdir}/usr/lib/${ASK_HOST_TRIPLET}/xtables"
for f in "${SDCARD}/usr/lib/${ASK_HOST_TRIPLET}/xtables/"libxt_qos*.so \
"${SDCARD}/usr/lib/${ASK_HOST_TRIPLET}/xtables/"libxt_QOS*.so; do
[[ -f "$f" ]] && cp -a "$f" "${pkgdir}/usr/lib/${ASK_HOST_TRIPLET}/xtables/"
done

# Version: kernel version + build date — allows bugfix rebuilds without kernel change
local ask_version="${kernel_ver}+$(date +%Y%m%d)"

Expand All @@ -374,7 +398,7 @@ Architecture: arm64
Section: net
Priority: optional
Maintainer: Mono Technologies <support@mono.si>
Depends: linux-image-${BRANCH}-${LINUXFAMILY} (>= ${kernel_ver}), libxml2, libpcap0.8
Depends: linux-image-${BRANCH}-${LINUXFAMILY} (>= ${kernel_ver}), libxml2, libpcap0.8, iptables
Description: NXP ASK hardware offloading userspace for Mono Gateway DK
Userspace tools (fmlib, fmc, libfci, libcli, dpa-app, cmm) and configuration
for NXP ASK data-plane acceleration on the LS1046A Gateway DK.
Expand All @@ -391,7 +415,7 @@ if command -v systemctl >/dev/null 2>&1; then
systemctl enable cmm.service 2>/dev/null || true
fi
# Re-pin patched ASK libraries — vanilla Debian versions break CMM/CDX offloading
apt-mark hold libnetfilter-conntrack3 libnfnetlink0 iptables 2>/dev/null || true
apt-mark hold libnetfilter-conntrack3 libnfnetlink0 2>/dev/null || true
EOF
chmod 755 "${pkgdir}/DEBIAN/postinst"

Expand All @@ -406,7 +430,7 @@ EOF
ldconfig || true
systemctl daemon-reload || true
if [ "\$1" = "remove" ] || [ "\$1" = "purge" ]; then
apt-mark unhold libnetfilter-conntrack3 libnfnetlink0 iptables 2>/dev/null || true
apt-mark unhold libnetfilter-conntrack3 libnfnetlink0 2>/dev/null || true
fi
EOF
chmod 755 "${pkgdir}/DEBIAN/postrm"
Expand Down Expand Up @@ -438,7 +462,7 @@ function build_ask_patched_libraries() {
# Install all build dependencies upfront
display_alert "ASK extension" "installing build deps for patched libraries" "info"
chroot_sdcard "DEBIAN_FRONTEND=noninteractive apt-get -y build-dep \
libnetfilter-conntrack libnfnetlink iptables"
libnetfilter-conntrack libnfnetlink"

# Staging dir for patched .debs (saved to output later)
mkdir -p "${SDCARD}/tmp/ask-patched-debs"
Expand All @@ -452,9 +476,6 @@ function build_ask_patched_libraries() {
"01-nxp-ask-nonblocking-heap-buffer.patch" \
"libnfnetlink0_*.deb libnfnetlink-dev_*.deb"

rebuild_patched_deb "iptables" \
"001-qosmark-extensions.patch" \
"libip4tc2_*.deb libip6tc2_*.deb libxtables12_*.deb iptables_*.deb"

# Copy patched .debs to output for distribution
mkdir -p "${SRC}/output/debs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ diff --git a/arch/arm64/boot/dts/freescale/mono-gateway-dk.dts b/arch/arm64/boot
new file mode 100644
--- /dev/null
+++ b/arch/arm64/boot/dts/freescale/mono-gateway-dk.dts
@@ -0,0 +1,1021 @@
@@ -0,0 +1,1027 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for Mono Gateway DK (NXP LS1046A).
Expand Down Expand Up @@ -60,6 +60,12 @@ new file mode 100644
+ stdout-path = "serial0:115200n8";
+ };
+
+ gpio-poweroff {
+ compatible = "gpio-poweroff";
+ gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
+ timeout-ms = <1000>;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
Expand Down
Loading