Reputation: 104
I was trying to write a "hello world" x86_64 OS with GNU-EFI according to an article:https://wiki.osdev.org/GNU-EFI, but I ran into some problem.
When I boot the img using following command
sudo qemu-system-x86_64 -drive file=$(BUILD_DIR)/$(OSNAME).img -m 256M -cpu qemu64 \
-drive if=pflash,format=raw,unit=0,file="$(OVMF_DIR)/OVMF_CODE.fd",readonly=on \
-drive if=pflash,format=raw,unit=1,file="$(OVMF_DIR)/OVMF_VARS.fd" \
-net none
Qemu hangs after printing Found bootloader on fs0:
I can't find out what cause it. I suspect I made some mistakes in the Makefile. Heres the code repo:https://github.com/xubury/myos for reproduce.
BTW, you may need to specify path to gnu-efi
and ovmf
in the Makefile.
I ran the code under OS: Arch Linux x86_64 and Kernel: 5.11.1-arch1-1
Many thanks in advance!
Upvotes: 0
Views: 596
Reputation: 104
So, apparently the problem goes away when I put -lgnuefi -lefi
at the end of the linkage. But I don't know excatly why. Also, the gnu-efi function should be called using uefi_call_warpper
for some ABI compatibility issues.
Upvotes: 0