Major revamp of the boot code.
- Good bye SYS_PBOOT and SYS_NBOOT, hello SYS_UBOOT (unified boot) Currently supports booting from SCSI and HP-IB disk and network from a single boot block. Infrastructure for booting from HP-IB tape is there, but it doesn't quite work yet. - Add a slightly modified version of Gordon Ross's "rawfs", which provides a filesystem-like interface to tape devices. Still needs debugging (see above). - Rename sys_inst.c to inst.c, so that the LIF directory entry turns out right (used to look like SYS_SYS_I if loaded from tape). - Add a "netio_ask" hint to netio.c, so that a special instnetio.o doesn't have to be compiled for SYS_INST. Defaults to using bootparams, but if set, will prompt user for information usually obtained from bootparams. - General cleanup.
This commit is contained in:
parent
a63c9b84e2
commit
fc699e8440
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: Makefile,v 1.19 1996/01/15 01:41:37 thorpej Exp $
|
# $NetBSD: Makefile,v 1.20 1996/06/26 17:44:21 thorpej Exp $
|
||||||
|
|
||||||
# @(#)Makefile 8.1 (Berkeley) 6/10/93
|
# @(#)Makefile 8.1 (Berkeley) 6/10/93
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ LIBSA= ${SA_LIB}
|
||||||
|
|
||||||
LIBS= ${OBJS} libdrive.a ${LIBSA} ${LIBKERN}
|
LIBS= ${OBJS} libdrive.a ${LIBSA} ${LIBKERN}
|
||||||
|
|
||||||
BOOTS= pboot netboot sys_inst dboot dcopy tboot tcopy cat #ls
|
BOOTS= uboot inst
|
||||||
ALL= ${BOOTS} mkboot installboot
|
ALL= ${BOOTS} mkboot installboot
|
||||||
|
|
||||||
all: ${ALL}
|
all: ${ALL}
|
||||||
|
@ -62,76 +62,21 @@ ite.o ite_subr.o ite_dv.o ite_gb.o ite_hy.o ite_rb.o ite_tc.o: Makefile
|
||||||
srt0.o: ${.CURDIR}/srt0.s
|
srt0.o: ${.CURDIR}/srt0.s
|
||||||
${CC} ${INCPATH} ${DEFS} -c ${.CURDIR}/srt0.s
|
${CC} ${INCPATH} ${DEFS} -c ${.CURDIR}/srt0.s
|
||||||
|
|
||||||
tpsrt0.o: ${.CURDIR}/srt0.s
|
# unified boot program (disk, network, tape)
|
||||||
${CC} ${INCPATH} ${DEFS} -DTP -c ${.CURDIR}/srt0.s -o $@
|
uboot: srt0.o uboot.o tgets.o netio.o clock.o conf.o ${LIBS}
|
||||||
|
${LD} -N -T ${RELOC} -e begin srt0.o uboot.o tgets.o netio.o clock.o \
|
||||||
# new boot
|
conf.o ${LIBS} -o $@
|
||||||
pboot: srt0.o pboot.o tgets.o conf.o ${LIBS}
|
|
||||||
${LD} -N -T ${RELOC} -e begin srt0.o pboot.o tgets.o conf.o ${LIBS} -o $@
|
|
||||||
@size $@
|
@size $@
|
||||||
@echo $@ total size should not exceed 1044480 bytes
|
@echo $@ total size should not exceed 1044480 bytes
|
||||||
|
|
||||||
ls: srt0.o ls.o conf.o ${LIBS}
|
# miniroot installation program
|
||||||
${LD} -N -T ${RELOC} -e begin srt0.o ls.o conf.o ${LIBS} -o $@
|
inst: srt0.o inst.o clock.o conf.o netio.o tgets.o ${LIBS}
|
||||||
|
${LD} -N -T ${RELOC} -e begin srt0.o inst.o clock.o conf.o netio.o \
|
||||||
|
tgets.o ${LIBS} -o $@
|
||||||
@size $@
|
@size $@
|
||||||
@echo $@ total size should not exceed 1044480 bytes
|
@echo $@ total size should not exceed 1044480 bytes
|
||||||
|
|
||||||
cat: srt0.o cat.o conf.o ${LIBS}
|
# helper program ... turns OMAGIC into LIF
|
||||||
${LD} -N -T ${RELOC} -e begin srt0.o cat.o conf.o ${LIBS} -o $@
|
|
||||||
@size $@
|
|
||||||
@echo $@ total size should not exceed 1044480 bytes
|
|
||||||
|
|
||||||
# installation
|
|
||||||
sys_inst: srt0.o sys_inst.o clock.o instconf.o inst_netio.o tgets.o ${LIBS}
|
|
||||||
${LD} -N -T ${RELOC} -e begin srt0.o sys_inst.o clock.o instconf.o inst_netio.o tgets.o ${LIBS} -o $@
|
|
||||||
@size $@
|
|
||||||
@echo $@ total size should not exceed 1044480 bytes
|
|
||||||
|
|
||||||
instconf.o: ${.CURDIR}/conf.c
|
|
||||||
${CC} ${CFLAGS} -DSYS_INST -c ${.CURDIR}/conf.c -o $@
|
|
||||||
|
|
||||||
inst_netio.o: ${.CURDIR}/netio.c
|
|
||||||
${CC} ${CFLAGS} -DSYS_INST -c ${.CURDIR}/netio.c -o $@
|
|
||||||
|
|
||||||
# bootable from network
|
|
||||||
|
|
||||||
netboot: srt0.o netboot.o clock.o netconf.o netio.o tgets.o ${LIBS}
|
|
||||||
${LD} -N -T ${RELOC} -e begin srt0.o netboot.o clock.o netconf.o netio.o tgets.o ${LIBS} -o $@
|
|
||||||
@size $@
|
|
||||||
@echo $@ total size should not exceed 1044480 bytes
|
|
||||||
|
|
||||||
netconf.o: ${.CURDIR}/conf.c
|
|
||||||
${CC} ${CFLAGS} -DNETBOOT -c ${.CURDIR}/conf.c -o $@
|
|
||||||
|
|
||||||
# bootable from tape
|
|
||||||
|
|
||||||
tboot: srt0.o tboot.o conf.o ${LIBS}
|
|
||||||
${LD} -N -T ${RELOC} -e begin srt0.o tboot.o conf.o ${LIBS} -o $@
|
|
||||||
@size $@
|
|
||||||
@echo $@ total size should not exceed 1044480 bytes
|
|
||||||
|
|
||||||
tboot.o: ${.CURDIR}/boot.c
|
|
||||||
${CC} ${CFLAGS} -DJUSTASK -c ${.CURDIR}/boot.c -o $@
|
|
||||||
|
|
||||||
tcopy: tpsrt0.o copy.o conf.o ${LIBS}
|
|
||||||
${LD} -N -T ${RELOC} -e begin tpsrt0.o copy.o conf.o ${LIBS} -o $@
|
|
||||||
@size $@
|
|
||||||
@echo $@ total size should not exceed 1044480 bytes
|
|
||||||
|
|
||||||
# bootable from floppy or real disks
|
|
||||||
|
|
||||||
dboot: srt0.o boot.o tapeconf.o ${LIBS}
|
|
||||||
${LD} -N -T ${RELOC} -e begin srt0.o boot.o tapeconf.o ${LIBS} -o $@
|
|
||||||
@size $@
|
|
||||||
@echo $@ text+data size should not exceed 57344 bytes
|
|
||||||
@echo $@ total size should not exceed 1044480 bytes
|
|
||||||
|
|
||||||
tapeconf.o: ${.CURDIR}/conf.c
|
|
||||||
${CC} ${CFLAGS} -DTAPEBOOT -c ${.CURDIR}/conf.c -o $@
|
|
||||||
|
|
||||||
dcopy: srt0.o copy.o conf.o ${LIBS}
|
|
||||||
${LD} -N -T ${RELOC} -e begin srt0.o copy.o conf.o ${LIBS} -o $@
|
|
||||||
|
|
||||||
mkboot: ${.CURDIR}/mkboot.c
|
mkboot: ${.CURDIR}/mkboot.c
|
||||||
${CC} ${CFLAGS} ${.CURDIR}/mkboot.c -o $@
|
${CC} ${CFLAGS} ${.CURDIR}/mkboot.c -o $@
|
||||||
|
|
||||||
|
@ -142,35 +87,34 @@ installboot: ${.CURDIR}/installboot.sh
|
||||||
# utilities
|
# utilities
|
||||||
|
|
||||||
clean::
|
clean::
|
||||||
rm -f *.o *.exe *.i errs make.out
|
rm -f *.o *.i
|
||||||
rm -f a.out pboot cat ls tboot tcopy
|
rm -f a.out ${BOOTS}
|
||||||
rm -f boot[a-z]? boot[a-wyz][a-z].c conf[a-wyz][a-z].c
|
rm -f libdrive.a mkboot installboot *.lif
|
||||||
rm -f core sboot
|
|
||||||
rm -f libdrive.a mkboot dboot dcopy installboot *.lif
|
|
||||||
|
|
||||||
install: mkboot installboot ${ALL}
|
install: mkboot installboot ${ALL}
|
||||||
./mkboot pboot netbsdboot.lif
|
./mkboot uboot uboot.lif
|
||||||
./mkboot netboot netboot.lif
|
./mkboot inst inst.lif
|
||||||
./mkboot sys_inst sys_inst.lif
|
install -d -m 755 -o ${BINOWN} -g ${BINGRP} ${DESTDIR}/usr/mdec/rbootd
|
||||||
./mkboot dboot diskboot.lif
|
|
||||||
./mkboot tboot tcopy tapeboot.lif
|
|
||||||
install -c -o ${BINOWN} -g ${BINGRP} -m 555 installboot \
|
install -c -o ${BINOWN} -g ${BINGRP} -m 555 installboot \
|
||||||
${DESTDIR}/usr/mdec
|
${DESTDIR}/usr/mdec
|
||||||
install -c -o ${BINOWN} -g ${BINGRP} -m 444 netbsdboot.lif \
|
install -c -o ${BINOWN} -g ${BINGRP} -m 444 uboot.lif \
|
||||||
${DESTDIR}/usr/mdec/rdboot
|
${DESTDIR}/usr/mdec
|
||||||
|
rm -f ${DESTDIR}/usr/mdec/rdboot
|
||||||
|
ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/rdboot
|
||||||
rm -f ${DESTDIR}/usr/mdec/bootrd
|
rm -f ${DESTDIR}/usr/mdec/bootrd
|
||||||
ln ${DESTDIR}/usr/mdec/rdboot ${DESTDIR}/usr/mdec/bootrd
|
ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/bootrd
|
||||||
rm -f ${DESTDIR}/usr/mdec/sdboot
|
rm -f ${DESTDIR}/usr/mdec/sdboot
|
||||||
ln ${DESTDIR}/usr/mdec/rdboot ${DESTDIR}/usr/mdec/sdboot
|
ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/sdboot
|
||||||
rm -f ${DESTDIR}/usr/mdec/bootsd
|
rm -f ${DESTDIR}/usr/mdec/bootsd
|
||||||
ln ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/bootsd
|
ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/bootsd
|
||||||
install -d -m 755 -o ${BINOWN} -g ${BINGRP} ${DESTDIR}/usr/mdec/rbootd
|
rm -f ${DESTDIR}/usr/mdec/ctboot
|
||||||
install -c -o ${BINOWN} -g ${BINGRP} -m 444 netboot.lif \
|
ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/ctboot
|
||||||
${DESTDIR}/usr/mdec/rbootd/SYS_NBOOT
|
rm -f ${DESTDIR}/usr/mdec/bootct
|
||||||
install -c -o ${BINOWN} -g ${BINGRP} -m 444 sys_inst.lif \
|
ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/bootct
|
||||||
|
rm -f ${DESTDIR}/usr/mdec/rbootd/SYS_UBOOT
|
||||||
|
ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/rbootd/SYS_UBOOT
|
||||||
|
install -c -o ${BINOWN} -g ${BINGRP} -m 444 inst.lif \
|
||||||
${DESTDIR}/usr/mdec/rbootd/SYS_INST
|
${DESTDIR}/usr/mdec/rbootd/SYS_INST
|
||||||
install -c -o ${BINOWN} -g ${BINGRP} -m 644 tapeboot.lif \
|
|
||||||
${DESTDIR}/usr/mdec/bootct
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
.include <bsd.subdir.mk>
|
.include <bsd.subdir.mk>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: autoconf.c,v 1.9 1995/08/05 16:47:34 thorpej Exp $ */
|
/* $NetBSD: autoconf.c,v 1.10 1996/06/26 17:44:23 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988 University of Utah.
|
* Copyright (c) 1988 University of Utah.
|
||||||
|
@ -57,7 +57,9 @@
|
||||||
* WARNING: major numbers must match bdevsw indices in hp300/conf.c.
|
* WARNING: major numbers must match bdevsw indices in hp300/conf.c.
|
||||||
*/
|
*/
|
||||||
char rom2mdev[] = {
|
char rom2mdev[] = {
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0-13: none */
|
0, 0, /* 0-1: none */
|
||||||
|
6, /* 2: network device; special */
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3-13: none */
|
||||||
4, /* 14: SCSI disk */
|
4, /* 14: SCSI disk */
|
||||||
0, /* 15: none */
|
0, /* 15: none */
|
||||||
2, /* 16: CS/80 device on HPIB */
|
2, /* 16: CS/80 device on HPIB */
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
/* $NetBSD: boot.c,v 1.6 1995/02/21 09:06:13 mycroft Exp $ */
|
|
||||||
|
|
||||||
/*-
|
|
||||||
* Copyright (c) 1982, 1986, 1990, 1993
|
|
||||||
* The Regents of the University of California. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* @(#)boot.c 8.1 (Berkeley) 6/10/93
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/reboot.h>
|
|
||||||
#include <a.out.h>
|
|
||||||
#include "stand.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Boot program... bits in `howto' determine whether boot stops to
|
|
||||||
* ask for system name. Boot device is derived from ROM provided
|
|
||||||
* information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
char line[100];
|
|
||||||
|
|
||||||
extern u_int opendev;
|
|
||||||
extern char *lowram;
|
|
||||||
extern int noconsole;
|
|
||||||
extern int howto, bootdev;
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
int retry, type;
|
|
||||||
|
|
||||||
printf("%s CPU\nBoot\n", getmachineid());
|
|
||||||
#ifdef JUSTASK
|
|
||||||
howto = RB_ASKNAME|RB_SINGLE;
|
|
||||||
#else
|
|
||||||
if ((howto & RB_ASKNAME) == 0) {
|
|
||||||
type = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
|
|
||||||
if ((unsigned)type < ndevs && devsw[type].dv_name)
|
|
||||||
strcpy(line, "/netbsd");
|
|
||||||
else
|
|
||||||
howto |= RB_SINGLE|RB_ASKNAME;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
for (retry = 0;;) {
|
|
||||||
if (!noconsole && (howto & RB_ASKNAME)) {
|
|
||||||
printf(": ");
|
|
||||||
gets(line);
|
|
||||||
if (line[0] == 0) {
|
|
||||||
strcpy(line, "/netbsd");
|
|
||||||
printf(": %s\n", line);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
printf(": %s\n", line);
|
|
||||||
exec(line, lowram, howto);
|
|
||||||
printf("boot: %s\n", strerror(errno));
|
|
||||||
howto |= RB_SINGLE|RB_ASKNAME;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
machdep_start(entry, howto, loadaddr, ssym, esym)
|
|
||||||
char *entry;
|
|
||||||
int howto;
|
|
||||||
char *loadaddr;
|
|
||||||
char *ssym, *esym;
|
|
||||||
{
|
|
||||||
|
|
||||||
asm("movl %0,d7" : : "m" (howto));
|
|
||||||
asm("movl %0,d6" : : "m" (opendev));
|
|
||||||
asm("movl %0,a5" : : "a" (loadaddr));
|
|
||||||
asm("movl %0,a4" : : "a" (esym));
|
|
||||||
(*((int (*)())entry))();
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: conf.c,v 1.10 1995/09/23 17:28:11 thorpej Exp $ */
|
/* $NetBSD: conf.c,v 1.11 1996/06/26 17:44:26 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1982, 1986, 1990, 1993
|
* Copyright (c) 1982, 1986, 1990, 1993
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
#include "stand.h"
|
#include "stand.h"
|
||||||
|
|
||||||
#if defined(NETBOOT) || defined(SYS_INST)
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
@ -47,38 +46,22 @@
|
||||||
#include <netinet/in_systm.h>
|
#include <netinet/in_systm.h>
|
||||||
|
|
||||||
#include "nfs.h"
|
#include "nfs.h"
|
||||||
|
#include "rawfs.h"
|
||||||
#endif /* NETBOOT || SYS_INST */
|
|
||||||
|
|
||||||
#ifndef NETBOOT
|
|
||||||
#include "ufs.h"
|
#include "ufs.h"
|
||||||
#endif /* ! NETBOOT */
|
|
||||||
|
|
||||||
int debug = 0; /* XXX */
|
int debug = 0; /* XXX */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Device configuration
|
* Device configuration
|
||||||
*/
|
*/
|
||||||
#if defined(NETBOOT) || defined(SYS_INST)
|
|
||||||
int netstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
|
int netstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
|
||||||
int netopen __P((struct open_file *, ...));
|
int netopen __P((struct open_file *, ...));
|
||||||
int netclose __P((struct open_file *));
|
int netclose __P((struct open_file *));
|
||||||
#define netioctl noioctl
|
#define netioctl noioctl
|
||||||
#endif /* NETBOOT || SYS_INST */
|
|
||||||
|
|
||||||
#ifndef NETBOOT
|
|
||||||
/* XXX: no support for tapes in SYS_INST yet. */
|
|
||||||
#ifdef TAPEBOOT
|
|
||||||
int ctstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
|
int ctstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
|
||||||
int ctopen __P((struct open_file *, ...));
|
int ctopen __P((struct open_file *, ...));
|
||||||
int ctclose __P((struct open_file *));
|
int ctclose __P((struct open_file *));
|
||||||
#else
|
|
||||||
#define ctstrategy \
|
|
||||||
(int (*) __P((void *, int, daddr_t, size_t, void *, size_t *)))nullsys
|
|
||||||
#define ctopen (int (*) __P((struct open_file *, ...)))nodev
|
|
||||||
#define ctclose (int (*) __P((struct open_file *)))nullsys
|
|
||||||
#endif /* TAPEBOOT */
|
|
||||||
|
|
||||||
#define ctioctl noioctl
|
#define ctioctl noioctl
|
||||||
|
|
||||||
int rdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
|
int rdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
|
||||||
|
@ -96,46 +79,46 @@ int sdclose __P((struct open_file *));
|
||||||
#define xxopen (int (*) __P((struct open_file *, ...)))nodev
|
#define xxopen (int (*) __P((struct open_file *, ...)))nodev
|
||||||
#define xxclose (int (*) __P((struct open_file *)))nullsys
|
#define xxclose (int (*) __P((struct open_file *)))nullsys
|
||||||
|
|
||||||
#endif /* ! NETBOOT */
|
/*
|
||||||
|
* Note: "le" isn't a major offset.
|
||||||
|
*/
|
||||||
struct devsw devsw[] = {
|
struct devsw devsw[] = {
|
||||||
#ifdef NETBOOT
|
|
||||||
{ "le", netstrategy, netopen, netclose, netioctl }, /*0*/
|
|
||||||
#else
|
|
||||||
{ "ct", ctstrategy, ctopen, ctclose, ctioctl }, /*0*/
|
{ "ct", ctstrategy, ctopen, ctclose, ctioctl }, /*0*/
|
||||||
{ "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
|
{ "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
|
||||||
{ "rd", rdstrategy, rdopen, rdclose, rdioctl }, /*2*/
|
{ "rd", rdstrategy, rdopen, rdclose, rdioctl }, /*2*/
|
||||||
{ "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
|
{ "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
|
||||||
{ "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
|
{ "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
|
||||||
#ifdef SYS_INST
|
{ "??", xxstrategy, xxopen, xxclose, noioctl }, /*5*/
|
||||||
{ "le", netstrategy, netopen, netclose, netioctl },
|
{ "le", netstrategy, netopen, netclose, netioctl },/*6*/
|
||||||
#endif /* SYS_INST */
|
|
||||||
#endif /* NETBOOT */
|
|
||||||
};
|
};
|
||||||
int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
|
int ndevs = (sizeof(devsw) / sizeof(devsw[0]));
|
||||||
|
|
||||||
/*
|
|
||||||
* Filesystem configuration
|
|
||||||
*/
|
|
||||||
struct fs_ops file_system[] = {
|
|
||||||
#ifndef NETBOOT
|
|
||||||
{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
|
|
||||||
#endif /* ! NETBOOT */
|
|
||||||
#if defined(NETBOOT) || defined(SYS_INST)
|
|
||||||
{ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
|
|
||||||
#endif /* NETBOOT || SYS_INST */
|
|
||||||
};
|
|
||||||
|
|
||||||
int nfsys = (sizeof(file_system) / sizeof(file_system[0]));
|
|
||||||
|
|
||||||
#if defined(NETBOOT) || defined(SYS_INST)
|
|
||||||
extern struct netif_driver le_driver;
|
extern struct netif_driver le_driver;
|
||||||
|
|
||||||
struct netif_driver *netif_drivers[] = {
|
struct netif_driver *netif_drivers[] = {
|
||||||
&le_driver,
|
&le_driver,
|
||||||
};
|
};
|
||||||
int n_netif_drivers = sizeof(netif_drivers)/sizeof(netif_drivers[0]);
|
int n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
|
||||||
#endif /* NETBOOT */
|
|
||||||
|
/*
|
||||||
|
* Filesystem configuration
|
||||||
|
*/
|
||||||
|
struct fs_ops file_system_rawfs[] = {
|
||||||
|
{ rawfs_open, rawfs_close, rawfs_read, rawfs_write, rawfs_seek,
|
||||||
|
rawfs_stat },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct fs_ops file_system_ufs[] = {
|
||||||
|
{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct fs_ops file_system_nfs[] = {
|
||||||
|
{ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct fs_ops file_system[1];
|
||||||
|
int nfsys = 1; /* we always know which one we want */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Inititalize controllers
|
* Inititalize controllers
|
||||||
|
@ -144,11 +127,7 @@ int n_netif_drivers = sizeof(netif_drivers)/sizeof(netif_drivers[0]);
|
||||||
*/
|
*/
|
||||||
void ctlrinit()
|
void ctlrinit()
|
||||||
{
|
{
|
||||||
#if defined(NETBOOT) || defined(SYS_INST)
|
|
||||||
leinit();
|
leinit();
|
||||||
#endif /* NETBOOT || SYS_INST */
|
|
||||||
#ifndef NETBOOT
|
|
||||||
hpibinit();
|
hpibinit();
|
||||||
scsiinit();
|
scsiinit();
|
||||||
#endif /* ! NETBOOT */
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* $NetBSD: devopen.c,v 1.5 1995/08/05 16:47:41 thorpej Exp $ */
|
/* $NetBSD: devopen.c,v 1.6 1996/06/26 17:44:28 thorpej Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
|
||||||
* Copyright (c) 1993 John Brezak
|
* Copyright (c) 1993 John Brezak
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -61,10 +62,38 @@ devlookup(d, len)
|
||||||
struct devsw *dp = devsw;
|
struct devsw *dp = devsw;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ndevs; i++, dp++)
|
for (i = 0; i < ndevs; i++, dp++) {
|
||||||
if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0)
|
if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0) {
|
||||||
return(i);
|
/*
|
||||||
|
* Set the filesystem and startup up according to the device
|
||||||
|
* being opened.
|
||||||
|
*/
|
||||||
|
switch (i) {
|
||||||
|
case 0: /* ct */
|
||||||
|
bcopy(file_system_rawfs, file_system, sizeof(struct fs_ops));
|
||||||
|
__machdep_start = machdep_start_disk_tape;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: /* rd */
|
||||||
|
case 4: /* sd */
|
||||||
|
bcopy(file_system_ufs, file_system, sizeof(struct fs_ops));
|
||||||
|
__machdep_start = machdep_start_disk_tape;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6: /* le */
|
||||||
|
bcopy(file_system_nfs, file_system, sizeof(struct fs_ops));
|
||||||
|
__machdep_start = machdep_start_net;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* Agh! What happened?! */
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
return(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bad:
|
||||||
printf("No such device - Configured devices are:\n");
|
printf("No such device - Configured devices are:\n");
|
||||||
for (dp = devsw, i = 0; i < ndevs; i++, dp++)
|
for (dp = devsw, i = 0; i < ndevs; i++, dp++)
|
||||||
if (dp->dv_name)
|
if (dp->dv_name)
|
||||||
|
@ -188,6 +217,37 @@ devopen(f, fname, file)
|
||||||
unit = B_UNIT(bootdev);
|
unit = B_UNIT(bootdev);
|
||||||
part = B_PARTITION(bootdev);
|
part = B_PARTITION(bootdev);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set up defaults for filesystem and startup, according to
|
||||||
|
* type detetect by the BOOT ROM.
|
||||||
|
*/
|
||||||
|
switch (dev) {
|
||||||
|
case 0: /* ct */
|
||||||
|
bcopy(file_system_rawfs, file_system, sizeof(struct fs_ops));
|
||||||
|
__machdep_start = machdep_start_disk_tape;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: /* rd */
|
||||||
|
case 4: /* sd */
|
||||||
|
bcopy(file_system_ufs, file_system, sizeof(struct fs_ops));
|
||||||
|
__machdep_start = machdep_start_disk_tape;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6: /* le */
|
||||||
|
bcopy(file_system_nfs, file_system, sizeof(struct fs_ops));
|
||||||
|
__machdep_start = machdep_start_net;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* XXX what else should we do here? */
|
||||||
|
printf("WARNING: BOGUS BOOT DEV TYPE 0x%x!\n", dev);
|
||||||
|
printf("FALLING BACK ON `sd'\n");
|
||||||
|
bcopy(file_system_ufs, file_system, sizeof(struct fs_ops));
|
||||||
|
__machdep_start = machdep_start_disk_tape;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file))
|
if (error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file))
|
||||||
return(error);
|
return(error);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sys_inst.c,v 1.3 1995/10/04 07:24:33 thorpej Exp $ */
|
/* $NetBSD: inst.c,v 1.1 1996/06/26 17:44:29 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Jason R. Thorpe.
|
* Copyright (c) 1995 Jason R. Thorpe.
|
||||||
|
@ -69,6 +69,7 @@ extern u_int opendev;
|
||||||
extern char *lowram;
|
extern char *lowram;
|
||||||
extern int noconsole;
|
extern int noconsole;
|
||||||
extern int cons_scode;
|
extern int cons_scode;
|
||||||
|
extern int netio_ask;
|
||||||
|
|
||||||
char *kernel_name = "/netbsd";
|
char *kernel_name = "/netbsd";
|
||||||
|
|
||||||
|
@ -99,9 +100,15 @@ main()
|
||||||
{
|
{
|
||||||
int i, currname = 0;
|
int i, currname = 0;
|
||||||
|
|
||||||
printf("\n>> NetBSD INSTALLATION HP9000/%s CPU\n",
|
/*
|
||||||
|
* We want netopen() to ask for IP address, etc, rather
|
||||||
|
* that using bootparams.
|
||||||
|
*/
|
||||||
|
netio_ask = 1;
|
||||||
|
|
||||||
|
printf("\n>> NetBSD MINIROOT INSTALLATION HP9000/%s CPU\n",
|
||||||
getmachineid());
|
getmachineid());
|
||||||
printf(">> $NetBSD: sys_inst.c,v 1.3 1995/10/04 07:24:33 thorpej Exp $\n");
|
printf(">> $NetBSD: inst.c,v 1.1 1996/06/26 17:44:29 thorpej Exp $\n");
|
||||||
gethelp();
|
gethelp();
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
|
@ -1,13 +1,15 @@
|
||||||
# $NetBSD: Makefile,v 1.4 1996/01/30 19:47:32 thorpej Exp $
|
# $NetBSD: Makefile,v 1.5 1996/06/26 17:44:42 thorpej Exp $
|
||||||
|
|
||||||
LIB= sa
|
LIB= sa
|
||||||
|
|
||||||
.PATH: ${.CURDIR}/../../../../lib/libsa
|
.PATH: ${.CURDIR}/../../../../lib/libsa
|
||||||
|
.PATH: ${.CURDIR}/..
|
||||||
|
|
||||||
# Don't need these now...
|
# Don't need these now...
|
||||||
# DEBUGFLAGS=-DNETIF_DEBUG -DRPC_DEBUG -DNFS_DEBUG -DRARP_DEBUG -DNET_DEBUG
|
# DEBUGFLAGS=-DNETIF_DEBUG -DRPC_DEBUG -DNFS_DEBUG -DRARP_DEBUG -DNET_DEBUG
|
||||||
|
|
||||||
CFLAGS+=-DSTANDALONE -DCOMPAT_UFS ${DEBUGFLAGS}
|
CFLAGS+=-DSTANDALONE -DCOMPAT_UFS -DNO_LSEEK ${DEBUGFLAGS}
|
||||||
|
CFLAGS+=-I${.CURDIR}/..
|
||||||
CFLAGS+=-I${.CURDIR}/../../../.. -I${.CURDIR}/../../../../lib/libsa
|
CFLAGS+=-I${.CURDIR}/../../../.. -I${.CURDIR}/../../../../lib/libsa
|
||||||
|
|
||||||
# stand routines
|
# stand routines
|
||||||
|
@ -25,7 +27,7 @@ SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c
|
||||||
SRCS+= bootp.c bootparam.c rarp.c
|
SRCS+= bootp.c bootparam.c rarp.c
|
||||||
|
|
||||||
# boot filesystems
|
# boot filesystems
|
||||||
SRCS+= ufs.c nfs.c
|
SRCS+= ufs.c nfs.c rawfs.o
|
||||||
|
|
||||||
NOPROFILE=
|
NOPROFILE=
|
||||||
NOPIC=
|
NOPIC=
|
||||||
|
|
|
@ -1,162 +0,0 @@
|
||||||
/* $NetBSD: netboot.c,v 1.10 1995/10/04 07:24:32 thorpej Exp $ */
|
|
||||||
|
|
||||||
/*-
|
|
||||||
* Copyright (c) 1982, 1986, 1990, 1993
|
|
||||||
* The Regents of the University of California. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* @(#)boot.c 8.1 (Berkeley) 6/10/93
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/reboot.h>
|
|
||||||
#include <a.out.h>
|
|
||||||
#include "stand.h"
|
|
||||||
#include "samachdep.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Boot program... bits in `howto' determine whether boot stops to
|
|
||||||
* ask for system name. Boot device is derived from ROM provided
|
|
||||||
* information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
char line[100];
|
|
||||||
|
|
||||||
extern u_int opendev;
|
|
||||||
extern char *lowram;
|
|
||||||
extern int noconsole;
|
|
||||||
extern int cons_scode;
|
|
||||||
|
|
||||||
char *name;
|
|
||||||
char *names[] = {
|
|
||||||
"netbsd", "onetbsd", "netbsd.old",
|
|
||||||
};
|
|
||||||
#define NUMNAMES (sizeof(names)/sizeof(char *))
|
|
||||||
|
|
||||||
static int bdev, badapt, bctlr, bunit, bpart;
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
int currname = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XXX: different versions of the HP boot rom seem to report
|
|
||||||
* different things, so we have to compensate.
|
|
||||||
*/
|
|
||||||
bootdev = MAKEBOOTDEV(0, 0, 0, 0, 0);
|
|
||||||
|
|
||||||
printf("\n>> NetBSD NETWORK BOOT HP9000/%s CPU\n",
|
|
||||||
getmachineid());
|
|
||||||
printf(">> $NetBSD: netboot.c,v 1.10 1995/10/04 07:24:32 thorpej Exp $\n");
|
|
||||||
printf(">> Enter \"reset\" to reset system.\n");
|
|
||||||
|
|
||||||
bdev = B_TYPE(bootdev);
|
|
||||||
badapt = B_ADAPTOR(bootdev);
|
|
||||||
bctlr = B_CONTROLLER(bootdev);
|
|
||||||
bunit = B_UNIT(bootdev);
|
|
||||||
bpart = B_PARTITION(bootdev);
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
name = names[currname++];
|
|
||||||
if (currname == NUMNAMES)
|
|
||||||
currname = 0;
|
|
||||||
|
|
||||||
if (!noconsole) {
|
|
||||||
howto = 0;
|
|
||||||
getbootname(&howto);
|
|
||||||
} else
|
|
||||||
printf(": %s\n", name);
|
|
||||||
|
|
||||||
exec(name, lowram, howto);
|
|
||||||
printf("boot: %s\n", strerror(errno));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getbootname(howto)
|
|
||||||
int *howto;
|
|
||||||
{
|
|
||||||
char c, *ptr = line;
|
|
||||||
|
|
||||||
printf("Boot: [%s][-s][-a][-d] :- ", name);
|
|
||||||
|
|
||||||
if (tgets(line)) {
|
|
||||||
if (strcmp(line, "reset") == 0) {
|
|
||||||
call_req_reboot(); /* reset machine */
|
|
||||||
printf("panic: can't reboot, halting\n");
|
|
||||||
asm("stop #0x2700");
|
|
||||||
}
|
|
||||||
|
|
||||||
while (c = *ptr) {
|
|
||||||
while (c == ' ')
|
|
||||||
c = *++ptr;
|
|
||||||
if (!c)
|
|
||||||
return;
|
|
||||||
if (c == '-')
|
|
||||||
while ((c = *++ptr) && c != ' ')
|
|
||||||
switch (c) {
|
|
||||||
case 'a':
|
|
||||||
*howto |= RB_ASKNAME;
|
|
||||||
continue;
|
|
||||||
case 's':
|
|
||||||
*howto |= RB_SINGLE;
|
|
||||||
continue;
|
|
||||||
case 'd':
|
|
||||||
*howto |= RB_KDB;
|
|
||||||
continue;
|
|
||||||
case 'b':
|
|
||||||
*howto |= RB_HALT;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
name = ptr;
|
|
||||||
while ((c = *++ptr) && c != ' ');
|
|
||||||
if (c)
|
|
||||||
*ptr++ = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
machdep_start(entry, howto, loadaddr, ssym, esym)
|
|
||||||
char *entry;
|
|
||||||
int howto;
|
|
||||||
char *loadaddr;
|
|
||||||
char *ssym, *esym;
|
|
||||||
{
|
|
||||||
|
|
||||||
asm("movl %0,d7" : : "m" (howto));
|
|
||||||
asm("movl #0,d6"); /* tell setroot we've netbooted */
|
|
||||||
asm("movl %0,d5" : : "m" (cons_scode));
|
|
||||||
asm("movl %0,a5" : : "a" (loadaddr));
|
|
||||||
asm("movl %0,a4" : : "a" (esym));
|
|
||||||
(*((int (*)())entry))();
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* $NetBSD: netio.c,v 1.2 1995/09/23 17:31:10 thorpej Exp $ */
|
/* $NetBSD: netio.c,v 1.3 1996/06/26 17:44:32 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Jason R. Thorpe
|
* Copyright (c) 1995, 1996 Jason R. Thorpe
|
||||||
* Copyright (c) 1995 Gordon W. Ross
|
* Copyright (c) 1995 Gordon W. Ross
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -71,9 +71,9 @@ char rootpath[FNAME_SIZE];
|
||||||
int netdev_sock = -1;
|
int netdev_sock = -1;
|
||||||
static int open_count;
|
static int open_count;
|
||||||
|
|
||||||
#ifdef SYS_INST
|
int netio_ask = 0; /* default to bootparam, can override */
|
||||||
|
|
||||||
static char input_line[100];
|
static char input_line[100];
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Why be any different? */
|
/* Why be any different? */
|
||||||
#define SUN_BOOTPARAMS
|
#define SUN_BOOTPARAMS
|
||||||
|
@ -131,64 +131,68 @@ netmountroot(f, devname)
|
||||||
char *devname; /* Device part of file name (or NULL). */
|
char *devname; /* Device part of file name (or NULL). */
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
#ifdef SYS_INST
|
|
||||||
struct iodesc *d;
|
struct iodesc *d;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("netmountroot: %s\n", devname);
|
printf("netmountroot: %s\n", devname);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SYS_INST
|
if (netio_ask) {
|
||||||
get_my_ip:
|
get_my_ip:
|
||||||
printf("My IP address? ");
|
printf("My IP address? ");
|
||||||
bzero(input_line, sizeof(input_line));
|
bzero(input_line, sizeof(input_line));
|
||||||
gets(input_line);
|
gets(input_line);
|
||||||
if ((myip.s_addr = inet_addr(input_line)) == htonl(INADDR_NONE)) {
|
if ((myip.s_addr = inet_addr(input_line)) ==
|
||||||
printf("invalid IP address: %s\n", input_line);
|
htonl(INADDR_NONE)) {
|
||||||
goto get_my_ip;
|
printf("invalid IP address: %s\n", input_line);
|
||||||
}
|
goto get_my_ip;
|
||||||
|
}
|
||||||
|
|
||||||
get_my_netmask:
|
get_my_netmask:
|
||||||
printf("My netmask? ");
|
printf("My netmask? ");
|
||||||
bzero(input_line, sizeof(input_line));
|
bzero(input_line, sizeof(input_line));
|
||||||
gets(input_line);
|
gets(input_line);
|
||||||
if ((netmask = inet_addr(input_line)) == htonl(INADDR_NONE)) {
|
if ((netmask = inet_addr(input_line)) ==
|
||||||
printf("invalid netmask: %s\n", input_line);
|
htonl(INADDR_NONE)) {
|
||||||
goto get_my_netmask;
|
printf("invalid netmask: %s\n", input_line);
|
||||||
}
|
goto get_my_netmask;
|
||||||
|
}
|
||||||
|
|
||||||
get_my_gateway:
|
get_my_gateway:
|
||||||
printf("My gateway? ");
|
printf("My gateway? ");
|
||||||
bzero(input_line, sizeof(input_line));
|
bzero(input_line, sizeof(input_line));
|
||||||
gets(input_line);
|
gets(input_line);
|
||||||
if ((gateip.s_addr = inet_addr(input_line)) == htonl(INADDR_NONE)) {
|
if ((gateip.s_addr = inet_addr(input_line)) ==
|
||||||
printf("invalid IP address: %s\n", input_line);
|
htonl(INADDR_NONE)) {
|
||||||
goto get_my_gateway;
|
printf("invalid IP address: %s\n", input_line);
|
||||||
}
|
goto get_my_gateway;
|
||||||
|
}
|
||||||
|
|
||||||
get_server_ip:
|
get_server_ip:
|
||||||
printf("Server IP address? ");
|
printf("Server IP address? ");
|
||||||
bzero(input_line, sizeof(input_line));
|
bzero(input_line, sizeof(input_line));
|
||||||
gets(input_line);
|
gets(input_line);
|
||||||
if ((rootip.s_addr = inet_addr(input_line)) == htonl(INADDR_NONE)) {
|
if ((rootip.s_addr = inet_addr(input_line)) ==
|
||||||
printf("invalid IP address: %s\n", input_line);
|
htonl(INADDR_NONE)) {
|
||||||
goto get_server_ip;
|
printf("invalid IP address: %s\n", input_line);
|
||||||
}
|
goto get_server_ip;
|
||||||
|
}
|
||||||
|
|
||||||
get_server_path:
|
get_server_path:
|
||||||
printf("Server path? ");
|
printf("Server path? ");
|
||||||
bzero(rootpath, sizeof(rootpath));
|
bzero(rootpath, sizeof(rootpath));
|
||||||
gets(rootpath);
|
gets(rootpath);
|
||||||
if (rootpath[0] == '\0' || rootpath[0] == '\n')
|
if (rootpath[0] == '\0' || rootpath[0] == '\n')
|
||||||
goto get_server_path;
|
goto get_server_path;
|
||||||
|
|
||||||
if ((d = socktodesc(netdev_sock)) == NULL)
|
if ((d = socktodesc(netdev_sock)) == NULL)
|
||||||
return (EMFILE);
|
return (EMFILE);
|
||||||
|
|
||||||
d->myip = myip;
|
d->myip = myip;
|
||||||
|
|
||||||
|
goto do_nfs_mount;
|
||||||
|
}
|
||||||
|
|
||||||
#else /* SYS_INST */
|
|
||||||
/*
|
/*
|
||||||
* Get info for NFS boot: our IP address, our hostname,
|
* Get info for NFS boot: our IP address, our hostname,
|
||||||
* server IP address, and our root path on the server.
|
* server IP address, and our root path on the server.
|
||||||
|
@ -233,8 +237,7 @@ netmountroot(f, devname)
|
||||||
|
|
||||||
printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath);
|
printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath);
|
||||||
|
|
||||||
#endif /* SYS_INST */
|
do_nfs_mount:
|
||||||
|
|
||||||
/* Get the NFS file handle (mount). */
|
/* Get the NFS file handle (mount). */
|
||||||
error = nfs_mount(netdev_sock, rootip, rootpath);
|
error = nfs_mount(netdev_sock, rootip, rootpath);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,207 @@
|
||||||
|
/* $NetBSD: rawfs.c,v 1.1 1996/06/26 17:44:35 thorpej Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1995 Gordon W. Ross
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
* 4. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by Gordon W. Ross
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Raw file system - for stream devices like tapes.
|
||||||
|
* No random access, only sequential read allowed.
|
||||||
|
* This exists only to allow upper level code to be
|
||||||
|
* shielded from the fact that the device must be
|
||||||
|
* read only with whole block position and size.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <stand.h>
|
||||||
|
#include <rawfs.h>
|
||||||
|
|
||||||
|
extern int debug;
|
||||||
|
|
||||||
|
/* Our devices are generally willing to do 8K transfers. */
|
||||||
|
#define RAWFS_BSIZE 0x2000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In-core open file.
|
||||||
|
*/
|
||||||
|
struct file {
|
||||||
|
daddr_t fs_nextblk; /* block number to read next */
|
||||||
|
int fs_len; /* amount left in f_buf */
|
||||||
|
char * fs_ptr; /* read pointer into f_buf */
|
||||||
|
char fs_buf[RAWFS_BSIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
rawfs_get_block __P((struct open_file *));
|
||||||
|
|
||||||
|
int rawfs_open(path, f)
|
||||||
|
char *path;
|
||||||
|
struct open_file *f;
|
||||||
|
{
|
||||||
|
struct file *fs;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The actual PROM driver has already been opened.
|
||||||
|
* Just allocate the I/O buffer, etc.
|
||||||
|
*/
|
||||||
|
fs = alloc(sizeof(struct file));
|
||||||
|
fs->fs_nextblk = 0;
|
||||||
|
fs->fs_len = 0;
|
||||||
|
fs->fs_ptr = fs->fs_buf;
|
||||||
|
|
||||||
|
#ifdef DEBUG_RAWFS
|
||||||
|
printf("rawfs_open: fs=0x%x\n", fs);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
f->f_fsdata = fs;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rawfs_close(f)
|
||||||
|
struct open_file *f;
|
||||||
|
{
|
||||||
|
struct file *fs;
|
||||||
|
|
||||||
|
fs = (struct file *) f->f_fsdata;
|
||||||
|
f->f_fsdata = (void *)0;
|
||||||
|
|
||||||
|
#ifdef DEBUG_RAWFS
|
||||||
|
if (debug) {
|
||||||
|
printf("rawfs_close: breakpoint...", fs->fs_buf);
|
||||||
|
__asm (" trap #0");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (fs != (struct file *)0)
|
||||||
|
free(fs, sizeof(*fs));
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rawfs_read(f, start, size, resid)
|
||||||
|
struct open_file *f;
|
||||||
|
void *start;
|
||||||
|
u_int size;
|
||||||
|
u_int *resid;
|
||||||
|
{
|
||||||
|
struct file *fs = (struct file *)f->f_fsdata;
|
||||||
|
char *addr = start;
|
||||||
|
int error = 0;
|
||||||
|
size_t csize;
|
||||||
|
|
||||||
|
while (size != 0) {
|
||||||
|
|
||||||
|
if (fs->fs_len == 0)
|
||||||
|
if ((error = rawfs_get_block(f)) != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (fs->fs_len <= 0)
|
||||||
|
break; /* EOF */
|
||||||
|
|
||||||
|
csize = size;
|
||||||
|
if (csize > fs->fs_len)
|
||||||
|
csize = fs->fs_len;
|
||||||
|
|
||||||
|
bcopy(fs->fs_ptr, addr, csize);
|
||||||
|
fs->fs_ptr += csize;
|
||||||
|
fs->fs_len -= csize;
|
||||||
|
addr += csize;
|
||||||
|
size -= csize;
|
||||||
|
}
|
||||||
|
if (resid)
|
||||||
|
*resid = size;
|
||||||
|
return (error);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rawfs_write(f, start, size, resid)
|
||||||
|
struct open_file *f;
|
||||||
|
void *start;
|
||||||
|
size_t size;
|
||||||
|
size_t *resid; /* out */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_RAWFS
|
||||||
|
panic("rawfs_write");
|
||||||
|
#endif
|
||||||
|
return (EROFS);
|
||||||
|
}
|
||||||
|
|
||||||
|
off_t rawfs_seek(f, offset, where)
|
||||||
|
struct open_file *f;
|
||||||
|
off_t offset;
|
||||||
|
int where;
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_RAWFS
|
||||||
|
panic("rawfs_seek");
|
||||||
|
#endif
|
||||||
|
return (EFTYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rawfs_stat(f, sb)
|
||||||
|
struct open_file *f;
|
||||||
|
struct stat *sb;
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_RAWFS
|
||||||
|
panic("rawfs_stat");
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* Clear out the stat buffer so that the uid check
|
||||||
|
* won't fail. See sys/lib/libsa/exec.c
|
||||||
|
*/
|
||||||
|
bzero(sb, sizeof(*sb));
|
||||||
|
|
||||||
|
return (EFTYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read a block from the underlying stream device
|
||||||
|
* (In our case, a tape drive.)
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
rawfs_get_block(f)
|
||||||
|
struct open_file *f;
|
||||||
|
{
|
||||||
|
struct file *fs;
|
||||||
|
int error, len;
|
||||||
|
|
||||||
|
fs = (struct file *)f->f_fsdata;
|
||||||
|
fs->fs_ptr = fs->fs_buf;
|
||||||
|
|
||||||
|
twiddle();
|
||||||
|
error = f->f_dev->dv_strategy(f->f_devdata, F_READ,
|
||||||
|
fs->fs_nextblk, RAWFS_BSIZE, fs->fs_buf, &len);
|
||||||
|
|
||||||
|
if (!error) {
|
||||||
|
fs->fs_len = len;
|
||||||
|
fs->fs_nextblk += (RAWFS_BSIZE / DEV_BSIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (error);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
/* $NetBSD: rawfs.h,v 1.1 1996/06/26 17:44:36 thorpej Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Raw file system - for stream devices like tapes.
|
||||||
|
* No random access, only sequential read allowed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int rawfs_open __P((char *path, struct open_file *f));
|
||||||
|
int rawfs_close __P((struct open_file *f));
|
||||||
|
int rawfs_read __P((struct open_file *f, void *buf,
|
||||||
|
u_int size, u_int *resid));
|
||||||
|
int rawfs_write __P((struct open_file *f, void *buf,
|
||||||
|
u_int size, u_int *resid));
|
||||||
|
off_t rawfs_seek __P((struct open_file *f, off_t offset, int where));
|
||||||
|
int rawfs_stat __P((struct open_file *f, struct stat *sb));
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: samachdep.h,v 1.5 1995/08/05 16:47:50 thorpej Exp $ */
|
/* $NetBSD: samachdep.h,v 1.6 1996/06/26 17:44:37 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1982, 1990, 1993
|
* Copyright (c) 1982, 1990, 1993
|
||||||
|
@ -35,6 +35,8 @@
|
||||||
* @(#)samachdep.h 8.1 (Berkeley) 6/10/93
|
* @(#)samachdep.h 8.1 (Berkeley) 6/10/93
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
#define NHPIB 4
|
#define NHPIB 4
|
||||||
#define NSCSI 2
|
#define NSCSI 2
|
||||||
#define NRD 8
|
#define NRD 8
|
||||||
|
@ -71,9 +73,23 @@ extern int howto;
|
||||||
extern unsigned int bootdev;
|
extern unsigned int bootdev;
|
||||||
extern char *getmachineid();
|
extern char *getmachineid();
|
||||||
|
|
||||||
|
void machdep_start_net __P((char *, int, char *, char *, char *));
|
||||||
|
void machdep_start_disk_tape __P((char *, int, char *, char *, char *));
|
||||||
|
void (*__machdep_start) __P((char *, int, char *, char *, char *));
|
||||||
|
|
||||||
#define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
|
#define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
|
||||||
|
|
||||||
/* bogon grfinfo structure to keep grf_softc happy */
|
/* bogon grfinfo structure to keep grf_softc happy */
|
||||||
struct grfinfo {
|
struct grfinfo {
|
||||||
int grf_foo;
|
int grf_foo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern struct devsw devsw_net[];
|
||||||
|
extern int ndevs_net;
|
||||||
|
|
||||||
|
extern struct devsw devsw_general[];
|
||||||
|
extern int ndevs_general;
|
||||||
|
|
||||||
|
extern struct fs_ops file_system_rawfs[];
|
||||||
|
extern struct fs_ops file_system_ufs[];
|
||||||
|
extern struct fs_ops file_system_nfs[];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pboot.c,v 1.10 1995/10/04 07:24:31 thorpej Exp $ */
|
/* $NetBSD: uboot.c,v 1.1 1996/06/26 17:44:39 thorpej Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1982, 1986, 1990, 1993
|
* Copyright (c) 1982, 1986, 1990, 1993
|
||||||
|
@ -54,11 +54,14 @@ extern char *lowram;
|
||||||
extern int noconsole;
|
extern int noconsole;
|
||||||
extern int cons_scode;
|
extern int cons_scode;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX UFS accepts a /, NFS doesn't.
|
||||||
|
*/
|
||||||
char *name;
|
char *name;
|
||||||
char *names[] = {
|
char *names[] = {
|
||||||
"/netbsd", "/onetbsd", "/netbsd.old",
|
"netbsd", "onetbsd", "netbsd.old",
|
||||||
};
|
};
|
||||||
#define NUMNAMES (sizeof(names)/sizeof(char *))
|
#define NUMNAMES (sizeof(names) / sizeof(char *))
|
||||||
|
|
||||||
static int bdev, badapt, bctlr, bunit, bpart;
|
static int bdev, badapt, bctlr, bunit, bpart;
|
||||||
|
|
||||||
|
@ -66,9 +69,9 @@ main()
|
||||||
{
|
{
|
||||||
int currname = 0;
|
int currname = 0;
|
||||||
|
|
||||||
printf("\n>> NetBSD BOOT HP9000/%s CPU\n",
|
printf("\n>> NetBSD UNIFIED BOOT HP9000/%s CPU\n",
|
||||||
getmachineid());
|
getmachineid());
|
||||||
printf(">> $NetBSD: pboot.c,v 1.10 1995/10/04 07:24:31 thorpej Exp $\n");
|
printf(">> $NetBSD: uboot.c,v 1.1 1996/06/26 17:44:39 thorpej Exp $\n");
|
||||||
printf(">> Enter \"reset\" to reset system.\n");
|
printf(">> Enter \"reset\" to reset system.\n");
|
||||||
|
|
||||||
bdev = B_TYPE(bootdev);
|
bdev = B_TYPE(bootdev);
|
||||||
|
@ -88,11 +91,6 @@ main()
|
||||||
} else
|
} else
|
||||||
printf(": %s\n", name);
|
printf(": %s\n", name);
|
||||||
|
|
||||||
#if 0
|
|
||||||
printf("Booting %s%d%c:%s @ 0x%x\n",
|
|
||||||
devsw[dev].dv_name, ctlr + (8 * adapt), 'a' + part, name, x.a_entry);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
exec(name, lowram, howto);
|
exec(name, lowram, howto);
|
||||||
printf("boot: %s\n", strerror(errno));
|
printf("boot: %s\n", strerror(errno));
|
||||||
}
|
}
|
||||||
|
@ -145,7 +143,23 @@ getbootdev(howto)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
machdep_start(entry, howto, loadaddr, ssym, esym)
|
machdep_start_net(entry, howto, loadaddr, ssym, esym)
|
||||||
|
char *entry;
|
||||||
|
int howto;
|
||||||
|
char *loadaddr;
|
||||||
|
char *ssym, *esym;
|
||||||
|
{
|
||||||
|
|
||||||
|
asm("movl %0,d7" : : "m" (howto));
|
||||||
|
asm("movl #0,d6"); /* tell setroot we've netbooted */
|
||||||
|
asm("movl %0,d5" : : "m" (cons_scode));
|
||||||
|
asm("movl %0,a5" : : "a" (loadaddr));
|
||||||
|
asm("movl %0,a4" : : "a" (esym));
|
||||||
|
(*((int (*)())entry))();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
machdep_start_disk_tape(entry, howto, loadaddr, ssym, esym)
|
||||||
char *entry;
|
char *entry;
|
||||||
int howto;
|
int howto;
|
||||||
char *loadaddr;
|
char *loadaddr;
|
||||||
|
@ -159,3 +173,14 @@ machdep_start(entry, howto, loadaddr, ssym, esym)
|
||||||
asm("movl %0,a4" : : "a" (esym));
|
asm("movl %0,a4" : : "a" (esym));
|
||||||
(*((int (*)())entry))();
|
(*((int (*)())entry))();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
machdep_start(entry, howto, loadaddr, ssym, esym)
|
||||||
|
char *entry;
|
||||||
|
int howto;
|
||||||
|
char *loadaddr;
|
||||||
|
char *ssym, *esym;
|
||||||
|
{
|
||||||
|
|
||||||
|
(*__machdep_start)(entry, howto, loadaddr, ssym, esym);
|
||||||
|
}
|
Loading…
Reference in New Issue