diff options
author | Joursoir <chat@joursoir.net> | 2022-09-27 18:59:00 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2022-10-04 02:34:12 +0300 |
commit | 14c0596d40f5b02153ce379ea6060bd82120f4f9 (patch) | |
tree | 58d633b4aa883c7e9a52cbdf6431263a77458eeb /arch/x86/boot/bootloader/Makefile | |
parent | 3955de98fa26ca847041f5fcb50268927b44a208 (diff) | |
download | mfsos-14c0596d40f5b02153ce379ea6060bd82120f4f9.tar.gz mfsos-14c0596d40f5b02153ce379ea6060bd82120f4f9.tar.bz2 mfsos-14c0596d40f5b02153ce379ea6060bd82120f4f9.zip |
move our bootloader to special directory
Diffstat (limited to 'arch/x86/boot/bootloader/Makefile')
-rw-r--r-- | arch/x86/boot/bootloader/Makefile | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/x86/boot/bootloader/Makefile b/arch/x86/boot/bootloader/Makefile new file mode 100644 index 0000000..e026e24 --- /dev/null +++ b/arch/x86/boot/bootloader/Makefile @@ -0,0 +1,39 @@ +# 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 $BOOTBIN is to run the corresponding +# target in the main Makefile, which is in the root of the +# project (.../path/to/os/Makefile) + +BOOTBIN = bootloader.bin + +.PHONY: all objdump clean + +all: $(BOOTBIN) + +$(BOOTBIN): bootsect.bin setup.bin + cat $^ > $@ + +bootsect.bin: bootsect.o + $(CC) -Wl,--oformat binary -Ttext 0x7c00 -o $@ \ + -ffreestanding -nostdlib \ + $^ -lgcc + +setup.bin: setup.o + $(CC) -Wl,--oformat binary -Ttext 0x0200 -o $@ \ + -ffreestanding -nostdlib \ + $^ -lgcc + +%.o: %.s + $(AS) $< -o $@ + +objdump-bootsect: + $(OBJDUMP) -D -m i386 -b binary \ + --adjust-vma=0x7c00 -Maddr16,data16 bootsect.bin + +objdump-setup: + $(OBJDUMP) -D -m i386 -b binary \ + --adjust-vma=0x2000 -Maddr16,data16 setup.bin + +clean: + rm -rf bootsect.o setup.o $(BOOTBIN) |