Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save devspyrosv/fab9140084a0bcf2ffce80e86aaa987b to your computer and use it in GitHub Desktop.

Select an option

Save devspyrosv/fab9140084a0bcf2ffce80e86aaa987b to your computer and use it in GitHub Desktop.

Revisions

  1. @ryuheechul ryuheechul revised this gist Apr 14, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion openwrt-efi-on-proxmox.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ _Existing references I looked at before I went on trial and error until eventual
    My situation:
    - Proxmox on x86-64 machine
    - booting with OVMF (UEFI, since I want to passthrough hardware at somepoint)
    - booting with OVMF (UEFI, since I want to passthrough hardware at somepoint)

    1) Go to OpenWRT [release page](https://downloads.openwrt.org/releases/), select the latest release stable release, then ```targets``` -> ```x86``` -> ```64```. Right-click ```generic-ext4-combined-efi.img.gz``` and copy the link.

  2. @ryuheechul ryuheechul created this gist Apr 14, 2024.
    53 changes: 53 additions & 0 deletions openwrt-efi-on-proxmox.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    _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)

    1) Go to OpenWRT [release page](https://downloads.openwrt.org/releases/), select the latest release stable release, then ```targets``` -> ```x86``` -> ```64```. Right-click ```generic-ext4-combined-efi.img.gz``` and copy the link.

    2) On the Proxmox host, download the archive and unpack it:

    ```bash
    # 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
    ```

    3) Resize the image to be the size you want your VM's disk to be (example with 8 GiB):

    ```bash
    # 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
    ```

    4) 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

    5) Import the resized OpenWRT image into the new VM:

    ```bash
    # qm importdisk *VMID* openwrt-*.img *STORAGEID*
    qm importdisk 101 openwrt-23.05.3-x86-64-generic-ext4-combined-efi.img local-lvm
    ```

    6) 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

    7) Add whatever networking or other devices you need.

    8) Start the VM and it should be booting to OpenWRT.