Added makefiles
parent
1fd7b7c55f
commit
bebed12bf4
|
@ -0,0 +1,11 @@
|
||||||
|
BUILD_DIR=./build
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
|
||||||
|
all: $(BUILD_DIR)/bootloader.bin
|
||||||
|
|
||||||
|
include make/bios
|
||||||
|
include make/bootloader
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -drf $(BUILD_DIR)
|
|
@ -0,0 +1,12 @@
|
||||||
|
BIOS_SRC = ./bios
|
||||||
|
STAGE3_BIN = $(BUILD_DIR)/stage3.elf
|
||||||
|
|
||||||
|
$(BUILD_DIR)/bootloader.bin: $(wildcard $(BIOS_SRC)/*.asm) $(STAGE3_BIN)
|
||||||
|
@mkdir -p "$(BUILD_DIR)"
|
||||||
|
nasm \
|
||||||
|
-f bin \
|
||||||
|
-o "$@" \
|
||||||
|
-l "$@.lst" \
|
||||||
|
-D STAGE3="$(STAGE3_BIN)" \
|
||||||
|
-i "$(BIOS_SRC)" \
|
||||||
|
"$(BIOS_SRC)/bootloader.asm"
|
|
@ -0,0 +1,29 @@
|
||||||
|
STAGE3_SRC = ./bootloader/Cargo.toml ./bootloader/Cargo.lock $(shell find ./bootloader/src -type f)
|
||||||
|
STAGE3_LD = ./bootloader/linkers/x86-unknown-none.ld
|
||||||
|
|
||||||
|
# Compile stage 3 bootloader
|
||||||
|
$(BUILD_DIR)/stage3.lib.a: $(STAGE3_SRC)
|
||||||
|
@mkdir -p $(BUILD_DIR)
|
||||||
|
env RUSTFLAGS="-C soft-float" \
|
||||||
|
cargo rustc \
|
||||||
|
--manifest-path="./bootloader/Cargo.toml" \
|
||||||
|
-Z build-std=core,alloc \
|
||||||
|
-Z build-std-features=compiler-builtins-mem \
|
||||||
|
--target "./bootloader/targets/x86-unknown-none.json" \
|
||||||
|
--lib \
|
||||||
|
--release \
|
||||||
|
-- \
|
||||||
|
--emit link="$(CURDIR)/$@"
|
||||||
|
|
||||||
|
# Link stage 3 bootloader
|
||||||
|
$(BUILD_DIR)/stage3.elf: $(BUILD_DIR)/stage3.lib.a $(STAGE3_LD)
|
||||||
|
ld \
|
||||||
|
-m elf_i386 \
|
||||||
|
--gc-sections \
|
||||||
|
-z max-page-size=0x1000 \
|
||||||
|
-T "$(STAGE3_LD)" \
|
||||||
|
-o "$@" \
|
||||||
|
"$<"
|
||||||
|
|
||||||
|
objcopy --only-keep-debug "$@" "$@.sym"
|
||||||
|
objcopy --strip-debug "$@"
|
Loading…
Reference in New Issue