0

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!

xubury
  • 84
  • 6
  • You don't give much context and your code is not in the question but in a link. You expect ppl who see your question to just know how things work in your bootloader and how things are set up. You should instead explain what you have tried what doesn't work, give context, even to tell us how you think things are working. Maybe then someone can give you a clearer understanding of what you missed. With the question you posted, I think no one can help you. – user123 Feb 28 '21 at 13:00

1 Answers1

0

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.

xubury
  • 84
  • 6