1
0
Fork 0

Added mock rootfs

main
Mark 2024-12-12 07:26:17 -08:00
parent cb8fe6ed34
commit f43637b726
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
3 changed files with 16 additions and 1 deletions

View File

@ -24,4 +24,5 @@ qemu: $(BUILD_DIR)/bios.img
-cpu host \
-drive file="$<",format=raw
include make/filesystem
include make/bios

View File

@ -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" "$@"

13
make/filesystem Normal file
View File

@ -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 $@