-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (21 loc) · 1.16 KB
/
Makefile
File metadata and controls
29 lines (21 loc) · 1.16 KB
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
.DEFAULT_GOAL := build/rusternel.img
.PHONY: clean qemu
# lto -> link time optimization: リンク時最適化
# relocation-model=static -> いろんなアドレスをstaticにするよ
# no-prepopulate-passes:
build/rusternel_main.o : src/main.rs # src/crt.rs src/x86.rs
rustc --target=i686-unknown-linux-gnu --crate-type=staticlib --emit=obj,dep-info -C lto -C opt-level=2 -C relocation-model=static -C no-prepopulate-passes -o build/rusternel_main.o src/main.rs
build/rusternel.bin : kernel.ld build/rusternel_main.o
i686-unknown-linux-gnu-ld -nostdlib -Tdata=0x00310000 build/rusternel_main.o -T kernel.ld -o build/rusternel.bin
build/rusternel.sys : lib/secondboot.bin build/rusternel.bin
cat lib/secondboot.bin build/rusternel.bin > build/rusternel.sys
build/rusternel.img : lib/bootsector.bin build/rusternel.sys
mformat -f 1440 -C -B lib/bootsector.bin -i build/rusternel.img
mcopy -i build/rusternel.img build/rusternel.sys ::
clean:
rm -f build/*
bootloader:
nasm -f bin -o lib/bootsector.bin lib/bootsector.asm
nasm -f bin -o lib/secondboot.bin lib/secondboot.asm
qemu: build/rusternel.img
qemu-system-i386 -m 32 -localtime -vga std -fda build/rusternel.img