From f43637b7261f08d7d38d9269fd698e70b176e1b9 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 12 Dec 2024 07:26:17 -0800 Subject: [PATCH] Added mock rootfs --- Makefile | 1 + make/bios | 3 ++- make/filesystem | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 make/filesystem diff --git a/Makefile b/Makefile index 113ef89..893a7e5 100644 --- a/Makefile +++ b/Makefile @@ -24,4 +24,5 @@ qemu: $(BUILD_DIR)/bios.img -cpu host \ -drive file="$<",format=raw +include make/filesystem include make/bios \ No newline at end of file diff --git a/make/bios b/make/bios index a9dc9f8..9bbd3f3 100644 --- a/make/bios +++ b/make/bios @@ -46,11 +46,12 @@ $(BUILD_DIR)/bios.bin: $(wildcard $(BIOS_SRC)/*.asm) $(BUILD_DIR)/bios.elf "$(BIOS_SRC)/main.asm" # Build demo disk image -$(BUILD_DIR)/bios.img: $(BUILD_DIR)/bios.bin +$(BUILD_DIR)/bios.img: $(BUILD_DIR)/bios.bin $(BUILD_DIR)/filesystem.img rm -f "$@.partial" fallocate -l 256MiB "$@.partial" parted -s -a minimal "$@.partial" mklabel msdos parted -s -a minimal "$@.partial" mkpart primary 2MiB 100% dd if="$<" of="$@.partial" bs=1 count=512 conv=notrunc dd if="$<" of="$@.partial" bs=512 skip=1 seek=1 conv=notrunc + dd if="$(BUILD_DIR)/filesystem.img" of="$@.partial" bs=1MiB seek=2 conv=notrunc mv "$@.partial" "$@" \ No newline at end of file diff --git a/make/filesystem b/make/filesystem new file mode 100644 index 0000000..176905c --- /dev/null +++ b/make/filesystem @@ -0,0 +1,13 @@ +$(BUILD_DIR)/filesystem: + @mkdir -p $(BUILD_DIR) + rm -f $@.partial + mkdir $@.partial + fallocate -l 1MiB $@.partial/kernel + mv $@.partial $@ + +$(BUILD_DIR)/filesystem.img: $(BUILD_DIR)/filesystem + @mkdir -p $(BUILD_DIR) + rm -f $@.partial + fallocate -l 254MiB $@.partial + redoxfs-ar $@.partial $< + mv $@.partial $@ \ No newline at end of file