Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha/stand Nuke the alpha ecoff/elf bootloader and...
details: https://anonhg.NetBSD.org/src/rev/5dde83fb7f67
branches: trunk
changeset: 476233:5dde83fb7f67
user: ross <ross%NetBSD.org@localhost>
date: Fri Sep 10 07:31:16 1999 +0000
description:
Nuke the alpha ecoff/elf bootloader and use the libsa/ one instead.
diffstat:
sys/arch/alpha/stand/Makefile.bootprogs | 5 +-
sys/arch/alpha/stand/boot/Makefile | 4 +-
sys/arch/alpha/stand/common/boot.c | 21 +-
sys/arch/alpha/stand/common/loadfile.c | 336 --------------------------------
sys/arch/alpha/stand/netboot/Makefile | 4 +-
sys/arch/alpha/stand/ustarboot/Makefile | 4 +-
6 files changed, 19 insertions(+), 355 deletions(-)
diffs (truncated from 486 to 300 lines):
diff -r 55f1c4e72fe0 -r 5dde83fb7f67 sys/arch/alpha/stand/Makefile.bootprogs
--- a/sys/arch/alpha/stand/Makefile.bootprogs Fri Sep 10 07:22:03 1999 +0000
+++ b/sys/arch/alpha/stand/Makefile.bootprogs Fri Sep 10 07:31:16 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.bootprogs,v 1.13 1999/04/11 03:36:21 cgd Exp $
+# $NetBSD: Makefile.bootprogs,v 1.14 1999/09/10 07:31:16 ross Exp $
S= ${.CURDIR}/../../../..
@@ -87,7 +87,7 @@
STANDPROG_LOAD_ADDRESS= 0xfffffc0000300000
-FILE_FORMAT_CPPFLAGS= -DALPHA_BOOT_ECOFF -DALPHA_BOOT_ELF
+FILE_FORMAT_CPPFLAGS= -DBOOT_ECOFF -DBOOT_ELF
UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \
-DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \
@@ -119,5 +119,6 @@
### find out what to use for libsa
SA_AS= library
+SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
.include "${S}/lib/libsa/Makefile.inc"
LIBSA= ${SALIB}
diff -r 55f1c4e72fe0 -r 5dde83fb7f67 sys/arch/alpha/stand/boot/Makefile
--- a/sys/arch/alpha/stand/boot/Makefile Fri Sep 10 07:22:03 1999 +0000
+++ b/sys/arch/alpha/stand/boot/Makefile Fri Sep 10 07:31:16 1999 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.27 1999/08/18 20:01:06 cgd Exp $
+# $NetBSD: Makefile,v 1.28 1999/09/10 07:31:17 ross Exp $
PROG = boot
-SRCS = start.S boot.c loadfile.c blkdev.c prom.c prom_disp.S OSFpal.c
+SRCS = start.S boot.c blkdev.c prom.c prom_disp.S OSFpal.c
SRCS+= filesystem.c prom_swpal.S booted_dev.c
# XXX for debugging primary and secondary together
diff -r 55f1c4e72fe0 -r 5dde83fb7f67 sys/arch/alpha/stand/common/boot.c
--- a/sys/arch/alpha/stand/common/boot.c Fri Sep 10 07:22:03 1999 +0000
+++ b/sys/arch/alpha/stand/common/boot.c Fri Sep 10 07:31:16 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.21 1999/04/09 17:50:15 cgd Exp $ */
+/* $NetBSD: boot.c,v 1.22 1999/09/10 07:31:17 ross Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -40,6 +40,7 @@
#include <lib/libsa/stand.h>
#include <lib/libkern/libkern.h>
+#include <lib/libsa/loadfile.h>
#include <sys/param.h>
#include <sys/exec.h>
@@ -57,8 +58,6 @@
#error not UNIFIED_BOOTBLOCK and not SECONDARY_BOOTBLOCK
#endif
-int loadfile __P((char *, u_int64_t *));
-
char boot_file[128];
char boot_flags[128];
@@ -66,8 +65,6 @@
paddr_t ffp_save, ptbr_save;
-extern vaddr_t ssym, esym;
-
int debug;
char *kernelnames[] = {
@@ -86,6 +83,7 @@
#endif
{
char *name, **namep;
+ u_long marks[MARK_MAX];
u_int64_t entry;
int win;
@@ -127,25 +125,26 @@
gets(boot_file);
}
+ memset(marks, 0, sizeof marks);
if (boot_file[0] != '\0')
- win = (loadfile(name = boot_file, &entry) == 0);
+ win = loadfile(name = boot_file, marks, LOAD_KERNEL) == 0;
else
for (namep = kernelnames, win = 0; *namep != NULL && !win;
namep++)
- win = (loadfile(name = *namep, &entry) == 0);
+ win = loadfile(name = *namep, marks, LOAD_KERNEL) == 0;
+ entry = marks[MARK_ENTRY];
booted_dev_close();
printf("\n");
- if (!win) {
+ if (!win)
goto fail;
- }
/*
* Fill in the bootinfo for the kernel.
*/
bzero(&bootinfo_v1, sizeof(bootinfo_v1));
- bootinfo_v1.ssym = ssym;
- bootinfo_v1.esym = esym;
+ bootinfo_v1.ssym = marks[MARK_SYM];
+ bootinfo_v1.esym = marks[MARK_END];
bcopy(name, bootinfo_v1.booted_kernel,
sizeof(bootinfo_v1.booted_kernel));
bcopy(boot_flags, bootinfo_v1.boot_flags,
diff -r 55f1c4e72fe0 -r 5dde83fb7f67 sys/arch/alpha/stand/common/loadfile.c
--- a/sys/arch/alpha/stand/common/loadfile.c Fri Sep 10 07:22:03 1999 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-/* $NetBSD: loadfile.c,v 1.11 1998/08/14 16:50:04 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * 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 NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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
- */
-
-#define ELFSIZE 64
-
-#include <lib/libsa/stand.h>
-#include <lib/libkern/libkern.h>
-
-#include <sys/param.h>
-#include <sys/exec.h>
-#include <sys/exec_ecoff.h>
-#include <sys/exec_elf.h>
-
-#include <machine/prom.h>
-
-#define _KERNEL
-#include "include/pte.h"
-
-#ifdef ALPHA_BOOT_ECOFF
-static int coff_exec __P((int, struct ecoff_exechdr *, u_int64_t *));
-#endif
-#ifdef ALPHA_BOOT_ELF
-static int elf_exec __P((int, Elf_Ehdr *, u_int64_t *));
-#endif
-int loadfile __P((char *, u_int64_t *));
-
-paddr_t ffp_save, ptbr_save;
-vaddr_t ssym, esym;
-
-/*
- * Open 'filename', read in program and return the entry point or -1 if error.
- */
-int
-loadfile(fname, entryp)
- char *fname;
- u_int64_t *entryp;
-{
- union {
-#ifdef ALPHA_BOOT_ECOFF
- struct ecoff_exechdr coff;
-#endif
-#ifdef ALPHA_BOOT_ELF
- Elf_Ehdr elf;
-#endif
- } hdr;
- ssize_t nr;
- int fd, rval;
-
- printf("\nLoading %s...\n", fname);
-
- /* Open the file. */
- rval = 1;
- if ((fd = open(fname, 0)) < 0) {
- (void)printf("open %s: %s\n", fname, strerror(errno));
- goto err;
- }
-
- /* Read the exec header. */
- if ((nr = read(fd, &hdr, sizeof(hdr))) != sizeof(hdr)) {
- (void)printf("read header: %s\n", strerror(errno));
- goto err;
- }
-
-#ifdef ALPHA_BOOT_ECOFF
- if (!ECOFF_BADMAG(&hdr.coff)) {
- rval = coff_exec(fd, &hdr.coff, entryp);
- } else
-#endif
-#ifdef ALPHA_BOOT_ELF
- if (memcmp(Elf_e_ident, hdr.elf.e_ident, Elf_e_siz) == 0) {
- rval = elf_exec(fd, &hdr.elf, entryp);
- } else
-#endif
- {
- (void)printf("%s: unknown executable format\n", fname);
- }
-
-err:
- if (fd >= 0)
- (void)close(fd);
- return (rval);
-}
-
-#ifdef ALPHA_BOOT_ECOFF
-static int
-coff_exec(fd, coff, entryp)
- int fd;
- struct ecoff_exechdr *coff;
- u_int64_t *entryp;
-{
-
- /* Read in text. */
- (void)printf("%lu", coff->a.tsize);
- if (lseek(fd, ECOFF_TXTOFF(coff), SEEK_SET) == -1) {
- (void)printf("lseek text: %s\n", strerror(errno));
- return (1);
- }
- if (read(fd, (void *)coff->a.text_start, coff->a.tsize) !=
- coff->a.tsize) {
- (void)printf("read text: %s\n", strerror(errno));
- return (1);
- }
-
- /* Read in data. */
- if (coff->a.dsize != 0) {
- (void)printf("+%lu", coff->a.dsize);
- if (read(fd, (void *)coff->a.data_start, coff->a.dsize) !=
Home |
Main Index |
Thread Index |
Old Index