"make release" draft

This commit is contained in:
2026-03-22 23:47:55 +08:00
parent a9a3af5e99
commit e324969a94
10 changed files with 104 additions and 23 deletions

View File

@@ -10,6 +10,12 @@ ALPINE_TAR := $(PACKAGES_DIR)/alpine-minirootfs-$(ALPINE_VER)-$(ALPINE_ARCH).ta
NXP_TAR := $(PACKAGES_DIR)/$(NXP_VERSION).tar.gz
CRIO_TAR := $(PACKAGES_DIR)/$(CRIO_VERSION).tar.gz
BOARD_ITB := out/board.itb
INITRAMFS := out/initramfs.cpio.gz
RELEASE_IMAGE := out/monok8s-$(TAG).img
ALPINE_SERIES := $(word 1,$(subst ., ,${ALPINE_VER})).$(word 2,$(subst ., ,${ALPINE_VER}))
$(BUSYBOX_TAR):
@mkdir -p $(PACKAGES_DIR)
curl -L -o $@ "https://github.com/mirror/busybox/archive/refs/tags/$(BUSYBOX_VERSION).tar.gz"
@@ -32,7 +38,7 @@ build-base:
--build-arg TAG=$(TAG) \
-t $(DOCKER_IMAGE_ROOT)/build-base:$(TAG) .
kernel-build: build-base $(NXP_TAR)
$(KERNEL_IMAGE): build-base $(NXP_TAR)
docker build \
-f docker/kernel-build.Dockerfile \
--build-arg DOCKER_IMAGE_ROOT=$(DOCKER_IMAGE_ROOT) \
@@ -41,29 +47,34 @@ kernel-build: build-base $(NXP_TAR)
--build-arg CROSS_COMPILE=$(CROSS_COMPILE) \
--build-arg NXP_VERSION=$(NXP_VERSION) \
--build-arg DEVICE_TREE_TARGET=$(DEVICE_TREE_TARGET) \
-t $(DOCKER_IMAGE_ROOT)/kernel-build:$(TAG) .
--output type=local,dest=./out .
fit-build: kernel-build $(BUSYBOX_TAR)
@test -f $(KERNEL_IMAGE)
$(INITRAMFS): $(KERNEL_IMAGE) $(BUSYBOX_TAR)
docker build \
-f docker/fit-build.Dockerfile \
-f docker/initramfs.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 BUSYBOX_VERSION=$(BUSYBOX_VERSION) \
-t $(DOCKER_IMAGE_ROOT)/fit-build:$(TAG) .
--output type=local,dest=./out .
itb: fit-build
@test -f $(INITRAMFS)
$(BOARD_ITB): $(INITRAMFS)
docker build \
-f docker/itb.Dockerfile \
--build-arg DOCKER_IMAGE_ROOT=$(DOCKER_IMAGE_ROOT) \
--build-arg TAG=$(TAG) \
--build-arg ARCH=$(ARCH) \
--build-arg DEVICE_TREE_TARGET=$(DEVICE_TREE_TARGET) \
--output type=local,dest=./out \
-t $(DOCKER_IMAGE_ROOT)/itb:$(TAG) .
--output type=local,dest=./out .
buildenv-alpine: build-base $(ALPINE_TAR) $(CRIO_TAR)
@test -f $(BOARD_ITB)
release: $(BOARD_ITB) build-base
docker build \
-f docker/alpine.Dockerfile \
--build-arg DOCKER_IMAGE_ROOT=$(DOCKER_IMAGE_ROOT) \
@@ -72,13 +83,17 @@ buildenv-alpine: build-base $(ALPINE_TAR) $(CRIO_TAR)
--build-arg ALPINE_VER=$(ALPINE_VER) \
--build-arg CRIO_VERSION=$(CRIO_VERSION) \
-t $(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) .
alpine-rootfs: buildenv-alpine kernel-build
docker run --rm -it \
@cid=$$(docker create \
--privileged \
-v /cache/apk:/var/cache/apk \
-v /cache/artifacts:/artifacts \
--device=/dev/loop0:/dev/loop0 \
-e ROOTFS=/out/rootfs \
-e ARTIFACT_DIR=/artifacts \
-e RELEASE_IMAGE=$(RELEASE_IMAGE) \
$(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) \
bash -lc '/build-rootfs.sh'
bash -lc '/build-rootfs.sh'); \
docker start -a $$cid; \
docker cp $$cid:/build/output.img $(RELEASE_IMAGE); \
docker rm $$cid
@test -f $(RELEASE_IMAGE)