tech-kern archive

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

Re: 9.99.100 fallout: bootloader and modules



Searching for uses of netbsd_version, there is some more broken logic in a few places, following similar patterns or assumptions.

Like in /usr/src/sys/arch/i386/stand/lib/exec.c:

        if (netbsd_version / 1000000 % 100 == 99) {
                /* -current */
                snprintf(buf, bufsize,
                    "/stand/%s/%d.%d.%d/modules", machine,
                    netbsd_version / 100000000,
                    netbsd_version / 1000000 % 100,
                    netbsd_version / 100 % 100);
        } else if (netbsd_version != 0) {
                /* release */
                snprintf(buf, bufsize,
                    "/stand/%s/%d.%d/modules", machine,
                    netbsd_version / 100000000,
                    netbsd_version / 1000000 % 100);
        }


So just changing the modulo in the place you were suggesting isn't enough. :-P

  Johnny

On 2022-09-21 13:47, Taylor R Campbell wrote:
The x86 bootloader, and the MI efiboot, are unable to find modules
when the kernel version is 9.99.100 -- they try
/stand/$ARCH/9.99.0/modules instead, because of this logic:

/* sys/arch/i386/stand/lib/exec.c */
		snprintf(buf, bufsize,
		    "/stand/%s/%d.%d.%d/modules", machine,
		    netbsd_version / 100000000,
		    netbsd_version / 1000000 % 100,
		    netbsd_version / 100 % 100);		/* XXX */

/* sys/stand/efiboot/module.c */
	const u_int vmajor = netbsd_version / 100000000;
	const u_int vminor = netbsd_version / 1000000 % 100;
	const u_int vpatch = netbsd_version / 100 % 100;	/* XXX */

I will try the attached patch to do `% 10000' instead of `% 100' on
the lines marked XXX.  Likely other bootloaders will need to be
adjusted to handle this.  Loading modules from the bootloader in a
=9.99.100 kernel will require updating the bootloader.

(After boot, module loading works fine because the kernel's module
loader uses the `osrelease' string instead of doing arithmetic on
__NetBSD_Version__.)

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index