From 4c87a1868835d05f1cadae7b8ad6a7c95d9d9c0e Mon Sep 17 00:00:00 2001 From: Ross Philipson Date: Tue, 14 Mar 2017 15:40:33 -0400 Subject: Initial commit of EFI TBOOT work from internal project. Signed-off-by: Ross Philipson --- tboot/Makefile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tboot/Makefile (limited to 'tboot/Makefile') diff --git a/tboot/Makefile b/tboot/Makefile new file mode 100644 index 0000000..fdae048 --- /dev/null +++ b/tboot/Makefile @@ -0,0 +1,49 @@ +# Build with GCC compiler, note .rodata section in .lds file +#CC = gcc +# Build with MinGW compiler, note .rdata section in .lds file +CC = x86_64-w64-mingw32-gcc +LD = x86_64-w64-mingw32-ld +CFLAGS = -ffreestanding -fPIE -fno-exceptions -fshort-wchar -mno-ms-bitfields -DTPM_TRACE +CFLAGS += -I/usr/include/efi -I/usr/include/efi/x86_64 -I/usr/include/efi/protocol -Iinclude +AFLAGS = -D__ASSEMBLY__ $(patsubst -std=gnu%,,$(CFLAGS)) +#LDFLAGS = -nostdlib -Wl,-pie -shared -Wl,--no-seh -Wl,--subsystem,10 -e efi_main +LDFLAGS = -nostdlib -pie -shared --no-seh --subsystem=10 -e efi_main +ASM = launch.S bits.S # must be in order +SRC = $(wildcard *.c) +OBJ = $(ASM:.S=.o) # must be first +OBJ += $(SRC:.c=.o) + +# Banner +CFLAGS += -DTBOOT_CHANGESET=\""$(shell ((hg parents --template "{isodate|isodate} {rev}:{node|short}" >/dev/null && hg parents --template "{isodate|isodate} {rev}:{node|short}") || echo "2016-05-18 12:00 -0800 1.9.4") 2>/dev/null)"\" + + +.PHONY: all +all: tboot.lds tboot.efi tboot.dsm + +tboot.efi: $(OBJ) + $(LD) tboot.lds $(LDFLAGS) $^ -o $@ + +# With lds +#tboot.efi: $(OBJ) +# $(CC) -T lds/tboot2.lds $(LDFLAGS) $^ -o $@ +# $(CC) -Wl,lds/tboot2.lds $(LDFLAGS) $^ -o $@ + +# Grrr someone is frobbing the stack +tpm_20.o: tpm_20.c + $(CC) $(CFLAGS) -mno-stack-arg-probe -o $@ -c $< + +%.o: %.c + $(CC) $(CFLAGS) -o $@ -c $< + +%.o: %.S + $(CC) $(AFLAGS) -c $< -o $@ + +tboot.lds: + $(PWD)/genlds.sh $(CC) + +tboot.dsm: + mingw-objdump -d tboot.efi > tboot.dsm + +.PHONY: clean +clean: + rm -f tboot.efi *.o tboot.dsm tboot.lds -- cgit v1.2.3