Capsule blocks step 1: the RAM block count is a build knob, BLK_RAM_USER_BLOCKS

Captain Bob ruled that the offset is the RAM block count, not a literal
2048.
- v3/include/blk_layout.h defines it, 2048 by default. block_subsystem.h
  derives BLK_RAM_BLOCKS (2080) and BLK_DISK_START from it.
- Kconfig.kernel has the symbol. kernel/Makefile passes it to the
  kernel's C code and builds mkcapsule and mkartemis with it.
- mkcapsule's two literal 2048s are now the knob.

The default value is unchanged, so the layout and the media are as before.

Test first: scripts/test_capsule_ram_blocks.sh, 8 checks.
- The before-run failed 4: the knob did not exist and mkcapsule ignored
  it. Its three Makefile checks also hit a SIGPIPE flaw in the test,
  fixed before the after-run.
- After: all 8 pass.

The amd64 build and mkartemis build clean. All 40 capsules lint. The
mesh boot passes 109 checks with POST 990/990. test_host_blocks,
test_host_quit, test_host_unit and test-32 pass.

Logs are in logs/20261118-ram-blocks-knob.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-18 17:35:15 +00:00
parent cda8aad8b2
commit 6f9900f805
14 changed files with 764 additions and 13 deletions
+10 -3
View File
@@ -67,6 +67,13 @@ $(eval $(call kconfig_bool,STARFORTH_ENABLE_VM,1))
# system=v3 (V4_DEFAULT below). STARFORTH_V4=0 builds v3 alone.
$(eval $(call kconfig_bool,STARFORTH_V4,1))
# The VM's user RAM block count, the knob the block layout is derived from (v3/include/blk_layout.h;
# docs/v4.0.0/plans/2026-11-18-capsule-blocks.md, ruling 3). The kernel gets it through
# VM_FEATURE_FLAG_VARS; mkcapsule and mkartemis are built with the same value.
$(eval $(call kconfig_int,BLK_RAM_USER_BLOCKS,2048))
MKCAPSULE_DEFS := -DBLK_RAM_USER_BLOCKS=$(BLK_RAM_USER_BLOCKS)
MKARTEMIS_DEFS := -DBLK_RAM_USER_BLOCKS=$(BLK_RAM_USER_BLOCKS)
# Monolithic build — loader + kernel compiled together (default: enabled)
MONOLITHIC ?= 1
@@ -525,7 +532,7 @@ $(eval $(call kconfig_bool,SK_PARITY_DEBUG,0))
endif
VM_FEATURE_FLAG_VARS := \
STRICT_PTR ENABLE_HOTWORDS_CACHE ENABLE_PIPELINING OPCODE_PHYSICS \
STRICT_PTR ENABLE_HOTWORDS_CACHE ENABLE_PIPELINING OPCODE_PHYSICS BLK_RAM_USER_BLOCKS \
ROLLING_WINDOW_SIZE TRANSITION_WINDOW_SIZE \
ADAPTIVE_SHRINK_RATE ADAPTIVE_MIN_WINDOW_SIZE \
ADAPTIVE_CHECK_FREQUENCY ADAPTIVE_GROWTH_THRESHOLD \
@@ -824,12 +831,12 @@ v3/include/version.h: FORCE
$(MKCAPSULE_BIN): $(MKCAPSULE_SRC)
@mkdir -p $(dir $@)
@echo "HOSTCC $(MKCAPSULE_SRC)"
@cc -std=c99 -Wall -Wextra -O2 -Iv3/include -Ikernel/include -Itools -o $@ $(MKCAPSULE_SRC)
@cc -std=c99 -Wall -Wextra -O2 $(MKCAPSULE_DEFS) -Iv3/include -Ikernel/include -Itools -o $@ $(MKCAPSULE_SRC)
$(MKARTEMIS_BIN): $(MKARTEMIS_SRC) $(wildcard v3/include/*.h) kernel/include/starkernel/artemis_sig.h
@mkdir -p $(dir $@)
@echo "HOSTCC tools/mkartemis.c"
@cc -std=gnu99 -Wall -O2 -Iv3/include -Ikernel/include -o $@ $(MKARTEMIS_SRC)
@cc -std=gnu99 -Wall -O2 $(MKARTEMIS_DEFS) -Iv3/include -Ikernel/include -o $@ $(MKARTEMIS_SRC)
# datastick -- the data stick, fresh every time it is made (STICK.md 9: "fresh for each boot").
.PHONY: datastick