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'



The following reply was made to PR kern/59374; it has been noted by GNATS.

From: Christos Zoulas <christos%zoulas.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: kern-bug-people%netbsd.org@localhost,
 gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost,
 Thomas Klausner <wiz%NetBSD.org@localhost>
Subject: Re: kern/59374: KERNEL_DIR: support passing directories from 'boot'
Date: Mon, 28 Apr 2025 16:48:39 -0400

 --Apple-Mail=_DFA14F01-7125-4D43-8947-FB2576ECA12C
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8
 
 Perhaps:
 
 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;
 =20
  char *sprint_bootsel(const char *);
  static void bootit(const char *, int);
 +static void bootit2(const char *, size_t, int);
  void boot2(int, uint64_t);
 =20
  void   command_help(char *);
 @@ -473,6 +474,14 @@ command_quit(char *arg)
         panic("Could not reboot!");
  }
 =20
 +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;
 =20
         if (filename !=3D NULL) {
 -               bootit(filename, howto);
 +               char path[512];
 +               if (strchr(filename, '/') =3D=3D 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;
 =20
 
 
 > On Apr 28, 2025, at 4:20=E2=80=AFPM, Paul Goyette via gnats =
 <gnats-admin%netbsd.org@localhost> wrote:
 >=20
 > The following reply was made to PR kern/59374; it has been noted by =
 GNATS.
 >=20
 > 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,=20
 >    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)
 >=20
 > On Mon, 28 Apr 2025, Paul Goyette wrote:
 >=20
 >> On Mon, 28 Apr 2025, Christos Zoulas wrote:
 >>=20
 >>> 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.
 >>=20
 >> That sounds workable.
 >=20
 > Does this work for you?
 >=20
 > Index: boot2.c
 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 > 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;
 >=20
 >   	if (!parseboot(arg, &filename, &howto))
 >   		return;
 >=20
 >   	if (filename !=3D NULL) {
 > -		bootit(filename, howto);
 > +		if ((strrchr(filename, '/') =3D=3D '\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;
 >=20
 >=20
 > =
 +---------------------+--------------------------+----------------------+
 > | 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 |
 > =
 +---------------------+--------------------------+----------------------+
 >=20
 
 
 --Apple-Mail=_DFA14F01-7125-4D43-8947-FB2576ECA12C
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP
 
 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org
 
 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCaA/ppwAKCRBxESqxbLM7
 OjtWAKDlH/PJ1+tauzByS4skxzs/2WbS+gCdFaVPDJwKMgwLuC8GpUdw7CKtJCI=
 =ZAoj
 -----END PGP SIGNATURE-----
 
 --Apple-Mail=_DFA14F01-7125-4D43-8947-FB2576ECA12C--
 


Home | Main Index | Thread Index | Old Index