add makefile for prod image with linux VM

This commit is contained in:
Melora Hugues 2023-09-01 18:44:43 +02:00
parent 3bbc74bd7e
commit 08d6909a74

View file

@ -3,6 +3,16 @@
build: build:
cargo build --target x86_64-unknown-uefi cargo build --target x86_64-unknown-uefi
build-prod:
cargo build -r --target x86_64-unknown-uefi
restore:
cp build/backup/* build/
backup:
cp build/archlinux.qcow2 build/backup/
cp build/archlinux-1.qcow2 build/backup/
testvm: testvm:
cp target/x86_64-unknown-uefi/debug/http_boot_client.efi build/esp/efi/httpboot/httpboot.efi cp target/x86_64-unknown-uefi/debug/http_boot_client.efi build/esp/efi/httpboot/httpboot.efi
qemu-system-x86_64 -enable-kvm \ qemu-system-x86_64 -enable-kvm \
@ -10,3 +20,28 @@ testvm:
-drive if=pflash,format=raw,readonly=off,file=build/OVMF_VARS.fd \ -drive if=pflash,format=raw,readonly=off,file=build/OVMF_VARS.fd \
-drive format=raw,file=fat:rw:build/esp \ -drive format=raw,file=fat:rw:build/esp \
-netdev user,id=n1 -device virtio-net-pci,netdev=n1 -netdev user,id=n1 -device virtio-net-pci,netdev=n1
prodvm:
# ip tuntap add tap0 mode tap || true
# ip addr add 2001:abcd:1234:1::3/96 dev tap0 || true
# ip addr add 192.168.122.2/24 dev tap0 || true
# ip link set tap0 master virbr0 || true
# ip link set tap0 up || true
# ip link set virbr0 up || true
# sysctl net.ipv4.ip_forward=1
# iptables -t nat -A POSTROUTING -o enp6s0 -j MASQUERADE
cp target/x86_64-unknown-uefi/release/http_boot_client.efi build/esp/efi/httpboot/httpboot.efi
qemu-system-x86_64 -enable-kvm -m 1G -M q35 \
-drive if=pflash,format=raw,readonly=off,file=build/OVMF_CODE.fd \
-drive if=pflash,format=raw,readonly=off,file=build/OVMF_VARS.fd \
-drive file=build/archlinux.qcow2,format=qcow2,if=ide \
-drive file=build/archlinux-1.qcow2,format=qcow2,if=ide \
-nic bridge,br=virbr0,model=virtio-net-pci
# -netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no \
# -device e1000,netdev=mynet0,mac=52:55:00:d1:55:01
push-prod:
scp target/x86_64-unknown-uefi/release/http_boot_client.efi root@192.168.122.2:/root/httpboot.efi