Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/stand/ofwboot Try to detect if we are doing a...



details:   https://anonhg.NetBSD.org/src/rev/134db4c68816
branches:  trunk
changeset: 757326:134db4c68816
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Aug 25 16:24:45 2010 +0000

description:
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.

diffstat:

 sys/arch/sparc/stand/ofwboot/boot.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (57 lines):

diff -r 5c4d76b5d7b4 -r 134db4c68816 sys/arch/sparc/stand/ofwboot/boot.c
--- a/sys/arch/sparc/stand/ofwboot/boot.c       Wed Aug 25 16:23:23 2010 +0000
+++ b/sys/arch/sparc/stand/ofwboot/boot.c       Wed Aug 25 16:24:45 2010 +0000
@@ -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.
@@ -350,10 +350,11 @@
 }
 
 static void
-start_kernel(char *kernel, char *bootline, void *ofw)
+start_kernel(char *kernel, char *bootline, void *ofw, int isfloppy)
 {
        int fd;
        u_long marks[MARK_MAX];
+       int flags = isfloppy ? LOAD_MINIMAL : LOAD_ALL;
 
        /*
         * First, load headers using default allocator and check whether kernel
@@ -371,7 +372,7 @@
                }
                (void)printf("Loading %s: ", kernel);
 
-               if (fdloadfile(fd, marks, LOAD_ALL) != -1) {
+               if (fdloadfile(fd, marks, flags) != -1) {
                        close(fd);
                        jump_to_kernel(marks, kernel, bootline, ofw);
                }
@@ -488,7 +489,7 @@
 void
 main(void *ofw)
 {
-       int boothowto, i = 0;
+       int boothowto, i = 0, isfloppy;
 
        char kernel[PROM_MAX_PATH];
        char bootline[PROM_MAX_PATH];
@@ -503,6 +504,7 @@
        /* Figure boot arguments */
        strncpy(bootdev, prom_getbootpath(), sizeof(bootdev) - 1);
        boothowto = bootoptions(prom_getbootargs(), bootdev, kernel, bootline);
+       isfloppy = strstr(bootdev, "fd") || strstr(bootdev, "floppy");
 
        for (;; *kernel = '\0') {
                if (boothowto & RB_ASKNAME) {
@@ -541,7 +543,7 @@
                }
 
                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,



Home | Main Index | Thread Index | Old Index