mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-21 11:46:37 +00:00
492103d5b8
Serial output was silent (x-option-roms=off suppresses BIOS serial init); fixed by removing it from the machine string and using -serial chardev:console0 to attach to the machine-created ISA serial device instead of adding a duplicate isa-serial device (which would create ttyS1 while kernel uses ttyS0). virtio-net interfaces were invisible to the kernel because QEMU's auto-kernel-cmdline does not append virtio_mmio.device= params when -append is used. Fixed by generating explicit virtio_mmio.device=0x200@0xfebNNNNN:N params for each NIC in KernelCmdline, and modprobing virtio_mmio + virtio_net in init.sh. sys.micro bumped to 512 MiB — 128 MiB caused kernel OOM during initramfs decompression (~68 MiB uncompressed). BusyBox init ::respawn: entries do not source or export env files; fixed inittab to use set -a; . /etc/conf.d/lb-agent; set +a before exec. wireLBAgentConfig was documented as reading the CA cert but never set elbv2Service.CACert; lb-agent TLS handshakes to AWSGW failed with x509: certificate signed by unknown authority. Fixed by reading d.config.NATS.CACert (same local CA that signs the AWSGW server cert) and assigning to elbv2Service.CACert so writeFwCfgBlobs writes a non-empty cacert blob into fw_cfg. Adds vm_test TestExecute_MicrovmFileChardev and updates lifecycle_test to assert SerialSocket is intentionally empty on direct-boot VMs.
61 lines
1.9 KiB
Bash
Executable File
61 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
mount -t proc proc /proc
|
|
mount -t sysfs sys /sys
|
|
mount -t devtmpfs dev /dev
|
|
|
|
modprobe qemu_fw_cfg 2>/dev/null || modprobe fw_cfg_sysfs 2>/dev/null || true
|
|
modprobe virtio_mmio 2>/dev/null || true
|
|
modprobe virtio_net 2>/dev/null || true
|
|
|
|
echo "[init] waiting for fw_cfg sysfs..."
|
|
for i in $(seq 1 10); do
|
|
[ -f /sys/firmware/qemu_fw_cfg/by_name/opt/spinifex/netcfg/raw ] && break
|
|
sleep 0.2
|
|
done
|
|
|
|
if [ ! -f /sys/firmware/qemu_fw_cfg/by_name/opt/spinifex/netcfg/raw ]; then
|
|
echo "[init] FATAL: fw_cfg netcfg not available" >&2
|
|
exit 1
|
|
fi
|
|
|
|
. /sys/firmware/qemu_fw_cfg/by_name/opt/spinifex/netcfg/raw
|
|
|
|
echo "[init] network interfaces:"
|
|
ip -o link show
|
|
|
|
for n in 0 1 2 3 4 5; do
|
|
eval mac=\$NIC${n}_MAC
|
|
[ -z "$mac" ] && continue
|
|
|
|
# Retry finding the interface by MAC — virtio-mmio may take a moment to appear.
|
|
iface=""
|
|
for attempt in $(seq 1 10); do
|
|
iface=$(ip -o link | awk -v m="$mac" 'tolower($0) ~ tolower(m) {print $2}' | tr -d :)
|
|
[ -n "$iface" ] && break
|
|
sleep 0.2
|
|
done
|
|
|
|
if [ -z "$iface" ]; then
|
|
echo "[init] WARNING: no interface found for MAC $mac (NIC$n), skipping" >&2
|
|
continue
|
|
fi
|
|
|
|
eval cidr=\$NIC${n}_CIDR
|
|
eval gw=\$NIC${n}_GW
|
|
eval default=\$NIC${n}_DEFAULT
|
|
eval rdst=\$NIC${n}_ROUTE_DST
|
|
eval rvia=\$NIC${n}_ROUTE_VIA
|
|
|
|
echo "[init] configuring NIC$n: iface=$iface cidr=$cidr gw=$gw default=$default"
|
|
ip link set "$iface" up
|
|
[ -n "$cidr" ] && ip addr add "$cidr" dev "$iface"
|
|
[ "$default" = "1" ] && [ -n "$gw" ] && ip route add default via "$gw" dev "$iface"
|
|
[ -n "$rdst" ] && [ -n "$rvia" ] && ip route add "$rdst" via "$rvia" dev "$iface"
|
|
done
|
|
|
|
cp /sys/firmware/qemu_fw_cfg/by_name/opt/spinifex/lb-agent-env/raw /etc/conf.d/lb-agent
|
|
mkdir -p /etc/ssl/certs
|
|
cp /sys/firmware/qemu_fw_cfg/by_name/opt/spinifex/ca-cert/raw /etc/ssl/certs/ca-certificates.crt
|
|
|
|
exec /sbin/init
|