summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-09-28 20:12:00 +0300
committerJoursoir <chat@joursoir.net>2022-10-04 03:04:30 +0300
commitf4deaf87d42fdfd696daa87c4bae7b2727dabbad (patch)
treedc6fca525bef1331fad2afa3dbf8b45f09a8c283
parent36501d7d38ca32031c8401fed67c4cb684a9f495 (diff)
downloadmfsos-f4deaf87d42fdfd696daa87c4bae7b2727dabbad.tar.gz
mfsos-f4deaf87d42fdfd696daa87c4bae7b2727dabbad.tar.bz2
mfsos-f4deaf87d42fdfd696daa87c4bae7b2727dabbad.zip
makefile: add a choice of booting mechanism
-rw-r--r--Makefile11
1 files changed, 9 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index caf5939..570e4a8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,17 @@
OSNAME = mfsos
OSBIN = $(OSNAME).bin
KERNBIN = kernel.bin
+# Available options: `bootloader`, `multiboot`
+BOOT ?= bootloader
ARCH = x86
-ARCH_BOOT = arch/$(ARCH)/boot/bootloader
+ARCH_BOOT = arch/$(ARCH)/boot/$(BOOT)
+
BOOTBIN = $(ARCH_BOOT)/bootloader.bin
+OS_BINARIES = $(KERNBIN)
+ifeq ($(BOOT), bootloader)
+ OS_BINARIES := $(BOOTBIN) $(OS_BINARIES)
+endif
TARGET = i686-elf
TARGET_TOOLS = $(PWD)/tools/toolchain/bin/$(TARGET)-
@@ -26,7 +33,7 @@ export CC LD AS OBJDUMP
all: $(OSBIN)
-$(OSBIN): $(BOOTBIN) $(KERNBIN)
+$(OSBIN): $(OS_BINARIES)
cat $^ > $@
dd if=/dev/zero bs=512 count=128 >> $@ # 65536