summaryrefslogtreecommitdiff
path: root/sys/arch/i386/stand/installboot/installboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/i386/stand/installboot/installboot.c')
-rw-r--r--sys/arch/i386/stand/installboot/installboot.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/sys/arch/i386/stand/installboot/installboot.c b/sys/arch/i386/stand/installboot/installboot.c
index 43c3d50ac0b..3063302c72b 100644
--- a/sys/arch/i386/stand/installboot/installboot.c
+++ b/sys/arch/i386/stand/installboot/installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: installboot.c,v 1.4 1997/07/17 22:47:01 mickey Exp $ */
+/* $OpenBSD: installboot.c,v 1.5 1997/08/22 20:03:17 mickey Exp $ */
/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
/*
@@ -41,6 +41,13 @@
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
#include <ufs/ffs/fs.h>
+
+#include <vm/vm.h>
+#include <sys/sysctl.h>
+
+#include <machine/cpu.h>
+#include <machine/biosvar.h>
+
#include <err.h>
#include <a.out.h>
#include <fcntl.h>
@@ -64,6 +71,9 @@ u_int8_t *block_count_p; /* block count var. in prototype image */
u_int8_t *block_table_p; /* block number array in prototype image */
int maxblocknum; /* size of this array */
+#ifdef CPU_BIOSDEV
+int biosdev;
+#endif
char *loadprotoblocks __P((char *, long *));
int loadblocknums __P((char *, int));
@@ -127,6 +137,32 @@ main(argc, argv)
printf("device: %s\n", dev);
}
+#ifdef CPU_BIOSDEV
+ if (heads == -1 || nsectors == -1) {
+ int mib[3], size;
+
+ mib[0] = CTL_MACHDEP;
+ mib[1] = CPU_BIOSDEV;
+ size = sizeof(int);
+
+ if (sysctl(mib, 2, &biosdev, &size, NULL, 0) == -1)
+ err(1, "sysctl");
+
+ if (biosdev & 0x80) {
+ int geo;
+
+ mib[1] = CPU_BIOSGEOMETRY;
+ size = sizeof(int);
+
+ if (sysctl(mib, 2, &geo, &size, NULL, 0) == -1)
+ err(1, "sysctl");
+
+ heads = BIOSNHEADS(geo);
+ nsectors = BIOSNSECTS(geo);
+ }
+ }
+#endif
+
/* Load proto blocks into core */
if ((protostore = loadprotoblocks(proto, &protosize)) == NULL)
exit(1);