Successfully build based on ASK and run k8s, cdx pending

This commit is contained in:
2026-05-10 04:35:55 +08:00
parent 9c6fb5194e
commit 9fd18cfe6f
11 changed files with 403 additions and 271 deletions

View File

@@ -1,9 +1,10 @@
INTERVAL=10 INTERVAL=10
DEVPATH=hwmon0=devices/platform/soc/2180000.i2c/i2c-0/i2c-7/7-002e hwmon1=devices/virtual/thermal/thermal_zone0 DEVPATH=hwmon0=devices/platform/soc/1a00000.fman/1afd000.mdio/mdio_bus/0x0000000001afd000/0x0000000001afd000:00 hwmon3=devices/platform/soc/2180000.i2c/i2c-0/i2c-7/7-002e
DEVNAME=hwmon0=emc2305 hwmon1=ddr_thermal DEVNAME=hwmon0=0x0000000001afd000:00 hwmon3=emc2305
FCTEMPS=hwmon0/pwm2=hwmon1/temp1_input FCTEMPS=hwmon3/pwm1=hwmon0/temp1_input
FCFANS= hwmon0/pwm2=hwmon0/fan1_input FCFANS= hwmon3/pwm1=hwmon3/fan1_input
MINTEMP=hwmon0/pwm2=35 MINTEMP=hwmon3/pwm1=35
MAXTEMP=hwmon0/pwm2=60 MAXTEMP=hwmon3/pwm1=60
MINSTART=hwmon0/pwm2=60 MINSTART=hwmon3/pwm1=60
MINSTOP=hwmon0/pwm2=45 MINSTOP=hwmon3/pwm1=45
MINPWM=hwmon3/pwm1=0

View File

@@ -64,7 +64,7 @@ RUN mkdir linux && tar zxf "kernel.tar.gz" -C "linux" --strip-components=1 && \
mkdir -p /src/ASK/patches/kernel/updated-patch mkdir -p /src/ASK/patches/kernel/updated-patch
# ASK's Kernel patches # ASK's Kernel patches
COPY patches/split-kernel-patch.sh /src/split-kernel-patch.sh COPY patches/ask/split-kernel-patch.sh /src/split-kernel-patch.sh
COPY patches/ask/kernel/*.patch /src/ASK/patches/kernel/updated-patch/ COPY patches/ask/kernel/*.patch /src/ASK/patches/kernel/updated-patch/
RUN chmod +x /src/split-kernel-patch.sh && \ RUN chmod +x /src/split-kernel-patch.sh && \
@@ -179,18 +179,10 @@ RUN make -C "${ASK_DIR}/fci/lib" \
CC=aarch64-linux-musl-gcc \ CC=aarch64-linux-musl-gcc \
AR=aarch64-linux-musl-ar AR=aarch64-linux-musl-ar
COPY patches/ask/0001-cdx-adapt-dpa-wifi-a050385-to-6.18.patch /src/ # Build the kernel first, without the custom DTS
RUN cd /src/ASK && \
git init -q && git add -A && git commit -q -m "base" && \
git apply /src/0001-cdx-adapt-dpa-wifi-a050385-to-6.18.patch
# Build the kernel
COPY kernel-extra.config /src/kernel-extra.config COPY kernel-extra.config /src/kernel-extra.config
COPY kernel-build/dts/*.dts /src/linux/arch/arm64/boot/dts/freescale/
COPY kernel-build/ensure-kconfig.sh /src/ COPY kernel-build/ensure-kconfig.sh /src/
# NXP tree: use the LSDK defconfig target
RUN cd /src/linux \ RUN cd /src/linux \
&& make ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" defconfig lsdk.config \ && make ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" defconfig lsdk.config \
&& ./scripts/kconfig/merge_config.sh -m .config "${ASK_DIR}/config/kernel/defconfig" /src/kernel-extra.config \ && ./scripts/kconfig/merge_config.sh -m .config "${ASK_DIR}/config/kernel/defconfig" /src/kernel-extra.config \
@@ -198,6 +190,31 @@ RUN cd /src/linux \
&& /src/ensure-kconfig.sh .config /src/kernel-extra.config \ && /src/ensure-kconfig.sh .config /src/kernel-extra.config \
&& make ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" -j"$(nproc)" && make ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" -j"$(nproc)"
# DTS changes happen after the expensive kernel build layer
COPY kernel-build/dts/*.dts /src/linux/arch/arm64/boot/dts/freescale/
ARG DEVICE_TREE_TARGET
RUN cd /src/linux \
&& grep -q "^dtb-\\\$(CONFIG_ARCH_LAYERSCAPE) += ${DEVICE_TREE_TARGET}.dtb$" \
arch/arm64/boot/dts/freescale/Makefile \
|| echo "dtb-\$(CONFIG_ARCH_LAYERSCAPE) += ${DEVICE_TREE_TARGET}.dtb" \
>> arch/arm64/boot/dts/freescale/Makefile \
&& make ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" \
"freescale/${DEVICE_TREE_TARGET}.dtb"
# Patch verdor's modules
RUN mkdir -p /src/patches/ask
COPY patches/ask/ /src/patches/ask/
RUN cd /src/ASK && \
git init -q && git add -A && git commit -q -m "base" && \
find /src/patches/ask \
-path /src/patches/ask/kernel -prune -o \
-name '*.patch' -print \
| sort > /tmp/ask-module-patches.list && \
test ! -s /tmp/ask-module-patches.list || xargs -a /tmp/ask-module-patches.list git apply --check && \
test ! -s /tmp/ask-module-patches.list || xargs -a /tmp/ask-module-patches.list git apply
# Build out-of-tree ASK kernel modules: cdx -> fci, plus auto_bridge. # Build out-of-tree ASK kernel modules: cdx -> fci, plus auto_bridge.
RUN make -C "${ASK_DIR}/cdx" \ RUN make -C "${ASK_DIR}/cdx" \
@@ -219,6 +236,9 @@ RUN make -C "${ASK_DIR}/cdx" \
KERNEL_SOURCE="${KERNEL_DIR}" \ KERNEL_SOURCE="${KERNEL_DIR}" \
PLATFORM="${PLATFORM}" PLATFORM="${PLATFORM}"
# Patch vendor's binaries
RUN sed -i '/^[[:space:]]*CFLAGS[[:space:]]*+=.*-Wall.*-Werror/a CFLAGS += -Wno-address-of-packed-member' "${ASK_DIR}/cmm/Makefile"
# Build remaining userspace binaries: cmm and dpa_app. # Build remaining userspace binaries: cmm and dpa_app.
RUN make -C "${ASK_DIR}/cmm" \ RUN make -C "${ASK_DIR}/cmm" \
CC="aarch64-linux-musl-gcc -static" \ CC="aarch64-linux-musl-gcc -static" \
@@ -237,15 +257,43 @@ RUN make -C "${ASK_DIR}/cmm" \
LDFLAGS="-static -L/src/fmc/source -L/src/fmlib -L${SYSROOT}/lib \ LDFLAGS="-static -L/src/fmc/source -L/src/fmlib -L${SYSROOT}/lib \
-lfmc -lfm -lcli -lxml2 -lstdc++ -lpthread -lm" -lfmc -lfm -lcli -lxml2 -lstdc++ -lpthread -lm"
# Stage outputs. # Stage outputs
RUN mkdir -p /out/ask && \ RUN mkdir -p /out/ASK/dist && \
cp "${ASK_DIR}/cdx/cdx.ko" /out/ask/ && \ cp "${ASK_DIR}/cdx/cdx.ko" /out/ASK/dist && \
cp "${ASK_DIR}/fci/fci.ko" /out/ask/ && \ cp "${ASK_DIR}/fci/fci.ko" /out/ASK/dist && \
cp "${ASK_DIR}/auto_bridge/auto_bridge.ko" /out/ask/ && \ cp "${ASK_DIR}/auto_bridge/auto_bridge.ko" /out/ASK/dist && \
cp /src/fmc/source/fmc /out/ask/ && \ mkdir -p /out/ask/bin && \
cp "${ASK_DIR}/cmm/src/cmm" /out/ask/ && \ cp /src/fmc/source/fmc /out/ASK/bin && \
cp "${ASK_DIR}/dpa_app/dpa_app" /out/ask/ && \ cp "${ASK_DIR}/cmm/src/cmm" /out/ASK/bin && \
aarch64-linux-musl-strip /out/ask/fmc /out/ask/cmm /out/ask/dpa_app || true cp "${ASK_DIR}/dpa_app/dpa_app" /out/ASK/bin && \
aarch64-linux-musl-strip /out/ASK/bin/fmc /out/ASK/bin/cmm /out/ASK/bin/dpa_app || true
FROM scratch AS ask-artifacts # in-tree Linux kernel modules
COPY --from=build /out/ask/ / RUN mkdir -p /out/rootfs && \
make -C /src/linux ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \
modules_install INSTALL_MOD_PATH=/out/rootfs
RUN KERNEL_VER=$(ls /out/rootfs/lib/modules/) && \
mkdir -p /out/rootfs/lib/modules/$KERNEL_VER/extra && \
mv /out/ASK/dist/*.ko /out/rootfs/lib/modules/$KERNEL_VER/extra/ && \
depmod -b /out/rootfs $KERNEL_VER && \
cd /out && tar zcf rootfs.tar.gz rootfs
FROM scratch AS export
ARG DEVICE_TREE_TARGET
# Export the newly staged in-tree modules
COPY --from=build /out/rootfs.tar.gz /
COPY --from=build \
/src/linux/System.map \
/src/linux/.config \
/src/linux/arch/arm64/boot/Image.gz \
/src/linux/arch/arm64/boot/dts/freescale/${DEVICE_TREE_TARGET}.dtb \
/kernel/
# Grab the proprietary Mono Gateway XML configs
COPY --from=build \
/src/ASK/config/gateway-dk/cdx_cfg.xml \
/src/ASK/dpa_app/files/etc/cdx_pcd.xml \
/xml/

View File

@@ -347,22 +347,6 @@
phy-connection-type = "xgmii"; phy-connection-type = "xgmii";
}; };
/* DPA Offline port bindings - required for CDX.
* Use phandles fman0_oh_0x3 (port@83000) and fman0_oh_0x4 (port@84000).
* Cell-index overridden to SDK-style (1 and 2) in port nodes above.
*/
dpa-fman0-oh@2 {
compatible = "fsl,dpa-oh";
fsl,qman-frame-queues-oh = <0x60 0x01 0x61 0x01>;
fsl,fman-oh-port = <&fman0_oh_0x3>;
};
dpa-fman0-oh@3 {
compatible = "fsl,dpa-oh";
fsl,qman-frame-queues-oh = <0x62 0x01 0x63 0x01>;
fsl,fman-oh-port = <&fman0_oh_0x4>;
};
/* Override OH port cell-index values for SDK driver compatibility. /* Override OH port cell-index values for SDK driver compatibility.
* SDK driver expects cell-index 0 for HC (Host Command/PCD) port. * SDK driver expects cell-index 0 for HC (Host Command/PCD) port.
* Mainline qoriq-fman3-0.dtsi uses cell-index 2-7, but SDK needs 0-5. * Mainline qoriq-fman3-0.dtsi uses cell-index 2-7, but SDK needs 0-5.
@@ -373,8 +357,8 @@
}; };
port@83000 { port@83000 {
cell-index = <1>;
compatible = "fsl,fman-port-oh"; compatible = "fsl,fman-port-oh";
cell-index = <1>;
}; };
port@84000 { port@84000 {
@@ -568,4 +552,18 @@
&fsldpaa { &fsldpaa {
dma-coherent; dma-coherent;
/* CDX / DPA IPsec offline port */
dpa-fman0-oh@2 {
compatible = "fsl,dpa-oh";
fsl,qman-frame-queues-oh = <0x60 0x01 0x61 0x01>;
fsl,fman-oh-port = <&fman0_oh_0x3>;
dma-coherent;
};
/* CDX / VWD WiFi offline port; optional */
dpa-fman0-oh@3 {
compatible = "fsl,dpa-oh";
fsl,qman-frame-queues-oh = <0x62 0x01 0x63 0x01>;
fsl,fman-oh-port = <&fman0_oh_0x4>;
dma-coherent;
};
}; };

View File

@@ -176,17 +176,11 @@ $(BUILD_BASE_STAMP): $(BUILD_BASE_DEPS) | $(OUT_DIR)
docker tag monok8s/build-base:$(TAG) monok8s/build-base:$$iid; \ docker tag monok8s/build-base:$(TAG) monok8s/build-base:$$iid; \
touch $@ touch $@
$(KERNEL_IMAGE): $(KERNEL_DEPS) $(DOWNLOAD_PACKAGES_STAMP) | $(OUT_DIR) $(KERNEL_IMAGE): $(KERNEL_DEPS) $(DOWNLOAD_PACKAGES_STAMP) ASK | $(OUT_DIR)
docker build \ rm -f "$@"
-f docker/kernel-build.Dockerfile \ cp $(OUT_DIR)/ASK/rootfs.tar.gz $(OUT_DIR)/rootfs.tar.gz
--build-arg DOCKER_IMAGE_ROOT=$(DOCKER_IMAGE_ROOT) \ cp $(OUT_DIR)/ASK/kernel/* $(OUT_DIR)/
--build-arg TAG=$(TAG) \ test -f "$@"
--build-arg ARCH=$(ARCH) \
--build-arg CROSS_COMPILE=$(CROSS_COMPILE) \
--build-arg NXP_VERSION=$(NXP_VERSION) \
--build-arg DEVICE_TREE_TARGET=$(DEVICE_TREE_TARGET) \
--output type=local,dest=./$(OUT_DIR) .
test -f $@
$(INITRAMFS): $(INITRAMFS_DEPS) $(DOWNLOAD_PACKAGES_STAMP) | $(OUT_DIR) $(INITRAMFS): $(INITRAMFS_DEPS) $(DOWNLOAD_PACKAGES_STAMP) | $(OUT_DIR)
docker build \ docker build \
@@ -232,6 +226,7 @@ ASK: $(ASK_TAR) $(LIBNFCT_TAR) $(LIBNFNETLINK_TAR) $(TCLAP_TAR) $(LIBXML2_TAR) |
--build-arg LIBCLI_TAR=$(LIBCLI_TAR) \ --build-arg LIBCLI_TAR=$(LIBCLI_TAR) \
--build-arg LIBNFNETLINK_VERSION=$(LIBNFNETLINK_VERSION) \ --build-arg LIBNFNETLINK_VERSION=$(LIBNFNETLINK_VERSION) \
--build-arg LIBNFCT_VERSION=$(LIBNFCT_VERSION) \ --build-arg LIBNFCT_VERSION=$(LIBNFCT_VERSION) \
--build-arg DEVICE_TREE_TARGET=$(DEVICE_TREE_TARGET) \
--output type=local,dest=./$(OUT_DIR)/ASK . --output type=local,dest=./$(OUT_DIR)/ASK .
vpp: $(BUILD_BASE_STAMP) $(VPP_TAR) $(DPDK_TAR) $(FMLIB_TAR) $(FMC_TAR) $(NXP_TAR) vpp: $(BUILD_BASE_STAMP) $(VPP_TAR) $(DPDK_TAR) $(FMLIB_TAR) $(FMC_TAR) $(NXP_TAR)

View File

@@ -0,0 +1,62 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: builder <builder@localhost>
Date: Sun, 10 May 2026 00:00:00 +0000
Subject: [PATCH] auto_bridge: adapt timer API names for Linux 6.18
Linux 6.18 uses the renamed timer helpers. Update the vendor
module to use timer_delete() and timer_container_of().
---
auto_bridge/auto_bridge.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/auto_bridge/auto_bridge.c
+++ b/auto_bridge/auto_bridge.c
@@ -243,7 +243,7 @@
list_add(&table_entry->list_msg_to_send, &l2flow_list_msg_to_send);
work_to_do = 1;
}
- if (del_timer(&table_entry->timeout) || no_timer)
+ if (timer_delete(&table_entry->timeout) || no_timer)
__abm_go_dying(table_entry);
}
}
@@ -604,7 +604,7 @@
****************************************************************************/
static void abm_death_by_timeout(struct timer_list *t)
{
- struct l2flowTable *table_entry = from_timer(table_entry, t, timeout);
+ struct l2flowTable *table_entry = timer_container_of(table_entry, t, timeout);
spin_lock_bh(&abm_lock);
__abm_go_dying(table_entry);
@@ -671,7 +671,7 @@
/* Flow is programmed in FPP */
table_entry->state = L2FLOW_STATE_FF;
/* If timer already expired we'll die, it's ok though... */
- del_timer(&table_entry->timeout);
+ timer_delete(&table_entry->timeout);
}
else if(flags & L2FLOW_DENIED){
/* Flow is not programmed in FPP */
@@ -735,7 +735,7 @@
}
/* Die soon or now */
- if(del_timer(&table_entry->timeout) || (table_entry->state == L2FLOW_STATE_FF))
+ if(timer_delete(&table_entry->timeout) || (table_entry->state == L2FLOW_STATE_FF))
__abm_go_dying(table_entry);
}
else{
@@ -1093,7 +1093,7 @@
list_for_each_safe(entry, tmp, &l2flow_table[i]){
table_entry = container_of(entry, struct l2flowTable, list);
table_entry->flags |= L2FLOW_FL_DEAD;
- if(del_timer(&table_entry->timeout) || table_entry->state == L2FLOW_STATE_FF)
+ if(timer_delete(&table_entry->timeout) || table_entry->state == L2FLOW_STATE_FF)
__abm_go_dying(table_entry);
}
}
--
2.43.0

View File

@@ -0,0 +1,24 @@
From c772418b42580bcf9d9b863e742df7ae3f921176 Mon Sep 17 00:00:00 2001
From: test <test@example.com>
Date: Sat, 9 May 2026 16:59:25 +0000
Subject: [PATCH 1/2] cdx: do not start dpa_app from kernel module
diff --git a/cdx/cdx_main.c b/cdx/cdx_main.c
index 2d7b72b..ec763cb 100644
--- a/cdx/cdx_main.c
+++ b/cdx/cdx_main.c
@@ -8,8 +8,8 @@
*
*/
-//uncomment to start dpa_app from cdx module
-#define START_DPA_APP 1
+// Start dpa_app from userspace service ordering instead of kernel module init.
+// #define START_DPA_APP 1
#define DEFINE_GLOBALS
#include "portdefs.h"
--
2.47.3

View File

@@ -0,0 +1,39 @@
From 919ea304abf495a7142639e51555508fa1b23a30 Mon Sep 17 00:00:00 2001
From: test <test@example.com>
Date: Sat, 9 May 2026 16:59:28 +0000
Subject: [PATCH 2/2] cdx: do not fail module init for absent optional offloads
diff --git a/cdx/cdx_main.c b/cdx/cdx_main.c
index ec763cb..641121b 100644
--- a/cdx/cdx_main.c
+++ b/cdx/cdx_main.c
@@ -195,16 +195,17 @@ static int __init cdx_module_init(void)
#ifdef CFG_WIFI_OFFLOAD
rc = dpaa_vwd_init();
if (rc != 0) {
- printk("%s::vwd_driver_init failed\n", __func__);
- goto exit;
+ printk(KERN_WARNING "%s::vwd_driver_init failed rc %d; continuing without wifi offload\n",
+ __func__, rc);
+ rc = 0;
}
#endif
- // initialize global fragmentation params
- if (cdx_init_frag_module()) {
- printk("%s::cdx_init_frag_module failed\n", __func__);
- rc = -EIO;
- goto exit;
- }
+ /*
+ * The vendor fragmentation path assumes its BMan pool/config exists and
+ * can crash in bman_free_pool() when this board profile does not provide
+ * it. Keep CDX usable without the optional fragmentation offload path.
+ */
+ printk(KERN_WARNING "%s::skipping cdx_init_frag_module on this platform\n", __func__);
#ifdef DPA_IPSEC_OFFLOAD
if (cdx_dpa_ipsec_init()) {
--
2.47.3

View File

@@ -0,0 +1,52 @@
--- a/cdx/devoh.c
+++ b/cdx/devoh.c
@@ -313,6 +313,7 @@
uint32_t port_idx;
uint8_t oh_iface_name[8]="";
+ printk(KERN_INFO "%s::adding OH iface name=%s\n", __func__, name);
if (sscanf(name, "dpa-fman%d-oh@%d", &fman_idx,
&port_idx) != 2) {
@@ -331,6 +332,8 @@
DPA_ERROR("%s::oh_port_driver_get_port_info failed\n", __func__);
return FAILURE;
}
+ printk(KERN_INFO "%s::OH port info name=%s channel=%u default_fqid=0x%x err_fqid=0x%x\n",
+ __func__, name, info.channel_id, info.default_fqid, info.err_fqid);
//ethernet/physical iface type
iface_info = (struct dpa_iface_info *)
kzalloc(sizeof(struct dpa_iface_info), GFP_KERNEL);
@@ -358,6 +361,10 @@
__func__, name);
goto err_ret;
}
+ printk(KERN_INFO "%s::CDX OH iface config found name=%s fman=%u port_idx=%u portid=%u max_dist=%u\n",
+ __func__, name,
+ iface_info->oh_info.fman_idx, iface_info->oh_info.port_idx,
+ iface_info->oh_info.portid, iface_info->oh_info.max_dist);
if (cdx_create_dir_in_procfs(&iface_info->pcd_proc_entry, oh_iface_name, PCD_DIR)) {
DPA_ERROR("%s:: create pcd proc entry failed %s\n",
__func__, name);
@@ -581,6 +588,10 @@
#endif
}
//add fqid information into of port list
+ printk(KERN_INFO "%s::created OH FQs name=%s fman=%u port_idx=%u rx_default_fqid=0x%x rx_err_fqid=0x%x channel=0x%x\n",
+ __func__, dpa_oh_iface_info->name, iface_info->fman_idx,
+ iface_info->port_idx, iface_info->fqinfo[RX_DEFA_FQ].fq_base,
+ iface_info->fqinfo[RX_ERR_FQ].fq_base, iface_info->channel_id);
port_info->fm_idx = iface_info->fman_idx;
port_info->ohinfo = iface_info;
port_info->channel = iface_info->channel_id;
@@ -600,6 +611,10 @@
}
offline_port_info[iface_info->fman_idx][iface_info->port_idx].flags |=
(OF_FQID_VALID | PORT_VALID);
+ printk(KERN_INFO "%s::OH port registered name=%s fman=%u port_idx=%u flags=0x%x\n",
+ __func__, port_info->name, iface_info->fman_idx,
+ iface_info->port_idx,
+ offline_port_info[iface_info->fman_idx][iface_info->port_idx].flags);
return 0;
}

View File

@@ -1,87 +0,0 @@
# mono-ask.mk
# Custom wrapper to build the NXP ASK for the monok8s Alpine/musl ecosystem
# Define default paths and cross-compilers
KDIR?= /src/linux
ASK_DIR?= $(CURDIR)
ARCH?= arm64
GNU_CROSS?= aarch64-linux-gnu-
MUSL_HOST?= aarch64-linux-musl
STAMPS_DIR := $(ASK_DIR)/sources/.stamps
FMLIB_DIR := $(ASK_DIR)/sources/fmlib
FMC_BASE := $(ASK_DIR)/sources/fmc
FMC_DIR := $(FMC_BASE)/source
SYSROOT_PATH := /opt/aarch64-linux-musl-cross/aarch64-linux-musl
.PHONY: prepare-kernel build-kernel modules userspace dist
prepare-preloaded-sources:
@echo "--> Initializing dummy git repos and building preloaded fmlib/fmc..."
mkdir -p $(STAMPS_DIR)
git config --global user.email "monok8s@localhost"
git config --global user.name "monok8s authors"
git config --global --add safe.directory '*'
# Inject libmnl.pc into the vendor's isolated sysroot to satisfy pkg-config
mkdir -p $(ASK_DIR)/sources/sysroot/lib/pkgconfig
cp -a $(SYSROOT_PATH)/lib/pkgconfig/libmnl.pc $(ASK_DIR)/sources/sysroot/lib/pkgconfig/
# Handle fmlib: Initialize dummy repo, patch, and build
cd $(FMLIB_DIR) && git init -q && git add -A && git commit -q -m "base"
cd $(FMLIB_DIR) && git apply $(ASK_DIR)/patches/fmlib/01-mono-ask-extensions.patch
$(MAKE) -C $(FMLIB_DIR) CROSS_COMPILE=$(MUSL_HOST)- KERNEL_SRC=$(KDIR) libfm-arm.a
ln -sf libfm-arm.a $(FMLIB_DIR)/libfm.a
touch $(STAMPS_DIR)/fmlib
# Handle fmc: Initialize dummy repo, patch, and build
cd $(FMC_BASE) && git init -q && git add -A && git commit -q -m "base"
cd $(FMC_BASE) && git apply $(ASK_DIR)/patches/fmc/01-mono-ask-extensions.patch
$(MAKE) -C $(FMC_DIR) CC="$(MUSL_HOST)-gcc -static" CXX="$(MUSL_HOST)-g++ -static" AR=$(MUSL_HOST)-ar \
MACHINE=ls1046 \
FMD_USPACE_HEADER_PATH=$(FMLIB_DIR)/include/fmd \
FMD_USPACE_LIB_PATH=$(FMLIB_DIR) \
LIBXML2_HEADER_PATH=$(SYSROOT_PATH)/include/libxml2 \
TCLAP_HEADER_PATH=$(SYSROOT_PATH)/include
touch $(STAMPS_DIR)/fmc
# 1. Patch the kernel and merge our custom Kubernetes configuration
prepare-kernel:
@echo "--> Patching the Linux kernel with NXP DPAA extensions..."
cd $(KDIR) && patch -p1 < $(ASK_DIR)/patches/kernel/002-mono-gateway-ask-kernel_linux_6_12.patch
@echo "--> Merging NXP defconfig with Kubernetes extra config..."
cp $(ASK_DIR)/config/kernel/defconfig $(KDIR)/.config
cd $(KDIR) && ./scripts/kconfig/merge_config.sh -m .config /src/kernel-extra.config
$(MAKE) -C $(KDIR) ARCH=$(ARCH) CROSS_COMPILE=$(GNU_CROSS) olddefconfig
/src/ensure-kconfig.sh $(KDIR)/.config /src/kernel-extra.config
# 2. Build the kernel tree (mandatory before out-of-tree modules can be built)
build-kernel: prepare-kernel
@echo "--> Building the Linux kernel natively..."
# Replace "dtbs" with the exact path to your target dtb
$(MAKE) -C $(KDIR) ARCH=$(ARCH) CROSS_COMPILE=$(GNU_CROSS) -j$$(nproc) \
Image modules freescale/mono-gateway-dk-sdk.dtb
# 3. Build the ASK out-of-tree modules using the vendor Makefile
modules: build-kernel
@echo "--> Building ASK out-of-tree modules..."
$(MAKE) -f Makefile modules KDIR=$(KDIR) CROSS_COMPILE=$(GNU_CROSS) ARCH=$(ARCH)
# 4. Build the ASK userspace daemons using the musl cross-compiler
userspace: prepare-preloaded-sources
@echo "--> Building ASK sources and libraries..."
$(MAKE) -f Makefile sources KDIR=$(KDIR) CROSS_COMPILE=$(MUSL_HOST)- ARCH=$(ARCH) HOST=$(MUSL_HOST)
@echo "--> Stripping -Werror from vendor Makefiles for modern GCC compatibility..."
sed -i 's/-Werror//g' $(ASK_DIR)/cmm/Makefile
sed -i 's/-Werror//g' $(ASK_DIR)/dpa_app/Makefile
@echo "--> Building ASK userspace executables statically..."
$(MAKE) -f Makefile userspace KDIR=$(KDIR) CROSS_COMPILE=$(MUSL_HOST)- ARCH=$(ARCH) HOST=$(MUSL_HOST) CC='"$(MUSL_HOST)-gcc -static"' CXX='"$(MUSL_HOST)-g++ -static"'
# 5. Extract artifacts
dist:
@echo "--> Staging artifacts..."
$(MAKE) -f Makefile dist KDIR=$(KDIR) CROSS_COMPILE=$(GNU_CROSS) ARCH=$(ARCH)