Next: Using the gdbinfo command, Up: x86_64-efi [Contents][Index]
In order to get the GRUB2 load address from OVMF, first, a debug build of OVMF must be obtained (here is one which is not officially recommended). OVMF will output debug messages to a special serial device, which we must add to QEMU. The following QEMU command will run the debug OVMF and write the debug messages to a file named debug.log. It is assumed that disk.img is a disk image or block device that is set up to boot GRUB2 EFI.
qemu-system-x86_64 -bios /path/to/debug/OVMF.fd \ -drive file=disk.img,format=raw \ -device virtio-scsi-pci,id=scsi0 \ -debugcon file:debug.log -global isa-debugcon.iobase=0x402
If GRUB2 was started by the (U)EFI firmware, then in the debug.log file one of the last lines should be a log message like: ‘Loading driver at 0x00006AEE000 EntryPoint=0x00006AEE756’. This means that the GRUB2 EFI application was loaded at ‘0x00006AEE000’ and its .text section is at ‘0x00006AEE756’.