[Solved] QEMU: Booting x86_64 kernel via PVH
Posted: Tue Jul 27, 2021 5:29 pm
After getting a basic 32-bit i386 kernel emulating through QEMU, I figured I would go ahead and get one fired up on x86_64. I am still completely in the "Let's make sure this actually works before doing anything else" phase. Running "qemu-system-x86_64 -kernel out.bin" results in QEMU spitting out "Error loading uncompressed kernel without PVH ELF Note." The binary file has been verified with grub-file as well.
I've read around that QEMU does not support multiboot2 so I figured I would just give it what it wants and include the elf note. My only issue here is figuring out how to do this correctly. As of now I have
and my linker puts the section at the right spot in the file.
Running readelf does show that the elfnote is present and contains what I thought was the correct information (see below). QEMU still tells me that it wants its PVH elfnote despite this. I have exhausted every resource trying to get it to work over the past week and I'm about at the end of my ropes; Thinking I misunderstood something big-time. Would love if someone could point me in the right direction here on where I went wrong.
Note data:
https://xenbits.xen.org/docs/unstable/misc/pvh.html
I've read around that QEMU does not support multiboot2 so I figured I would just give it what it wants and include the elf note. My only issue here is figuring out how to do this correctly. As of now I have
Code: Select all
section .note
align 4
dd 3 ; name size
dd 4 ; data size
dd 18 ; type (0x12)
align 4
db 'Xen' ; name
align 4
dd _start ; data
Code: Select all
.note :
{
*(.note)
}
Note data:
Code: Select all
Displaying notes found in: .note
Owner Data size Description
Xen 0x00000004 Unknown note type: (0x00000012)
description data: 00 20 00 00