From c2716412f8255d225f9990993b9b9b034e44e8face12e6bc9e8106a277345e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Sat, 2 May 2026 06:10:30 +0800 Subject: [PATCH] Switch to ASK's kernel --- docker/alpine.Dockerfile | 1 + docker/ask.Dockerfile | 22 ++++++++++++++++++++++ docker/itb.Dockerfile | 4 ---- makefile | 19 ++++++++----------- patches/mono-ask.mk | 4 +++- 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/docker/alpine.Dockerfile b/docker/alpine.Dockerfile index 6378bd9..d6dfe91 100644 --- a/docker/alpine.Dockerfile +++ b/docker/alpine.Dockerfile @@ -30,6 +30,7 @@ COPY packages/kubernetes/kubectl-${KUBE_VERSION} /out/rootfs/usr/local/bin/kubec # COPY clitools/out/dpdk/bin/dpdk-testpmd /out/rootfs/usr/local/bin/dpdk-testpmd # COPY clitools/out/dpdk/usr/local/lib/*.so* /out/rootfs/usr/local/lib/ # COPY clitools/out/dpdk/usr/local/lib/dpdk/pmds-23.0/*.so* /out/rootfs/usr/local/lib/dpdk/pmds-23.0/ + COPY alpine/rootfs-extra ./rootfs-extra COPY alpine/migrations ./migrations COPY out/build-info ./rootfs-extra/etc/profile.d/build-info.sh diff --git a/docker/ask.Dockerfile b/docker/ask.Dockerfile index f4c73e7..2c78db7 100644 --- a/docker/ask.Dockerfile +++ b/docker/ask.Dockerfile @@ -110,6 +110,7 @@ WORKDIR /src/ASK COPY patches/mono-ask.mk . COPY kernel-extra.config /src/kernel-extra.config COPY kernel-build/ensure-kconfig.sh /src/ensure-kconfig.sh +COPY kernel-build/dts/*.dts /src/linux/arch/arm64/boot/dts/freescale/ # 1. This step patches the kernel, merges kernel-extra.config, and builds the modules RUN make -f mono-ask.mk modules @@ -120,7 +121,28 @@ RUN make -f mono-ask.mk userspace # 3. Stage the artifacts RUN make -f mono-ask.mk dist +# 4. Stage the in-tree Linux kernel modules +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 /src/ASK/dist/*.ko /out/rootfs/lib/modules/$KERNEL_VER/extra/ && \ + depmod -b /out/rootfs $KERNEL_VER && \ + cd /out && tar zcf rootfs.tar.gz rootfs + # Export stage FROM scratch AS export COPY --from=build /src/ASK/dist/ /ask/ + +# Export the newly staged in-tree modules +COPY --from=build /out/rootfs.tar.gz / +COPY --from=build /src/linux/System.map /kernel/System.map +COPY --from=build /src/linux/.config /kernel/.config COPY --from=build /src/linux/arch/arm64/boot/Image /kernel/Image +COPY --from=build /src/linux/arch/arm64/boot/dts/freescale/mono-gateway-dk-sdk.dtb /kernel/mono-gateway-dk-sdk.dtb + +# Grab the proprietary Mono Gateway XML configs +COPY --from=build /src/ASK/config/gateway-dk/cdx_cfg.xml /xml/cdx_cfg.xml +COPY --from=build /src/ASK/dpa_app/files/etc/cdx_pcd.xml /xml/cdx_pcd.xml diff --git a/docker/itb.Dockerfile b/docker/itb.Dockerfile index 91080b7..d87f00e 100644 --- a/docker/itb.Dockerfile +++ b/docker/itb.Dockerfile @@ -1,7 +1,5 @@ ARG TAG=dev ARG DOCKER_IMAGE_ROOT=monok8s -FROM ${DOCKER_IMAGE_ROOT}/kernel-build:${TAG} AS kernel -FROM ${DOCKER_IMAGE_ROOT}/fit-build:${TAG} AS fit FROM --platform=$BUILDPLATFORM ${DOCKER_IMAGE_ROOT}/build-base:${TAG} AS build @@ -11,8 +9,6 @@ RUN mkdir /image WORKDIR /image COPY [ "./out/Image.gz" \ - , "./out/System.map" \ - , "./out/.config" \ , "./out/initramfs.cpio.gz" \ , "./out/${DEVICE_TREE_TARGET}.dtb", "./" ] diff --git a/makefile b/makefile index 0e5b4b3..ab0b5bd 100644 --- a/makefile +++ b/makefile @@ -130,6 +130,7 @@ $(DOWNLOAD_PACKAGES_STAMP): docker/download-packages.Dockerfile build.env makefi --build-arg KUBE_VERSION=$(KUBE_VERSION) \ --build-arg ARCH=$(ARCH) \ --build-arg BUSYBOX_VERSION=$(BUSYBOX_VERSION) \ + --build-arg DEVICE_TREE_TARGET=$(DEVICE_TREE_TARGET) \ --build-arg E2FSPROGS_VERSION=$(E2FSPROGS_VERSION) \ --build-arg DPDK_VERSION=$(DPDK_VERSION) \ --build-arg FMLIB_VERSION=$(FMLIB_VERSION) \ @@ -175,17 +176,6 @@ $(BUILD_BASE_STAMP): $(BUILD_BASE_DEPS) | $(OUT_DIR) docker tag monok8s/build-base:$(TAG) monok8s/build-base:$$iid; \ touch $@ -$(KERNEL_IMAGE): $(KERNEL_DEPS) $(DOWNLOAD_PACKAGES_STAMP) | $(OUT_DIR) - docker build \ - -f docker/kernel-build.Dockerfile \ - --build-arg DOCKER_IMAGE_ROOT=$(DOCKER_IMAGE_ROOT) \ - --build-arg TAG=$(TAG) \ - --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) docker build \ @@ -233,6 +223,13 @@ ASK: $(ASK_TAR) $(LIBNFCT_TAR) $(LIBNFNETLINK_TAR) $(TCLAP_TAR) $(LIBXML2_TAR) | --build-arg LIBNFCT_VERSION=$(LIBNFCT_VERSION) \ --output type=local,dest=./$(OUT_DIR)/ASK . +$(KERNEL_IMAGE): ASK $(KERNEL_DEPS) $(DOWNLOAD_PACKAGES_STAMP) | $(OUT_DIR) + rm -f "$@" + cp $(OUT_DIR)/ASK/rootfs.tar.gz $(OUT_DIR)/rootfs.tar.gz + cp $(OUT_DIR)/ASK/kernel/* $(OUT_DIR)/ + gzip $(OUT_DIR)/Image + test -f "$@" + vpp: $(BUILD_BASE_STAMP) $(VPP_TAR) $(DPDK_TAR) $(FMLIB_TAR) $(FMC_TAR) $(NXP_TAR) @build_base_tag=$$(docker image inspect \ --format '{{.Id}}' \ diff --git a/patches/mono-ask.mk b/patches/mono-ask.mk index 8485c5f..39ddb77 100644 --- a/patches/mono-ask.mk +++ b/patches/mono-ask.mk @@ -60,7 +60,9 @@ prepare-kernel: # 2. Build the kernel tree (mandatory before out-of-tree modules can be built) build-kernel: prepare-kernel @echo "--> Building the Linux kernel natively..." - $(MAKE) -C $(KDIR) ARCH=$(ARCH) CROSS_COMPILE=$(GNU_CROSS) -j$$(nproc) Image modules + # 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