feat(storage): ext4-only disk via mkfs.ext4 -d; drop FAT16; feature-gated mount (ro on unknown ro_compat); ext4 read spans blocks, delete clears inode, mkdir counts dir; virtio-blk writes; test-qemu e2fsck gate
This commit is contained in:
@@ -1,45 +1,43 @@
|
||||
#!/bin/bash
|
||||
# Builds the k-os disk: one ext4 filesystem holding every program init may
|
||||
# start. Init and storage themselves are packed into the kernel image.
|
||||
set -euo pipefail
|
||||
|
||||
IMG="${IMG:-boot.img}"
|
||||
IMG_SIZE_KB=4096
|
||||
SIZE="${SIZE:-16M}"
|
||||
TARGET="riscv64gc-unknown-none-elf"
|
||||
BUILD_DIR="target/${TARGET}/release"
|
||||
# What the storage server's ext4 driver does not maintain, switched off so it
|
||||
# can write to the disk (see storage-server's tests/ext4_real.rs).
|
||||
FEATURES="^has_journal,^metadata_csum,^64bit,^dir_index,^huge_file,^orphan_file,^metadata_csum_seed"
|
||||
|
||||
echo "=== Creating k-os boot disk image ==="
|
||||
ROOT="$(mktemp -d)"
|
||||
trap 'rm -rf "${ROOT}"' EXIT
|
||||
|
||||
dd if=/dev/zero of="${IMG}" bs=1K count=${IMG_SIZE_KB} 2>/dev/null
|
||||
mformat -i "${IMG}" -t 8 -h 2 -s 32 -r 16 -c 1 -M 512 ::
|
||||
echo "Created and formatted ${IMG} (${IMG_SIZE_KB}KB, FAT16)"
|
||||
|
||||
# Copy with 8.3 names (no long filenames, no tilde mangling)
|
||||
copy() {
|
||||
local src="$1" dst="$2"
|
||||
if [ -f "${BUILD_DIR}/${src}" ]; then
|
||||
mcopy -i "${IMG}" "${BUILD_DIR}/${src}" "::${dst}"
|
||||
echo " ${dst}"
|
||||
cp "${BUILD_DIR}/${src}" "${ROOT}/${dst}"
|
||||
fi
|
||||
}
|
||||
|
||||
copy init "init.elf"
|
||||
copy echo "echo.elf"
|
||||
copy snake "snake.elf"
|
||||
copy display-qemu "display.elf"
|
||||
copy input-qemu "input.elf"
|
||||
copy log-server "log.elf"
|
||||
copy echo "echo.elf"
|
||||
copy snake "snake.elf"
|
||||
copy display-qemu "display.elf"
|
||||
copy input-qemu "input.elf"
|
||||
copy log-server "log.elf"
|
||||
copy permission-manager "permis.elf"
|
||||
copy storage-qemu "storage.elf"
|
||||
copy session-server "session.elf"
|
||||
copy terminal-server "terminal.elf"
|
||||
copy shell "shell.elf"
|
||||
# Only the test image: its presence makes init run the SMP self-test.
|
||||
copy session-server "session.elf"
|
||||
copy terminal-server "terminal.elf"
|
||||
copy shell "shell.elf"
|
||||
# Only the test image: its presence makes init run the self-test.
|
||||
if [ -n "${SMPTEST:-}" ]; then
|
||||
copy smptest "smptest.elf"
|
||||
copy spawntest "spawntst.elf"
|
||||
copy hello "hello.elf"
|
||||
copy smptest "smptest.elf"
|
||||
copy spawntest "spawntst.elf"
|
||||
copy hello "hello.elf"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Disk contents:"
|
||||
mdir -i "${IMG}" ::
|
||||
echo "=== Done: ${IMG} ==="
|
||||
rm -f "${IMG}"
|
||||
mkfs.ext4 -q -F -b 4096 -L k-os -O "${FEATURES}" -d "${ROOT}" "${IMG}" "${SIZE}"
|
||||
echo "=== ${IMG}: ext4, ${SIZE} ==="
|
||||
ls -1 "${ROOT}"
|
||||
|
||||
Reference in New Issue
Block a user