Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/macppc/stand/ofwboot Search "/netbsd.gz" and "/netb...



details:   https://anonhg.NetBSD.org/src/rev/49aab7f14c3f
branches:  trunk
changeset: 513777:49aab7f14c3f
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Mon Aug 13 15:38:11 2001 +0000

description:
Search "/netbsd.gz" and "/netbsd.macppc" in addition to "/netbsd".

diffstat:

 sys/arch/macppc/stand/ofwboot/boot.c  |  32 ++++++++++++++++++++++++++------
 sys/arch/macppc/stand/ofwboot/ofdev.c |   8 ++++----
 sys/arch/macppc/stand/ofwboot/ofdev.h |  12 +++++-------
 3 files changed, 35 insertions(+), 17 deletions(-)

diffs (133 lines):

diff -r d9084ce83155 -r 49aab7f14c3f sys/arch/macppc/stand/ofwboot/boot.c
--- a/sys/arch/macppc/stand/ofwboot/boot.c      Mon Aug 13 12:33:48 2001 +0000
+++ b/sys/arch/macppc/stand/ofwboot/boot.c      Mon Aug 13 15:38:11 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: boot.c,v 1.11 2001/07/22 11:29:48 wiz Exp $    */
+/*     $NetBSD: boot.c,v 1.12 2001/08/13 15:38:11 tsubai Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -95,12 +95,19 @@
 #include "ofdev.h"
 #include "openfirm.h"
 
+#ifdef DEBUG
+# define DPRINTF printf
+#else
+# define DPRINTF while (0) printf
+#endif
+
 char bootdev[128];
 char bootfile[128];
 int boothowto;
 int debug;
 
 static ofw_version = 0;
+static char *kernels[] = { "/netbsd", "/netbsd.gz", "/netbsd.macppc", NULL };
 
 static void
 prom2boot(dev)
@@ -242,20 +249,33 @@
 
        prom2boot(bootdev);
        parseargs(bootline, &boothowto);
+       DPRINTF("bootline=%s\n", bootline);
 
        for (;;) {
+               int i;
+
                if (boothowto & RB_ASKNAME) {
                        printf("Boot: ");
                        gets(bootline);
                        parseargs(bootline, &boothowto);
                }
-               marks[MARK_START] = 0;
-               if (loadfile(bootline, marks, LOAD_ALL) >= 0)
-                       break;
-               if (errno)
-                       printf("open %s: %s\n", opened_name, strerror(errno));
+
+               if (bootline[0]) {
+                       kernels[0] = bootline;
+                       kernels[1] = NULL;
+               }
+
+               for (i = 0; kernels[i]; i++) {
+                       DPRINTF("Trying %s\n", kernels[i]);
+
+                       marks[MARK_START] = 0;
+                       if (loadfile(kernels[i], marks, LOAD_KERNEL) >= 0)
+                               goto loaded;
+               }
                boothowto |= RB_ASKNAME;
        }
+loaded:
+
 #ifdef __notyet__
        OF_setprop(chosen, "bootpath", opened_name, strlen(opened_name) + 1);
        cp = bootline;
diff -r d9084ce83155 -r 49aab7f14c3f sys/arch/macppc/stand/ofwboot/ofdev.c
--- a/sys/arch/macppc/stand/ofwboot/ofdev.c     Mon Aug 13 12:33:48 2001 +0000
+++ b/sys/arch/macppc/stand/ofwboot/ofdev.c     Mon Aug 13 15:38:11 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofdev.c,v 1.6 2001/07/22 11:29:48 wiz Exp $    */
+/*     $NetBSD: ofdev.c,v 1.7 2001/08/13 15:38:11 tsubai Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -41,11 +41,11 @@
 #include <netinet/in.h>
 
 #include <lib/libsa/stand.h>
-#include <lib/libsa/ufs.h>
 #include <lib/libsa/cd9660.h>
 #include <lib/libsa/nfs.h>
-#include <hfs.h>
+#include <lib/libsa/ufs.h>
 
+#include "hfs.h"
 #include "ofdev.h"
 
 extern char bootdev[];
@@ -273,7 +273,7 @@
                *cp = 0;
        }
        if (!cp || !*buf)
-               strcpy(buf, DEFAULT_KERNEL);
+               return ENOENT;
        if (!*fname)
                strcpy(fname, bootdev);
        strcpy(opened_name, fname);
diff -r d9084ce83155 -r 49aab7f14c3f sys/arch/macppc/stand/ofwboot/ofdev.h
--- a/sys/arch/macppc/stand/ofwboot/ofdev.h     Mon Aug 13 12:33:48 2001 +0000
+++ b/sys/arch/macppc/stand/ofwboot/ofdev.h     Mon Aug 13 15:38:11 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofdev.h,v 1.2 1999/02/04 15:41:15 tsubai Exp $ */
+/*     $NetBSD: ofdev.h,v 1.3 2001/08/13 15:38:11 tsubai Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -30,8 +30,8 @@
  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-#ifndef        _STAND_DEV_H_
-#define        _STAND_DEV_H_
+#ifndef _STAND_DEV_H_
+#define _STAND_DEV_H_
 
 struct of_dev {
        int handle;
@@ -42,10 +42,8 @@
 };
 
 /* Known types: */
-#define        OFDEV_NET       1
-#define        OFDEV_DISK      2
-
-#define        DEFAULT_KERNEL  "/netbsd"
+#define OFDEV_NET      1
+#define OFDEV_DISK     2
 
 extern char opened_name[];
 extern int floppyboot;



Home | Main Index | Thread Index | Old Index