diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-05-05 06:02:04 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-05-05 06:02:04 +0000 |
commit | 3d10bc794d2e03421fd174136259f42a03004bca (patch) | |
tree | d1b03f69e85167322eb9804fa9e85237ce45b7f1 /sys/arch/alpha/stand/boot | |
parent | 53e6b51c98a2cae3f0e7c41c03a85f76fcd17341 (diff) |
Updates from NetBSD (cgd):
- seriously clean up makefiles. use libsa/libkern/libz as appropriate,
and don't build the various sources into objs locally by specifying
them directly in the Makefiles.
- move the secondary bootstrap down (to 0x20004000), and add a HEAP_LIMIT
so that we don't exhaust our bootstrap address space (when using the new,
not yet checked in, memory allocator).
- clean up installboot, deal with secondary bootstrap programs not on
'a' partition or 'a' partition not starting at 0.
- add padding to structures in bbinfo.h for future expansion. Add a
netbbinfo structure to allow netboot information to be hard-coded in
network boot blocks, so that they can be made to work even on systems
with firmware which doesn't support the new "ethernet address in boot
device" convention.
- move the sync() calls to the correct place in installboot.c
- remove a kludge in disk.c which was breaking multiple opens/closes
of the disk
- allow netboot ethernet address to be hard-coded into binary so that
machines with old firmware which doesn't pass it in the boot device
can work. Assume that if the ethernet address isn't passed in, it
uses the old (dain-bramaged) 'read' interface works on my 3000/300LX.
- Add setnetbootinfo, a program to hard code an ethernet address into
a network boot.
- move an 'int debug;' into boot.c (it was the only diff between boot.c and
netboot.c), and nuke netboot.c (using boot.c instead for net boot blocks).
- add cd9660 file system ops to the file system ops table in filesystem.c
- if a file name is given (i.e. BOOTED_FILE) is set, boot only that file,
but if not then try to boot "bsd", "bsd.bak", "bsd.old", and
"obsd" (in that order) until one is found or until the list of names
is exhausted.
- add support for reading gzipped kernels.
- use strerror() to print errors, rather than just printing error numbers
- if no disk label exists, fake one up
- slightly relax the block size checks in bootxx.c; they were a bit to paranoid
And local changes:
- don't build a copy of libsa/libkern/libz for each boot prog,
just build a single copy and use it for everything.
Diffstat (limited to 'sys/arch/alpha/stand/boot')
-rw-r--r-- | sys/arch/alpha/stand/boot/Makefile | 88 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/boot.c | 33 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/devopen.c | 6 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/disk.c | 17 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/filesystem.c | 7 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/version | 7 |
6 files changed, 94 insertions, 64 deletions
diff --git a/sys/arch/alpha/stand/boot/Makefile b/sys/arch/alpha/stand/boot/Makefile index a4dc4aa2df2..46c63dfc077 100644 --- a/sys/arch/alpha/stand/boot/Makefile +++ b/sys/arch/alpha/stand/boot/Makefile @@ -1,55 +1,65 @@ -# $OpenBSD: Makefile,v 1.7 1997/04/05 04:26:54 millert Exp $ -# $NetBSD: Makefile,v 1.10 1996/10/18 06:01:41 thorpej Exp $ +# $OpenBSD: Makefile,v 1.8 1997/05/05 06:01:50 millert Exp $ +# $NetBSD: Makefile,v 1.17 1997/04/17 07:27:46 thorpej Exp $ -.PATH: ${.CURDIR}/.. ${.CURDIR}/../../../../lib/libsa +S= ${.CURDIR}/../../../.. -BOOT_PROG = boot -BOOT_RELOC = ${SECONDARY_LOAD_ADDRESS} +.PATH: ${.CURDIR}/.. -BOOT_SRCS = start.S boot.c loadfile.c disk.c conf.c prom.c prom_disp.S OSFpal.c +PROG = boot -BOOT_SRCS+= alloc.c bzero.c close.c dev.c devopen.c disklabel.c dkcksum.c -BOOT_SRCS+= getfile.c gets.c ioctl.c lseek.c open.c printf.c read.c -BOOT_SRCS+= strcmp.c ufs.c write.c filesystem.c strlen.c -BOOT_SRCS+= ntohl.c prom_swpal.S -BOOT_OBJS = ${BOOT_SRCS:N*.h:R:S/$/.o/g} +SRCS = start.S boot.c loadfile.c disk.c conf.c prom.c prom_disp.S OSFpal.c +SRCS+= devopen.c filesystem.c prom_swpal.S +NOMAN= +INSTALL_STRIP= +BINMODE= 444 +BOOT_RELOC = ${SECONDARY_LOAD_ADDRESS} HEADERSIZE_PROG = headersize +CLEANFILES+= vers.c vers.o ${PROG}.sym ${PROG}.nosym ${HEADERSIZE_PROG} + DEFNS= -DCOMPAT_UFS -DALPHA_BOOT_ECOFF # -DALPHA_BOOT_ELF AFLAGS += -DASSEMBLER ${DEFNS} -CPPFLAGS += -I${.CURDIR}/../.. -I${.CURDIR}/../../../.. -I${.CURDIR}/../../../../lib/libsa -CFLAGS = -Werror -mno-fp-regs -g ${DEFNS} +CPPFLAGS += -I${.CURDIR}/../.. -I${S} ${DEFNS} +CFLAGS = -Werror -mno-fp-regs + +${PROG}.nosym: ${PROG}.sym + cp ${PROG}.sym ${PROG}.nosym + strip ${PROG}.nosym + +${PROG}: ${PROG}.nosym ${HEADERSIZE_PROG} + dd if=${PROG}.nosym of=${PROG} \ + bs=`./${HEADERSIZE_PROG} ${BOOT_RELOC} ${PROG}.nosym` skip=1 + +# no lint here (yet?) +lint: + +.include <bsd.prog.mk> -CLEANFILES+= vers.c vers.o +### find out what to use for libkern +KERN_AS= library +KERNDST= ${.CURDIR}/../libkern/${__objdir} +.include "${.CURDIR}/../libkern/Makefile.inc" +LIBKERN= ${KERNLIB} -.PATH: ${.CURDIR}/../../../../lib/libkern +### find out what to use for libz +Z_AS= library +ZDST= ${.CURDIR}/../libz/${__objdir} +.include "${.CURDIR}/../libz/Makefile.inc" +LIBZ= ${ZLIB} -all: ${BOOT_PROG} +### find out what to use for libsa +SA_AS= library +SADST= ${.CURDIR}/../libsa/${__objdir} +SAREL= +SA_ZLIB= yes +.include "${.CURDIR}/../libsa/Makefile.inc" +LIBSA= ${SALIB} -${BOOT_PROG}: ${BOOT_OBJS} ${HEADERSIZE_PROG} +${PROG}.sym: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${COMPILE.c} vers.c - ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${BOOT_PROG}.hdr \ - ${BOOT_OBJS} vers.o -lc # XXX - size ${BOOT_PROG}.hdr - strip ${BOOT_PROG}.hdr - dd if=${BOOT_PROG}.hdr of=${BOOT_PROG} \ - bs=`./${HEADERSIZE_PROG} ${BOOT_RELOC} ${BOOT_PROG}.hdr` skip=1 - -install: - ${INSTALL} -c -o bin -g bin -m 444 ${BOOT_PROG} \ - ${DESTDIR}${BINDIR}/${BOOT_PROG} - -clean: _SUBDIRUSE - rm -f a.out [Ee]rrs mklog core *.core \ - ${BOOT_PROG} ${BOOT_OBJS} ${CLEANFILES} \ - ${BOOT_PROG}.hdr ${HEADERSIZE_PROG} - -cleandir: _SUBDIRUSE clean - -.include "${.CURDIR}/../Makefile.inc" -.include <bsd.obj.mk> -.include <bsd.dep.mk> -.include <bsd.subdir.mk> + ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${PROG}.sym \ + ${OBJS} vers.o ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} + size ${PROG}.sym diff --git a/sys/arch/alpha/stand/boot/boot.c b/sys/arch/alpha/stand/boot/boot.c index 2ddaef27e5d..5af7bdb9274 100644 --- a/sys/arch/alpha/stand/boot/boot.c +++ b/sys/arch/alpha/stand/boot/boot.c @@ -1,5 +1,5 @@ -/* $OpenBSD: boot.c,v 1.8 1996/11/27 19:54:52 niklas Exp $ */ -/* $NetBSD: boot.c,v 1.8 1996/09/17 22:00:26 cgd Exp $ */ +/* $OpenBSD: boot.c,v 1.9 1997/05/05 06:01:51 millert Exp $ */ +/* $NetBSD: boot.c,v 1.10 1997/01/18 01:58:33 cgd Exp $ */ /* * Copyright (c) 1992, 1993 @@ -61,10 +61,22 @@ extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; vm_offset_t ffp_save, ptbr_save; +int debug; + +char *kernelnames[] = { + "bsd", + "bsd.bak", + "bsd.old", + "obsd", + NULL +}; + void main() { + char *name, **namep; u_int64_t entry; + int win; /* Init prom callback vector. */ init_prom_calls(); @@ -83,13 +95,20 @@ main() prom_getenv(PROM_E_BOOTED_FILE, boot_file, sizeof(boot_file)); prom_getenv(PROM_E_BOOTED_OSFLAGS, boot_flags, sizeof(boot_flags)); - if (boot_file[0] == '\0') - bcopy("bsd", boot_file, sizeof "bsd"); + if (boot_file[0] != 0) + (void)printf("Boot file: %s\n", boot_file); + (void)printf("Boot flags: %s\n", boot_flags); - (void)printf("Boot: %s %s\n", boot_file, boot_flags); + if (boot_file[0] != '\0') + win = (loadfile(name = boot_file, &entry) == 0); + else + for (namep = kernelnames, win = 0; *namep != NULL && !win; + namep++) + win = (loadfile(name = *namep, &entry) == 0); - if (!loadfile(boot_file, &entry)) { - (void)printf("Entering kernel at 0x%lx...\n", entry); + printf("\n"); + if (win) { + (void)printf("Entering %s at 0x%lx...\n", name, entry); (*(void (*)())entry)(ffp_save, ptbr_save, 0); } diff --git a/sys/arch/alpha/stand/boot/devopen.c b/sys/arch/alpha/stand/boot/devopen.c index 2e9cbc1951d..fc6de09d56c 100644 --- a/sys/arch/alpha/stand/boot/devopen.c +++ b/sys/arch/alpha/stand/boot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.3 1996/10/30 22:40:41 niklas Exp $ */ +/* $OpenBSD: devopen.c,v 1.4 1997/05/05 06:01:51 millert Exp $ */ /* $NetBSD: devopen.c,v 1.1 1995/11/23 02:39:37 cgd Exp $ */ /*- @@ -89,10 +89,6 @@ devopen(f, fname, file) cp++; } *ncp = '\0'; - /* - * XXX - * pulling strchr from the C library, should pull from libkern. - */ } else if (strchr(cp, '(')) { /* expect a string like 'rz(0,0,0)vmunix' */ while ((c = *cp) != '\0') { diff --git a/sys/arch/alpha/stand/boot/disk.c b/sys/arch/alpha/stand/boot/disk.c index 05d1c348068..73406487228 100644 --- a/sys/arch/alpha/stand/boot/disk.c +++ b/sys/arch/alpha/stand/boot/disk.c @@ -1,5 +1,5 @@ -/* $OpenBSD: disk.c,v 1.6 1997/04/07 06:23:10 millert Exp $ */ -/* $NetBSD: disk.c,v 1.3 1995/11/23 02:39:40 cgd Exp $ */ +/* $OpenBSD: disk.c,v 1.7 1997/05/05 06:01:52 millert Exp $ */ +/* $NetBSD: disk.c,v 1.6 1997/04/06 08:40:33 cgd Exp $ */ /* * Copyright (c) 1992, 1993 @@ -104,12 +104,7 @@ diskopen(f, ctlr, unit, part) size_t cnt; int devlen, i; char *msg, buf[DEV_BSIZE], devname[32]; - static struct disk_softc *sc; - - if (sc != NULL) { - f->f_devdata = (void *)sc; - return 0; - } + struct disk_softc *sc; if (unit >= 8 || part >= MAXPARTITIONS) return (ENXIO); @@ -148,6 +143,12 @@ diskopen(f, ctlr, unit, part) if (i || cnt != DEV_BSIZE) { printf("disk%d: error reading disk label\n", unit); goto bad; + } else if (lp->d_magic != DISKMAGIC) { + /* No label at all. Fake all partitions as whole disk. */ + for (i = 0; i < MAXPARTITIONS; i++) { + lp->d_partitions[part].p_offset = 0; + lp->d_partitions[part].p_size = 0x7fffffff; + } } else { msg = getdisklabel(buf, lp); if (msg) { diff --git a/sys/arch/alpha/stand/boot/filesystem.c b/sys/arch/alpha/stand/boot/filesystem.c index 1956f3504fa..25be97d2685 100644 --- a/sys/arch/alpha/stand/boot/filesystem.c +++ b/sys/arch/alpha/stand/boot/filesystem.c @@ -1,5 +1,5 @@ -/* $OpenBSD: filesystem.c,v 1.3 1996/10/30 22:40:43 niklas Exp $ */ -/* $NetBSD: filesystem.c,v 1.1 1995/11/23 02:39:46 cgd Exp $ */ +/* $OpenBSD: filesystem.c,v 1.4 1997/05/05 06:01:52 millert Exp $ */ +/* $NetBSD: filesystem.c,v 1.3 1997/04/06 08:40:35 cgd Exp $ */ /* * Copyright (c) 1993 Philip A. Nelson. @@ -36,10 +36,11 @@ #include <lib/libsa/stand.h> #include <lib/libsa/ufs.h> +#include <lib/libsa/cd9660.h> struct fs_ops file_system[] = { { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat }, + { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek, cd9660_stat }, }; int nfsys = sizeof(file_system)/sizeof(struct fs_ops); - diff --git a/sys/arch/alpha/stand/boot/version b/sys/arch/alpha/stand/boot/version index 4343db37627..b502ad108f2 100644 --- a/sys/arch/alpha/stand/boot/version +++ b/sys/arch/alpha/stand/boot/version @@ -1,5 +1,5 @@ -$OpenBSD: version,v 1.5 1996/10/30 22:40:47 niklas Exp $ -$NetBSD: version,v 1.6 1996/06/14 20:03:07 cgd Exp $ +$OpenBSD: version,v 1.6 1997/05/05 06:01:53 millert Exp $ +$NetBSD: version,v 1.9 1997/01/23 23:10:38 cgd Exp $ 1.1: Initial version 1.2: don't forget the Id string! @@ -10,3 +10,6 @@ $NetBSD: version,v 1.6 1996/06/14 20:03:07 cgd Exp $ 1.6: Don't pass arguments to the kernel, trim unnecessary environment calls, kill 'ask' loop (i.e. if boot fails, halt), seperate ECOFF and a.out support into seperate options. +1.7: Use libsa and libkern rather than building the objects locally. +1.8: Search for a kernel, if none specified. +1.9: Add support for gzipped kernels. |