feat(v4.0.0): the system boots from a nucleus and loads its capsules
One boot, v4/system/boot.c, for both products: it starts the nucleus image, finds each capsule in the baked capsule directory, recomputes its hash, checks its signature, gives its blocks to the node a line at a time, and prints PARITY:V4_NUCLEUS, PARITY:V4_CAPSULE and PARITY:OK before the prompt. A line the node does not accept ends the boot with the capsule, block and line named. docs/v4.0.0/NUCLEUS.md. - hosted Linux product for amd64, aarch64 and riscv64 (make -C v4 hosted); make -C v4 hosted-check boots all three and requires identical output - the kernel's v4 entry (STARFORTH_V4=1) calls the same boot - capsules/v4/forth79.4th, block 6000: no definitions yet - mkimage builds the nucleus only; no FORTH source is compiled at build time - capsule_blocks.c: the Block-header parse, free of any VM, for every loader Verified: make -C v4 test passes; hosted-check passes on the three ISAs with the same hashes; the kernel compiles with STARFORTH_V4=1 on the three. Not verified: no bare-metal boot of v4 has been run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
903321e548
commit
294e69463a
@@ -60,6 +60,9 @@ $(eval $(call kconfig_bool,PARITY_MODE,0))
|
||||
# StarForth VM integration (default: enabled)
|
||||
$(eval $(call kconfig_bool,STARFORTH_ENABLE_VM,1))
|
||||
|
||||
# StarForth v4 at a single prompt in place of the v3 VM (default: off)
|
||||
$(eval $(call kconfig_bool,STARFORTH_V4,0))
|
||||
|
||||
# Monolithic build — loader + kernel compiled together (default: enabled)
|
||||
MONOLITHIC ?= 1
|
||||
|
||||
@@ -597,6 +600,30 @@ LOADER_VM_OBJS := $(patsubst v3/src/%.c,$(LOADER_OBJ_DIR)/vmcore/%.o,$(VM_CORE_S
|
||||
KERNEL_VM_OBJS := $(patsubst v3/src/%.c,$(KERNEL_OBJ_DIR)/vmcore/%.o,$(VM_CORE_SRCS))
|
||||
endif
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# StarForth v4 (STARFORTH_V4=1): the golden model of the F18-derived engine,
|
||||
# v4/src, and the nucleus image v4's own Makefile builds on this machine from
|
||||
# v4/capsule (docs/v4.0.0/NUCLEUS.md). The node is the host node's size, with 64-bit cells, as every
|
||||
# ISA this kernel boots on has (DECOMPOSITION.md D-5), so the image is the
|
||||
# same file for all three.
|
||||
# ------------------------------------------------------------------------------
|
||||
ifeq ($(STARFORTH_V4),1)
|
||||
V4_DEFS := -DSTARFORTH_V4=1 -Iv4/include \
|
||||
-DV4_CELL_BITS=64 -DV4_NODE_WORDS=16384 -DV4_DATA_RING=30 -DV4_RET_RING=31
|
||||
KERNEL_CFLAGS += $(V4_DEFS)
|
||||
LOADER_CFLAGS += $(V4_DEFS)
|
||||
|
||||
V4_ENGINE_SRCS := $(addprefix v4/src/,node.c exec.c stack.c iword.c heat.c guard.c image.c)
|
||||
V4_IMAGE_C := $(BUILD_DIR)/v4_image_64.c
|
||||
|
||||
LOADER_EXTRA_SRCS += $(KERNEL_SRC)/v4/sk_v4.c
|
||||
KERNEL_EXTRA_SRCS += $(KERNEL_SRC)/v4/sk_v4.c
|
||||
# v4/system/boot.c is the boot the hosted v4 system runs too: nucleus, then
|
||||
# the capsules from this kernel's own capsule directory, then the prompt.
|
||||
LOADER_V4_OBJS := $(patsubst v4/src/%.c,$(LOADER_OBJ_DIR)/v4engine/%.o,$(V4_ENGINE_SRCS)) $(LOADER_OBJ_DIR)/v4engine/v4_image.o $(LOADER_OBJ_DIR)/v4system/boot.o
|
||||
KERNEL_V4_OBJS := $(patsubst v4/src/%.c,$(KERNEL_OBJ_DIR)/v4engine/%.o,$(V4_ENGINE_SRCS)) $(KERNEL_OBJ_DIR)/v4engine/v4_image.o $(KERNEL_OBJ_DIR)/v4system/boot.o
|
||||
endif
|
||||
|
||||
LOADER_SRCS := $(LOADER_SRCS_BASE) $(LOADER_EXTRA_SRCS)
|
||||
KERNEL_SRCS := $(KERNEL_SRCS_BASE) $(KERNEL_EXTRA_SRCS)
|
||||
|
||||
@@ -605,12 +632,14 @@ LOADER_OBJS := \
|
||||
$(patsubst $(KERNEL_SRC)/%.c,$(LOADER_OBJ_DIR)/%.o,$(LOADER_ARCH_SRCS)) \
|
||||
$(patsubst $(KERNEL_SRC)/%.S,$(LOADER_OBJ_DIR)/%.o,$(LOADER_ASM)) \
|
||||
$(LOADER_VM_OBJS) \
|
||||
$(LOADER_V4_OBJS) \
|
||||
$(CAPSULE_GENERATED_OBJ)
|
||||
|
||||
KERNEL_OBJS := \
|
||||
$(patsubst $(KERNEL_SRC)/%.c,$(KERNEL_OBJ_DIR)/%.o,$(KERNEL_SRCS)) \
|
||||
$(patsubst $(KERNEL_SRC)/%.S,$(KERNEL_OBJ_DIR)/%.o,$(KERNEL_ASM)) \
|
||||
$(KERNEL_VM_OBJS) \
|
||||
$(KERNEL_V4_OBJS) \
|
||||
$(CAPSULE_GENERATED_KOBJ)
|
||||
|
||||
# ==============================================================================
|
||||
@@ -733,6 +762,41 @@ else
|
||||
@$(LOADER_CC) $(VMCORE_CFLAGS_COMMON) $(filter-out -I$(KERNEL_INC),$(LOADER_CFLAGS)) -c $< -o $@
|
||||
endif
|
||||
|
||||
# StarForth v4: the capsule image, built on this machine by v4's Makefile, and
|
||||
# the engine, compiled like any other kernel source.
|
||||
ifeq ($(STARFORTH_V4),1)
|
||||
$(V4_IMAGE_C): FORCE
|
||||
@mkdir -p $(dir $@)
|
||||
@echo " V4IMG v4/capsule -> $@"
|
||||
@$(MAKE) --no-print-directory -C v4 CC=cc build/v4_image_64.c
|
||||
@cmp -s v4/build/v4_image_64.c $@ || cp v4/build/v4_image_64.c $@
|
||||
|
||||
$(LOADER_OBJ_DIR)/v4engine/v4_image.o: $(V4_IMAGE_C) | $(LOADER_OBJ_DIR)
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "CC (loader) $<"
|
||||
@$(LOADER_CC) $(LOADER_CFLAGS) -c $< -o $@
|
||||
$(KERNEL_OBJ_DIR)/v4engine/v4_image.o: $(V4_IMAGE_C) | $(KERNEL_OBJ_DIR)
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "CC (kernel) $<"
|
||||
@$(CC) $(KERNEL_CFLAGS) -c $< -o $@
|
||||
$(LOADER_OBJ_DIR)/v4system/%.o: v4/system/%.c | $(LOADER_OBJ_DIR)
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "CC (loader) $<"
|
||||
@$(LOADER_CC) $(LOADER_CFLAGS) -c $< -o $@
|
||||
$(KERNEL_OBJ_DIR)/v4system/%.o: v4/system/%.c | $(KERNEL_OBJ_DIR)
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "CC (kernel) $<"
|
||||
@$(CC) $(KERNEL_CFLAGS) -c $< -o $@
|
||||
$(LOADER_OBJ_DIR)/v4engine/%.o: v4/src/%.c | $(LOADER_OBJ_DIR)
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "CC (loader) $<"
|
||||
@$(LOADER_CC) $(LOADER_CFLAGS) -c $< -o $@
|
||||
$(KERNEL_OBJ_DIR)/v4engine/%.o: v4/src/%.c | $(KERNEL_OBJ_DIR)
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "CC (kernel) $<"
|
||||
@$(CC) $(KERNEL_CFLAGS) -c $< -o $@
|
||||
endif
|
||||
|
||||
# Compile loader assembly sources
|
||||
$(LOADER_OBJ_DIR)/%.o: $(KERNEL_SRC)/%.S | $(LOADER_OBJ_DIR)
|
||||
@mkdir -p $(dir $@)
|
||||
@@ -1337,6 +1401,7 @@ info:
|
||||
@echo "Loader output: $(LOADER_EFI)"
|
||||
@echo "Kernel output: $(KERNEL_ELF)"
|
||||
@echo "VM integration: $(STARFORTH_ENABLE_VM)"
|
||||
@echo "StarForth v4: $(STARFORTH_V4)"
|
||||
@echo "Monolithic: $(MONOLITHIC)"
|
||||
|
||||
help:
|
||||
|
||||
Reference in New Issue
Block a user