http-boot-client/Makefile

47 lines
No EOL
1.6 KiB
Makefile

.PHONY: build
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 \
-drive if=pflash,format=raw,readonly=on,file=build/OVMF_CODE.fd \
-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