Module Name:    src
Committed By:   christos
Date:           Wed Aug 25 16:24:45 UTC 2010

Modified Files:
        src/sys/arch/sparc/stand/ofwboot: boot.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sparc/stand/ofwboot/boot.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.22 src/sys/arch/sparc/stand/ofwboot/boot.c:1.23
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.22	Fri Apr  2 14:39:44 2010
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Wed Aug 25 12:24:45 2010
@@ -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,

Reply via email to