Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SEMI-SOLVED] QEMU UEFI firmware
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Ari_archer
Tux's lil' helper
Tux's lil' helper


Joined: 30 Aug 2021
Posts: 128
Location: Lithuania

PostPosted: Thu Sep 23, 2021 11:05 am    Post subject: [SEMI-SOLVED] QEMU UEFI firmware Reply with quote

Hey, I reemerged qemu for the second time and I'm not able to boot qemu in UEFI mode, I keep getting this message:
Code:

 * Messages for package sys-firmware/edk2-ovmf-202008:

 * This package contains the tianocore edk2 UEFI firmware for 64-bit x86
 * virtual machines. The firmware is located under
 * /usr/share/edk2-ovmf/OVMF_CODE.fd
 * /usr/share/edk2-ovmf/OVMF_VARS.fd
 * /usr/share/edk2-ovmf/OVMF_CODE.secboot.fd
 *
 * If USE=binary is enabled, we also install an OVMF variables file (coming from
 * fedora) that contains secureboot default keys
 *
 * /usr/share/edk2-ovmf/OVMF_VARS.secboot.fd
 *
 * If you have compiled this package by hand, you need to either populate all
 * necessary EFI variables by hand by booting
 * /usr/share/edk2-ovmf/UefiShell.(iso|img)
 * or creating OVMF_VARS.secboot.fd by hand:
 * https://github.com/puiterwijk/qemu-ovmf-secureboot
 *
 * The firmware does not support csm (due to no free csm implementation
 * available). If you need a firmware with csm support you have to download
 * one for yourself. Firmware blobs are commonly labeled
 * OVMF{,_CODE,_VARS}-with-csm.fd
 *
 * In order to use the firmware you can run qemu the following way
 *
 * $ qemu-system-x86_64         -drive file=/usr/share/edk2-ovmf/OVMF.fd,if=pflash,format=raw,unit=0,readonly=on
 *
 * You can register the firmware for use in libvirt by adding to /etc/libvirt/qemu.conf:
 * nvram = [
 * "/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
 * "/usr/share/edk2-ovmf/OVMF_CODE.secboot.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
 * ]
 *
 * (Note: Above message is only printed the first time package is
 * installed. Please look at /usr/share/doc/edk2-ovmf-202008/README.gentoo*
 * for future reference)


I tried the `ovmf-vars-generator` script, but I am confused on what to do with it, how should I do it?


My USE for qemu:
Code:

app-emulation/qemu python_targets_python3_9 -accessibility aio -capstone curl fdt -fuse -glusterfs gnutls iscsi io-uring jemalloc jpeg -multipath -ncurses -nfs -numa pin-upstream-blobs plugins png -rbd -sdl -sdl-image slirp spice -ssh systemtap -usb -usbdir vde vhost-net -vhost-user-fs -virgl virtfs vte -xattrs -xen xfs gtk usbredir




***


Semi-solution:
Code:

qemu-system-x86_qemu-system-x86_64 -cdrom SOME_ISO.iso -m 2048 -smbios type=0,uefi=on -smp 2 -enable-kvm -bios /usr/share/edk2-ovmf/OVMF_CODE.fd



If you have any better ones - please suggest
_________________
regards,
ari


Last edited by Ari_archer on Mon Sep 27, 2021 7:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Thu Sep 23, 2021 12:51 pm    Post subject: Reply with quote

Plz emerge
sys-firmware/edk2-ovmf
then create a file
/etc/qemu/firmware/10-ovmf.json
containing
Code:

{
    "description": "UEFI firmware for x86_64",
    "interface-types": [
        "uefi"
    ],
    "mapping": {
        "device": "flash",
        "executable": {
            "filename": "/usr/share/edk2-ovmf/OVMF_CODE.fd",
            "format": "raw"
        },
        "nvram-template": {
            "filename": "/usr/share/edk2-ovmf/OVMF_VARS.fd",
            "format": "raw"
        }
    },
    "targets": [
        {
            "architecture": "x86_64",
            "machines": [
                "pc-i440fx-*",
                "pc-q35-*"
            ]
        }
    ],
    "features": [
        "acpi-s3",
        "amd-sev",
        "verbose-dynamic"
    ],
    "tags": [

    ]
}


restart libvirt and virt-manager
OR
in /etc/libvirt/qemu.conf
Code:

nvram = [
   "/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
]


whichever works.
_________________
:)
Back to top
View user's profile Send private message
Ari_archer
Tux's lil' helper
Tux's lil' helper


Joined: 30 Aug 2021
Posts: 128
Location: Lithuania

PostPosted: Thu Sep 23, 2021 7:02 pm    Post subject: Reply with quote

alamahant wrote:
Plz emerge
sys-firmware/edk2-ovmf
then create a file
/etc/qemu/firmware/10-ovmf.json
containing
Code:

{
    "description": "UEFI firmware for x86_64",
    "interface-types": [
        "uefi"
    ],
    "mapping": {
        "device": "flash",
        "executable": {
            "filename": "/usr/share/edk2-ovmf/OVMF_CODE.fd",
            "format": "raw"
        },
        "nvram-template": {
            "filename": "/usr/share/edk2-ovmf/OVMF_VARS.fd",
            "format": "raw"
        }
    },
    "targets": [
        {
            "architecture": "x86_64",
            "machines": [
                "pc-i440fx-*",
                "pc-q35-*"
            ]
        }
    ],
    "features": [
        "acpi-s3",
        "amd-sev",
        "verbose-dynamic"
    ],
    "tags": [

    ]
}


restart libvirt and virt-manager
OR
in /etc/libvirt/qemu.conf
Code:

nvram = [
   "/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
]


whichever works.



I'm sorry, I use pure qemu - I.e no virt-manager
_________________
regards,
ari
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Thu Sep 23, 2021 11:50 pm    Post subject: Reply with quote

Plz
Just use the first option.
_________________
:)
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Fri Sep 24, 2021 9:39 am    Post subject: Reply with quote

have you defined the nvram option?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Ari_archer
Tux's lil' helper
Tux's lil' helper


Joined: 30 Aug 2021
Posts: 128
Location: Lithuania

PostPosted: Fri Sep 24, 2021 1:32 pm    Post subject: Reply with quote

DaggyStyle wrote:
have you defined the nvram option?


I have

/etc/libvirt/qemu.conf

Code:

nvram = [
    "/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
    "/usr/share/edk2-ovmf/OVMF_CODE.secboot.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
]

_________________
regards,
ari
Back to top
View user's profile Send private message
Ari_archer
Tux's lil' helper
Tux's lil' helper


Joined: 30 Aug 2021
Posts: 128
Location: Lithuania

PostPosted: Fri Sep 24, 2021 1:38 pm    Post subject: Reply with quote

alamahant wrote:
Plz
Just use the first option.


Doesn't seem to work
_________________
regards,
ari
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Fri Sep 24, 2021 6:51 pm    Post subject: Reply with quote

what are the logs say?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Fri Sep 24, 2021 7:15 pm    Post subject: Reply with quote

Quote:

I have

/etc/libvirt/qemu.conf

Code:

nvram = [
"/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
"/usr/share/edk2-ovmf/OVMF_CODE.secboot.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
]

you miss a comma
Code:

nvram = [
    "/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd",
    "/usr/share/edk2-ovmf/OVMF_CODE.secboot.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
]

_________________
:)
Back to top
View user's profile Send private message
Ari_archer
Tux's lil' helper
Tux's lil' helper


Joined: 30 Aug 2021
Posts: 128
Location: Lithuania

PostPosted: Mon Sep 27, 2021 11:32 am    Post subject: Reply with quote

alamahant wrote:
Quote:

I have

/etc/libvirt/qemu.conf

Code:

nvram = [
"/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
"/usr/share/edk2-ovmf/OVMF_CODE.secboot.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
]

you miss a comma
Code:

nvram = [
    "/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd",
    "/usr/share/edk2-ovmf/OVMF_CODE.secboot.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
]


Sorry, I accidentally erased it, I didn't miss it, it has a comma in the file
_________________
regards,
ari
Back to top
View user's profile Send private message
Ari_archer
Tux's lil' helper
Tux's lil' helper


Joined: 30 Aug 2021
Posts: 128
Location: Lithuania

PostPosted: Mon Sep 27, 2021 7:10 pm    Post subject: Reply with quote

alamahant wrote:
Quote:

I have

/etc/libvirt/qemu.conf

Code:

nvram = [
"/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
"/usr/share/edk2-ovmf/OVMF_CODE.secboot.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
]

you miss a comma
Code:

nvram = [
    "/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd",
    "/usr/share/edk2-ovmf/OVMF_CODE.secboot.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
]


I tried without commans, with commans, etc. nothing works
_________________
regards,
ari
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Mon Sep 27, 2021 7:12 pm    Post subject: Reply with quote

Quote:

Hey, I reemerged qemu for the second time and I'm not able to boot qemu in UEFI mode, I keep getting this message:

how do you spin an uefi vm via qemu?
which invocation do you use?
with or without libvirt?
_________________
:)
Back to top
View user's profile Send private message
Ari_archer
Tux's lil' helper
Tux's lil' helper


Joined: 30 Aug 2021
Posts: 128
Location: Lithuania

PostPosted: Mon Sep 27, 2021 7:18 pm    Post subject: Reply with quote

alamahant wrote:
Quote:

Hey, I reemerged qemu for the second time and I'm not able to boot qemu in UEFI mode, I keep getting this message:

how do you spin an uefi vm via qemu?
which invocation do you use?
with or without libvirt?


Code:

qemu-system-x86_64 -cdrom SOME_ISO_THAT_EXISTS.iso -m 2048 -smbios type=0,uefi=on -smp 2 -enable-kvm


ALSO UPDATE:

when I do:

Code:

qemu-system-x86_64 -cdrom SOME_ISO_THAT_EXISTS.iso -m 2048 -smbios type=0,uefi=on -smp 2 -enable-kvm -bios /usr/share/edk2-ovmf/OVMF_CODE.fd


It boots me into UEFI mode.


also no libvirt, at least I don't think so
_________________
regards,
ari
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Mon Sep 27, 2021 7:32 pm    Post subject: Reply with quote

when I do:

Code:

qemu-system-x86_64 -cdrom SOME_ISO_THAT_EXISTS.iso -m 2048 -smbios type=0,uefi=on -smp 2 -enable-kvm -bios /usr/share/edk2-ovmf/OVMF_CODE.fd


It boots me into UEFI mode.

Then plz do that.
_________________
:)
Back to top
View user's profile Send private message
Ari_archer
Tux's lil' helper
Tux's lil' helper


Joined: 30 Aug 2021
Posts: 128
Location: Lithuania

PostPosted: Mon Sep 27, 2021 7:36 pm    Post subject: Reply with quote

alamahant wrote:
when I do:

Code:

qemu-system-x86_64 -cdrom SOME_ISO_THAT_EXISTS.iso -m 2048 -smbios type=0,uefi=on -smp 2 -enable-kvm -bios /usr/share/edk2-ovmf/OVMF_CODE.fd


It boots me into UEFI mode.

Then plz do that.


it does work as I metioned, but `-smbbios type=0,uefi=on` should boot into uefi directly, but thanks, i will mark it as solved
_________________
regards,
ari
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum