head	1.23;
access;
symbols
	RELENG_5_5_0_RELEASE:1.22
	RELENG_5_5:1.22.0.8
	RELENG_5_5_BP:1.22
	RELENG_5_4_0_RELEASE:1.22
	RELENG_5_4:1.22.0.6
	RELENG_5_4_BP:1.22
	RELENG_5_3_0_RELEASE:1.22
	RELENG_5_3:1.22.0.4
	RELENG_5_3_BP:1.22
	RELENG_5:1.22.0.2
	RELENG_5_BP:1.22
	RELENG_5_2_1_RELEASE:1.19
	RELENG_5_2_0_RELEASE:1.19
	RELENG_5_2:1.19.0.4
	RELENG_5_2_BP:1.19
	RELENG_5_1_0_RELEASE:1.19
	RELENG_5_1:1.19.0.2
	RELENG_5_1_BP:1.19
	RELENG_5_0_0_RELEASE:1.18
	RELENG_5_0:1.18.0.2
	RELENG_5_0_BP:1.18
	KSE_MILESTONE_2:1.6
	KSE_PRE_MILESTONE_2:1.6;
locks; strict;
comment	@# @;


1.23
date	2004.11.23.18.54.06;	author marcel;	state dead;
branches;
next	1.22;

1.22
date	2004.07.20.07.01.02;	author marcel;	state Exp;
branches;
next	1.21;

1.21
date	2004.02.13.04.45.41;	author marcel;	state Exp;
branches;
next	1.20;

1.20
date	2004.02.12.08.10.33;	author ru;	state Exp;
branches;
next	1.19;

1.19
date	2003.02.26.06.18.52;	author obrien;	state Exp;
branches;
next	1.18;

1.18
date	2002.05.10.09.26.31;	author obrien;	state Exp;
branches;
next	1.17;

1.17
date	2002.04.07.04.27.50;	author peter;	state Exp;
branches;
next	1.16;

1.16
date	2002.04.07.04.26.42;	author peter;	state Exp;
branches;
next	1.15;

1.15
date	2002.04.07.04.25.45;	author peter;	state Exp;
branches;
next	1.14;

1.14
date	2002.04.06.04.29.36;	author peter;	state Exp;
branches;
next	1.13;

1.13
date	2002.04.06.04.11.46;	author peter;	state Exp;
branches;
next	1.12;

1.12
date	2002.04.06.03.39.22;	author peter;	state Exp;
branches;
next	1.11;

1.11
date	2002.04.04.06.04.38;	author peter;	state Exp;
branches;
next	1.10;

1.10
date	2002.03.31.20.48.13;	author marcel;	state Exp;
branches;
next	1.9;

1.9
date	2002.03.28.06.58.46;	author marcel;	state Exp;
branches;
next	1.8;

1.8
date	2001.10.08.01.41.45;	author marcel;	state Exp;
branches;
next	1.7;

1.7
date	2001.09.22.19.12.30;	author dfr;	state Exp;
branches;
next	1.6;

1.6
date	2001.09.04.14.48.59;	author dfr;	state Exp;
branches;
next	1.5;

1.5
date	2001.09.04.08.59.38;	author dfr;	state Exp;
branches;
next	1.4;

1.4
date	2001.07.10.16.18.20;	author dfr;	state Exp;
branches;
next	1.3;

1.3
date	2001.06.16.06.17.16;	author obrien;	state Exp;
branches;
next	1.2;

1.2
date	2001.06.14.01.23.57;	author peter;	state Exp;
branches;
next	1.1;

1.1
date	2001.06.09.16.49.51;	author dfr;	state Exp;
branches;
next	;


desc
@@


1.23
log
@This file was repocopied to src/sys/boot/ia64/efi.
@
text
@# $FreeBSD: src/sys/boot/efi/loader/Makefile,v 1.22 2004/07/20 07:01:02 marcel Exp $

PROG= 		loader.sym
INTERNALPROG=
NOMAN=
NEWVERSWHAT=	"EFI boot" ${MACHINE_ARCH}

SRCS=		start.S main.c conf.c dev_net.c vers.c

.PATH: ${.CURDIR}/../libefi/arch/${MACHINE_ARCH}

.if !defined(NOFORTH)
# Enable BootForth
BOOT_FORTH=	yes
CFLAGS+=	-DBOOT_FORTH
CFLAGS+=	-I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/${MACHINE_ARCH}
LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
.endif

LIBEFI=		${.OBJDIR}/../libefi/libefi.a

# Always add MI sources 
.PATH: ${.CURDIR}/../../common
.include "${.CURDIR}/../../common/Makefile.inc"

CFLAGS+= -I${.CURDIR}/../include
CFLAGS+= -I${.CURDIR}/../include/${MACHINE_ARCH}
CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I${.CURDIR}/../libefi
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
CFLAGS+= -DLOADER

LDSCRIPT=	${.CURDIR}/../libefi/arch/${MACHINE_ARCH}/ldscript.${MACHINE_ARCH}
LDFLAGS=	-Wl,-T${LDSCRIPT} -shared -symbolic
OBJCOPY?=	objcopy

CLEANFILES=	vers.c loader.efi loader.help

vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}

loader.efi: loader.sym
	${OBJCOPY} -j .text \
		-j .data \
		-j .sdata \
		-j .dynamic \
		-j .rela.dyn \
		-j .reloc \
		-j .hash \
		-j .dynsym \
		-j .dynstr \
		--target=efi-app-${MACHINE_ARCH} \
		loader.sym loader.efi

loader.help:	help.common
	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk \
	    > ${.TARGET}

.PATH: ${.CURDIR}/../../forth
FILES=	loader.efi loader.help loader.4th support.4th loader.conf
FILESMODE_loader.efi= ${BINMODE}
FILESDIR_loader.conf=	/boot/defaults

.if !exists(${DESTDIR}/boot/loader.rc)
FILES+=	loader.rc
.endif

DPADD=	${LIBFICL} ${LIBEFI} ${LIBSTAND}
LDADD=	${LIBFICL} ${LIBEFI} -lstand

.include <bsd.prog.mk>
@


1.22
log
@Fix the creation of EFI images that got broken by the import of
binutils 2.15. The linker now creates a .rela.dyn section for
dynamic relocations, while our script created a .rela section.
Likewise, we copied the .rela section to the EFI image, but not
the .rela.dyn section. The fix is to rename .rela to .rela.dyn
in the linker script so that all relocations end up in the same
section again. This we copy into the EFI image.
@
text
@d1 1
a1 1
# $FreeBSD$
@


1.21
log
@Don't create a mapfile during link. It's not needed for the build.
@
text
@a43 1
		-j .hash \
d47 1
a47 1
		-j .rela \
d49 1
@


1.20
log
@Tidy up makefiles.

Tested by:	marcel
@
text
@d34 1
a34 1
LDFLAGS=	-Wl,-T${LDSCRIPT} -Wl,-M,-Map,loader.list -shared -symbolic
d37 1
a37 1
CLEANFILES=	vers.c loader.efi loader.list loader.help
@


1.19
log
@Consistently use NOFORTH to control the usage of ficl.
@
text
@d3 2
a4 4
.PATH: ${.CURDIR}/../common

BASE= 		loader
PROG= 		${BASE}.efi
a6 2
BINDIR?=	/boot
STRIP=		# We must not strip loader.efi at install time.
d8 1
a8 1
SRCS+=		main.c conf.c dev_net.c
d10 1
a10 1
CFLAGS+=	-ffreestanding
a16 1
.if exists(${.OBJDIR}/../../ficl/libficl.a)
a17 10
.else
LIBFICL=	${.CURDIR}/../../ficl/libficl.a
.endif
.endif

# where to get libstand from
.if exists(${.OBJDIR}/../../../../lib/libstand/libstand.a)
LIBSTAND=	${.OBJDIR}/../../../../lib/libstand/libstand.a
.else
LIBSTAND=	${.CURDIR}/../../../../lib/libstand/libstand.a
a19 1
.if exists(${.OBJDIR}/../libefi/libefi.a)
a20 3
.else
LIBEFI=		${.CURDIR}/../libefi/libefi.a
.endif
d24 1
a24 1
.include <${.CURDIR}/../../common/Makefile.inc>
a25 1
CFLAGS+= -I-
d28 1
a28 2
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}
CFLAGS+= -I${.CURDIR}/../../.. -I.
d34 1
a34 1
LDFLAGS=	-nostdlib -T ${LDSCRIPT} -shared -Bsymbolic
d37 1
a37 8
CLEANFILES+=	setdef0.c setdef0.o setdef1.c setdef1.o setdefs.h start.o \
		vers.c vers.o ${BASE}.efi ${BASE}.sym ${BASE}.list
CLEANFILES+=	loader.help
CLEANFILES+=	machine

CRT=	start.o

all: ${BASE}
d39 1
a39 1
vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
a40 1
	${CC} -c vers.c
d42 1
a42 3
${BASE}:	${BASE}.efi ${BASE}.help

${BASE}.efi: ${BASE}.sym
d53 1
a53 1
		${BASE}.sym ${BASE}.efi
d55 1
a55 1
${BASE}.help:	help.common
d59 5
a63 8
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
d65 1
a65 2
	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
		${.CURDIR}/../../forth/loader.rc ${DESTDIR}/boot
a66 7
	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
		${.CURDIR}/../../forth/loader.4th ${DESTDIR}/boot
	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
		${.CURDIR}/../../forth/support.4th ${DESTDIR}/boot
	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
		${.CURDIR}/../../forth/loader.conf ${DESTDIR}/boot/defaults

d68 2
a69 6
# Other fragments still to be brought in from ../Makfile.booters?
start.o: ${.CURDIR}/../libefi/arch/${MACHINE_ARCH}/start.S
	${CC} -c ${CFLAGS} ${.IMPSRC}

machine:
	ln -sf ${.CURDIR}/../../../${MACHINE_ARCH}/include machine
a71 6

${BASE}.sym: ${OBJS} ${LIBFICL} ${LIBEFI} ${LIBSTAND} ${CRT} vers.o
	${LD} ${LDFLAGS} -o ${BASE}.sym -M ${CRT} ${OBJS} vers.o \
	    ${LIBFICL} ${LIBEFI} ${LIBSTAND} > ${.OBJDIR}/${BASE}.list

beforedepend ${OBJS}: machine
@


1.18
log
@-ffreestanding is the word.
(also resort some CFLAGS such that the more "important" value are first so
they are easier to see)
@
text
@d15 2
d19 1
a20 2
.if BOOT_FORTH
CFLAGS+=	-DBOOT_FORTH
a25 2
.else
LIBFICL=
@


1.17
log
@We must not let install(1) strip loader.efi when installing it, or the
resulting binary will be damaged and no longer work.
@
text
@d14 1
@


1.16
log
@Set BINDIR
@
text
@d10 1
@


1.15
log
@Add loader bootforth infrastructure and install it.
@
text
@d9 1
@


1.14
log
@Try and tidy up some very loose ends with paths to various libraries etc.
@
text
@d63 1
a63 1
all: ${PROG}
d69 2
d84 1
a84 1
${BASE}.help:	help.common help.efi
d89 8
a96 1
.if exists(${.OBJDIR}/${BASE}.help)
d98 1
a98 1
	    ${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
d100 7
@


1.13
log
@Do not assume that ${OBJCOPY} variable exists.  It was hidden by the
fact that the 'ia64-make' wrapper explicitly set it.
@
text
@d26 13
d101 1
a101 1
${BASE}.sym: ${OBJS} ${LIBEFI} ${CRT} vers.o
d103 1
a103 2
	    ${LIBFICL}  ${LIBEFI} -L${DESTDIR}${LIBDIR} ${LIBSTAND} \
	    > ${.OBJDIR}/${BASE}.list
@


1.12
log
@Fix self hosted loader building.  When you use a self configured gcc, it
detects and uses the gas section merge support.  As a result, a whole bunch
of new sections arrive, including .rodata.str1.8, which was not included
in our custom ldscript.ia64.  The result was a loader binary that EFI
rejected.

While here, collect the loader shell commands linker set and include it
in the data area rather than having its own section.

/boot/loader.efi was the last holdout for having a 100% self built ia64
system.
@
text
@d41 1
@


1.11
log
@Use a relative path to libstand.. /usr/src/lib/libstand may not exist
or may have the wrong header files.
@
text
@a56 1
		-j set_Xcommand_set \
@


1.10
log
@Only install the help file if we can find it. Use ${BASE}.help
in both the condition and for the install. We expect to find
the help file in ${.OBJDIR}.
@
text
@d36 1
a36 1
CFLAGS+= -I/usr/src/lib/libstand
@


1.9
log
@o  Add -L${DESTDIR}${LIBDIR} on the link line for -lstand.
o  Add -j .dynstr to objcopy. This makes .efi binaries work
   when built with a 3.x based toolchain.
@
text
@d74 1
a74 1
.if exists(${.OBJDIR}/loader.help)
a76 3
.else
	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
	    ${.CURDIR}/${BASE}.help ${DESTDIR}/boot
@


1.8
log
@s/alpha/${MACHINE_ARCH}/g
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/efi/loader/Makefile,v 1.7 2001/09/22 19:12:30 dfr Exp $
d65 1
d91 3
a93 4
${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBEFI} ${CRT} vers.o
	${LD} ${LDFLAGS} -o ${BASE}.sym -M \
	    ${CRT} ${OBJS} vers.o \
	    ${LIBFICL} ${LIBSTAND} ${LIBEFI} ${LIBSTAND} \
@


1.7
log
@Add EFI network support.
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/efi/loader/Makefile,v 1.6 2001/09/04 14:48:59 dfr Exp $
d14 1
a14 1
CFLAGS+=	-I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/alpha
@


1.6
log
@Enable bootforth.
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/efi/loader/Makefile,v 1.5 2001/09/04 08:59:38 dfr Exp $
d10 1
a10 1
SRCS+=		main.c conf.c
d36 1
d90 1
a90 1
${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBARC} ${CRT} vers.o
@


1.5
log
@Make sure we copy over the linker set sections to the EFI executable.
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/efi/loader/Makefile,v 1.4 2001/07/10 16:18:20 dfr Exp $
d13 1
a13 1
#BOOT_FORTH=	yes
@


1.4
log
@Make this build again after breakage from previous commits.
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/efi/loader/Makefile,v 1.3 2001/06/16 06:17:16 obrien Exp $
d56 1
@


1.3
log
@style cleanup
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/efi/loader/Makefile,v 1.2 2001/06/14 01:23:57 peter Exp $
a65 6
${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBARC} ${CRT} vers.o
	${LD} ${LDFLAGS} -o ${BASE}.sym -M \
	    ${CRT} {OBJS} vers.o \
	    ${LIBFICL} ${LIBSTAND} ${LIBEFI} ${LIBSTAND} \
	    > ${.OBJDIR}/${BASE}.list

d87 6
@


1.2
log
@Nuke old gensetdefs based linker sets with extreme prejudice
@
text
@d1 3
a3 1
# $FreeBSD: src/sys/boot/efi/loader/Makefile,v 1.1 2001/06/09 16:49:51 dfr Exp $
a9 2
.PATH:		${.CURDIR}/../common

d27 10
a36 10
.PATH:		${.CURDIR}/../../common
.include	<${.CURDIR}/../../common/Makefile.inc>
CFLAGS+=	-I-
CFLAGS+=	-I${.CURDIR}/../include
CFLAGS+=	-I${.CURDIR}/../include/${MACHINE_ARCH}
CFLAGS+=	-I${.CURDIR}/../../common -I${.CURDIR}
CFLAGS+=	-I${.CURDIR}/../../.. -I.
CFLAGS+=	-I${.CURDIR}/../libefi
CFLAGS+=	-DLOADER
CFLAGS+=	-Wall
d46 1
a46 1
CRT=		start.o
d48 1
a48 1
all:		${PROG}
d68 3
a70 3
	${CRT} {OBJS} vers.o \
	${LIBFICL} ${LIBSTAND} ${LIBEFI} ${LIBSTAND} \
	> ${.OBJDIR}/${BASE}.list
d73 2
a74 1
	cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
d79 1
a79 1
		${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
d82 1
a82 1
		${.CURDIR}/${BASE}.help ${DESTDIR}/boot
d86 2
a87 2
start.o:	${.CURDIR}/../libefi/arch/${MACHINE_ARCH}/start.S
	${CC} -c ${CFLAGS} $<
@


1.1
log
@First approximation of an ia64 EFI loader. Not functional.
@
text
@d1 1
a1 1
# $FreeBSD$
d66 1
a66 1
${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBARC} ${CRT} vers.o setdef0.o setdef1.o
d68 1
a68 1
	${CRT} setdef0.o ${OBJS} setdef1.o vers.o \
a87 4
setdef0.o: setdefs.h

setdef1.o: setdefs.h

a91 5

.ORDER: setdefs.h setdef0.c setdef1.c
setdefs.h setdef0.c setdef1.c: ${OBJS}
	@@echo Generating linker sets
	@@perl ${.CURDIR}/../../../kern/gensetdefs.pl ${OBJS}
@

