-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
60 lines (44 loc) · 1.57 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
CSRC=${wildcard src/*.c src/*/*.c}
ASRC= ${wildcard src/*.s}
SOURCES := $(ASRC) $(CSRC)
BUILDDIR=build/
OUTDIR=out
OBJS:= $(patsubst %.c,$(BUILDDIR)%.o,${notdir ${CSRC}}) $(patsubst %.s,$(BUILDDIR)%.o,${notdir ${ASRC}})
LIMINE_ROOT = limine_iso
LIMINE_INSTALL_DIR = /usr/local/share/limine
MEMORY=3G
LIBS=
all: sc
sc:
@scons
limine: ramdisc LIMINE_SETUP
@cp ${OUTDIR}/kernel.bin ${LIMINE_ROOT}/boot
@xorriso -as mkisofs -b limine-bios-cd.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
${LIMINE_ROOT} -o ${OUTDIR}/boot.iso 1> /dev/null 2>&1
${LIMINE_ROOT}:
@mkdir -p "${LIMINE_ROOT}"/EFI/BOOT
@mkdir -p "${LIMINE_ROOT}"/boot
LIMINE_SETUP: ${LIMINE_ROOT}
@cp "${LIMINE_INSTALL_DIR}"/limine-uefi-cd.bin "${LIMINE_ROOT}"
@cp "${LIMINE_INSTALL_DIR}"/limine-bios-cd.bin "${LIMINE_ROOT}"
@cp "${LIMINE_INSTALL_DIR}"/limine-bios.sys "${LIMINE_ROOT}"
@cp "${LIMINE_INSTALL_DIR}"/BOOTX64.EFI "${LIMINE_ROOT}"/EFI/BOOT
@cp limine.cfg "${LIMINE_ROOT}"
.PHONY: qemu
qemu: limine
qemu-system-x86_64 -bios OVMF.fd -m $(MEMORY) -cdrom ${OUTDIR}/boot.iso -no-reboot -no-shutdown -D qemu_log.txt
.PHONY: qemu_gdb
qemu_gdb: limine
qemu-system-x86_64 -cdrom out/boot.iso -bios OVMF.fd -m $(MEMORY) -s -S -d int -D qemu_log.txt -M smm=off &
gdb -x debug.gdb
.PHONY: clean
clean :
scons -c
rm -r build/
rm -r out/
rm -r limine_iso
ramdisc: LIMINE_SETUP
@cd initrd && tar -cvf ../${LIMINE_ROOT}/boot/initrd.tar --format=ustar * 1> /dev/null 2>&1 && cd ../