--- /dev/null
+obj = test.o
+efiso = test.so
+efibin = bootx64.efi
+
+inc = -I/usr/include/efi -I/usr/include/efi/x86_64 -I/usr/include/efi/protocol
+def = -DEFI_FUNCTION_WRAPPER
+eficrt = /usr/lib/crt0-efi-x86_64.o
+ldscript = /usr/lib/elf_x86_64_efi.lds
+
+CFLAGS = -pedantic -Wall $(inc) $(def) -fno-stack-protector -fPIC -fshort-wchar \
+ -mno-red-zone
+LDFLAGS = -nostdlib -znocombreloc -T $(ldscript) -L/usr/lib $(eficrt) -lefi -lgnuefi
+
+.PHONY: all
+all: $(efibin)
+
+$(efiso): $(obj)
+ $(LD) -o $@ -shared -Bsymbolic $(obj) $(LDFLAGS)
+
+$(efibin): $(efiso)
+ objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
+ -j .rela -j .reloc --target=efi-app-x86_64 $< $@
+
+
+.PHONY: clean
+clean:
+ rm -f $(obj) $(efibin) $(efiso)
--- /dev/null
+#include <efi.h>
+#include <efilib.h>
+#include <efiprot.h>
+
+EFI_STATUS EFIAPI efi_main(EFI_HANDLE img, EFI_SYSTEM_TABLE *systab)
+{
+ InitializeLib(img, systab);
+ Print(L"hello world\n");
+
+ asm volatile("cli");
+ for(;;) {
+ asm volatile("hlt");
+ }
+
+ return EFI_SUCCESS;
+}