From 1323dddd714cef95a27ca13979c4b3a0e0ac0f8e Mon Sep 17 00:00:00 2001 From: Joseph Wright Date: Sun, 19 Apr 2026 00:59:12 -0400 Subject: [PATCH 1/3] Improve Makefile dependencies Make the kernel file used by QEMU depend on kernel.tar rather than the assets directory containing it. Also use a grouped target for all the files contained in the easyto-assets-runtime archive. --- Makefile | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 05ca621..a427571 100644 --- a/Makefile +++ b/Makefile @@ -69,10 +69,17 @@ $(DIR_OUT)/$(EASYTO_ASSETS_BUILD_ARCHIVE): | $(HAS_COMMAND_CURL) $(DIR_OUT) $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME_ARCHIVE): | $(HAS_COMMAND_CURL) $(DIR_OUT) @curl -L -o $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME_ARCHIVE) $(EASYTO_ASSETS_RUNTIME_URL) -$(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/: $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME_ARCHIVE) +EASYTO_ASSETS_RUNTIME_OUT = $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/base.tar \ + $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/boot.tar \ + $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/chrony.tar \ + $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/kernel.tar \ + $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/ssh.tar + +$(EASYTO_ASSETS_RUNTIME_OUT) &: $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME_ARCHIVE) @tar -zxf $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME_ARCHIVE) -C $(DIR_OUT) + @touch $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/* -$(DIR_OUT)/vmlinuz: $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/ +$(DIR_OUT)/vmlinuz: $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/kernel.tar @tar -xf $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/kernel.tar -C $(DIR_OUT) --strip-components=2 ./boot/ && \ mv $$(ls $(DIR_OUT)/vmlinuz-*) $(DIR_OUT)/vmlinuz @@ -125,8 +132,8 @@ KVM_GID = $(shell getent group kvm | cut -d: -f3) test-integration: \ $(HAS_IMAGE_LOCAL) \ $(DIR_OUT)/zig-out/bin/init \ - $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/ \ - $(DIR_OUT)/vmlinuz + $(DIR_OUT)/vmlinuz \ + $(EASYTO_ASSETS_RUNTIME_OUT) @docker run --rm -t \ -v $(DIR_ROOT):/code:Z \ -v /var/run/docker.sock:/var/run/docker.sock \ @@ -145,8 +152,8 @@ test-integration: \ test-integration-kvm: \ $(HAS_IMAGE_LOCAL) \ $(DIR_OUT)/zig-out/bin/init \ - $(DIR_OUT)/$(EASYTO_ASSETS_RUNTIME)/ \ - $(DIR_OUT)/vmlinuz + $(DIR_OUT)/vmlinuz \ + $(EASYTO_ASSETS_RUNTIME_OUT) @docker run --rm -t \ -v $(DIR_ROOT):/code:Z \ -v /var/run/docker.sock:/var/run/docker.sock \ From 40641dcf705d93204c31980e661d51cb924be144 Mon Sep 17 00:00:00 2001 From: Joseph Wright Date: Sun, 19 Apr 2026 15:57:04 -0400 Subject: [PATCH 2/3] Update easyto-assets to v0.6.0 This includes changes to the integration test runner and bench-qemu scripts to use virtio-net-pci as the network device in QEMU since e1000 has been removed from the kernel. Network initialization now takes approximately 1 second in QEMU locally, down from 3 seconds with e1000, which speeds up the time it takes to run the integration tests. The bench-qemu script now runs from the Makefile in a container in the same way as the integration tests. --- Dockerfile.build | 3 ++- Makefile | 21 ++++++++++++++++++++- hack/bench-qemu | 28 +++++++++++++--------------- tests/integration/image/build.sh | 2 +- tests/integration/run.sh | 4 ++-- 5 files changed, 38 insertions(+), 20 deletions(-) diff --git a/Dockerfile.build b/Dockerfile.build index 6f4cbcc..eae576c 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -13,7 +13,8 @@ RUN apk add --no-cache \ python3 \ qemu-system-x86_64 \ tar \ - xz + xz \ + zstd RUN curl -L -o /tmp/zig.tar.xz \ "https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz" && \ diff --git a/Makefile b/Makefile index a427571..50d7100 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ CTR_IMAGE_LOCALSTACK = ghcr.io/cloudboss/docker.io/localstack/localstack:4.14.0 DIR_RELEASE = $(DIR_OUT)/release EASYTO_ASSETS_RELEASES = https://github.com/cloudboss/easyto-assets/releases/download -EASYTO_ASSETS_VERSION = v0.5.1 +EASYTO_ASSETS_VERSION = v0.6.0 EASYTO_ASSETS_BUILD = easyto-assets-build-$(EASYTO_ASSETS_VERSION) EASYTO_ASSETS_BUILD_ARCHIVE = $(EASYTO_ASSETS_BUILD).tar.gz EASYTO_ASSETS_BUILD_URL = $(EASYTO_ASSETS_RELEASES)/$(EASYTO_ASSETS_VERSION)/$(EASYTO_ASSETS_BUILD_ARCHIVE) @@ -171,6 +171,25 @@ test-integration-kvm: \ -w /code \ $(CTR_IMAGE_LOCAL) /bin/sh -c "./tests/integration/run.sh" +bench-qemu: $(HAS_IMAGE_LOCAL) \ + $(DIR_OUT)/zig-out/bin/init \ + $(DIR_OUT)/vmlinuz \ + $(EASYTO_ASSETS_RUNTIME_OUT) + @docker run --rm -t \ + -v $(DIR_ROOT):/code:Z \ + -v /var/run/docker.sock:/var/run/docker.sock \ + --group-add $(DOCKER_GID) \ + --group-add $(KVM_GID) \ + --security-opt label=type:container_runtime_t \ + --device=/dev/kvm \ + -e CTR_IMAGE_ALPINE=$(CTR_IMAGE_BASE) \ + -e EASYTO_ASSETS_VERSION=$(EASYTO_ASSETS_VERSION) \ + -e INIT_BINARY=$(DIR_OUT)/zig-out/bin/init \ + -e KVM=1 \ + -e SCENARIO=$(SCENARIO) \ + -w /code \ + $(CTR_IMAGE_LOCAL) /bin/sh -c "./hack/bench-qemu" + release: $(DIR_RELEASE)/easyto-init-$(VERSION).tar.gz clean: diff --git a/hack/bench-qemu b/hack/bench-qemu index 0ba709b..f629697 100755 --- a/hack/bench-qemu +++ b/hack/bench-qemu @@ -10,10 +10,8 @@ set -eu -SCRIPT_DIR=$(cd "$(dirname "${0}")" && pwd) -PROJECT_ROOT=$(cd "${SCRIPT_DIR}/.." && pwd) -OUTPUT_DIR="${PROJECT_ROOT}/_output" -INTEGRATION_DIR="${PROJECT_ROOT}/tests/integration" +OUTPUT_DIR="_output" +INTEGRATION_DIR="tests/integration" EASYTO_ASSETS_VERSION=${EASYTO_ASSETS_VERSION:?EASYTO_ASSETS_VERSION must be defined} RUNS=5 @@ -24,10 +22,14 @@ IMDS_PID="" EASYTO_ASSETS_RUNTIME="${OUTPUT_DIR}/easyto-assets-runtime-${EASYTO_ASSETS_VERSION}" KERNEL="${OUTPUT_DIR}/vmlinuz" +CTR_IMAGE_ALPINE="${CTR_IMAGE_ALPINE:?CTR_IMAGE_ALPINE must be defined}" INIT_BINARY="${INIT_BINARY:-${OUTPUT_DIR}/zig-out/bin/init}" die() { echo "ERROR: ${*}" >&2 ; exit 1 ; } +# Return current time in milliseconds because busybox `date` does not. +now_ms() { awk '{ printf "%d\n", $1 * 1000 }' /proc/uptime ; } + while [ ${#} -gt 0 ]; do case "${1}" in --runs) RUNS="${2}" ; shift 2 ;; @@ -36,8 +38,7 @@ while [ ${#} -gt 0 ]; do esac done -BENCH_OUT="${OUTPUT_DIR}/bench.$$" -mkdir -p "${BENCH_OUT}" +BENCH_OUT=$(mktemp -p ${OUTPUT_DIR} -d bench.XXXXXX) cleanup() { if [ -n "${IMDS_PID}" ]; then @@ -51,23 +52,20 @@ trap cleanup EXIT # Check prerequisites. [ -f "${INIT_BINARY}" ] || die "init binary not found: ${INIT_BINARY}" [ -f "${KERNEL}" ] || die "kernel not found: ${KERNEL}" -if lsof -i :"${IMDS_PORT}" >/dev/null 2>&1; then - die "port ${IMDS_PORT} already in use (stale IMDS?)" -fi command -v qemu-system-x86_64 >/dev/null || die "qemu-system-x86_64 not found" SCENARIO_DIR="${INTEGRATION_DIR}/scenarios/${SCENARIO}" [ -d "${SCENARIO_DIR}" ] || die "scenario not found: ${SCENARIO}" # Build initramfs. -INITRAMFS="${BENCH_OUT}/initramfs.cpio.gz" +INITRAMFS="${BENCH_OUT}/initramfs.cpio.zst" OVERLAY="" if [ -d "${SCENARIO_DIR}/overlay" ]; then OVERLAY="${SCENARIO_DIR}" fi echo "Building test image..." ${INTEGRATION_DIR}/image/build.sh \ - "${INIT_BINARY}" "${EASYTO_ASSETS_RUNTIME}" "${INITRAMFS}" "${OVERLAY}" + "${CTR_IMAGE_ALPINE}" "${INIT_BINARY}" "${EASYTO_ASSETS_RUNTIME}" "${INITRAMFS}" "${OVERLAY}" # Read scenario config. nic_count=1 @@ -82,7 +80,7 @@ nic_args="" i=0 while [ "${i}" -lt "${nic_count}" ]; do mac_suffix=$(printf "%02x" $((86 + i))) - nic_args="${nic_args} -device e1000,netdev=net${i},mac=52:54:00:12:34:${mac_suffix}" + nic_args="${nic_args} -device virtio-net-pci,netdev=net${i},mac=52:54:00:12:34:${mac_suffix}" nic_args="${nic_args} -netdev user,id=net${i}" i=$((i + 1)) done @@ -131,7 +129,7 @@ echo "Running ${RUNS} iterations (scenario=${SCENARIO})..." run=1 while [ "${run}" -le "${RUNS}" ]; do LOG="${BENCH_OUT}/run-${run}.log" - START=$(date +%s%N) + START=$(now_ms) # shellcheck disable=SC2086 timeout "${TIMEOUT}" qemu-system-x86_64 \ @@ -147,8 +145,8 @@ while [ "${run}" -le "${RUNS}" ]; do -no-reboot \ 2>/dev/null || true - END=$(date +%s%N) - ELAPSED_MS=$(( (END - START) / 1000000 )) + END=$(now_ms) + ELAPSED_MS=$(( END - START )) echo "${ELAPSED_MS}" >> "${RESULTS}" if [ ! -s "${LOG}" ]; then diff --git a/tests/integration/image/build.sh b/tests/integration/image/build.sh index 80fd773..567cde6 100755 --- a/tests/integration/image/build.sh +++ b/tests/integration/image/build.sh @@ -92,6 +92,6 @@ fi # Create initramfs with fakeroot to preserve root ownership log "Creating initramfs..." -(cd "${ROOTFS_DIR}" && fakeroot sh -c 'chown -R 0:0 . && find . -print0 | cpio --null -o -H newc' 2>/dev/null | gzip -9) > "${OUTPUT}" +(cd "${ROOTFS_DIR}" && fakeroot sh -c 'chown -R 0:0 . && find . -print0 | cpio --null -o -H newc' 2>/dev/null | zstd -T0 -19) > "${OUTPUT}" log "Created ${OUTPUT}" diff --git a/tests/integration/run.sh b/tests/integration/run.sh index 25bd2b6..a57c095 100755 --- a/tests/integration/run.sh +++ b/tests/integration/run.sh @@ -20,7 +20,7 @@ KERNEL="${OUTPUT_DIR}/vmlinuz" INIT_BINARY="${INIT_BINARY:-${OUTPUT_DIR}/zig-out/bin/init}" # Test image -INITRAMFS="${INTEGRATION_OUT}/initramfs.cpio.gz" +INITRAMFS="${INTEGRATION_OUT}/initramfs.cpio.zst" # Mock IMDS server IMDS_PORT=8080 @@ -94,7 +94,7 @@ generate_qemu_nic_args() i=0 while [ $i -lt "$nic_count" ]; do mac_suffix=$(printf "%02x" $((86 + i))) - echo "-device e1000,netdev=net${i},mac=52:54:00:12:34:${mac_suffix}" + echo "-device virtio-net-pci,netdev=net${i},mac=52:54:00:12:34:${mac_suffix}" echo "-netdev user,id=net${i}" i=$((i + 1)) done From 0c5480c07f3e687982bd3c7b1e674dbcffc32a78 Mon Sep 17 00:00:00 2001 From: Joseph Wright Date: Sun, 19 Apr 2026 16:42:05 -0400 Subject: [PATCH 3/3] Update changelog for v0.5.0 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 529ef45..f187e89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.5.0] - 2026-04-19 + +### Changed + +- Update [easyto-assets](https://github.com/cloudboss/easyto-assets) to `v0.6.0`. This includes a kernel configuration trimmed specifically for EC2 Nitro, new support for XFS, and version updates to zlib, OpenSSL, and OpenSSH. +- Update bench-qemu and integration test runner to use virtio-net-pci in QEMU. +- Update bench-qemu to run in container from Makefile. + ## [0.4.1] - 2026-04-17 ### Fixed @@ -73,6 +81,7 @@ The most user visible change is the addition of "template" pseudo-volumes to ena Initial release +[0.5.0]: https://github.com/cloudboss/easyto-init/releases/tag/v0.5.0 [0.4.1]: https://github.com/cloudboss/easyto-init/releases/tag/v0.4.1 [0.4.0]: https://github.com/cloudboss/easyto-init/releases/tag/v0.4.0 [0.3.0]: https://github.com/cloudboss/easyto-init/releases/tag/v0.3.0