2018-04-16 18:13:43 +00:00
|
|
|
KERNEL = $(shell uname -s)
|
|
|
|
CC = $(CROSS)gcc
|
2018-05-07 19:52:21 +00:00
|
|
|
BITS = 64
|
|
|
|
EFI_ARCH = x86_64
|
|
|
|
#BITS = 32
|
|
|
|
#EFI_ARCH = x86
|
|
|
|
|
2018-04-16 18:13:43 +00:00
|
|
|
|
2018-05-08 14:12:31 +00:00
|
|
|
#TARGETS += fvloader.ffs
|
2018-05-07 19:52:21 +00:00
|
|
|
TARGETS += linuxboot.ffs
|
2018-08-09 11:18:32 +00:00
|
|
|
#TARGETS += hello.ffs
|
2018-04-16 18:13:43 +00:00
|
|
|
|
|
|
|
all: $(TARGETS)
|
|
|
|
|
|
|
|
clean: FORCE
|
|
|
|
$(RM) *.efi *.exe *.rom *.o .*.d $(TARGETS)
|
|
|
|
|
2018-05-08 14:12:31 +00:00
|
|
|
linuxboot.exe: linuxboot.o efifv.o
|
|
|
|
hello.exe: hello.o
|
2018-04-16 18:13:43 +00:00
|
|
|
|
|
|
|
FORCE:
|
|
|
|
|
2018-05-08 14:12:31 +00:00
|
|
|
%.exe:
|
2018-05-07 19:52:21 +00:00
|
|
|
$(CROSS)ld \
|
|
|
|
$(LDFLAGS) \
|
2018-05-07 20:03:14 +00:00
|
|
|
-T elf_x86_64_efi.lds \
|
2018-05-07 19:52:21 +00:00
|
|
|
-o $@ \
|
|
|
|
$^
|
|
|
|
|
2018-04-16 18:13:43 +00:00
|
|
|
%.efi: %.exe
|
2018-08-09 16:18:39 +00:00
|
|
|
$(CROSS)objcopy \
|
2018-05-07 20:03:14 +00:00
|
|
|
-j .text -j .sdata -j .data -j .dynamic \
|
|
|
|
-j .dynsym -j .rel -j .rela -j .reloc \
|
2018-05-07 19:52:21 +00:00
|
|
|
--subsystem efi-bsd \
|
|
|
|
--target efi-app-$(EFI_ARCH) \
|
|
|
|
$^ \
|
|
|
|
$@
|
|
|
|
# fixup the PE32 characteristic field to make DxeCore happy
|
2018-08-09 16:18:39 +00:00
|
|
|
/usr/bin/printf '\x2E\x00' | dd of=$@ conv=notrunc bs=1 seek=150 status=none
|
2018-04-16 18:13:43 +00:00
|
|
|
|
|
|
|
%.ffs: %.efi
|
2021-11-15 19:10:26 +00:00
|
|
|
../bin/create-ffs$(if $(USE_UTK),.utk,) \
|
2018-04-16 18:13:43 +00:00
|
|
|
-o $@ \
|
2018-04-24 21:44:29 +00:00
|
|
|
--type DRIVER \
|
2018-05-07 19:52:21 +00:00
|
|
|
--version 1.0 \
|
2018-04-24 21:44:29 +00:00
|
|
|
--name "$(basename $@)" \
|
|
|
|
--depex TRUE \
|
2018-04-16 18:13:43 +00:00
|
|
|
$<
|
|
|
|
|
|
|
|
CFLAGS += \
|
|
|
|
-std=c99 \
|
|
|
|
-D__efi__ \
|
2018-05-07 19:52:21 +00:00
|
|
|
-DGNU_EFI_USE_MS_ABI \
|
2018-04-16 18:13:43 +00:00
|
|
|
-fshort-wchar \
|
|
|
|
-mno-red-zone \
|
|
|
|
-fno-stack-protector \
|
|
|
|
-m$(BITS) \
|
|
|
|
-fpic \
|
|
|
|
-O3 \
|
|
|
|
-W \
|
|
|
|
-Wall \
|
|
|
|
-I . \
|
2018-08-09 11:18:32 +00:00
|
|
|
-I efi/x86_64 \
|
2018-04-16 18:13:43 +00:00
|
|
|
-MMD \
|
|
|
|
-MF .$(notdir $@).d \
|
|
|
|
|
2018-05-07 19:52:21 +00:00
|
|
|
LDFLAGS += \
|
|
|
|
-nostdlib \
|
|
|
|
-znocombreloc \
|
2018-05-07 20:03:14 +00:00
|
|
|
-shared \
|
|
|
|
-Bsymbolic \
|
2018-05-07 19:52:21 +00:00
|
|
|
|
|
|
|
NO_LFLAGS += \
|
|
|
|
-T $(EFI_LDS) \
|
|
|
|
-L $(EFILIB) \
|
|
|
|
-L $(LIB) \
|
|
|
|
$(EFI_CRT_OBJS) \
|
|
|
|
|
|
|
|
|
2018-04-16 18:13:43 +00:00
|
|
|
-include .*.d
|