NetBSD Problem Report #58814

From martin@aprisoft.de  Wed Nov  6 19:26:41 2024
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 570091A9238
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  6 Nov 2024 19:26:41 +0000 (UTC)
Message-Id: <20241106192632.07E455CC79B@emmas.aprisoft.de>
Date: Wed,  6 Nov 2024 20:26:32 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: Can't use "fs" bootloader command in boot.cfg w/o menu
X-Send-Pr-Version: 3.95

>Number:         58814
>Category:       port-amd64
>Synopsis:       Can't use "fs" bootloader command in boot.cfg w/o menu
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 06 19:30:00 +0000 2024
>Last-Modified:  Thu Nov 07 06:30:02 +0000 2024
>Originator:     Martin Husemann
>Release:        NetBSD 10.99.12
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD martins.aprisoft.de 10.99.12 NetBSD 10.99.12 (GENERIC) #250: Sat Nov 2 11:23:49 CET 2024 martin@martins.aprisoft.de:/home/martin/current/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

This may be a documentation bug only, but I can't find a way to
express in boot.cfg the equivalent of these two commands
entered at the boot prompt:

---8<---
fs cgdrd.img
boot netbsd
--->8---

I don't want a menu to display, my naive try was

---8<---
clear
timeout=0
fs cgdrd.img
boot netbsd
--->8---

but that did not work (everything worked fine, but the ramdisk was
not loaded).

Mimicing the "load" syntax from boot.cfg doces did not work either:

fs=cgdrd.img

>How-To-Repeat:
s/a

>Fix:
s/a

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/58814: Can't use "fs" bootloader command in boot.cfg
 w/o menu
Date: Wed, 6 Nov 2024 20:33:40 +0100

 If I don't mind spurious menu display, using

 menu=:fs cgdrd.img;boot netbsd

 works.

 Martin

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/58814: Can't use "fs" bootloader command in boot.cfg w/o menu
Date: Thu, 7 Nov 2024 06:24:52 -0000 (UTC)

 gnats-admin@NetBSD.org ("Martin Husemann via gnats") writes:

 > If I don't mind spurious menu display, using
 > 
 > menu=:fs cgdrd.img;boot netbsd
 > 
 > works.


 boot.cfg commands are executed by libsa, except for machine specific
 commands that are handled by a callback.


 For x86 this is:

 /*
  * XXX
  * if module_add, userconf_add are strictly mi they can be folded back
  * into sys/lib/libsa/bootcfg.c:perform_bootcfg().
  */
 static void
 do_bootcfg_command(const char *cmd, char *arg)
 {
         if (strcmp(cmd, BOOTCFG_CMD_LOAD) == 0)
                 module_add(arg);
         else if (strcmp(cmd, BOOTCFG_CMD_USERCONF) == 0)
                 userconf_add(arg);
 }

 So you can only do

 load=...
 userconf=...

 fs= is simply missing. There isn't a BOOTCFG_CMD_FS declared either.


 libsa checks commands by prefix like:

      if (!strncmp(key, "banner", 6)) {

 and it knows about BOOTCFG_CMD_LOAD and BOOTCFG_CMD_USERCONF
 to identify these commands in the same way but still passes
 them to the callback.

 Commands not known are passed as-is to the callback.

 libsa is used for boot.cfg commands by x86 (i386), sparc and zaurus.
 sparc knows about "bootpartition".
 zaurus just provides a dummy callback.


 N.B. For the menu command in boot.cfg, libsa gathers the entries and
 the MD code (x86 only) executes it in a separate routine ("doboottypemenu")
 like interactive input.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.