From 08d6909a74a85dc62ea2f63b21dca34b4afee9a6 Mon Sep 17 00:00:00 2001 From: Melora Hugues Date: Fri, 1 Sep 2023 18:44:43 +0200 Subject: [PATCH] add makefile for prod image with linux VM --- Makefile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Makefile b/Makefile index 77c1a23..29c7767 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,16 @@ build: 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: cp target/x86_64-unknown-uefi/debug/http_boot_client.efi build/esp/efi/httpboot/httpboot.efi qemu-system-x86_64 -enable-kvm \ @@ -10,3 +20,28 @@ testvm: -drive if=pflash,format=raw,readonly=off,file=build/OVMF_VARS.fd \ -drive format=raw,file=fat:rw:build/esp \ -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 \ No newline at end of file