1
0
Fork 0
mirror of synced 2025-03-06 20:53:36 +01:00
UEFILinux/Makefile
2023-09-15 01:16:18 +02:00

23 lines
1.2 KiB
Makefile

all: link
compile: obj/linux-uefi-c.o obj/main-c.o
link: compile
ld -o bin/efitest -m elf_x86_64 obj/linux-uefi-c.o obj/main-c.o -znocombreloc -T /usr/lib/elf_x86_64_efi.lds -shared -Bsymbolic -L /usr/lib /usr/lib/crt0-efi-x86_64.o -lefi -lgnuefi -nostdlib
clean:
rm -f obj/linux-uefi-c.o obj/main-c.o bin/efitest
obj/linux-uefi-c.o: src/linux-uefi.c
gcc -DEFI_FUNCTION_WRAPPER -DLINUX_UEFI_USE_INTERNAL_INTS -mno-red-zone -fno-stack-protector -fpic -fshort-wchar -Wno-builtin-declaration-mismatch -Iinclude -Iinclude/compat -Inolibc -I/usr/include/efi -I/usr/include/efi/x86_64 -I/usr/include/efi/protocol -c src/linux-uefi.c -o obj/linux-uefi-c.o
obj/main-c.o: src/main.c
gcc -DEFI_FUNCTION_WRAPPER -DLINUX_UEFI_USE_INTERNAL_INTS -mno-red-zone -fno-stack-protector -fpic -fshort-wchar -Wno-builtin-declaration-mismatch -Iinclude -Iinclude/compat -Inolibc -I/usr/include/efi -I/usr/include/efi/x86_64 -I/usr/include/efi/protocol -c src/main.c -o obj/main-c.o
efi: bin/efitest.efi
bin/efitest.efi: all
objcopy -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc \
--target=efi-app-x86_64 bin/efitest bin/efitest.efi
test: bin/efitest.efi
qemu-system-x86_64 -bios /usr/share/ovmf/OVMF.fd -kernel bin/efitest.efi -m 128M