Module Name:    src
Committed By:   dsl
Date:           Sat Mar 10 18:42:19 UTC 2012

Modified Files:
        src/usr.sbin/installboot: installboot.8
        src/usr.sbin/installboot/arch: i386.c

Log Message:
Some FAT16 filesystems don't have 'hidden sectors' correctly set to
the offset of the filesystem on the disk.
Let '-b s1blk' be used to fix the value.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/usr.sbin/installboot/installboot.8
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/installboot/arch/i386.c

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

Modified files:

Index: src/usr.sbin/installboot/installboot.8
diff -u src/usr.sbin/installboot/installboot.8:1.84 src/usr.sbin/installboot/installboot.8:1.85
--- src/usr.sbin/installboot/installboot.8:1.84	Sat Feb 11 07:27:25 2012
+++ src/usr.sbin/installboot/installboot.8	Sat Mar 10 18:42:18 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: installboot.8,v 1.84 2012/02/11 07:27:25 ast Exp $
+.\"	$NetBSD: installboot.8,v 1.85 2012/03/10 18:42:18 dsl Exp $
 .\"
 .\" Copyright (c) 2002-2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 11, 2012
+.Dd March 10, 2012
 .Dt INSTALLBOOT 8
 .Os
 .Sh NAME
@@ -165,6 +165,7 @@ at block number
 .Ar s1bno
 instead of the default location for the machine and file system type.
 .Sy [ alpha ,
+.Sy i386/amd64 (bootxx_fat16 only) ,
 .Sy pmax ,
 .Sy vax ]
 .
@@ -453,6 +454,12 @@ any
 It also uses the information in the
 .Ql Boot Parameter Block
 to get the media and filesytem properties.
+The
+.Ql hidden sectors
+field of the BPB must the offset of the partition in the disk.
+This can be set using the
+.Fl b Ar s1bno
+option.
 .
 .It Pa /usr/mdec/bootxx_ffsv1
 Primary bootstrap for

Index: src/usr.sbin/installboot/arch/i386.c
diff -u src/usr.sbin/installboot/arch/i386.c:1.37 src/usr.sbin/installboot/arch/i386.c:1.38
--- src/usr.sbin/installboot/arch/i386.c:1.37	Sun Aug 14 17:50:17 2011
+++ src/usr.sbin/installboot/arch/i386.c	Sat Mar 10 18:42:18 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: i386.c,v 1.37 2011/08/14 17:50:17 christos Exp $ */
+/* $NetBSD: i386.c,v 1.38 2012/03/10 18:42:18 dsl Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(__lint)
-__RCSID("$NetBSD: i386.c,v 1.37 2011/08/14 17:50:17 christos Exp $");
+__RCSID("$NetBSD: i386.c,v 1.38 2012/03/10 18:42:18 dsl Exp $");
 #endif /* !__lint */
 
 #include <sys/param.h>
@@ -79,13 +79,15 @@ struct ib_mach ib_mach_i386 =
 	{ "i386", i386_setboot, no_clearboot, i386_editboot,
 		IB_RESETVIDEO | IB_CONSOLE | IB_CONSPEED | IB_CONSADDR |
 		IB_KEYMAP | IB_PASSWORD | IB_TIMEOUT |
-		IB_MODULES | IB_BOOTCONF };
+		IB_MODULES | IB_BOOTCONF |
+		IB_STAGE1START };
 
 struct ib_mach ib_mach_amd64 =
 	{ "amd64", i386_setboot, no_clearboot, i386_editboot,
 		IB_RESETVIDEO | IB_CONSOLE | IB_CONSPEED | IB_CONSADDR |
 		IB_KEYMAP | IB_PASSWORD | IB_TIMEOUT |
-		IB_MODULES | IB_BOOTCONF };
+		IB_MODULES | IB_BOOTCONF |
+		IB_STAGE1START };
 
 /*
  * Attempting to write the 'labelsector' (or a sector near it - within 8k?)
@@ -440,6 +442,9 @@ i386_setboot(ib_params *params)
 				/* Old BPB is shorter, leave zero filled */
 				u = disk_buf.b[1];
 			}
+			if (params->s1start != 0)
+				/* Fixup physical offset of filesytem */
+				bpb->bpbHiddenSecs = htole32(params->s1start);
 			memcpy(bootstrap.b + 2, disk_buf.b + 2, u);
 		}
 		#undef USE_F

Reply via email to