aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/arch/x86/mbr/Makefile
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-12-21 22:01:56 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2025-02-20 20:40:41 +0100
commit496a4126f52649ea954ce6be2cdfeb1d7a02c372 (patch)
tree6bf24ae10b37d25a6c896643e17f6acb5bfb0db0 /src/arch/x86/mbr/Makefile
parent888faa5f4f2b89c75f2dc2610fb5253120a028ce (diff)
downloadnotes-496a4126f52649ea954ce6be2cdfeb1d7a02c372.tar.gz
notes-496a4126f52649ea954ce6be2cdfeb1d7a02c372.zip
x86: add small mbr example
Diffstat (limited to 'src/arch/x86/mbr/Makefile')
-rw-r--r--src/arch/x86/mbr/Makefile19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/arch/x86/mbr/Makefile b/src/arch/x86/mbr/Makefile
new file mode 100644
index 0000000..bcecb76
--- /dev/null
+++ b/src/arch/x86/mbr/Makefile
@@ -0,0 +1,19 @@
+mbr: mbr.ld mbr.o
+ ld -o $@.elf -nostdlib -T $^
+ objcopy -O binary $@.elf $@
+
+mbr.o: mbr.S
+ gcc -c -o $@ -m32 -ffreestanding $^
+
+clean:
+ $(RM) mbr.o mbr.elf mbr
+
+run: mbr
+ qemu-system-i386 -hda mbr $(QEMU_ARGS)
+
+debug:
+ make run QEMU_ARGS="-s -S"
+
+gdb:
+ gdb -ex 'target remote :1234' mbr.elf -ex 'layout asm' -ex 'b entry_pm32' -ex 'c'
+