summaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/Makefile
blob: 0501ab35b2c3cd7ce9100e90832c5433e0ea5864 (plain)
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
# 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)