diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93ec085a2..ea785456e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -95,6 +95,11 @@ jobs: name: artifact-${{ matrix.target }} path: output/*.tar.gz + - uses: actions/upload-artifact@v4 + with: + name: artifact-disk-image-${{ matrix.target }} + path: output/images/*.qcow2 + release: name: Release Infix ${{ github.ref_name }} needs: build @@ -141,6 +146,11 @@ jobs: for file in *.tar.gz; do sha256sum $file > $file.sha256 done + if ls *.qcow2 &>/dev/null; then + for file in *.qcow2; do + sha256sum "$file" > "$file.sha256" + done + fi - name: Extract ChangeLog entry ... run: | @@ -155,7 +165,7 @@ jobs: makeLatest: ${{ steps.rel.outputs.latest }} discussionCategory: ${{ steps.rel.outputs.cat }} bodyFile: release.md - artifacts: "*.tar.gz*" + artifacts: "*.tar.gz*,*.qcow2*" - name: Summary run: | diff --git a/board/common/mkdisk.sh b/board/common/mkdisk.sh index 79516aaf3..ababde0fa 100755 --- a/board/common/mkdisk.sh +++ b/board/common/mkdisk.sh @@ -127,7 +127,7 @@ bootdata= diskimg=disk.img bootimg= bootpart= - +tmpimage=$(mktemp) while getopts "a:b:B:n:s:" opt; do case ${opt} in a) @@ -166,7 +166,7 @@ awk \ -vimgsize=$imgsize \ -vcfgsize=$cfgsize \ -vvarsize=$varsize \ - -vdiskimg=$diskimg \ + -vdiskimg=$tmpimage \ -vbootimg="$bootimg" -vbootpart="$bootpart" \ '{ sub(/@TOTALSIZE@/, total); @@ -211,5 +211,7 @@ genimage \ --rootpath "$root" \ --tmppath "$tmp" \ --inputpath "$BINARIES_DIR" \ - --outputpath "$BINARIES_DIR" \ --config "$root/genimage.cfg" + +qemu-img convert -c -O qcow2 "$tmpimage" "$BINARIES_DIR/$diskimg" +rm "$tmpimage" diff --git a/board/common/post-image.sh b/board/common/post-image.sh index b57aad188..c78078c50 100755 --- a/board/common/post-image.sh +++ b/board/common/post-image.sh @@ -23,7 +23,7 @@ if [ -n "$IMAGE_ID" ]; then else NAME="$INFIX_ID"-$(echo "$BR2_ARCH" | tr _ - | sed 's/x86-64/x86_64/') fi -diskimg=disk.img +diskimg=disk.qcow2 ver() { @@ -48,7 +48,7 @@ fi load_cfg DISK_IMAGE if [ "$DISK_IMAGE" = "y" ]; then ixmsg "Creating Disk Image" - diskimg="${NAME}-disk$(ver).img" + diskimg="${NAME}-disk$(ver).qcow2" bootcfg= if [ "$DISK_IMAGE_BOOT_DATA" ]; then bootcfg="-b $DISK_IMAGE_BOOT_DATA -B $DISK_IMAGE_BOOT_OFFSET" @@ -90,7 +90,7 @@ if [ "$BR2_TARGET_ROOTFS_SQUASHFS" = "y" ]; then rel=$(ver) ln -sf rootfs.squashfs "$BINARIES_DIR/${NAME}${rel}.img" if [ -n "$rel" ]; then - ln -sf "$BINARIES_DIR/${NAME}${rel}.img" "$BINARIES_DIR/${NAME}.img" + ln -sf "${NAME}${rel}.img" "$BINARIES_DIR/${NAME}.img" fi fi diff --git a/board/common/qemu/qemu.sh b/board/common/qemu/qemu.sh index 4830cb969..0de195da3 100755 --- a/board/common/qemu/qemu.sh +++ b/board/common/qemu/qemu.sh @@ -120,7 +120,7 @@ rootfs_args() echo -n "-device sd-card,drive=mmc " echo -n "-drive id=mmc,file=$CONFIG_QEMU_ROOTFS,if=none,format=raw " elif [ "$CONFIG_QEMU_ROOTFS_VSCSI" = "y" ]; then - echo -n "-drive file=$CONFIG_QEMU_ROOTFS.qcow2,if=virtio,format=qcow2,bus=0,unit=0 " + echo -n "-drive file=qemu.qcow2,if=virtio,format=qcow2,bus=0,unit=0 " fi } @@ -316,13 +316,13 @@ gdb_args() run_qemu() { if [ "$CONFIG_QEMU_ROOTFS_VSCSI" = "y" ]; then - if ! qemu-img check "${CONFIG_QEMU_ROOTFS}.qcow2"; then - rm -f "${CONFIG_QEMU_ROOTFS}.qcow2" + if ! qemu-img check "qemu.qcow2"; then + rm -f "qemu.qcow2" fi - if [ ! -f "${CONFIG_QEMU_ROOTFS}.qcow2" ]; then + if [ ! -f "qemu.qcow2" ]; then echo "Creating qcow2 disk image for Qemu ..." qemu-img create -f qcow2 -o backing_file="$CONFIG_QEMU_ROOTFS" \ - -F raw "${CONFIG_QEMU_ROOTFS}.qcow2" > /dev/null + -F qcow2 "qemu.qcow2" > /dev/null fi fi diff --git a/board/common/rootfs/usr/libexec/infix/init.d/30-cfg-migrate b/board/common/rootfs/usr/libexec/infix/init.d/30-cfg-migrate index e53c15e27..def751055 100755 --- a/board/common/rootfs/usr/libexec/infix/init.d/30-cfg-migrate +++ b/board/common/rootfs/usr/libexec/infix/init.d/30-cfg-migrate @@ -11,7 +11,7 @@ chown root:wheel "$BACKUP_DIR" chmod 0770 "$BACKUP_DIR" if [ ! -f "$CONFIG_FILE" ]; then - note "No $(basename "$CONFIG_FILE" .cfg) yet, likely factory reset." + logger -I $$ -k -p user.notice -t $(basename "$0") "No $(basename "$CONFIG_FILE" .cfg) yet, likely factory reset." exit 0 elif migrate -cq "$CONFIG_FILE"; then exit 0 diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index b0670e7e3..96e3ae00a 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -8,15 +8,15 @@ All notable changes to the project are documented in this file. ------------------------- ### Changes - - N/A + - Format for disk image (for QEMU) has changed to `qcow2` ### Fixes + - Fix #1002: Broken symlink in release package - Fix #1006: NanoPi R2S corrupt startup, regression in Infix v25.02.0 - Bump R2S kernel, now same as tier one boards - Fix group owner and permissions of `/cfg/backup` directory - Fix extraction of old version for `/cfg/backup/` files - [v25.03.0][] - 2025-03-31 ------------------------- diff --git a/test/env b/test/env index a79682ef0..10eed98fe 100755 --- a/test/env +++ b/test/env @@ -74,7 +74,7 @@ get_base_img() { local files="$1" local base_img_file - base_img_file=$(echo "$files" | tr ' ' '\n' | grep -- '-disk.img$') + base_img_file=$(echo "$files" | tr ' ' '\n' | grep -- '-disk.qcow2$') echo "$envdir/qeneth/$(basename "$base_img_file")" } @@ -96,16 +96,20 @@ start_topology() done base_img=$(get_base_img "$files") - test_img="${base_img%-disk.img}-disk-test.img" - - $testdir/inject-test-mode -b "$base_img" -o "$test_img" - - img_name=$(basename "$test_img") + test_img_name="${base_img%-disk.qcow2}-disk-test" + base_img_name="${base_img%-disk.qcow2}-disk" + test_img_raw="${test_img_name}.img" + base_img_raw="${base_img_name}.img" + test_img_qcow2="${test_img_name}.qcow2" + + qemu-img convert -f qcow2 -O raw "$base_img" "$base_img_raw" + $testdir/inject-test-mode -b "$base_img_raw" -o "$test_img_raw" + qemu-img convert -f raw -O qcow2 "$test_img_raw" "$test_img_qcow2" + img_name=$(basename $test_img_qcow2) sed -i "s/qn_image=\".*\"/qn_image=\"$img_name\"/" "$envdir/qeneth/topology.dot.in" (cd "$envdir/qeneth/" && $qeneth generate && $qeneth start) INFAMY_ARGS="$INFAMY_ARGS $envdir/qeneth/topology.dot" - cat <"$envdir/bin/qeneth" #!/bin/sh cd $envdir/qeneth && exec $testdir/qeneth/qeneth "\$@" @@ -228,6 +232,7 @@ if [ "$containerize" ]; then --env INFAMY_EXTRA_ARGS="$INFAMY_EXTRA_ARGS" \ --env PROMPT_DIRTRIM="$ixdir" \ --env NINEPM_PROJ_CONFIG="$NINEPM_PROJ_CONFIG" \ + --env QENETH_PATH="$testdir/templates:$testdir" \ --env PS1="$(build_ps1)" \ $extra_env \ --expose 9001-9010 --publish-all \ diff --git a/test/qeneth b/test/qeneth index e17e0b805..332a376bc 160000 --- a/test/qeneth +++ b/test/qeneth @@ -1 +1 @@ -Subproject commit e17e0b80581e8ea60ffe97ec2683729cfcf75222 +Subproject commit 332a376bc000fbd9a1eccf6ecd5e54307421e7ab diff --git a/test/templates/inc/infix-disk.mustache b/test/templates/inc/infix-disk.mustache new file mode 100644 index 000000000..4e9f2acec --- /dev/null +++ b/test/templates/inc/infix-disk.mustache @@ -0,0 +1,4 @@ +if [ ! -e {{name}}.disk ]; then + qemu-img create -f raw {{name}}.disk 16M >/dev/null + mkfs.ext4 -q -L cfg {{name}}.disk +fi diff --git a/test/templates/inc/infix-usb.mustache b/test/templates/inc/infix-usb.mustache new file mode 100644 index 000000000..9dabb2ca1 --- /dev/null +++ b/test/templates/inc/infix-usb.mustache @@ -0,0 +1,9 @@ +usb_cmd="" + +if [ -n "{{qn_usb}}" ]; then + if ! [ -f {{qn_usb}} ]; then + dd if=/dev/zero of={{qn_usb}} bs=8M count=1 >/dev/null 2>&1 + mkfs.vfat {{qn_usb}} >/dev/null 2>&1 + fi + usb_cmd=" -drive if=none,id=usbstick,format=raw,file={{qn_usb}} -usb -device usb-ehci,id=ehci -device usb-storage,bus=ehci.0,drive=usbstick " +fi diff --git a/test/templates/infix-bios-x86_64.mustache b/test/templates/infix-bios-x86_64.mustache new file mode 100644 index 000000000..09a87e0c8 --- /dev/null +++ b/test/templates/infix-bios-x86_64.mustache @@ -0,0 +1,26 @@ +#!/bin/sh + +con=hvc0 +tty -s && con=hvc2 + +img={{#qn_image}}{{qn_image}}{{/qn_image}}{{^qn_image}}infix-x86_64-disk.img{{/qn_image}} +bios={{#qn_bios}}{{qn_bios}}{{/qn_bios}}{{^qn_bios}}OVMF.fd{{/qn_bios}} +{{> inc/infix-usb}} + +origimg=$(realpath $img) +qemu-img create -f qcow2 -o backing_file=$origimg -F qcow2 {{name}}.qcow2 + +truncate -s 0 $imgdir/{{name}}.mactab +{{#links}} +echo "{{qn_name}} {{qn_mac}}" >>$imgdir/{{name}}.mactab +{{/links}} + +exec qemu-system-x86_64 -M pc,accel=kvm:tcg -cpu max \ + -m {{#qn_mem}}{{qn_mem}}{{/qn_mem}}{{^qn_mem}}256M{{/qn_mem}} \ +{{> ../qeneth/templates/inc/qemu-links}} + -fw_cfg name=opt/mactab,file=$imgdir/{{name}}.mactab \ + -bios $bios \ + -drive file={{name}}.qcow2,if=virtio,format=qcow2,bus=0,unit=1 \ + $usb_cmd \ +{{> ../qeneth/templates/inc/infix-common}} +{{> ../qeneth/templates/inc/qemu-console}} diff --git a/test/templates/infix-kernel-x86_64.mustache b/test/templates/infix-kernel-x86_64.mustache new file mode 100644 index 000000000..e64a79c3e --- /dev/null +++ b/test/templates/infix-kernel-x86_64.mustache @@ -0,0 +1,30 @@ +#!/bin/sh + +con=hvc0 +tty -s && con=hvc2 + +img={{#qn_image}}{{qn_image}}{{/qn_image}}{{^qn_image}}infix-x86_64.img{{/qn_image}} +imgsz=$((($(stat -Lc %s $img) + 1023) >> 10)) +imgdir=./.$(realpath $img | sed -e s:/:-:g) + +unsquashfs -n -f -d $imgdir $img boot/bzImage >/dev/null + + +{{> inc/infix-disk}} +{{> inc/infix-usb}} + +truncate -s 0 $imgdir/{{name}}.mactab +{{#links}} +echo "{{qn_name}} {{qn_mac}}" >>$imgdir/{{name}}.mactab +{{/links}} + +exec qemu-system-x86_64 -M pc,accel=kvm:tcg -cpu max \ + -m {{#qn_mem}}{{qn_mem}}{{/qn_mem}}{{^qn_mem}}384M{{/qn_mem}} \ + -kernel "bzImage" -initrd $img \ + -append "root=/dev/ram0 ramdisk_size=$imgsz console=$con,115200 $append {{qn_append}}" \ + -drive file={{name}}.disk,if=virtio,format=raw,bus=0,unit=1 \ +{{> ../qeneth/templates/inc/qemu-links}} + -fw_cfg name=opt/mactab,file=$imgdir/{{name}}.mactab \ + $usb_cmd \ +{{> ../qeneth/templates/inc/infix-common}} +{{> ../qeneth/templates/inc/qemu-console}} diff --git a/test/templates/infix-x86_64.mustache b/test/templates/infix-x86_64.mustache new file mode 100644 index 000000000..b7971a28b --- /dev/null +++ b/test/templates/infix-x86_64.mustache @@ -0,0 +1,29 @@ +#!/bin/sh + +con=hvc0 +tty -s && con=hvc2 + +img={{#qn_image}}{{qn_image}}{{/qn_image}}{{^qn_image}}infix-x86_64.img{{/qn_image}} +imgsz=$((($(stat -Lc %s $img) + 1023) >> 10)) +imgdir=./.$(realpath $img | sed -e s:/:-:g) + +unsquashfs -n -f -d $imgdir $img boot/bzImage >/dev/null + + +{{> inc/infix-disk}} +{{> inc/infix-usb}} + +truncate -s 0 $imgdir/{{name}}.mactab +{{#links}} +echo "{{qn_name}} {{qn_mac}}" >>$imgdir/{{name}}.mactab +{{/links}} + +exec qemu-system-x86_64 -M pc,accel=kvm:tcg -cpu max \ + -m {{#qn_mem}}{{qn_mem}}{{/qn_mem}}{{^qn_mem}}384M{{/qn_mem}} \ + -kernel $imgdir/boot/bzImage -initrd $img \ + -append "root=/dev/ram0 ramdisk_size=$imgsz console=$con,115200 $append {{qn_append}}" \ + -drive file={{name}}.disk,if=virtio,format=raw,bus=0,unit=1 \ +{{> inc/qemu-links}} + -fw_cfg name=opt/mactab,file=$imgdir/{{name}}.mactab \ + $usb_cmd \ +{{> inc/infix-common}} diff --git a/test/test.mk b/test/test.mk index 3b5fed9f9..53c3391d6 100644 --- a/test/test.mk +++ b/test/test.mk @@ -16,7 +16,7 @@ mode-run := -t $(BINARIES_DIR)/qemu.dot mode := $(mode-$(TEST_MODE)) INFIX_IMAGE_ID := $(call qstrip,$(INFIX_IMAGE_ID)) -binaries-$(ARCH) := $(addprefix $(INFIX_IMAGE_ID),.img -disk.img) +binaries-$(ARCH) := $(addprefix $(INFIX_IMAGE_ID),.img -disk.qcow2) pkg-$(ARCH) := -p $(O)/images/$(addprefix $(INFIX_IMAGE_ID),.pkg) binaries-x86_64 += OVMF.fd binaries := $(foreach bin,$(binaries-$(ARCH)),-f $(BINARIES_DIR)/$(bin)) diff --git a/test/virt/quad/topology.dot.in b/test/virt/quad/topology.dot.in index f548c857a..a2b3fb100 100644 --- a/test/virt/quad/topology.dot.in +++ b/test/virt/quad/topology.dot.in @@ -9,7 +9,7 @@ graph "quad" { edge [color="cornflowerblue", penwidth="2"]; qn_template="infix-bios-x86_64"; - qn_image="infix-x86_64-disk-test.img" + qn_image="infix-x86_64-disk-test.qcow2" qn_oui="00:a0:85"; qn_append="quiet";