fix(build): KERNEL_ARGS is written as data, not as printf's format

kernel/Makefile wrote the boot arguments with printf '$(KERNEL_ARGS)\n', so
arguments starting with '-' were taken for an option -- "printf: Illegal
option --", the build stops; the Makefile's own documented example,
KERNEL_ARGS="--doe --log-level=info", hit it -- and a '%' in them would be a
conversion. Now printf '%s\n' '$(KERNEL_ARGS)', as the board images already
write theirs, at all four places (the amd64, aarch64 and riscv64 qemu
recipes, and qemu-esp).

Red: the stick's increment 2 sessions with KERNEL_ARGS=--log-level=info
failed in make. Green: amd64 203627, aarch64 203833, riscv64 204237 --
starforth.cfg holds "--log-level=info" and the boot shows INFO lines after
POST. Accepted: 214300, 214507, 214911; test-32 0 failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-26 21:56:31 -04:00
co-authored by Claude Opus 5.5
parent 3cc4937c93
commit ac3f29d318
13 changed files with 993 additions and 4 deletions
+4 -4
View File
@@ -974,7 +974,7 @@ ifeq ($(ARCH),amd64)
@mmd -i $(BUILD_DIR)/iso/efi.img ::/EFI/BOOT
@mcopy -i $(BUILD_DIR)/iso/efi.img $(LOADER_EFI) ::/EFI/BOOT/BOOTX64.EFI
$(if $(KERNEL_ARGS),\
@printf '$(KERNEL_ARGS)\n' > $(BUILD_DIR)/iso/starforth.cfg && \
@printf '%s\n' '$(KERNEL_ARGS)' > $(BUILD_DIR)/iso/starforth.cfg && \
mcopy -i $(BUILD_DIR)/iso/efi.img $(BUILD_DIR)/iso/starforth.cfg ::/starforth.cfg,)
@xorriso -as mkisofs -r -J \
-e efi.img -no-emul-boot \
@@ -1038,7 +1038,7 @@ else ifeq ($(ARCH),aarch64)
@mmd -i $(BUILD_DIR)/iso/efi.img ::/EFI/BOOT
@mcopy -i $(BUILD_DIR)/iso/efi.img $(LOADER_EFI) ::/EFI/BOOT/BOOTAA64.EFI
$(if $(KERNEL_ARGS),\
@printf '$(KERNEL_ARGS)\n' > $(BUILD_DIR)/iso/starforth.cfg && \
@printf '%s\n' '$(KERNEL_ARGS)' > $(BUILD_DIR)/iso/starforth.cfg && \
mcopy -i $(BUILD_DIR)/iso/efi.img $(BUILD_DIR)/iso/starforth.cfg ::/starforth.cfg,)
@xorriso -as mkisofs -r -J \
-e efi.img -no-emul-boot \
@@ -1148,7 +1148,7 @@ else ifeq ($(ARCH),riscv64)
printf 'FS0:\\EFI\\BOOT\\BOOTRISCV64.EFI\r\n' > $(BUILD_DIR)/startup.nsh; \
mcopy -i $(BUILD_DIR)/esp_rv64.img $(BUILD_DIR)/startup.nsh ::/startup.nsh; \
if [ -n "$(KERNEL_ARGS)" ]; then \
printf '$(KERNEL_ARGS)\n' > $(BUILD_DIR)/starforth.cfg; \
printf '%s\n' '$(KERNEL_ARGS)' > $(BUILD_DIR)/starforth.cfg; \
mcopy -i $(BUILD_DIR)/esp_rv64.img $(BUILD_DIR)/starforth.cfg ::/starforth.cfg; \
fi; \
dd if=$(BUILD_DIR)/esp_rv64.img of=$$DISK bs=512 seek=2048 conv=notrunc 2>/dev/null; \
@@ -1410,7 +1410,7 @@ ifeq ($(ARCH),amd64)
@cp $(LOADER_EFI) $(BUILD_DIR)/esp/EFI/BOOT/BOOTX64.EFI
@cp $(KERNEL_ELF) $(BUILD_DIR)/esp/kernel.elf
@printf "FS0:\\EFI\\BOOT\\BOOTX64.EFI\r\n" > $(BUILD_DIR)/esp/startup.nsh
$(if $(KERNEL_ARGS),@printf '$(KERNEL_ARGS)\n' > $(BUILD_DIR)/esp/starforth.cfg,)
$(if $(KERNEL_ARGS),@printf '%s\n' '$(KERNEL_ARGS)' > $(BUILD_DIR)/esp/starforth.cfg,)
@OVMF_CODE=$(OVMF_CODE); \
if [ ! -f $$OVMF_CODE ]; then echo "Error: $$OVMF_CODE not found"; exit 1; fi; \
cp $(OVMF_VARS_RO) $(BUILD_DIR)/OVMF_VARS.fd; \