RCS file: /cvsroot/src/sys/arch/i386/stand/boot/boot2.c,v
retrieving revision 1.80
diff -u -p -u -r1.80 boot2.c
--- boot2.c 26 Apr 2025 20:17:36 -0000 1.80
+++ boot2.c 28 Apr 2025 20:47:31 -0000
@@ -126,6 +126,7 @@ static const char *default_part_name;
char *sprint_bootsel(const char *);
static void bootit(const char *, int);
+static void bootit2(const char *, size_t, int);
void boot2(int, uint64_t);
void command_help(char *);
@@ -473,6 +474,14 @@ command_quit(char *arg)
panic("Could not reboot!");
}
+static void
+bootit2(char *path, size_t plen, int howto)
+{
+ bootit(path, howto);
+ snprintf(path, plen, "%s.gz", path);
+ bootit(path, howto | AB_VERBOSE);
+}
+
void
command_boot(char *arg)
{
@@ -483,7 +492,13 @@ command_boot(char *arg)
return;
if (filename != NULL) {
- bootit(filename, howto);
+ char path[512];
+ if (strchr(filename, '/') == NULL) {
+ snprintf(path, sizeof(path}, "%s/kernel", filename);
+ bootit2(path, sizeof(path), howto);
+ }
+ snprintf(path, sizeof(path}, "%s", filename);
+ bootit2(path, sizeof(path), howto);
} else {
int i;
On Apr 28, 2025, at 4:20 PM, Paul Goyette via gnats <gnats-admin%netbsd.org@localhost> wrote:
The following reply was made to PR kern/59374; it has been noted by GNATS.
From: Paul Goyette <paul%whooppee.com@localhost>
To: Christos Zoulas <christos%zoulas.com@localhost>
Cc: gnats-bugs%netbsd.org@localhost, kern-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
netbsd-bugs%netbsd.org@localhost
Subject: Re: kern/59374: KERNEL_DIR: support passing directories from 'boot'
Date: Mon, 28 Apr 2025 13:18:08 -0700 (PDT)
On Mon, 28 Apr 2025, Paul Goyette wrote:
On Mon, 28 Apr 2025, Christos Zoulas wrote:
Not easy to do because it can't simply stat the name because we are
accessing the disks using bios. The best we can do is probably
try name/kernel, name/kernel.gz and then try name.
That sounds workable.
Does this work for you?
Index: boot2.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/boot/boot2.c,v
retrieving revision 1.80
diff -u -p -r1.80 boot2.c
--- boot2.c 26 Apr 2025 20:17:36 -0000 1.80
+++ boot2.c 28 Apr 2025 20:16:01 -0000
@@ -477,13 +477,34 @@ void
command_boot(char *arg)
{
char *filename;
+ char path[512];
int howto;
if (!parseboot(arg, &filename, &howto))
return;
if (filename != NULL) {
- bootit(filename, howto);
+ if ((strrchr(filename, '/') == '\0') {
+
+ /* filename/kernel */
+ strcpy(path, filename);
+ strcat(path, "/kernel");
+ bootit(path, howto);
+
+ /* filename/kernel.gz */
+ strcat(path, ".gz");
+ bootit(path, howto || AB_VERBOSE);
+
+ /* filename */
+ bootit(filename, howto);
+
+ /* filename.gz */
+ strcpy(path, filename);
+ strcat(path, ".gz");
+ bootit(path, howto || AB_VERBOSE);
+
+ } else
+ bootit(filename, howto);
} else {
int i;
+---------------------+--------------------------+----------------------+
| Paul Goyette (.sig) | PGP Key fingerprint: | E-mail addresses: |
| (Retired) | 1B11 1849 721C 56C8 F63A | paul%whooppee.com@localhost |
| Software Developer | 6E2E 05FD 15CE 9F2D 5102 | pgoyette%netbsd.org@localhost |
| & Network Engineer | | pgoyette99%gmail.com@localhost |
+---------------------+--------------------------+----------------------+