43 lines
1.8 KiB
Makefile
43 lines
1.8 KiB
Makefile
# 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
|
|
|
|
.PHONY: prepare-kernel build-kernel modules userspace dist
|
|
|
|
# 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..."
|
|
$(MAKE) -C $(KDIR) ARCH=$(ARCH) CROSS_COMPILE=$(GNU_CROSS) -j$$(nproc) Image modules
|
|
|
|
# 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:
|
|
@echo "--> Building ASK sources and libraries..."
|
|
$(MAKE) -f Makefile sources KDIR=$(KDIR) CROSS_COMPILE=$(MUSL_HOST)- ARCH=$(ARCH) HOST=$(MUSL_HOST)
|
|
@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:
|
|
$(MAKE) -f Makefile dist
|