2014-04-13 01:14:25 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
2014-04-25 19:25:05 +00:00
|
|
|
MAN=
|
2014-04-13 01:14:25 +00:00
|
|
|
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
|
|
|
# In-tree GCC does not support __attribute__((ms_abi)).
|
|
|
|
.if ${COMPILER_TYPE} != "gcc"
|
|
|
|
|
|
|
|
MK_SSP= no
|
|
|
|
|
|
|
|
PROG= loader.sym
|
|
|
|
INTERNALPROG=
|
|
|
|
|
|
|
|
# architecture-specific loader code
|
|
|
|
SRCS= boot1.c reloc.c start.S
|
|
|
|
|
|
|
|
CFLAGS+= -fPIC
|
|
|
|
CFLAGS+= -I.
|
2015-04-01 08:30:40 +00:00
|
|
|
CFLAGS+= -I${.CURDIR}/../include
|
|
|
|
CFLAGS+= -I${.CURDIR}/../include/${MACHINE_CPUARCH}
|
2014-04-13 01:14:25 +00:00
|
|
|
CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../..
|
|
|
|
|
2014-04-13 06:24:01 +00:00
|
|
|
# Always add MI sources and REGULAR efi loader bits
|
2015-04-01 08:30:40 +00:00
|
|
|
.PATH: ${.CURDIR}/../loader/arch/amd64 ${.CURDIR}/../../common
|
2014-04-13 01:14:25 +00:00
|
|
|
CFLAGS+= -I${.CURDIR}/../../common
|
|
|
|
|
2014-04-26 16:34:22 +00:00
|
|
|
FILES= boot1.efi boot1.efifat
|
2014-04-13 01:14:25 +00:00
|
|
|
FILESMODE_boot1.efi= ${BINMODE}
|
|
|
|
|
2015-04-01 08:30:40 +00:00
|
|
|
LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE_CPUARCH}/ldscript.${MACHINE_CPUARCH}
|
2014-04-13 01:14:25 +00:00
|
|
|
LDFLAGS= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared -Wl,-znocombreloc
|
|
|
|
|
|
|
|
${PROG}: ${LDSCRIPT}
|
|
|
|
|
|
|
|
OBJCOPY?= objcopy
|
|
|
|
OBJDUMP?= objdump
|
|
|
|
|
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
|
|
|
EFI_TARGET= efi-app-x86_64
|
2015-04-01 08:30:40 +00:00
|
|
|
.elif ${MACHINE_CPUARCH} == "i386"
|
2014-04-13 01:14:25 +00:00
|
|
|
EFI_TARGET= efi-app-ia32
|
|
|
|
.endif
|
|
|
|
|
|
|
|
boot1.efi: loader.sym
|
|
|
|
if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \
|
|
|
|
${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
${OBJCOPY} -j .text -j .sdata -j .data \
|
|
|
|
-j .dynamic -j .dynsym -j .rel.dyn \
|
|
|
|
-j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
|
2014-12-23 15:58:45 +00:00
|
|
|
--output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2014-04-13 14:50:52 +00:00
|
|
|
boot1.o: ${.CURDIR}/../../common/ufsread.c
|
|
|
|
|
2014-04-26 16:34:22 +00:00
|
|
|
# The following inserts out objects into a template FAT file system
|
|
|
|
# created by generate-fat.sh
|
|
|
|
|
|
|
|
.include "${.CURDIR}/Makefile.fat"
|
|
|
|
|
|
|
|
boot1.efifat: boot1.efi
|
|
|
|
echo ${.OBJDIR}
|
|
|
|
uudecode ${.CURDIR}/fat.tmpl.bz2.uu
|
|
|
|
mv fat.tmpl.bz2 ${.TARGET}.bz2
|
|
|
|
bzip2 -f -d ${.TARGET}.bz2
|
|
|
|
dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
|
|
|
|
|
|
|
|
CLEANFILES= boot1.efifat
|
|
|
|
|
2014-04-13 01:14:25 +00:00
|
|
|
.endif # ${COMPILER_TYPE} != "gcc"
|
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|
|
|
|
|
|
|
|
beforedepend ${OBJS}: machine x86
|
|
|
|
|
2014-07-22 04:38:28 +00:00
|
|
|
CLEANFILES+= machine x86 boot1.efi
|
2014-04-13 01:14:25 +00:00
|
|
|
|
|
|
|
machine:
|
|
|
|
ln -sf ${.CURDIR}/../../../amd64/include machine
|
|
|
|
|
|
|
|
x86:
|
|
|
|
ln -sf ${.CURDIR}/../../../x86/include x86
|