Current-Users archive

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

Re: machdep.booted_kernel hosed



> During the quest of NFS diskless configuration with modern
> NetBSD, I encountered the following today;
> 
> $ /sbin/sysctl machdep.booted_kernel
> machdep.booted_kernel = /stand/i386/5.99.7/modules/nfs/nfs.kmod

I have a patch but not fully tested.

enami.

Index: stand/boot/devopen.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/boot/devopen.c,v
retrieving revision 1.7
diff -u -r1.7 devopen.c
--- stand/boot/devopen.c        2 May 2008 15:26:38 -0000       1.7
+++ stand/boot/devopen.c        11 Mar 2009 05:19:58 -0000
@@ -112,11 +112,6 @@
        *partition = biosdisk_findpartition(biosdev, sector);
 }
 
-#ifdef _STANDALONE
-struct btinfo_bootpath bibp;
-extern bool kernel_loaded;
-#endif
-
 /*
  * Open the BIOS disk device
  */
@@ -136,10 +131,7 @@
        f->f_dev = &devsw[0];           /* must be biosdisk */
 
 #ifdef _STANDALONE
-       if (!kernel_loaded) {
-               strncpy(bibp.bootpath, *file, sizeof(bibp.bootpath));
-               BI_ADD(&bibp, BTINFO_BOOTPATH, sizeof(bibp));
-       }
+       set_bootpath(*file);
 #endif
 
        return biosdisk_open(f, biosdev, partition);
Index: stand/dosboot/devopen.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/dosboot/devopen.c,v
retrieving revision 1.10
diff -u -r1.10 devopen.c
--- stand/dosboot/devopen.c     11 Dec 2005 12:17:48 -0000      1.10
+++ stand/dosboot/devopen.c     11 Mar 2009 05:19:58 -0000
@@ -91,8 +91,6 @@
        return (ENXIO);
 }
 
-struct btinfo_bootpath bibp;
-
 int
 devopen(f, fname, file)
        struct open_file *f;
@@ -121,8 +119,7 @@
                dp = &devsw[0]; /* must be biosdisk */
                f->f_dev = dp;
 
-               strncpy(bibp.bootpath, *file, sizeof(bibp.bootpath));
-               BI_ADD(&bibp, BTINFO_BOOTPATH, sizeof(bibp));
+               set_bootpath(*file);
 
                return (biosdisk_open(f, biosdev, partition));
        } else {
Index: stand/lib/exec.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/exec.c,v
retrieving revision 1.39
diff -u -r1.39 exec.c
--- stand/lib/exec.c    16 Feb 2009 22:39:30 -0000      1.39
+++ stand/lib/exec.c    11 Mar 2009 05:19:59 -0000
@@ -128,6 +128,7 @@
 bool boot_modules_enabled = true;
 bool kernel_loaded;
 
+static struct btinfo_bootpath btinfo_bootpath;
 static struct btinfo_framebuffer btinfo_framebuffer;
 
 static struct btinfo_modulelist *btinfo_modulelist;
@@ -138,6 +139,18 @@
 static void    module_init(void);
 
 void
+set_bootpath(const char *file)
+{
+       struct btinfo_bootpath *bb = &btinfo_bootpath;
+
+       if (kernel_loaded)
+               return;
+
+       strlcpy(bb->bootpath, file, sizeof(bb->bootpath));
+       BI_ADD(bb, BTINFO_BOOTPATH, sizeof(*bb));
+}
+
+void
 framebuffer_configure(struct btinfo_framebuffer *fb)
 {
        if (fb)
Index: stand/lib/libi386.h
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/libi386.h,v
retrieving revision 1.30
diff -u -r1.30 libi386.h
--- stand/lib/libi386.h 16 Feb 2009 22:39:30 -0000      1.30
+++ stand/lib/libi386.h 11 Mar 2009 05:19:59 -0000
@@ -135,6 +135,7 @@
 extern int doserrno;   /* in dos_file.S */
 
 void module_add(char *);
+void set_bootpath(const char *);
 
 struct btinfo_framebuffer;
 void framebuffer_configure(struct btinfo_framebuffer *);
Index: stand/netboot/devopen.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/netboot/devopen.c,v
retrieving revision 1.7
diff -u -r1.7 devopen.c
--- stand/netboot/devopen.c     11 Dec 2005 12:17:49 -0000      1.7
+++ stand/netboot/devopen.c     11 Mar 2009 05:19:59 -0000
@@ -45,10 +45,6 @@
 #endif
 #include "dev_net.h"
 
-#ifdef _STANDALONE
-struct btinfo_bootpath bibp;
-#endif
-
 int
 devopen(f, fname, file)
        struct open_file *f;
@@ -72,8 +68,7 @@
                *file = (char *) fname;
 
 #ifdef _STANDALONE
-       strncpy(bibp.bootpath, *file, sizeof(bibp.bootpath));
-       BI_ADD(&bibp, BTINFO_BOOTPATH, sizeof(bibp));
+       set_bootpath(*file);
 #endif
 
        return (error);
Index: stand/pxeboot/devopen.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/pxeboot/devopen.c,v
retrieving revision 1.7
diff -u -r1.7 devopen.c
--- stand/pxeboot/devopen.c     11 Dec 2005 12:17:49 -0000      1.7
+++ stand/pxeboot/devopen.c     11 Mar 2009 05:19:59 -0000
@@ -51,10 +51,6 @@
 
 #include "pxeboot.h"
 
-#ifdef _STANDALONE
-struct btinfo_bootpath bibp;
-#endif
-
 /*
  * Open the "device" named by the combined file system/file name
  * given as the fname arg.  Format is:
@@ -134,8 +130,7 @@
        *file = filename;
 
 #ifdef _STANDALONE
-       strncpy(bibp.bootpath, filename, sizeof(bibp.bootpath));
-       BI_ADD(&bibp, BTINFO_BOOTPATH, sizeof(bibp));
+       set_bootpath(filename);
 #endif
 
        return (0);


Home | Main Index | Thread Index | Old Index