Using our own mono-ask.mk

This commit is contained in:
2026-05-01 20:48:56 +08:00
parent 24c5039411
commit 3a2560652e
2 changed files with 57 additions and 31 deletions

View File

@@ -51,43 +51,26 @@ RUN mkdir -p ASK/sources/tarballs && \
RUN mkdir linux && tar zxf "kernel.tar.gz" -C "linux" --strip-components=1
# Extract fmc & fmlib to prevent git fetching
RUN mkdir -p ASK/sources/fmc && \
mkdir -p ASK/sources/fmlib && \
tar zxf "fmc.tar.gz" -C "ASK/sources/fmc" --strip-components=1 && \
tar zxf "fmlib.tar.gz" -C "ASK/sources/fmlib" --strip-components=1
WORKDIR /src/ASK
# Extract fmc & fmlib to prevent git fetching
RUN mkdir -p sources/fmc && \
mkdir -p sources/fmlib && \
tar zxf "/src/fmc.tar.gz" -C "sources/fmc" --strip-components=1 && \
tar zxf "/src/fmlib.tar.gz" -C "sources/fmlib" --strip-components=1
# 1. Apply the NXP ASK kernel patch to your Linux source tree FIRST
RUN cd /src/linux && \
patch -p1 < /src/ASK/patches/kernel/002-mono-gateway-ask-kernel_linux_6_12.patch
# 2. Merge the NXP defconfig with your Kubernetes extra config
# Assuming you copy kernel-extra.config into the container at /src/kernel-extra.config
COPY patches/mono-ask.mk .
COPY kernel-extra.config /src/kernel-extra.config
COPY kernel-build/ensure-kconfig.sh /src/ensure-kconfig.sh
RUN cd /src/linux && \
cp /src/ASK/config/kernel/defconfig .config && \
./scripts/kconfig/merge_config.sh -m .config /src/kernel-extra.config && \
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- olddefconfig
# 1. This step patches the kernel, merges your k8s config, and builds the modules
RUN make -f mono-ask.mk modules
# 3. Build the Kernel natively in the linux tree (Do NOT run 'make kernel' in the ASK folder)
RUN cd /src/linux && \
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc) Image modules
# 2. This step cross-compiles fmlib, fmc, cmm, and dpa_app for Alpine
RUN make -f mono-ask.mk userspace
# 4. Now build the ASK out-of-tree modules
RUN make modules KDIR=/src/linux CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64
# 5. Build Userspace with the musl cross-compiler
RUN make sources KDIR=/src/linux CROSS_COMPILE=aarch64-linux-musl- ARCH=arm64 HOST=aarch64-linux-musl
RUN make userspace KDIR=/src/linux CROSS_COMPILE=aarch64-linux-musl- ARCH=arm64 \
HOST=aarch64-linux-musl \
CC="aarch64-linux-musl-gcc -static" \
CXX="aarch64-linux-musl-g++ -static"
# Stage the artifacts
RUN make dist
# 3. Stage the artifacts
RUN make -f mono-ask.mk dist
# Export stage
FROM scratch AS export