UEFI Not booting kernel.
Posted: Sun Dec 02, 2012 12:25 pm
I have been going at this for a long time... Let me share my agony.
TL;DR: UEFI does not boot my kernel.
Here it is:
I don't get any compile or linking errors on this, so I assume it's all defined properly.
Build process:
What is this?
Wrong flags? Wrong address...?
EDIT: I should probably say I have an image, with a FAT32 32MB partition, and a ~1GB data partition as HFS+ (Didn't format that)
the EFI firmware detects the disk, but it doesn't boot from it automatically (or fails to).
When I go to 'boot from file' and select my bootx64.efi, the screen flashes black, then I get sent back to the menu screen.
Am I doing anything wrong...?
Help, thanks!
EDIT 2: For the purposes of help, here are the relevant files:
1. bootx64.efi, HERE
Thanks for your time.
18. KERNEL LOADER DOES NOT BOOT...!requimrar wrote: -- Insert agonising complaints and whining --
TL;DR: UEFI does not boot my kernel.
Here it is:
Code: Select all
#include <efi.h>
#include <efilib.h>
EFI_STATUS _start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
SystemTable->ConOut->OutputString(SystemTable->ConOut, (CHAR16*)L"Hello World\n\r");
asm volatile("cli; hlt");
return EFI_SUCCESS;
}
Build process:
Code: Select all
EFICCFLAGS = -w -m64 -O0 -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -std=gnu11 -fstrength-reduce -fno-leading-underscore -fno-stack-protector -fomit-frame-pointer -finline-functions -ffreestanding -nostdlib -mcmodel=large -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -Isrc/kernel/include -Isrc/ares/efi/efi/include -c
@$(CC) $(EFICCFLAGS) -o obj/efi/ares.o src/ares/efi/ares.c
@$(AS) --64 src/ares/efi/efi/x86_64/efi_stub.S -o obj/efi/efi_stub.o
@$(CC) $(EFICCFLAGS) -o obj/efi/boxdraw.o src/ares/efi/efi/boxdraw.c
@$(CC) $(EFICCFLAGS) -o obj/efi/console.o src/ares/efi/efi/console.c
@$(CC) $(EFICCFLAGS) -o obj/efi/crc.o src/ares/efi/efi/crc.c
@$(CC) $(EFICCFLAGS) -o obj/efi/data.o src/ares/efi/efi/data.c
@$(CC) $(EFICCFLAGS) -o obj/efi/debug.o src/ares/efi/efi/debug.c
@$(CC) $(EFICCFLAGS) -o obj/efi/dpath.o src/ares/efi/efi/dpath.c
@$(CC) $(EFICCFLAGS) -o obj/efi/error.o src/ares/efi/efi/error.c
@$(CC) $(EFICCFLAGS) -o obj/efi/event.o src/ares/efi/efi/event.c
@$(CC) $(EFICCFLAGS) -o obj/efi/guid.o src/ares/efi/efi/guid.c
@$(CC) $(EFICCFLAGS) -o obj/efi/hand.o src/ares/efi/efi/hand.c
@$(CC) $(EFICCFLAGS) -o obj/efi/hw.o src/ares/efi/efi/hw.c
@$(CC) $(EFICCFLAGS) -o obj/efi/init.o src/ares/efi/efi/init.c
@$(CC) $(EFICCFLAGS) -o obj/efi/lock.o src/ares/efi/efi/lock.c
@$(CC) $(EFICCFLAGS) -o obj/efi/misc.o src/ares/efi/efi/misc.c
@$(CC) $(EFICCFLAGS) -o obj/efi/print.o src/ares/efi/efi/print.c
@$(CC) $(EFICCFLAGS) -o obj/efi/smbios.o src/ares/efi/efi/smbios.c
@$(CC) $(EFICCFLAGS) -o obj/efi/sread.o src/ares/efi/efi/sread.c
@$(CC) $(EFICCFLAGS) -o obj/efi/str.o src/ares/efi/efi/str.c
@$(CC) $(EFICCFLAGS) -o obj/efi/efirtlib.o src/ares/efi/efi/runtime/efirtlib.c
@$(CC) $(EFICCFLAGS) -o obj/efi/rtdata.o src/ares/efi/efi/runtime/rtdata.c
@$(CC) $(EFICCFLAGS) -o obj/efi/rtlock.o src/ares/efi/efi/runtime/rtlock.c
@$(CC) $(EFICCFLAGS) -o obj/efi/rtstr.o src/ares/efi/efi/runtime/rtstr.c
@$(CC) $(EFICCFLAGS) -o obj/efi/vm.o src/ares/efi/efi/runtime/vm.c
@$(CC) $(EFICCFLAGS) -o obj/efi/callwrap.o src/ares/efi/efi/x86_64/callwrap.c
@$(CC) $(EFICCFLAGS) -o obj/efi/initplat.o src/ares/efi/efi/x86_64/initplat.c
@$(CC) $(EFICCFLAGS) -o obj/efi/math.o src/ares/efi/efi/x86_64/math.c
@$(LD) -o output/Ares.efi $(wildcard obj/efi/*.o)
@$(EFI_OBJCOPY) -O pe-x86-64 output/ares.efi output/bootx64.efi
@$(QEMU) -L output/qemu -bios OVMF.fd -m 786 -vga cirrus -hda output/efi.img
What is this?
Wrong flags? Wrong address...?
EDIT: I should probably say I have an image, with a FAT32 32MB partition, and a ~1GB data partition as HFS+ (Didn't format that)
the EFI firmware detects the disk, but it doesn't boot from it automatically (or fails to).
When I go to 'boot from file' and select my bootx64.efi, the screen flashes black, then I get sent back to the menu screen.
Am I doing anything wrong...?
Help, thanks!
EDIT 2: For the purposes of help, here are the relevant files:
1. bootx64.efi, HERE
Thanks for your time.