feat(boards): both systems on every board image, chosen at boot -- system=v3 or system=v4
boards/BRINGUP.md A6, FABRIC-3 SXLIII (ruled: one image, switch at boot). A STARFORTH_V4 kernel carries v3 too; system= in the boot arguments chooses, else the build's default (V4_DEFAULT: 1 for plain STARFORTH_V4 builds as before, 0 for board images). make boot_image builds both and always writes starforth.cfg / cmdline.txt with system=v3 first, and cleans its ISA's objects first -- that clean was removing build/<arch>/SER5, not the kernel's objects, until fixed here. Each ISA: v3 by default (hash unchanged), v4 with system=v4 (538/538). The SER5 image under OVMF: v3 as built, v4 after a one-word edit on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e729c64ba3
commit
1a4b163861
+15
-7
@@ -620,8 +620,13 @@ endif
|
||||
# ISA this kernel boots on has (DECOMPOSITION.md D-5), so the image is the
|
||||
# same file for all three.
|
||||
# ------------------------------------------------------------------------------
|
||||
# V4_DEFAULT: with v4 built in, whether it runs when the boot arguments
|
||||
# name no system (A6, 2026-10-14). 1 for a plain STARFORTH_V4=1 build, as
|
||||
# before; board images build with both and V4_DEFAULT=0 -- v3 unless
|
||||
# `system=v4` (root Makefile, boot_image).
|
||||
V4_DEFAULT ?= 1
|
||||
ifeq ($(STARFORTH_V4),1)
|
||||
V4_DEFS := -DSTARFORTH_V4=1 -Iv4/include \
|
||||
V4_DEFS := -DSTARFORTH_V4=1 -DSK_V4_DEFAULT=$(V4_DEFAULT) -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)
|
||||
@@ -1283,13 +1288,15 @@ else ifeq ($(BOARD_BOOT),uefi-esp)
|
||||
boot_image: all
|
||||
@mkdir -p $(BOARD_OUT)
|
||||
@printf 'FS0:\\EFI\\BOOT\\%s\r\n' "$(EFI_BOOTNAME)" > $(BOARD_OUT)/startup.nsh
|
||||
@rm -f $(BOARD_OUT)/starforth.cfg
|
||||
$(if $(KERNEL_ARGS),@printf '%s\n' '$(KERNEL_ARGS)' > $(BOARD_OUT)/starforth.cfg)
|
||||
@# The boot arguments, always written: system=v3 first, so that which
|
||||
@# system runs is one word to change on the stick (A6); KERNEL_ARGS
|
||||
@# after it, and a later system= wins.
|
||||
@printf '%s\n' 'system=v3 $(KERNEL_ARGS)' > $(BOARD_OUT)/starforth.cfg
|
||||
@bash scripts/mkdiskimage.sh --out $(BOARD_OUT)/$(BOARD_IMAGE) --table gpt \
|
||||
--size-mib $(BOOT_IMAGE_SIZE_MIB) --label LITHOS \
|
||||
$(LOADER_EFI):/EFI/BOOT/$(EFI_BOOTNAME) \
|
||||
$(BOARD_OUT)/startup.nsh:/startup.nsh \
|
||||
$(if $(KERNEL_ARGS),$(BOARD_OUT)/starforth.cfg:/starforth.cfg)
|
||||
$(BOARD_OUT)/starforth.cfg:/starforth.cfg
|
||||
@echo "$(BOARD_DESC)"
|
||||
@echo "Write with: dd if=$(BOARD_OUT)/$(BOARD_IMAGE) of=/dev/sdX bs=4M conv=fsync status=progress"
|
||||
else ifeq ($(BOARD_BOOT),rpi-native)
|
||||
@@ -1303,14 +1310,15 @@ $(RPI5_DTB):
|
||||
|
||||
boot_image: v3/include/version.h $(RPI5_NATIVE_IMG) $(RPI5_DTB)
|
||||
@mkdir -p $(BOARD_OUT)
|
||||
@rm -f $(BOARD_OUT)/cmdline.txt
|
||||
$(if $(KERNEL_ARGS),@printf '%s\n' '$(KERNEL_ARGS)' > $(BOARD_OUT)/cmdline.txt)
|
||||
@# cmdline.txt, always: the firmware hands it to the kernel as the
|
||||
@# devicetree's bootargs. system=v3 first, one word to change (A6).
|
||||
@printf '%s\n' 'system=v3 $(KERNEL_ARGS)' > $(BOARD_OUT)/cmdline.txt
|
||||
@bash scripts/mkdiskimage.sh --out $(BOARD_OUT)/$(BOARD_IMAGE) --table mbr \
|
||||
--size-mib $(BOOT_IMAGE_SIZE_MIB) --label LITHOS \
|
||||
boards/$(BOARD)/config.txt:/config.txt \
|
||||
$(RPI5_NATIVE_IMG):/kernel_2712.img \
|
||||
$(RPI5_DTB):/bcm2712-rpi-5-b.dtb \
|
||||
$(if $(KERNEL_ARGS),$(BOARD_OUT)/cmdline.txt:/cmdline.txt)
|
||||
$(BOARD_OUT)/cmdline.txt:/cmdline.txt
|
||||
@echo "$(BOARD_DESC)"
|
||||
@echo "Write with: dd if=$(BOARD_OUT)/$(BOARD_IMAGE) of=/dev/mmcblkX bs=4M conv=fsync status=progress"
|
||||
else
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
* --log-level=<level> debug / info / warn / error
|
||||
* --stack=<N>[KMG] stack_size in bytes
|
||||
* --heap=<N>[KMG] heap_size in bytes
|
||||
* system=v3 | system=v4 which system runs, where both are built in
|
||||
* ("--system=" too)
|
||||
*/
|
||||
void cmdline_parse_ascii(const char *cmdline, KernelArgs *args);
|
||||
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
#define KARGS_DEFAULT_HEAP_SIZE (2ULL * 1024ULL * 1024ULL * 1024ULL) /* 2 GB */
|
||||
#define KARGS_DEFAULT_LOG_LEVEL 2 /* warn — quiet by default; --log-level=info/debug re-enables ECW word-execution tracing */
|
||||
#define KARGS_DEFAULT_RUN_DOE 0
|
||||
/* Which system runs, where a kernel carries both (boards/BRINGUP.md A6,
|
||||
* ruled 2026-10-14: one image, chosen at boot). DEFAULT means the build's
|
||||
* own default (kernel/Makefile V4_DEFAULT). */
|
||||
#define KARGS_SYSTEM_DEFAULT 0
|
||||
#define KARGS_SYSTEM_V3 3
|
||||
#define KARGS_SYSTEM_V4 4
|
||||
|
||||
/* ---- Log level constants ------------------------------------------------ */
|
||||
#define KARGS_LOG_DEBUG 0
|
||||
@@ -43,6 +49,7 @@ typedef struct {
|
||||
/* Runtime behaviour */
|
||||
int run_doe; /* --doe (0 = off) */
|
||||
int log_level; /* --log-level=... (KARGS_LOG_*) */
|
||||
int system; /* system=v3 | system=v4 (KARGS_SYSTEM_*), 2026-10-14 */
|
||||
|
||||
/* Raw unparsed cmdline; always NUL-terminated */
|
||||
char raw[KERNEL_ARGS_CMDLINE_MAX];
|
||||
|
||||
@@ -186,6 +186,7 @@ void cmdline_parse_ascii(const char *cmdline, KernelArgs *args) {
|
||||
args->heap_size = 0;
|
||||
args->run_doe = KARGS_DEFAULT_RUN_DOE;
|
||||
args->log_level = KARGS_DEFAULT_LOG_LEVEL;
|
||||
args->system = KARGS_SYSTEM_DEFAULT;
|
||||
args->raw[0] = '\0';
|
||||
|
||||
if (!cmdline || !*cmdline) return;
|
||||
@@ -207,6 +208,14 @@ void cmdline_parse_ascii(const char *cmdline, KernelArgs *args) {
|
||||
if (tok_len == 5 && sf_strncmp(tok, "--doe", 5) == 0) {
|
||||
args->run_doe = 1;
|
||||
|
||||
/* system=v3 | system=v4, with or without "--": which system runs,
|
||||
* on a kernel that carries both (2026-10-14, A6) */
|
||||
} else if ((tok_len == 9 && sf_strncmp(tok, "system=v", 8) == 0) ||
|
||||
(tok_len == 11 && sf_strncmp(tok, "--system=v", 10) == 0)) {
|
||||
char v = tok[tok_len - 1];
|
||||
if (v == '3') args->system = KARGS_SYSTEM_V3;
|
||||
else if (v == '4') args->system = KARGS_SYSTEM_V4;
|
||||
|
||||
/* --log-level=<level> (prefix = 12 chars) */
|
||||
} else if (tok_len > 12 && sf_strncmp(tok, "--log-level=", 12) == 0) {
|
||||
args->log_level = parse_log_level(tok + 12);
|
||||
|
||||
@@ -561,12 +561,31 @@ static void kernel_main_deep(BootInfo *boot_info) {
|
||||
console_println("Kernel initialization complete.");
|
||||
console_println("Boot successful!\n");
|
||||
|
||||
/* Which system runs (boards/BRINGUP.md A6, ruled 2026-10-14: one image,
|
||||
* both systems, chosen at boot). A kernel built with STARFORTH_V4
|
||||
* carries v4 as well as v3; `system=v3` or `system=v4` among the boot
|
||||
* arguments (starforth.cfg on the ESP, cmdline.txt on the Pi 5) picks,
|
||||
* else the build's default (SK_V4_DEFAULT: on for a plain STARFORTH_V4
|
||||
* build, off for a board image). */
|
||||
#ifdef STARFORTH_V4
|
||||
/* StarForth v4 at a single prompt (Kconfig STARFORTH_V4): one host node
|
||||
* of the F18-derived engine, in place of the v3 VM and everything below.
|
||||
* It does not return. */
|
||||
sk_v4_boot_info = boot_info;
|
||||
sk_v4_run(sk_v4_block_chain);
|
||||
if (boot_info->args.system == KARGS_SYSTEM_V4 ||
|
||||
(boot_info->args.system == KARGS_SYSTEM_DEFAULT && SK_V4_DEFAULT)) {
|
||||
console_println(boot_info->args.system == KARGS_SYSTEM_V4
|
||||
? "System: StarForth v4 (system=v4)"
|
||||
: "System: StarForth v4 (this build's default)");
|
||||
/* StarForth v4 at a single prompt: one host node of the F18-derived
|
||||
* engine, in place of the v3 VM and everything below. It does not
|
||||
* return. */
|
||||
sk_v4_boot_info = boot_info;
|
||||
sk_v4_run(sk_v4_block_chain);
|
||||
}
|
||||
console_println(boot_info->args.system == KARGS_SYSTEM_V3
|
||||
? "System: StarForth v3 (system=v3)"
|
||||
: "System: StarForth v3 (this build's default; system=v4 for v4)");
|
||||
#else
|
||||
console_println(boot_info->args.system == KARGS_SYSTEM_V4
|
||||
? "System: StarForth v3 -- system=v4 asked for, and this kernel has no v4"
|
||||
: "System: StarForth v3");
|
||||
#endif
|
||||
|
||||
#ifdef STARFORTH_ENABLE_VM
|
||||
|
||||
Reference in New Issue
Block a user