NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/59374: KERNEL_DIR: support passing directories from 'boot'



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 |
+---------------------+--------------------------+----------------------+


Home | Main Index | Thread Index | Old Index