Add a fat12-enabled boot sector

This commit is contained in:
2025-09-24 00:49:54 +02:00
parent bdb2fce4db
commit 3c90dd8b3d
4 changed files with 136 additions and 7 deletions

View File

@@ -9,17 +9,37 @@ crc16.s: crc16.c
crc16.bin: crc16.s crt0.c
ia16-elf-gcc -o crc16.bin -Os -nostdlib crc16.s crt0.c
wozmon.s: wozmon.cc
ia16-elf-gcc -S -Os -o wozmon.s wozmon.cc
CC = ia16-elf-gcc
CXX = ia16-elf-gcc
LD = ia16-elf-gcc
CXXFLAGS = -mregparmcall -ffunction-sections -Os -flto
CFLAGS = -mregparmcall -ffunction-sections -Os -flto
LDFLAGS = -mregparmcall -Wl,--gc-sections -Os -nostdlib -flto
wozmon.bin: wozmon.s crt0.c
ia16-elf-gcc -o wozmon.bin -Os -nostdlib wozmon.s crt0.c
truncate -s 510 wozmon.bin
printf "\125\252" >> wozmon.bin
%.elf:
$(LD) $(LDFLAGS) $(CPPFLAGS) -o $@ $^
bootsectors = fat12boot.bin wozmon.bin
$(bootsectors):
ia16-elf-objcopy -O binary $? $@
truncate -s 510 $@
printf "\125\252" >> $@
fat12boot.elf: fat12boot.o fat12.o bootsect.S
fat12boot.elf: LDFLAGS += -T bootsect.ld
fat12boot.bin: fat12boot.elf
wozmon.elf: wozmon.o bootsect.S
wozmon.elf: LDFLAGS += -T bootsect.ld
wozmon.elf: CPPFLAGS += -DNOBPB
wozmon.bin: wozmon.elf
.PHONY: clean
clean: ## Remove generated files
rm -rf wozmon.bin crc16.bin readfloppy.bin writefloppy.bin
rm -rf wozmon.bin crc16.bin readfloppy.bin writefloppy.bin fat12boot.bin
.PHONY: dev-image
dev-image:
@@ -42,6 +62,7 @@ binaries: ## Build all binaries
docker build --build-arg TARGET=debug.bin -o . --target=export .
docker build --build-arg TARGET=dosdbt.bin -o . --target=export .
docker build --build-arg TARGET=format.bin -o . --target=export .
docker build --build-arg TARGET=fat12boot.bin -o . --target=export .
.PHONY: help