Try to detect if we are doing a floppy boot from the device name and if
we are, load the minimal set to avoid backwards seeks.
This commit is contained in:
parent
f2af08161f
commit
26c8040050
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: boot.c,v 1.22 2010/04/02 18:39:44 martin Exp $ */
|
/* $NetBSD: boot.c,v 1.23 2010/08/25 16:24:45 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved.
|
* Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved.
|
||||||
|
@ -350,10 +350,11 @@ jump_to_kernel(u_long *marks, char *kernel, char *args, void *ofw)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
start_kernel(char *kernel, char *bootline, void *ofw)
|
start_kernel(char *kernel, char *bootline, void *ofw, int isfloppy)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
u_long marks[MARK_MAX];
|
u_long marks[MARK_MAX];
|
||||||
|
int flags = isfloppy ? LOAD_MINIMAL : LOAD_ALL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First, load headers using default allocator and check whether kernel
|
* First, load headers using default allocator and check whether kernel
|
||||||
|
@ -371,7 +372,7 @@ start_kernel(char *kernel, char *bootline, void *ofw)
|
||||||
}
|
}
|
||||||
(void)printf("Loading %s: ", kernel);
|
(void)printf("Loading %s: ", kernel);
|
||||||
|
|
||||||
if (fdloadfile(fd, marks, LOAD_ALL) != -1) {
|
if (fdloadfile(fd, marks, flags) != -1) {
|
||||||
close(fd);
|
close(fd);
|
||||||
jump_to_kernel(marks, kernel, bootline, ofw);
|
jump_to_kernel(marks, kernel, bootline, ofw);
|
||||||
}
|
}
|
||||||
|
@ -488,7 +489,7 @@ check_boot_config(void)
|
||||||
void
|
void
|
||||||
main(void *ofw)
|
main(void *ofw)
|
||||||
{
|
{
|
||||||
int boothowto, i = 0;
|
int boothowto, i = 0, isfloppy;
|
||||||
|
|
||||||
char kernel[PROM_MAX_PATH];
|
char kernel[PROM_MAX_PATH];
|
||||||
char bootline[PROM_MAX_PATH];
|
char bootline[PROM_MAX_PATH];
|
||||||
|
@ -503,6 +504,7 @@ main(void *ofw)
|
||||||
/* Figure boot arguments */
|
/* Figure boot arguments */
|
||||||
strncpy(bootdev, prom_getbootpath(), sizeof(bootdev) - 1);
|
strncpy(bootdev, prom_getbootpath(), sizeof(bootdev) - 1);
|
||||||
boothowto = bootoptions(prom_getbootargs(), bootdev, kernel, bootline);
|
boothowto = bootoptions(prom_getbootargs(), bootdev, kernel, bootline);
|
||||||
|
isfloppy = strstr(bootdev, "fd") || strstr(bootdev, "floppy");
|
||||||
|
|
||||||
for (;; *kernel = '\0') {
|
for (;; *kernel = '\0') {
|
||||||
if (boothowto & RB_ASKNAME) {
|
if (boothowto & RB_ASKNAME) {
|
||||||
|
@ -541,7 +543,7 @@ main(void *ofw)
|
||||||
}
|
}
|
||||||
|
|
||||||
check_boot_config();
|
check_boot_config();
|
||||||
start_kernel(kernel, bootline, ofw);
|
start_kernel(kernel, bootline, ofw, isfloppy);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try next name from kernel name list if not in askname mode,
|
* Try next name from kernel name list if not in askname mode,
|
||||||
|
|
Loading…
Reference in New Issue