Page 1 of 1

lockdown.efi does nothing

Posted: Sun Sep 01, 2013 4:47 pm
by gabemaiberger
I am trying to run the uefi application I compiled called "LockDown.efi". It locks down the platform with my secure boot keys and puts it into Secure Boot mode. However, when I try to run it from QEMU with the OVMF UEFI BIOS it does nothing. It compiles perfectly. Could anybody tell me if the makefiles are wrong?

Here is the makefile:

Code: Select all

CC=gcc
LD=ld

include Make.rules

all: lockdown.efi

lockdown.efi: lockdown.so

lockdown.so: lockdown.o lib/lib-efi.a

lockdown.o: lockdown.c

PK.h: PK.auth

KEK.h: KEK.auth

DB.h: DB.auth
Here is Make.rules:

Code: Select all

CFLAGS=-c -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -mno-red-zone -fno-stack-protector -g -DEFI_FUNCTION_WRAPPER
LDFLAGS=-T elf_x86_64_efi.lds -nostdlib -znocombreloc --no-undefined -shared -Bsymbolic -L lib/
EFIDIR=/usr/local/include/efi
EFIINC=-I include/ -I $(EFIDIR) -I $(EFIDIR)/x86_64 -I $(EFIDIR)/protocol
LOADLIBS=-lefi -lgnuefi

%.h: %.auth
	xxd -i $< > $@

%.efi: %.so
	objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym  -j .rel -j .rela -j .reloc --target=efi-app-x86_64 $*.so $@

%.so: %.o
	ld $(LDFLAGS) $^ -o $@ $(LOADLIBS)

%.o: %.c
	gcc $(EFIINC) $(CFLAGS) $^ -o $@

Re: lockdown.efi does nothing

Posted: Mon Sep 02, 2013 1:50 am
by sortie
Makefiles are auxiliary tools to automate the invocation of commands. It's the commands that would be wrong, not the makefiles. It'll be easier to confirm whether your are compiling it wrong if you post the exact commands you used, rather than a script that would ultimately generate these commands. For instance, run make and then post its output here as it tells you what commands it invoked by default.

Re: lockdown.efi does nothing

Posted: Mon Sep 02, 2013 1:20 pm
by gabemaiberger
Here are the commands:

Code: Select all

gcc -I include/ -I /usr/local/include/efi -I /usr/local/include/efi/x86_64 -I /usr/local/include/efi/protocol -c -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -mno-red-zone -fno-stack-protector -g -DEFI_FUNCTION_WRAPPER lockdown.c -o lockdown.o
ld -T elf_x86_64_efi.lds -nostdlib -znocombreloc --no-undefined -shared -Bsymbolic -L lib/ lockdown.o lib/lib-efi.a -o lockdown.so -lefi -lgnuefi
objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym  -j .rel -j .rela -j .reloc --target=efi-app-x86_64 lockdown.so lockdown.efi