-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
39 lines (32 loc) · 958 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FS_DIR = ../fs
CC = x86_64-w64-mingw32-gcc
OBJCOPY = x86_64-w64-mingw32-objcopy
CFLAGS = -Wall -Wextra
CFLAGS += -nostdinc -nostdlib -fno-builtin -fno-common
CFLAGS += -Wl,--subsystem,10
OBJS = poiboot.o config.o
ifdef NO_GRAPHIC
QEMU_ADDITIONAL_ARGS += --nographic
endif
ifdef SMP
QEMU_ADDITIONAL_ARGS += -smp ${SMP}
endif
poiboot.efi: $(OBJS) libuefi/libuefi.a
$(CC) $(CFLAGS) -e efi_main -o $@ $+
%.o: %.c
$(CC) $(CFLAGS) -Iinclude -c -o $@ $<
libuefi/libuefi.a:
make -C libuefi CC=$(CC) CFLAGS="$(CFLAGS)"
deploy: poiboot.efi
mkdir -p $(FS_DIR)/EFI/BOOT
cp $< $(FS_DIR)/EFI/BOOT/BOOTX64.EFI
run: deploy
qemu-system-x86_64 -m 4G -enable-kvm \
-drive if=pflash,format=raw,readonly,file=$(HOME)/OVMF/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=$(HOME)/OVMF/OVMF_VARS.fd \
-drive dir=$(FS_DIR),driver=vvfat,rw=on \
$(QEMU_ADDITIONAL_ARGS)
clean:
rm -f *~ include/*~ *.o *.efi
make -C libuefi clean
.PHONY: deploy run clean