29 lines
805 B
Plaintext
29 lines
805 B
Plaintext
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 "$@" |