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>
30 lines
821 B
C
30 lines
821 B
C
/* capsule_blocks.c -- the block format of a .4th capsule payload.
|
|
* See capsule_blocks.h. Nothing here uses the C library or a VM.
|
|
*/
|
|
#include "starkernel/capsule_blocks.h"
|
|
|
|
int capsule_block_header(const uint8_t *p, const uint8_t *end,
|
|
uint32_t *out_num, const uint8_t **out_after)
|
|
{
|
|
const uint8_t *q;
|
|
uint32_t num = 0;
|
|
|
|
if ((uint64_t)(end - p) < 7u) return 0;
|
|
if (p[0] != 'B' || p[1] != 'l' || p[2] != 'o' || p[3] != 'c' || p[4] != 'k' || p[5] != ' ')
|
|
return 0;
|
|
|
|
q = p + 6;
|
|
if (q >= end || *q < '0' || *q > '9') return 0;
|
|
while (q < end && *q >= '0' && *q <= '9') {
|
|
num = num * 10u + (uint32_t)(*q - '0');
|
|
q++;
|
|
}
|
|
|
|
while (q < end && *q != '\n') q++;
|
|
if (q < end) q++;
|
|
|
|
*out_num = num;
|
|
*out_after = q;
|
|
return 1;
|
|
}
|