Last active
February 2, 2024 02:04
-
-
Save Taurolyon/985d537cb256f52cda2190db2f86ffb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# inspired by https://computingforgeeks.com/install-and-configure-openwrt-vm-on-proxmox-ve/ | |
VM_NAME=OpenWrt | |
VM_ID=$(pvesh get /cluster/nextid) | |
RAM=2048 | |
CORES=1 | |
BRIDGE=vmbr1 | |
IMAGE=./openwrt.img | |
STORAGE=local | |
VER=$(curl --silent "https://api.github.com/repos/openwrt/openwrt/releases/latest" | grep '"tag_name"' | sed -E 's/.*"v([^"]+)".*/\1/') | |
wget -O openwrt.img.gz "https://downloads.openwrt.org/releases/$VER/targets/x86/64/openwrt-$VER-x86-64-generic-ext4-combined-efi.img.gz" | |
du -sh openwrt.img.gz | |
gunzip ./openwrt.img.gz | |
qemu-img resize -f raw ./openwrt.img 5G | |
qm create $VM_ID --name $VM_NAME --memory $RAM --cores $CORES --cpu cputype=kvm64 --net0 virtio,bridge=$BRIDGE --bios ovmf --machine q35 | |
qm importdisk $VM_ID $IMAGE $STORAGE | |
qm set $VM_ID --scsihw virtio-scsi-pci --virtio0 $STORAGE:$VM_ID/vm-$VM_ID-disk-0.raw | |
qm set $VM_ID --efidisk0 $STORAGE:0,efitype=4m | |
qm set $VM_ID --serial0 socket --vga serial0 | |
qm set $VM_ID --boot c --bootdisk virtio0 | |
# qm set $VM_ID --onboot 1 | |
# qm start $VM_ID && qm terminal $VM_ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works, but the serial terminal is problematic. I switched it to default (VGA) display, and it appears to work fine.