qeneth: Move Infix test templates from qeneth to Infix

This commit is contained in:
Mattias Walström
2025-04-07 08:16:33 +02:00
parent d3fa51e4fa
commit 02080bfb6c
7 changed files with 100 additions and 1 deletions
+1
View File
@@ -232,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 \
+4
View File
@@ -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
+9
View File
@@ -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
+26
View File
@@ -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}}
@@ -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}}
+29
View File
@@ -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}}