Slight reorganisation of the Alpha/SRM loader build:

- Make as much of the makefile for each of the three flavours
   (disk, CDROM, net) common.
 - Special-case the libalpha startup module on its use in boot1, not
   the other way around.
 - Build the loader out of a "loader" directory

Reviewed by:	mjacob, dfr
This commit is contained in:
Mike Smith 1999-09-03 19:42:18 +00:00
parent 2ccc4fb694
commit c7ba4828b1
13 changed files with 26 additions and 476 deletions

View File

@ -1,6 +1,6 @@
# $FreeBSD$
SUBDIR= libalpha
SUBDIR+= boot1 boot2 netboot cdboot
SUBDIR+= boot1 loader netboot cdboot
.include <bsd.subdir.mk>

View File

@ -13,6 +13,7 @@ CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}
CFLAGS+= -I${LIBSTANDDIR}
CFLAGS+= -I${.CURDIR}/..
CFLAGS+= -DSECONDARY_LOAD_ADDRESS=${SECONDARY_LOAD_ADDRESS} -DMINIMAL
CFLAGS+= -DBOOT1
NOMAN=1
STRIP=
BINDIR?= /boot

View File

@ -1,86 +0,0 @@
# $NetBSD: Makefile,v 1.12 1998/02/19 14:18:36 drochner Exp $
BASE= loader
PROG= ${BASE}
NOMAN=
NEWVERSWHAT= "SRM disk boot" alpha
.PATH: ${.CURDIR}/../common
# Alpha-specific bootstrap sources
SRCS+= main.c conf.c
# Always add MI sources
.PATH: ${.CURDIR}/../../common
.include <${.CURDIR}/../../common/Makefile.inc>
CFLAGS+= -mno-fp-regs
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}
CFLAGS+= -I${.CURDIR}/../../.. -I.
CFLAGS+= -DLOADER
CFLAGS+= -DPRIMARY_LOAD_ADDRESS=${PRIMARY_LOAD_ADDRESS} \
-DSECONDARY_LOAD_ADDRESS=${SECONDARY_LOAD_ADDRESS}
CLEANFILES+= vers.c vers.o gensetdefs.o gensetdefs setdef0.o setdef1.o \
setdefs.h start.o
CLEANFILES+= ${BASE} ${BASE}.sym ${BASE}.list
CFLAGS+= -Wall
CFLAGS+= -I${LIBSTANDDIR}
CFLAGS+= -I${.CURDIR}/..
CRT= start.o
STRIP=
BINDIR?= /boot
all: ${BASE}
vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
${CC} -c vers.c
${BASE}: ${BASE}.sym ${BASE}.help
objcopy -O binary ${BASE}.sym ${BASE}
${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBALPHA} ${CRT} vers.o setdef0.o setdef1.o
${LD} -o ${BASE}.sym -M -e start -N -Ttext ${SECONDARY_LOAD_ADDRESS} \
${CRT} setdef0.o ${OBJS} setdef1.o \
vers.o ${LIBSTAND} ${LIBALPHA} ${LIBSTAND} >${.OBJDIR}/${BASE}.list
${BASE}.help: help.common help.alpha
cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
beforeinstall:
.if exists(${.OBJDIR}/loader.help)
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
.else
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
${.CURDIR}/${BASE}.help ${DESTDIR}/boot
.endif
# Other fragments still to be brought in from ../Makfile.booters?
start.o: ${.CURDIR}/../libalpha/start.S
${CC} -c ${CFLAGS} $<
setdef0.o: setdefs.h
setdef1.o: setdefs.h
machine:
ln -sf ${.CURDIR}/../../../alpha/include machine
CLEANFILES+= machine
.include <bsd.prog.mk>
setdefs.h: gensetdefs ${OBJS}
@echo Generating linker sets
@./gensetdefs ${OBJS} >setdefs.h
gensetdefs: gensetdefs.o
${CC} -static gensetdefs.o -o $@
gensetdefs.o: gensetdefs.c
${CC} -c $<
beforedepend ${OBJS}: machine

View File

@ -1,85 +0,0 @@
/*
* $FreeBSD$
* From $NetBSD: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $
*/
/*
* Copyright (c) 1997
* Matthias Drochner. 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 for the NetBSD Project
* by Matthias Drochner.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 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.
*/
#include <stand.h>
#include "libalpha/libalpha.h"
/*
* We could use linker sets for some or all of these, but
* then we would have to control what ended up linked into
* the bootstrap. So it's easier to conditionalise things
* here.
*
* XXX rename these arrays to be consistent and less namespace-hostile
*/
/* Exported for libstand */
struct devsw *devsw[] = {
&srmdisk,
NULL
};
struct fs_ops *file_system[] = {
&ufs_fsops,
&zipfs_fsops,
NULL
};
/* Exported for alpha only */
/*
* Sort formats so that those that can detect based on arguments
* rather than reading the file go first.
*/
extern struct module_format alpha_elf;
struct module_format *module_formats[] = {
&alpha_elf,
NULL
};
/*
* Consoles
*
* We don't prototype these in libalpha.h because they require
* data structures from bootstrap.h as well.
*/
extern struct console promconsole;
struct console *consoles[] = {
&promconsole,
NULL
};

View File

@ -1,71 +1,11 @@
# $FreeBSD$
# $NetBSD: Makefile,v 1.12 1998/02/19 14:18:36 drochner Exp $
BASE= cdboot
PROG= ${BASE}
NOMAN=
NEWVERSWHAT= "SRM CD9660 boot" alpha
LOAD_ADDRESS= ${PRIMARY_LOAD_ADDRESS}
.PATH: ${.CURDIR}/../common
# i386-specific bootstrap sources
SRCS+= main.c conf.c
# Always add MI sources
.PATH: ${.CURDIR}/../../common
.include <${.CURDIR}/../../common/Makefile.inc>
CFLAGS+= -mno-fp-regs
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}
CFLAGS+= -I${.CURDIR}/../../.. -I.
CFLAGS+= -I${.OBJDIR}
CFLAGS+= -DCDBOOT
CLEANFILES+= vers.c vers.o gensetdefs.o gensetdefs setdef0.o setdef1.o \
setdefs.h start.o
CLEANFILES+= ${BASE} ${BASE}.sym ${BASE}.list
CFLAGS+= -Wall
CFLAGS+= -I${LIBSTANDDIR}
CFLAGS+= -I${.CURDIR}/..
CRT= start.o
STRIP=
BINDIR?= /boot
all: ${BASE}
vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
${CC} -c vers.c
${BASE}: ${BASE}.sym
objcopy -O binary ${BASE}.sym ${BASE}
${BASE}.nosym: ${BASE}.sym
cp ${BASE}.sym ${BASE}.nosym
strip ${BASE}.nosym
${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBALPHA} ${CRT} vers.o setdef0.o setdef1.o
${LD} -o ${BASE}.sym -M -e start -N -Ttext ${PRIMARY_LOAD_ADDRESS} \
${CRT} setdef0.o ${OBJS} setdef1.o \
vers.o ${LIBSTAND} ${LIBALPHA} ${LIBSTAND} >${.OBJDIR}/${BASE}.list
start.o: ${.CURDIR}/../libalpha/start.S
${CC} -c ${CFLAGS} $<
setdef0.o: setdefs.h
setdef1.o: setdefs.h
.include <bsd.prog.mk>
setdefs.h: gensetdefs ${OBJS}
@echo Generating linker sets
@./gensetdefs ${OBJS} >setdefs.h
gensetdefs: gensetdefs.o
${CC} -static gensetdefs.o -o $@
gensetdefs.o: gensetdefs.c
${CC} -c $<
CFLAGS+= -DLOADER_CDROM_SUPPORT
.include <${.CURDIR}/../common/Makefile.common>

View File

@ -1,86 +0,0 @@
/*
* $FreeBSD$
* From: $NetBSD: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $
*/
/*
* Copyright (c) 1997
* Matthias Drochner. 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 for the NetBSD Project
* by Matthias Drochner.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 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.
*/
#include <stand.h>
#include "libalpha/libalpha.h"
#include "dev_net.h"
/*
* We could use linker sets for some or all of these, but
* then we would have to control what ended up linked into
* the bootstrap. So it's easier to conditionalise things
* here.
*
* XXX rename these arrays to be consistent and less namespace-hostile
*/
/* Exported for libstand */
struct devsw *devsw[] = {
&srmdisk,
NULL
};
struct fs_ops *file_system[] = {
&cd9660_fsops,
&zipfs_fsops,
NULL
};
/* Exported for alpha only */
/*
* Sort formats so that those that can detect based on arguments
* rather than reading the file go first.
*/
extern struct module_format alpha_elf;
struct module_format *module_formats[] = {
&alpha_elf,
NULL
};
/*
* Consoles
*
* We don't prototype these in libalpha.h because they require
* data structures from bootstrap.h as well.
*/
extern struct console promconsole;
struct console *consoles[] = {
&promconsole,
NULL
};

View File

@ -173,12 +173,14 @@ prom_init(desc, machdep_hint)
if (netbbinfovalid)
netbbinfovalid = netbbinfo.set;
#if 0
printf("netbbinfo ");
if (!netbbinfovalid)
printf("invalid\n");
else
printf("valid: force = %d, ea = %s\n", netbbinfo.force,
ether_sprintf(netbbinfo.ether_addr));
#endif
ret.bits = prom_getenv(PROM_E_BOOTED_DEV, devname, sizeof(devname));
devlen = ret.u.retval;

View File

@ -57,7 +57,7 @@ Lstartgp:
subq a1,a0,a1
CALL(bzero)
#if defined(CDBOOT) || defined(NETBOOT) || defined(LOADER)
#ifndef BOOT1
lda sp,stack + STACK_SIZE - ENTRY_FRAME
#endif
@ -84,6 +84,6 @@ LEAF(cpu_number, 0)
RET
END(cpu_number)
#if defined(CDBOOT) || defined(NETBOOT) || defined(LOADER)
#ifndef BOOT1
BSS(stack, STACK_SIZE)
#endif

View File

@ -0,0 +1,13 @@
# $Id$
BASE= loader
PROG= ${BASE}
NOMAN=
NEWVERSWHAT= "SRM disk boot" alpha
INSTALL_HELP= yes
LOAD_ADDRESS= ${SECONDARY_LOAD_ADDRESS}
# Only disk support
CFLAGS+= -DLOADER_DISK_SUPPORT
.include <${.CURDIR}/../common/Makefile.common>

View File

@ -1,4 +1,4 @@
$FreeBSD$
$Id: version,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $
NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
file is important. Make sure the current version number is on line 6.

View File

@ -4,67 +4,9 @@ BASE= netboot
PROG= ${BASE}
NOMAN=
NEWVERSWHAT= "SRM net boot" alpha
LOAD_ADDRESS= ${PRIMARY_LOAD_ADDRESS}
.PATH: ${.CURDIR}/../common
CFLAGS+= -DLOADER_NET_SUPPORT
# i386-specific bootstrap sources
SRCS+= main.c conf.c dev_net.c
# Always add MI sources
.PATH: ${.CURDIR}/../../common
.include <${.CURDIR}/../../common/Makefile.inc>
CFLAGS+= -mno-fp-regs
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}
CFLAGS+= -I${.CURDIR}/../../.. -I.
CFLAGS+= -I${.OBJDIR}
CFLAGS+= -DNETBOOT
CLEANFILES+= vers.c vers.o gensetdefs.o gensetdefs setdef0.o setdef1.o \
setdefs.h start.o
CLEANFILES+= ${BASE} ${BASE}.sym ${BASE}.list
CFLAGS+= -Wall
CFLAGS+= -I${LIBSTANDDIR}
CFLAGS+= -I${.CURDIR}/..
CRT= start.o
STRIP=
BINDIR?= /boot
all: ${BASE}
vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
${CC} -c vers.c
${BASE}: ${BASE}.sym
objcopy -O binary ${BASE}.sym ${BASE}
${BASE}.nosym: ${BASE}.sym
cp ${BASE}.sym ${BASE}.nosym
strip ${BASE}.nosym
${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBALPHA} ${CRT} vers.o setdef0.o setdef1.o
${LD} -o ${BASE}.sym -M -e start -N -Ttext ${PRIMARY_LOAD_ADDRESS} \
${CRT} setdef0.o ${OBJS} setdef1.o \
vers.o ${LIBSTAND} ${LIBALPHA} ${LIBSTAND} >${.OBJDIR}/${BASE}.list
start.o: ${.CURDIR}/../libalpha/start.S
${CC} -c ${CFLAGS} $<
setdef0.o: setdefs.h
setdef1.o: setdefs.h
.include <bsd.prog.mk>
setdefs.h: gensetdefs ${OBJS}
@echo Generating linker sets
@./gensetdefs ${OBJS} >setdefs.h
gensetdefs: gensetdefs.o
${CC} -static gensetdefs.o -o $@
gensetdefs.o: gensetdefs.c
${CC} -c $<
.include <${.CURDIR}/../common/Makefile.common>

View File

@ -1,91 +0,0 @@
/*
* $FreeBSD$
* From: $NetBSD: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $
*/
/*
* Copyright (c) 1997
* Matthias Drochner. 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 for the NetBSD Project
* by Matthias Drochner.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 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.
*/
#include <stand.h>
#include "libalpha/libalpha.h"
#include "dev_net.h"
/*
* We could use linker sets for some or all of these, but
* then we would have to control what ended up linked into
* the bootstrap. So it's easier to conditionalise things
* here.
*
* XXX rename these arrays to be consistent and less namespace-hostile
*/
/* Exported for libstand */
struct devsw *devsw[] = {
&netdev,
NULL
};
struct fs_ops *file_system[] = {
&nfs_fsops,
&zipfs_fsops,
NULL
};
struct netif_driver *netif_drivers[] = {
&srmnet,
NULL,
};
/* Exported for alpha only */
/*
* Sort formats so that those that can detect based on arguments
* rather than reading the file go first.
*/
extern struct module_format alpha_elf;
struct module_format *module_formats[] = {
&alpha_elf,
NULL
};
/*
* Consoles
*
* We don't prototype these in libalpha.h because they require
* data structures from bootstrap.h as well.
*/
extern struct console promconsole;
struct console *consoles[] = {
&promconsole,
NULL
};