Added builder
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
# Expects variables:
|
||||
# STAGE3: path to linked stage 3 binary
|
||||
# STAGE2_SECTOR: the index of the first sector
|
||||
# of the stage 2 binary on the disk it will be written to.
|
||||
|
||||
BIOS_SRC = ./bios
|
||||
|
||||
# Wrap bootloader in three-stage BIOS loader
|
||||
$(BIOS_BUILD)/bios.bin: $(wildcard $(BIOS_SRC)/*.asm) $(BUILD)/bios.elf
|
||||
@mkdir -p "$(BIOS_BUILD)"
|
||||
nasm \
|
||||
-f bin \
|
||||
-D STAGE3="$(BUILD)/bios.elf" \
|
||||
-D STAGE2_SECTOR=$(STAGE2_SECTOR) \
|
||||
-o "$@" \
|
||||
-l "$@.lst" \
|
||||
-i "$(BIOS_SRC)" \
|
||||
"$(BIOS_SRC)/main.asm"
|
||||
|
||||
# Extract MBR (first 440 bytes)
|
||||
$(BIOS_BUILD)/bios.mbr.bin: $(BIOS_BUILD)/bios.bin
|
||||
@mkdir -p "$(BIOS_BUILD)"
|
||||
@echo ""
|
||||
dd if="$(BIOS_BUILD)/bios.bin" bs=440 count=1 of="$@"
|
||||
|
||||
# Extract stage 2 (rest of file)
|
||||
$(BIOS_BUILD)/bios.stage2.bin: $(BIOS_BUILD)/bios.bin
|
||||
@mkdir -p "$(BIOS_BUILD)"
|
||||
@echo ""
|
||||
dd if="$(BIOS_BUILD)/bios.bin" bs=512 skip=1 of="$@"
|
||||
Reference in New Issue
Block a user