Hi list,

I have hardware where the LBA boot fails with "ERR R". Forcing CHS mode
allows me to boot the hardware just fine.

To make life easier, I have added an option "-c" to installboot. This
option sets the global symbol "_force_chs" to 1 in biosboot to save me
from pressing shift at start up.

Regards,
Florian

P.S.: A comment in biosboot.S actually suggested a "-c" option.

Index: installboot.8
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/installboot/installboot.8,v
retrieving revision 1.29
diff -u -p -u -r1.29 installboot.8
--- installboot.8       6 Mar 2010 16:16:43 -0000       1.29
+++ installboot.8       21 Jan 2014 17:24:59 -0000
@@ -33,7 +33,7 @@
 .Nd installs a bootstrap on an FFS disk or partition
 .Sh SYNOPSIS
 .Nm installboot
-.Op Fl nv
+.Op Fl cnv
 .Ar boot
 .Ar biosboot
 .Ar disk
@@ -52,6 +52,8 @@ Various filesystem parameters are also p
 .Pp
 The options are as follows:
 .Bl -tag -width flag_opt
+.It Fl c
+Force CHS mode in biosboot.
 .It Fl n
 Do not actually write anything on the disk.
 .It Fl v
Index: installboot.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/installboot/installboot.c,v
retrieving revision 1.70
diff -u -p -u -r1.70 installboot.c
--- installboot.c       13 Nov 2013 04:11:34 -0000      1.70
+++ installboot.c       21 Jan 2014 17:24:59 -0000
@@ -75,7 +75,7 @@ struct        sym_data {
 };
 
 extern char *__progname;
-int    verbose, nowrite = 0;
+int    verbose, nowrite = 0, forcechs = 0;
 char   *boot, *proto, *dev, *realdev;
 char   *protostore;
 long   protosize;
@@ -87,6 +87,7 @@ struct sym_data pbr_symbols[] = {
        {"_inodeblk",   4},
        {"_inodedbl",   4},
        {"_nblocks",    2},
+       {"_force_chs",  1},
        {NULL}
 };
 
@@ -113,7 +114,7 @@ static void sr_installpbr(int, int, int)
 static void
 usage(void)
 {
-       fprintf(stderr, "usage: %s [-nv] boot biosboot device\n", __progname);
+       fprintf(stderr, "usage: %s [-cnv] boot biosboot device\n", __progname);
        exit(1);
 }
 
@@ -130,8 +131,12 @@ main(int argc, char *argv[])
        int     devfd;
        struct  disklabel dl;
 
-       while ((c = getopt(argc, argv, "vn")) != -1) {
+       while ((c = getopt(argc, argv, "cnv")) != -1) {
                switch (c) {
+               case 'c':
+                       /* Force CHS mode */
+                       forcechs = 1;
+                       break;
                case 'n':
                        /* Do not actually write the bootblock to disk. */
                        nowrite = 1;
@@ -542,6 +547,7 @@ getbootparams(char *boot, int devfd, str
        sym_set_value(pbr_symbols, "_inodedbl",
            ((((char *)ap) - buf) + INODEOFF));
        sym_set_value(pbr_symbols, "_nblocks", ndb);
+       sym_set_value(pbr_symbols, "_force_chs", forcechs);
 
        if (verbose) {
                fprintf(stderr, "%s is %d blocks x %d bytes\n",
@@ -758,6 +764,7 @@ sr_installboot(int devfd)
        sym_set_value(pbr_symbols, "_inodeblk", inodeblk);
        sym_set_value(pbr_symbols, "_inodedbl", inodedbl);
        sym_set_value(pbr_symbols, "_nblocks", nblocks);
+       sym_set_value(pbr_symbols, "_force_chs", forcechs);
 
        if (verbose)
                fprintf(stderr, "%s is %d blocks x %d bytes\n",

Reply via email to