summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-08-27 17:54:05 +0000
committerJoursoir <chat@joursoir.net>2021-08-27 17:54:05 +0000
commit50742d6dc7ff563e8283f6b3e2aab08e3970c0fa (patch)
treee8e3c44114cebc01371bc6d9e8d55fcaae6a25f7
parent3009fc4d4ea33d3d6e29d5b1877c6d21c3db3c47 (diff)
downloadmfsos-50742d6dc7ff563e8283f6b3e2aab08e3970c0fa.tar.gz
mfsos-50742d6dc7ff563e8283f6b3e2aab08e3970c0fa.tar.bz2
mfsos-50742d6dc7ff563e8283f6b3e2aab08e3970c0fa.zip
x86/boot: add makefile
-rw-r--r--arch/x86/boot/Makefile27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
new file mode 100644
index 0000000..0501ab3
--- /dev/null
+++ b/arch/x86/boot/Makefile
@@ -0,0 +1,27 @@
+# If you want run this makefile immediately, then set environment
+# variables (CC, LD, AS, OBJDUMP) to path of your cross-compiler.
+#
+# The best way to compile bootsect.bin is to run the corresponding
+# target in the main Makefile, which is in the root of the
+# project (.../path/to/os/Makefile)
+
+BOOTBIN = bootsect.bin
+
+.PHONY: all objdump clean
+
+all: $(BOOTBIN)
+
+$(BOOTBIN): bootsect.o
+ $(CC) -T linker.ld -o $(BOOTBIN) \
+ -ffreestanding -nostdlib \
+ $^ -lgcc
+
+bootsect.o: bootsect.s
+ $(AS) $< -o $@
+
+objdump:
+ $(OBJDUMP) -D -m i386 -b binary \
+ --adjust-vma=0x7c00 -Maddr16,data16 $(BOOTBIN)
+
+clean:
+ rm -rf bootsect.o $(BOOTBIN)