build success

This commit is contained in:
iceBear67
2026-06-05 17:56:39 +08:00
parent 87e76877ca
commit ab9b4c7e13
8 changed files with 34 additions and 58 deletions

View File

@@ -1,24 +1,8 @@
# Alpine VM Image Builder
# ------------------------
# Builds a bootable Alpine Linux disk image for Cloud Hypervisor direct boot.
#
# Usage:
# make build — generate GPG key + build qcow2 image
# make build-raw — build raw image (for Cloud Hypervisor direct boot)
# make extract-kernel — extract kernel + initramfs from image
# make clean — remove build artifacts
#
# Configurable variables (override on command line):
# IMAGE_SIZE Size of the disk image (default: 4G)
# ALPINE_BRANCH Alpine release branch (default: latest-stable)
# KERNEL_FLAVOR Kernel variant (default: virt)
# ALPINE_MIRROR APK mirror (default: http://dl-cdn.alpinelinux.org/alpine)
SHELL := /bin/sh
# --- configurable ----------------------------------------------------
IMAGE_NAME = alpine-vm
IMAGE_SIZE ?= 4G
IMAGE_SIZE ?= 2G
IMAGE_FORMAT = raw
ALPINE_BRANCH ?= latest-stable
KERNEL_FLAVOR ?= virt
@@ -35,7 +19,7 @@ build:
echo "ERROR: GPG key not found. Generate key first" >&2; \
exit 1; \
}
$(MAKE_VM_IMAGE) \
alpine-make-vm-image \
--branch $(ALPINE_BRANCH) \
--image-format $(IMAGE_FORMAT) \
--image-size $(IMAGE_SIZE) \
@@ -44,29 +28,10 @@ build:
--fs-skel-dir $(OVERLAY_DIR) \
--fs-skel-chown root:root \
--script-chroot \
--packages "python3 py3-yaml py3-pydantic git curl gnupg docker docker-cli-buildx docker-cli-compose" \
--packages "python3 py3-yaml py3-pydantic git curl gnupg docker docker-cli-buildx docker-cli-compose cronie" \
$(IMAGE_FILE) \
$(CONFIGURE_SH)
@echo ">>> Image built: $(IMAGE_FILE)"
@ls -lh $(IMAGE_FILE)
# Raw image (best for Cloud Hypervisor)
build-raw:
$(MAKE) build IMAGE_FORMAT=raw
# --- kernel extraction -----------------------------------------------
extract-kernel: $(IMAGE_FILE)
@echo ">>> Extracting kernel and initramfs from $(IMAGE_FILE) ..."
@which guestmount >/dev/null 2>&1 || { \
echo "ERROR: guestmount (libguestfs) required. Install: apk add libguestfs" >&2; \
exit 1; \
}
@mkdir -p $(IMAGE_NAME)-boot
guestmount -a $(IMAGE_FILE) -m /dev/sda --ro $(IMAGE_NAME)-boot
cp $(IMAGE_NAME)-boot/boot/vmlinuz-$(KERNEL_FLAVOR) vmlinuz
cp $(IMAGE_NAME)-boot/boot/initramfs-$(KERNEL_FLAVOR) initramfs
guestunmount $(IMAGE_NAME)-boot
rmdir $(IMAGE_NAME)-boot
.PHONY: build build-raw build-no-gpg extract-kernel gpg-key gpg-fingerprint
.PHONY: build

View File

@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN6GbswtvLbhmju/vBunpfPaqpcIuESJSLoR+Sz0ujTs cardno:F1D0_013135A1

View File

@@ -1,10 +0,0 @@
python3
py3-yaml
py3-pydantic
git
curl
gnupg
docker
docker-cli-buildx
docker-cli-compose
cronie