checkpointing, heavy dev

This commit is contained in:
2025-07-24 14:32:50 +02:00
parent a3bc63d2d9
commit c2040a5c08
89 changed files with 741883 additions and 477 deletions

Binary file not shown.

View File

@@ -0,0 +1,2 @@
instance-id: hdmistat-test-01
local-hostname: hdmistat-test

View File

@@ -0,0 +1,101 @@
#cloud-config
hostname: hdmistat-test
manage_etc_hosts: true
users:
- name: ubuntu
groups: [adm, audio, cdrom, dialout, dip, floppy, lxd, netdev, plugdev, sudo, video]
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
lock_passwd: false
plain_text_passwd: ubuntu
packages:
- git
- build-essential
- wget
- fbset
- rsync
# Enable SSH (already enabled in cloud images)
ssh_pwauth: true
# Disable all package updates
package_update: false
package_upgrade: false
package_reboot_if_required: false
write_files:
- path: /tmp/install-go.sh
permissions: '0755'
content: |
#!/bin/bash
set -e
GO_VERSION="1.24.4"
wget -q -O /tmp/go.tar.gz "https://go.dev/dl/go${GO_VERSION}.linux-arm64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf /tmp/go.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee -a /etc/profile
echo 'export GOPATH=$HOME/go' | sudo tee -a /etc/profile
echo 'export PATH=$PATH:$GOPATH/bin' | sudo tee -a /etc/profile
- path: /tmp/setup-hdmistat.sh
permissions: '0755'
content: |
#!/bin/bash
set -e
export HOME=/root
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export GOCACHE=$HOME/.cache/go-build
mkdir -p $GOCACHE
# Mount hdmistat source
mkdir -p /mnt/hdmistat
mount -t 9p -o trans=virtio,version=9p2000.L hdmistat /mnt/hdmistat || echo "Failed to mount hdmistat source"
# Build hdmistat
if [ -d "/mnt/hdmistat" ]; then
echo "Copying hdmistat source to /tmp..."
rsync -av --exclude='test' --exclude='.git' /mnt/hdmistat/ /tmp/hdmistat-build/
cd /tmp/hdmistat-build
echo "Building hdmistat debug build in /tmp..."
# Build debug version with VCS disabled
make debug GOFLAGS="-buildvcs=false"
cp hdmistat-debug /usr/local/bin/hdmistat
chmod +x /usr/local/bin/hdmistat
echo "hdmistat binary installed to /usr/local/bin/"
fi
# Install hdmistat as systemd service (handles everything)
if [ -f /usr/local/bin/hdmistat ]; then
/usr/local/bin/hdmistat install
# Check service status
systemctl status hdmistat --no-pager || true
# Show logs
journalctl -u hdmistat -n 20 --no-pager || true
else
echo "ERROR: hdmistat binary not found!"
fi
# Enable framebuffer
echo "fbcon=map:10" | tee -a /etc/default/grub
update-grub || true
runcmd:
- /tmp/install-go.sh
- /tmp/setup-hdmistat.sh
- echo "hdmistat setup complete! Service installed and started by 'hdmistat install'"
- sleep 5
- echo "Checking hdmistat service status..."
- systemctl status hdmistat --no-pager || true
- echo "Recent hdmistat logs:"
- journalctl -u hdmistat -n 50 --no-pager || true
- echo "Checking framebuffer device..."
- ls -la /dev/fb* || true
- fbset -i || true
final_message: "hdmistat test environment ready!"

Binary file not shown.

View File

@@ -0,0 +1,72 @@
#!/bin/bash
cd "/Users/user/dev/hdmistat/qemu-ubuntu-test"
echo "Starting QEMU ARM64 Ubuntu with cloud-init..."
echo ""
echo "Login: ubuntu / ubuntu"
echo "SSH available on port 2223: ssh ubuntu@localhost -p 2223"
echo "VNC available on port 5902 (password: vncvnc)"
echo ""
echo "hdmistat will be installed automatically via cloud-init"
echo "Check cloud-init status with: cloud-init status"
echo ""
echo "Press Ctrl+A, X to quit"
echo ""
# Create fresh disk image from base image
echo "Creating fresh disk image..."
qemu-img create -f qcow2 -F qcow2 -b ubuntu-22.04-server-cloudimg-arm64.img hdmistat-test.qcow2 8G
# Find EFI firmware and vars
EFI_CODE=""
EFI_VARS=""
for dir in /nix/store/*/share/qemu /run/current-system/sw/share/qemu; do
if [ -f "$dir/edk2-aarch64-code.fd" ]; then
EFI_CODE="$dir/edk2-aarch64-code.fd"
if [ -f "$dir/edk2-arm-vars.fd" ]; then
EFI_VARS="$dir/edk2-arm-vars.fd"
fi
break
fi
done
# Create a copy of EFI vars if found
if [ -n "$EFI_VARS" ] && [ ! -f "efivars.fd" ]; then
cp "$EFI_VARS" efivars.fd
chmod u+rw efivars.fd
fi
BIOS_ARGS=""
if [ -n "$EFI_CODE" ]; then
# Use pflash method for UEFI boot (not -bios)
BIOS_ARGS="-drive if=pflash,file=$EFI_CODE,format=raw,readonly=on"
if [ -f "efivars.fd" ]; then
BIOS_ARGS="$BIOS_ARGS -drive if=pflash,format=raw,file=efivars.fd"
fi
fi
qemu-system-aarch64 \
-M virt \
-accel hvf \
-cpu host \
-smp 4 \
-m 2G \
-nographic \
-object secret,id=vncsec0,data=vncvnc \
-drive file=hdmistat-test.qcow2,format=qcow2,if=virtio \
-drive file=cloud-init.iso,format=raw,if=virtio \
-netdev user,id=net0,hostfwd=tcp::2223-:22 \
-device virtio-net-pci,netdev=net0 \
-device virtio-gpu-pci \
-display default,show-cursor=on \
-vnc :2,password-secret=vncsec0 \
-serial mon:stdio \
-virtfs local,path="/Users/user/dev/hdmistat",mount_tag=hdmistat,security_model=none,id=hdmistat \
$BIOS_ARGS \
${@}
# Clean up disk image after QEMU exits
echo ""
echo "Cleaning up disk image for fresh start next time..."
rm -f hdmistat-test.qcow2
echo "Disk image removed. Next run will start fresh with cloud-init."

View File

@@ -0,0 +1,4 @@
#!/bin/bash
echo "Connecting to Ubuntu VM..."
echo "Password: ubuntu"
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@localhost -p 2223

View File

@@ -0,0 +1,3 @@
#!/bin/bash
echo "Opening VNC viewer on localhost:5902"
vncviewer localhost:5902 || open vnc://localhost:5902 || echo "Connect to VNC at localhost:5902"