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

This commit is contained in:
tsubai 2001-08-13 15:38:11 +00:00
parent 811a1f306a
commit b1d1120084
3 changed files with 35 additions and 17 deletions

View File

@ -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 @@ main()
prom2boot(bootdev);
parseargs(bootline, &boothowto);
DPRINTF("bootline=%s\n", bootline);
for (;;) {
int i;
if (boothowto & RB_ASKNAME) {
printf("Boot: ");
gets(bootline);
parseargs(bootline, &boothowto);
}
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(bootline, marks, LOAD_ALL) >= 0)
break;
if (errno)
printf("open %s: %s\n", opened_name, strerror(errno));
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;

View File

@ -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 @@ devopen(of, name, file)
*cp = 0;
}
if (!cp || !*buf)
strcpy(buf, DEFAULT_KERNEL);
return ENOENT;
if (!*fname)
strcpy(fname, bootdev);
strcpy(opened_name, fname);

View File

@ -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.
@ -45,8 +45,6 @@ struct of_dev {
#define OFDEV_NET 1
#define OFDEV_DISK 2
#define DEFAULT_KERNEL "/netbsd"
extern char opened_name[];
extern int floppyboot;