Files
LithosAnanake/kernel/include/starkernel/cmdline.h
T
rajamesandClaude Opus 5.5 1a4b163861 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>
2026-10-14 15:11:47 -04:00

40 lines
1.3 KiB
C

/*
* cmdline.h — kernel command-line parser API
*
* Pure C99 / freestanding — no UEFI types, no libc.
* The UEFI loader converts LoadOptions (UCS-2) to ASCII before calling
* cmdline_parse_ascii(); the parser itself never sees CHAR16.
*/
#ifndef STARKERNEL_CMDLINE_H
#define STARKERNEL_CMDLINE_H
#include "kernel_args.h"
/*
* cmdline_parse_ascii — parse a NUL-terminated ASCII cmdline into *args.
*
* Fills all default values first; unknown flags are silently ignored so
* future kernels can add flags without breaking old boot entries.
* Safe to call with NULL or empty cmdline (returns all defaults).
*
* Recognised flags:
* --doe set run_doe = 1
* --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);
/*
* cmdline_parse_size — parse a size token with optional K/M/G suffix.
*
* Examples: "2M" -> 2*1024*1024, "4G" -> 4*1024^3, "65536" -> 65536.
* Returns 0 on parse error (empty string, non-digit start, etc.).
*/
uint64_t cmdline_parse_size(const char *s);
#endif /* STARKERNEL_CMDLINE_H */