TARGETS = dusk
BOOTFS_SRC = fs/xcomp/bootlo.fs posix/glue.fs fs/xcomp/boothi.fs
ALLSRCS = $(shell find fs)
all: $(TARGETS)
fs/init.fs: posix/init.fs fs/xcomp/init.fs
cat posix/init.fs fs/xcomp/init.fs > $@
posix/boot.fs: $(BOOTFS_SRC)
cat $(BOOTFS_SRC) > $@
dusk: posix/vm.c posix/boot.fs fs/init.fs
$(CC) posix/vm.c -Wall -o $@
mbr.bin: dusk buildmbr.fs $(ALLSRCS)
./dusk < buildmbr.fs 2> $@
pc.bin: dusk buildpc.fs $(ALLSRCS)
./dusk < buildpc.fs 2> $@
pc.img: mbr.bin pc.bin
dd if=/dev/zero of=$@ bs=1M count=1
# We need to reserve (-R) enough sectors for MBR + pc.bin
mformat -M 512 -d 1 -R 56 -i $@ ::
dd if=mbr.bin of=$@ bs=1 seek=62 conv=notrunc
dd if=pc.bin of=$@ bs=1 seek=512 conv=notrunc
mcopy -sQ -i $@ fs/* ::
.PHONY: pcrun
pcrun: pc.img
cat fs/xcomp/pc/init.fs fs/xcomp/init.fs | mcopy -D overwrite -i pc.img - ::init.fs
qemu-system-i386 -drive file=pc.img,format=raw
.PHONY: testpc
testpc: pc.img
cat fs/xcomp/pc/init.fs fs/xcomp/pc/inittest.fs | mcopy -D overwrite -i pc.img - ::init.fs
qemu-system-i386 -nographic -drive file=pc.img,format=raw | tee /dev/stderr | grep "All tests passed"
.PHONY: run
run: dusk
stty -icanon -echo; ./dusk ; stty icanon echo
.PHONY: test
test: dusk
echo "' byefail to abort f<< tests/all.fs bye" | ./dusk || (echo; exit 1)
.PHONY: clean
clean:
rm -f $(TARGETS) dusk.o fs/init.fs posix/boot.fs memdump *.bin *.img