i still dont know what im doing
This commit is contained in:
parent
4847eb4d88
commit
bc238a3bf9
19 changed files with 203 additions and 1099 deletions
86
Makefile
86
Makefile
|
@ -1,17 +1,81 @@
|
|||
.PHONY: default
|
||||
FLOPPY = 360
|
||||
|
||||
cp437.bin: src/cp437.bmp scripts/bmp2font
|
||||
scripts/bmp2font $< $@
|
||||
PROGRAMS = $(patsubst %.asm,%.com,$(wildcard com/*.asm))
|
||||
DISTFILES = $(PROGRAMS)
|
||||
ROMS =
|
||||
|
||||
vga11.bin: src/vga11.asm cp437.bin
|
||||
nasm -o $@ $<
|
||||
QEMU_ARCH = $(shell uname -m)
|
||||
QEMU = qemu-system-$(QEMU_ARCH)
|
||||
QEMU_ARGS = $(addprefix --option-rom ,$(ROMS))
|
||||
|
||||
forth.bin: src/forth.asm
|
||||
nasm -o $@ $<
|
||||
NASM = nasm
|
||||
NASM_ARGS = -s -Ilib -Plib/nasmcomp.asm -w-macro-params
|
||||
|
||||
scripts/%: src/scripts/%.c
|
||||
mkdir -p scripts
|
||||
gcc -o $@ $<
|
||||
EMUL = utils/emul
|
||||
|
||||
ifdef KVM
|
||||
QEMU_ARGS += --enable-kvm
|
||||
endif
|
||||
|
||||
ifdef DEBUG
|
||||
ROMS += rom/debug.rom
|
||||
NASM_ARGS += -l $(basename $@).lst
|
||||
endif
|
||||
|
||||
ifndef DISPLAY
|
||||
QEMU_ARGS += --display curses
|
||||
endif
|
||||
|
||||
.PHONY: default bootstrap clean qemu-rom qemu-floppy qemu-pxe
|
||||
|
||||
default: fdimage.img
|
||||
|
||||
# Host utils
|
||||
utils/%: src/utils/%.c
|
||||
mkdir -p utils
|
||||
$(CC) -o $@ $<
|
||||
|
||||
cp437.bin: src/cp437.bmp utils/bmp2font
|
||||
utils/bmp2font $< $@
|
||||
|
||||
# BIOS option roms
|
||||
rom/%.rom: rom/%.asm utils/fix-rom
|
||||
$(NASM) $(NASM_ARGS) -o $@ $< && utils/fix-rom $@
|
||||
|
||||
# COM programs
|
||||
%.com: %.asm
|
||||
$(NASM) $(NASM_ARGS) -DCOM -DBASE=0x0100 -o $@ $<
|
||||
|
||||
# Bootloaders, first sector on partition
|
||||
%.bs: %.asm
|
||||
$(NASM) $(NASM_ARGS) -DBOOT -DBASE=0x7C00 -o $@ $<
|
||||
: check boot signature
|
||||
test "$$(echo $$(xxd -p -l 2 -s 510 pxe.bs))" == 55aa
|
||||
|
||||
# Network bootstrap protocol as used for PXE
|
||||
%.0: %.asm
|
||||
$(NASM) $(NASM_ARGS) -DNBP -DBASE=0x7C00 -o $@ $<
|
||||
|
||||
fdimage.img: boot/fat.bs $(BDOSIMG) $(BIOSIMG) $(DISTFILES)
|
||||
mformat -R 9 -C -i $@ -f $(FLOPPY) -B boot/fat.bs ::
|
||||
dd if=$(BDOSIMG) bs=512 seek=1 count=4 conv=notrunc of=$@
|
||||
dd if=$(BIOSIMG) bs=512 seek=5 count=4 conv=notrunc of=$@
|
||||
mcopy -i $@ $(DISTFILES) ::
|
||||
|
||||
hdimage.img: boot/mbr.bs fdimage.img
|
||||
cat boot/mbr.bs fdimage.img >$@
|
||||
|
||||
clean:
|
||||
rm -f *.bin scripts/*
|
||||
rm -f *.com *.bs *.0 *.lst *.img *.bin *.rom
|
||||
|
||||
qemu-floppy: fdimage.img $(ROMS)
|
||||
$(QEMU) $(QEMU_ARGS) -boot a -fda fdimage.img
|
||||
|
||||
qemu-hdd: hdimage.img $(ROMS)
|
||||
$(QEMU) $(QEMU_ARGS) -boot c -hda hdimage.img
|
||||
|
||||
qemu-pxe: pxe.bs $(ROMS)
|
||||
$(QEMU) $(QEMU_ARGS) -boot n \
|
||||
-option-rom /usr/share/qemu/pxe-rtl8139.rom \
|
||||
-device e1000,netdev=mynet0,mac=52:54:00:12:34:56 \
|
||||
-netdev user,id=mynet0,net=192.168.76.0/24,dhcpstart=192.168.76.9,tftp=$(CURDIR),bootfile=pxe.bs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue