lockdown.efi does nothing

Programming, for all ages and all languages.
Post Reply
gabemaiberger
Member
Member
Posts: 40
Joined: Tue Nov 13, 2012 2:54 pm

lockdown.efi does nothing

Post 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 $@

Code: Select all

var myCat="marshmallow"
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: lockdown.efi does nothing

Post 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.
gabemaiberger
Member
Member
Posts: 40
Joined: Tue Nov 13, 2012 2:54 pm

Re: lockdown.efi does nothing

Post 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

Code: Select all

var myCat="marshmallow"
Post Reply