Existing references I looked at before I went on trial and error until eventually I managed to make it work:
- https://gist.github.com/subrezon/b9aa2014343f934fbf69e579ecfc8da8 (the format of this gist copies this one)
- https://forum.openwrt.org/t/minimum-ovmf-uefi-folders-and-files-to-boot-openwrt-in-proxmoxve/75824
- https://forum.proxmox.com/threads/openwrt-boot.130221/
Note
Although links above were good references to look at so I didn't have to start from scratch, following none of them actually worked for me. Hence, I'm leaving my own note after figuring things out.
My situation:
- Proxmox on x86-64 machine
- booting with OVMF (UEFI, since I want to passthrough hardware at somepoint)
-
Go to OpenWRT release page, select the latest release stable release, then
targets
->x86
->64
. Right-clickgeneric-ext4-combined-efi.img.gz
and copy the link. -
On the Proxmox host, download the archive and unpack it:
# I will use example link here but yours might different depends on the version
wget https://downloads.openwrt.org/releases/23.05.3/targets/x86/64/openwrt-23.05.3-x86-64-generic-squashfs-combined-efi.img.gz
# don't forget unzipping, because this is where I accidently skipped it at my second attempt (my first attempt I didn't download 64 bit version so that failed)
# - surpringly (or maybe not surprisingly) both `qemu-img resize` and `qm importdisk` works on `.gz` file
# - so the disk will imported with compressed bits which doesn't make any sense to the UEFI boot loader of course...
gzip -d openwrt-23.05.3-x86-64-generic-ext4-combined-efi.img.gz
- Resize the image to be the size you want your VM's disk to be (example with 8 GiB):
# choose your own size but I chose 2G
qemu-img resize -f raw openwrt-23.05.3-x86-64-generic-ext4-combined-efi.img 2G
- Create a new VM in Proxmox. Similar to https://www.youtube.com/watch?v=gbyjK4ni198&t but make sure to use:
- no installation media
- OVMF
- no drives (you can delete the EFI disk created due to choosing OVMF)
- do not start the VM yet after creating
- Import the resized OpenWRT image into the new VM:
# qm importdisk *VMID* openwrt-*.img *STORAGEID*
qm importdisk 101 openwrt-23.05.3-x86-64-generic-ext4-combined-efi.img local-lvm
- Go to the VM -> Hardware, select the newly imported disk named "Unused Disk 0", press "Edit" and simply click "Add"
- or you can edit whatever option you like or need
-
Add whatever networking or other devices you need.
-
Start the VM and it should be booting to OpenWRT.
This worked after I manually adjusted the boot order, before that it was booting to the UEFI shell.