SCFF: the live root ships compressed, with Xorg and Window Maker
SCFF, the SchOS Compressed File Format (include/fs/scff.h), is a block image cut into 128 KB chunks, each its own zstd frame, behind an index. tools/mkscff writes it from fs-ram.img on every core (-19, 11 s) and checks each chunk decompresses to itself. The kernel carries the .scff as its ramdisk and unpacks a chunk the first time a block in it is read; zero blocks share one page. The kernel and the ISO are the compressed size, and the root costs memory only for what is touched. See docs/architecture/scff.md. zstd 1.5.7 comes from ports/zstd like uACPI: the decoder is compiled into the kernel at -O2, with a static context and a 64 KB stack of its own, and mkscff builds the whole library from the same release. world now has xorg-server, the fbdev and evdev drivers, xinit, Window Maker, xterm and DejaVu, and /root/.xinitrc runs wmaker. That root is 358 MB, 102 MB as SCFF. The ISO no longer carries the root a third time as an ISO 9660 tree, which nothing read. schos.iso: 1389 MB -> 318 MB. El Torito keeps its own copy of the EFI image, the layout real machines have booted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
1ba93dde2c
commit
df1394eaa3
18 changed files with 832 additions and 38 deletions
|
|
@ -109,6 +109,13 @@ cat > "$P/root/.xserverrc" <<'XEOF'
|
|||
exec /usr/bin/X -nolisten tcp -dumbSched "$@"
|
||||
XEOF
|
||||
|
||||
# What startx runs inside it: Window Maker, which world installs. Without this
|
||||
# xinit falls back to twm and an xterm, neither of which is in the image.
|
||||
cat > "$P/root/.xinitrc" <<'XEOF'
|
||||
#!/bin/sh
|
||||
exec wmaker
|
||||
XEOF
|
||||
|
||||
# Mount points and runtime directories are alpine-baselayout's; an empty
|
||||
# directory here only duplicates it.
|
||||
for d in dev proc sys run tmp srv; do
|
||||
|
|
|
|||
|
|
@ -3,11 +3,16 @@
|
|||
#
|
||||
# tools/posix/mkiso.sh [output.iso]
|
||||
#
|
||||
# The disc carries one El Torito boot entry and a real directory tree:
|
||||
# The disc carries one El Torito boot entry and the loader and kernel as files:
|
||||
#
|
||||
# /boot/efiboot.img a FAT image holding the loader and the kernel
|
||||
# /EFI/BOOT/BOOTX64.EFI the same loader, visible as a file on the disc
|
||||
# /bin /etc /usr ... the staged sysroot, as an ordinary hierarchy
|
||||
# /schos/kernel the same kernel, for chainloaders (below)
|
||||
#
|
||||
# The root filesystem is inside the kernel, as its ramdisk. The disc used to
|
||||
# carry it a third time as an ISO 9660 tree, which nothing reads -- SchOS has
|
||||
# no ISO 9660 driver -- and once Xorg was in the root that copy alone was
|
||||
# 360 MB.
|
||||
#
|
||||
# --- Why only one entry -----------------------------------------------------
|
||||
#
|
||||
|
|
@ -69,7 +74,6 @@ cd "$repo"
|
|||
|
||||
BUILD=${BUILD:-build}
|
||||
STAGING="$BUILD/iso"
|
||||
SYSROOT=${SYSROOT:-sysroot}
|
||||
|
||||
KERNEL="$BUILD/kernel/kernel"
|
||||
EFIAPP="$BUILD/uefi/BOOTX64.EFI"
|
||||
|
|
@ -113,9 +117,6 @@ cp "$KERNEL" "$STAGING/schos/kernel"
|
|||
# this FAT image -- not the ISO 9660 tree around it. Without the kernel in here
|
||||
# the loader comes up and halts with EFI_NOT_FOUND, which is what it did.
|
||||
#
|
||||
# The ISO 9660 tree still carries the sysroot for a running system to read; the
|
||||
# loader's own two files live in here because that is the volume it is handed.
|
||||
#
|
||||
# Sized from what actually goes in plus slack, rather than fixed: a hardcoded
|
||||
# size is a thing that breaks quietly the first time the kernel grows.
|
||||
EFI_IMG="$STAGING/boot/efiboot.img"
|
||||
|
|
@ -145,15 +146,6 @@ if true; then
|
|||
mcopy -i "$EFI_IMG" "$KERNEL" ::/schos/kernel
|
||||
fi
|
||||
|
||||
# The sysroot, as an ordinary hierarchy. Copied rather than linked so that
|
||||
# whatever ends up on the disc is a snapshot, not a view of a tree that may be
|
||||
# rebuilt underneath it.
|
||||
if [ -d "$SYSROOT" ]; then
|
||||
for d in "$SYSROOT"/*; do
|
||||
[ -e "$d" ] || continue
|
||||
cp -a "$d" "$STAGING/"
|
||||
done
|
||||
fi
|
||||
|
||||
# xorriso if it is here, mkisofs otherwise. Both accept the El Torito flags
|
||||
# below unchanged -- xorriso's -as mkisofs mode exists precisely to be
|
||||
|
|
@ -173,6 +165,11 @@ if command -v xorriso >/dev/null 2>&1; then
|
|||
# of type 0xEF is what every UEFI firmware looks for on a removable
|
||||
# disk, MBR rather than GPT because the oldest ones read that best.
|
||||
HYBRID="-append_partition 2 0xef $EFI_IMG"
|
||||
# El Torito keeps its own copy of the image in the tree, the layout real
|
||||
# machines have booted. Pointing it into the partition instead
|
||||
# (--interval:appended_partition_2:all::, as Arch does) saves a copy, and
|
||||
# an ASUS laptop stopped listing the stick the day that was tried. With
|
||||
# the root compressed (SCFF) the copy is only the kernel's size.
|
||||
elif command -v mkisofs >/dev/null 2>&1; then
|
||||
MKISOFS="mkisofs"
|
||||
HYBRID=""
|
||||
|
|
|
|||
Loading…
Reference in a new issue