fix ultrasparc support.
This commit is contained in:
parent
b74059e5cf
commit
9bea0e1a52
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: binstall.sh,v 1.6 2000/08/10 13:34:39 mrg Exp $
|
||||
# $NetBSD: binstall.sh,v 1.7 2000/08/20 14:56:28 mrg Exp $
|
||||
#
|
||||
|
||||
vecho () {
|
||||
|
@ -11,7 +11,7 @@ vecho () {
|
|||
}
|
||||
|
||||
Usage () {
|
||||
echo "Usage: $0 [-hvt] [-m<path>] net|ffs directory"
|
||||
echo "Usage: $0 [-hvtuU] [-m<path>] net|ffs directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ Help () {
|
|||
echo "Options:"
|
||||
echo " -h - display this message"
|
||||
echo " -u - install sparc64 (UltraSPARC) boot block"
|
||||
echo " -U - install sparc boot block"
|
||||
echo " -b<bootprog> - second-stage boot program to install"
|
||||
echo " -m<path> - Look for boot programs in <path> (default: /usr/mdec)"
|
||||
echo " -v - verbose mode"
|
||||
|
@ -42,7 +43,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
|||
MDEC=${MDEC:-/usr/mdec}
|
||||
BOOTPROG=${BOOTPROG:-boot}
|
||||
OFWBOOT=${OFWBOOTBLK:-ofwboot}
|
||||
if [ "`uname -m`" = sparc64 ]; then
|
||||
if [ "`sysctl -n hw.machine`" = sparc64 ]; then
|
||||
ULTRASPARC=1
|
||||
else
|
||||
ULTRASPARC=0
|
||||
|
@ -52,7 +53,7 @@ if [ "`sysctl -n kern.securelevel`" -gt 0 ]; then
|
|||
Secure
|
||||
fi
|
||||
|
||||
set -- `getopt "b:hm:tv" "$@"`
|
||||
set -- `getopt "b:hm:tvuU" "$@"`
|
||||
if [ $? -gt 0 ]; then
|
||||
Usage
|
||||
fi
|
||||
|
@ -62,9 +63,9 @@ do
|
|||
case $1 in
|
||||
-h) Help; shift ;;
|
||||
-u) ULTRASPARC=1; shift ;;
|
||||
-U) ULTRASPARC=0; shift ;;
|
||||
-b) BOOTPROG=$2; OFWBOOT=$2; shift 2 ;;
|
||||
-m) MDEC=$2; shift 2 ;;
|
||||
-o) OFWBOOT=$2; shift 2 ;;
|
||||
-t) TEST=1; VERBOSE=1; shift ;;
|
||||
-v) VERBOSE=1; shift ;;
|
||||
--) shift; break ;;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: installboot.c,v 1.6 2000/08/10 13:29:40 mrg Exp $ */
|
||||
/* $NetBSD: installboot.c,v 1.7 2000/08/20 14:56:30 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -85,7 +85,7 @@ int32_t *block_count_p; /* size of this array */
|
|||
int32_t *block_size_p; /* filesystem block size */
|
||||
int32_t max_block_count;
|
||||
|
||||
char *loadprotoblocks __P((char *, long *));
|
||||
char *loadprotoblocks __P((char *, size_t *));
|
||||
int loadblocknums __P((char *, int));
|
||||
static void devread __P((int, void *, daddr_t, size_t, char *));
|
||||
static void usage __P((void));
|
||||
|
@ -117,7 +117,7 @@ main(argc, argv)
|
|||
int c;
|
||||
int devfd;
|
||||
char *protostore;
|
||||
long protosize;
|
||||
size_t protosize;
|
||||
struct utsname utsname;
|
||||
|
||||
/*
|
||||
|
@ -194,17 +194,24 @@ main(argc, argv)
|
|||
} else {
|
||||
struct stat sb;
|
||||
int protofd;
|
||||
size_t blanklen;
|
||||
|
||||
if ((protofd = open(dev, O_RDONLY)) < 0)
|
||||
if ((protofd = open(proto, O_RDONLY)) < 0)
|
||||
err(1, "open: %s", proto);
|
||||
|
||||
if (fstat(protofd, &sb) < 0)
|
||||
err(1, "fstat: %s", proto);
|
||||
|
||||
protosize = sb.st_size;
|
||||
if ((protostore = mmap(0, (size_t)protosize, PROT_READ,
|
||||
MAP_SHARED, protofd, 0)) == MAP_FAILED)
|
||||
/* there must be a better way */
|
||||
blanklen = DEV_BSIZE - ((sb.st_size + DEV_BSIZE) & (DEV_BSIZE - 1));
|
||||
protosize = sb.st_size + blanklen;
|
||||
if ((protostore = mmap(0, (size_t)protosize,
|
||||
PROT_READ|PROT_WRITE, MAP_PRIVATE,
|
||||
protofd, 0)) == MAP_FAILED)
|
||||
err(1, "mmap: %s", proto);
|
||||
/* and provide the rest of the block */
|
||||
if (blanklen)
|
||||
memset(protostore + sb.st_size, 0, blanklen);
|
||||
}
|
||||
|
||||
if (nowrite)
|
||||
|
@ -232,7 +239,7 @@ main(argc, argv)
|
|||
char *
|
||||
loadprotoblocks(fname, size)
|
||||
char *fname;
|
||||
long *size;
|
||||
size_t *size;
|
||||
{
|
||||
int fd, sz;
|
||||
u_long ap, bp, st, en;
|
||||
|
|
Loading…
Reference in New Issue