-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (28 loc) · 1.16 KB
/
Makefile
File metadata and controls
37 lines (28 loc) · 1.16 KB
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
OSNAME = CustomOS
GNUEFI = ../gnu-efi
OVMFDIR = ../OVMFbin
LDS =
CC = x86_64-w64-mingw32-gcc
CFLAGS = -ffreestanding -fshort-wchar
LDFLAGS = -T $(LDS) -shared -Bsymbolic -nostdlib
SRCDIR := src
OBJDIR := lib
BUILDDIR = bin
BOOTEFI := $(GNUEFI)/x86_64/bootloader/main.efi
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
SRC = $(call rwildcard,$(SRCDIR),*.c)
OBJS = $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(SRC))
DIRS = $(wildcard $(SRCDIR)/*)
setup:
@mkdir $(BUILDDIR)
@mkdir $(SRCDIR)
@mkdir $(OBJDIR)
buildimg:
dd if=/dev/zero of=$(BUILDDIR)/$(OSNAME).img bs=512 count=93750
mformat -i $(BUILDDIR)/$(OSNAME).img -f 1440 ::
mmd -i $(BUILDDIR)/$(OSNAME).img ::/EFI
mmd -i $(BUILDDIR)/$(OSNAME).img ::/EFI/BOOT
mcopy -i $(BUILDDIR)/$(OSNAME).img $(BOOTEFI) ::/EFI/BOOT
mcopy -i $(BUILDDIR)/$(OSNAME).img startup.nsh ::
run:
qemu-system-x86_64 -drive file=$(BUILDDIR)/$(OSNAME).img -m 256M -cpu qemu64 -drive if=pflash,format=raw,unit=0,file="$(OVMFDIR)/OVMF_CODE-pure-efi.fd",readonly=on -drive if=pflash,format=raw,unit=1,file="$(OVMFDIR)/OVMF_VARS-pure-efi.fd" -net none