-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (18 loc) · 783 Bytes
/
Makefile
File metadata and controls
29 lines (18 loc) · 783 Bytes
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
28
29
ASSEMBLER = nasm
COLLECTION_i386 = i386-elf
OUT-CC = sector-lba2
IMAGE = os.img
all: os.img
build:
$(COLLECTION_i386)-gcc -m16 src/sector-lba2.c -o sector-lba2.o -c -static -fno-stack-protector -fno-pie -fno-pic -fomit-frame-pointer -Wall \
-ffreestanding -nostdlib -nostartfiles -O3
$(COLLECTION_i386)-ld -T link.ld sector-lba2.o -o sector-lba2.elf -static
$(COLLECTION_i386)-objcopy -O binary sector-lba2.elf sector-lba2.bin
$(ASSEMBLER) -f bin src/bootsector.s -o bootsector.bin
dd if=/dev/zero of=$(IMAGE) bs=512 count=2880
dd if=bootsector.bin of=os.img bs=512 count=1 conv=notrunc
dd if=$(OUT-CC).bin of=os.img bs=512 seek=1 conv=notrunc
run :
qemu-system-i386 -fda $(IMAGE)
clean :
rm -rf os.img bootsector.bin $(OUT-CC).bin $(OUT-CC).o $(OUT-CC).elf \