Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
QEMU and UEFI partition booting
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Tux's lil' helper
Tux's lil' helper

Joined: 04 Apr 2015
Posts: 113

PostPosted: Sat Oct 29, 2016 1:05 pm    Post subject: QEMU and UEFI partition booting Reply with quote

Hello all, I'm not sure if this is the right section for this, but I'm having trouble finding information about QEMU and UEFI.
I currently have a dual boot scenario with gentoo, windows and the efi partition on the same drive - both operating systems are booting UEFI.
The problem is, that I don't know how to boot windows from qemu when it boots as UEFI.
I believe that OVMF is needed to boot, and I'm able to use it for image files containing windows systems - but whenever I replace the image file with the location of my windows partition, it won't boot and returns to the yellow shell.
This is what I'm using at the minute to try and boot my windows partition:

cp /usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd /tmp/my_vars.fd
qemu-system-x86_64 \
  -enable-kvm \
  -m 2048 \
  -cpu host,kvm=off \
  -vga none \
  -usb -usbdevice host:1017:0002 \
  -device vfio-pci,host=01:00.0,multifunction=on \
  -device vfio-pci,host=01:00.1 \
  -drive if=pflash,format=raw,readonly,file=/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd \
  -drive if=pflash,format=raw,file=/tmp/my_vars.fd \
  -device virtio-scsi-pci,id=scsi \
  -drive file=/mnt/virt.iso,id=virtiocd,if=none,format=raw -device ide-cd,bus=ide.1,drive=virtiocd \

Note that /dev/sda4 is my windows partition, and /dev/sda1 is the efi parition, and /dev/sda5 is a 16M system reserved microsoft partition - but I'm not sure what it does.
What I'm thinking is that it isn't enough to just add the windows main partition, but I should add the efi and sys-reserved as well - but I'm not sure how to add them to QEMU.
Back to top
View user's profile Send private message

Joined: 27 Aug 2013
Posts: 1850

PostPosted: Sun Oct 30, 2016 8:50 pm    Post subject: Reply with quote

I'm not quite sure whether qemu supports EFI mode mode by default or not. I know there is a patch for it, but it may not be included.
Also, since you seem to have windows installed in bare-metal fashion on that drive, you should provide the full drive to qemu. Let qemu look for a way to boot it, and then the OS installed on that drive to handle partitions. Being smart and providing only "necessary" partitions will strip some metadata (like partition table) making the whole thing unbootable - try this first, as it's much easier and faster to do than looking for patches :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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