Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -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" && \
Expand Down
40 changes: 33 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 \
Expand All @@ -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 \
Expand All @@ -164,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:
Expand Down
28 changes: 13 additions & 15 deletions hack/bench-qemu
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ;;
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/image/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
4 changes: 2 additions & 2 deletions tests/integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading