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
|
|
|
|
2016-01-15 01:22:36 +00:00
|
|
|
.include <src.opts.mk>
|
2014-04-13 01:14:25 +00:00
|
|
|
|
|
|
|
MK_SSP= no
|
|
|
|
|
2015-09-17 18:32:51 +00:00
|
|
|
PROG= boot1.sym
|
2014-04-13 01:14:25 +00:00
|
|
|
INTERNALPROG=
|
2016-01-12 02:17:39 +00:00
|
|
|
WARNS?= 6
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2016-01-15 02:33:47 +00:00
|
|
|
.if ${MK_ZFS} != "no"
|
|
|
|
# Disable warnings that are currently incompatible with the zfs boot code
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-array-bounds
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-cast-align
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-cast-qual
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-missing-prototypes
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-sign-compare
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-unused-parameter
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-unused-function
|
Add SHA512, skein, large blocks support for loader zfs.
Updated sha512 from illumos.
Using skein from freebsd crypto tree.
Since loader itself is using 64MB memory for heap, updated zfsboot to
use same, and this also allows to support zfs large blocks.
Note, adding additional features does increate zfsboot code, therefore
this update does increase zfsboot code to 128k, also I have ported gptldr.S
update to zfsldr.S to support 64k+ code.
With this update, boot1.efi has almost reached the current limit of the size
set for it, so one of the future patches for boot1.efi will need to
increase the limit.
Currently known missing zfs features in boot loader are edonr and gzip support.
Reviewed by: delphij, imp
Approved by: imp (mentor)
Obtained from: sha256.c update and skein_zfs.c stub from illumos.
Differential Revision: https://reviews.freebsd.org/D7418
2016-08-18 00:37:07 +00:00
|
|
|
CWARNFLAGS.skein.c += -Wno-cast-align
|
2017-03-28 21:39:24 +00:00
|
|
|
.if ${COMPILER_TYPE} == "clang"
|
Add SHA512, skein, large blocks support for loader zfs.
Updated sha512 from illumos.
Using skein from freebsd crypto tree.
Since loader itself is using 64MB memory for heap, updated zfsboot to
use same, and this also allows to support zfs large blocks.
Note, adding additional features does increate zfsboot code, therefore
this update does increase zfsboot code to 128k, also I have ported gptldr.S
update to zfsldr.S to support 64k+ code.
With this update, boot1.efi has almost reached the current limit of the size
set for it, so one of the future patches for boot1.efi will need to
increase the limit.
Currently known missing zfs features in boot loader are edonr and gzip support.
Reviewed by: delphij, imp
Approved by: imp (mentor)
Obtained from: sha256.c update and skein_zfs.c stub from illumos.
Differential Revision: https://reviews.freebsd.org/D7418
2016-08-18 00:37:07 +00:00
|
|
|
CWARNFLAGS.skein.c += -Wno-missing-variable-declarations
|
2017-03-28 21:39:24 +00:00
|
|
|
.else if ${COMPILER_TYPE} == "gcc"
|
|
|
|
CWARNFLAGS.skein.c += -Wno-missing-declarations
|
|
|
|
.endif
|
2016-01-15 02:33:47 +00:00
|
|
|
.endif
|
|
|
|
|
2014-04-13 01:14:25 +00:00
|
|
|
# architecture-specific loader code
|
2016-01-15 01:22:36 +00:00
|
|
|
SRCS= boot1.c self_reloc.c start.S ufs_module.c
|
2016-01-15 02:33:47 +00:00
|
|
|
.if ${MK_ZFS} != "no"
|
|
|
|
SRCS+= zfs_module.c
|
Add SHA512, skein, large blocks support for loader zfs.
Updated sha512 from illumos.
Using skein from freebsd crypto tree.
Since loader itself is using 64MB memory for heap, updated zfsboot to
use same, and this also allows to support zfs large blocks.
Note, adding additional features does increate zfsboot code, therefore
this update does increase zfsboot code to 128k, also I have ported gptldr.S
update to zfsldr.S to support 64k+ code.
With this update, boot1.efi has almost reached the current limit of the size
set for it, so one of the future patches for boot1.efi will need to
increase the limit.
Currently known missing zfs features in boot loader are edonr and gzip support.
Reviewed by: delphij, imp
Approved by: imp (mentor)
Obtained from: sha256.c update and skein_zfs.c stub from illumos.
Differential Revision: https://reviews.freebsd.org/D7418
2016-08-18 00:37:07 +00:00
|
|
|
SRCS+= skein.c skein_block.c
|
2016-10-06 03:32:30 +00:00
|
|
|
# Do not unroll skein loops, reduce code size
|
|
|
|
CFLAGS+= -DSKEIN_LOOP=111
|
Add SHA512, skein, large blocks support for loader zfs.
Updated sha512 from illumos.
Using skein from freebsd crypto tree.
Since loader itself is using 64MB memory for heap, updated zfsboot to
use same, and this also allows to support zfs large blocks.
Note, adding additional features does increate zfsboot code, therefore
this update does increase zfsboot code to 128k, also I have ported gptldr.S
update to zfsldr.S to support 64k+ code.
With this update, boot1.efi has almost reached the current limit of the size
set for it, so one of the future patches for boot1.efi will need to
increase the limit.
Currently known missing zfs features in boot loader are edonr and gzip support.
Reviewed by: delphij, imp
Approved by: imp (mentor)
Obtained from: sha256.c update and skein_zfs.c stub from illumos.
Differential Revision: https://reviews.freebsd.org/D7418
2016-08-18 00:37:07 +00:00
|
|
|
.PATH: ${.CURDIR}/../../../crypto/skein
|
2016-01-15 02:33:47 +00:00
|
|
|
.endif
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2017-03-28 23:56:02 +00:00
|
|
|
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
|
|
|
|
CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized
|
|
|
|
.endif
|
|
|
|
|
2014-04-13 01:14:25 +00:00
|
|
|
CFLAGS+= -I.
|
2015-04-01 08:30:40 +00:00
|
|
|
CFLAGS+= -I${.CURDIR}/../include
|
2015-04-14 10:40:37 +00:00
|
|
|
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
|
2014-04-13 01:14:25 +00:00
|
|
|
CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../..
|
2016-01-15 01:22:36 +00:00
|
|
|
CFLAGS+= -DEFI_UFS_BOOT
|
2016-01-18 12:02:05 +00:00
|
|
|
.ifdef(EFI_DEBUG)
|
|
|
|
CFLAGS+= -DEFI_DEBUG
|
|
|
|
.endif
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2016-01-15 02:33:47 +00:00
|
|
|
.if ${MK_ZFS} != "no"
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../zfs/
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs/
|
Add SHA512, skein, large blocks support for loader zfs.
Updated sha512 from illumos.
Using skein from freebsd crypto tree.
Since loader itself is using 64MB memory for heap, updated zfsboot to
use same, and this also allows to support zfs large blocks.
Note, adding additional features does increate zfsboot code, therefore
this update does increase zfsboot code to 128k, also I have ported gptldr.S
update to zfsldr.S to support 64k+ code.
With this update, boot1.efi has almost reached the current limit of the size
set for it, so one of the future patches for boot1.efi will need to
increase the limit.
Currently known missing zfs features in boot loader are edonr and gzip support.
Reviewed by: delphij, imp
Approved by: imp (mentor)
Obtained from: sha256.c update and skein_zfs.c stub from illumos.
Differential Revision: https://reviews.freebsd.org/D7418
2016-08-18 00:37:07 +00:00
|
|
|
CFLAGS+= -I${.CURDIR}/../../../crypto/skein
|
2016-01-15 02:33:47 +00:00
|
|
|
CFLAGS+= -DEFI_ZFS_BOOT
|
|
|
|
.endif
|
|
|
|
|
2014-04-13 06:24:01 +00:00
|
|
|
# Always add MI sources and REGULAR efi loader bits
|
2015-04-14 10:40:37 +00:00
|
|
|
.PATH: ${.CURDIR}/../loader/arch/${MACHINE}
|
2015-04-07 21:34:49 +00:00
|
|
|
.PATH: ${.CURDIR}/../loader
|
|
|
|
.PATH: ${.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-14 10:40:37 +00:00
|
|
|
LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE}
|
2016-03-08 17:45:56 +00:00
|
|
|
LDFLAGS+= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
|
2015-04-03 15:25:59 +00:00
|
|
|
|
2015-05-05 11:00:50 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "aarch64"
|
|
|
|
CFLAGS+= -msoft-float -mgeneral-regs-only
|
|
|
|
.endif
|
2015-04-03 15:25:59 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
2015-04-09 10:08:10 +00:00
|
|
|
CFLAGS+= -fPIC
|
2015-04-03 15:25:59 +00:00
|
|
|
LDFLAGS+= -Wl,-znocombreloc
|
|
|
|
.endif
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2015-04-06 15:50:20 +00:00
|
|
|
#
|
2015-04-07 21:41:26 +00:00
|
|
|
# Add libstand for the runtime functions used by the compiler - for example
|
|
|
|
# __aeabi_* (arm) or __divdi3 (i386).
|
2016-01-09 03:20:01 +00:00
|
|
|
# as well as required string and memory functions for all platforms.
|
2015-04-06 15:50:20 +00:00
|
|
|
#
|
|
|
|
DPADD+= ${LIBSTAND}
|
|
|
|
LDADD+= -lstand
|
|
|
|
|
2015-09-17 18:32:51 +00:00
|
|
|
DPADD+= ${LDSCRIPT}
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2016-03-12 21:44:33 +00:00
|
|
|
NM?= nm
|
2014-04-13 01:14:25 +00:00
|
|
|
OBJCOPY?= objcopy
|
|
|
|
|
|
|
|
.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
|
2015-04-06 15:50:20 +00:00
|
|
|
.else
|
|
|
|
EFI_TARGET= binary
|
2014-04-13 01:14:25 +00:00
|
|
|
.endif
|
|
|
|
|
2016-08-31 21:35:38 +00:00
|
|
|
# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
|
|
|
|
# for build reproducibility.
|
|
|
|
SOURCE_DATE_EPOCH?=1451606400
|
2015-09-17 18:32:51 +00:00
|
|
|
boot1.efi: ${PROG}
|
2016-03-12 21:44:33 +00:00
|
|
|
if ${NM} ${.ALLSRC} | grep ' U '; then \
|
|
|
|
echo "Undefined symbols in ${.ALLSRC}"; \
|
2014-04-13 01:14:25 +00:00
|
|
|
exit 1; \
|
|
|
|
fi
|
2016-08-31 21:35:38 +00:00
|
|
|
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
|
2015-04-06 15:50:20 +00:00
|
|
|
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
|
2014-04-13 01:14:25 +00:00
|
|
|
-j .dynamic -j .dynsym -j .rel.dyn \
|
2015-09-17 18:32:51 +00:00
|
|
|
-j .rela.dyn -j .reloc -j .eh_frame \
|
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
|
|
|
|
|
2015-09-17 18:32:51 +00:00
|
|
|
# The following inserts our objects into a template FAT file system
|
2014-04-26 16:34:22 +00:00
|
|
|
# created by generate-fat.sh
|
|
|
|
|
|
|
|
.include "${.CURDIR}/Makefile.fat"
|
2016-01-08 16:37:22 +00:00
|
|
|
BOOT1_MAXSIZE?= 131072
|
2014-04-26 16:34:22 +00:00
|
|
|
|
|
|
|
boot1.efifat: boot1.efi
|
2017-03-28 21:35:18 +00:00
|
|
|
@set -- `ls -l ${.ALLSRC}`; \
|
2016-01-08 16:37:22 +00:00
|
|
|
x=$$(($$5-${BOOT1_MAXSIZE})); \
|
|
|
|
if [ $$x -ge 0 ]; then \
|
|
|
|
echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\
|
|
|
|
exit 1; \
|
|
|
|
fi
|
2014-04-26 16:34:22 +00:00
|
|
|
echo ${.OBJDIR}
|
2015-04-14 10:40:37 +00:00
|
|
|
uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu
|
|
|
|
mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2
|
2014-04-26 16:34:22 +00:00
|
|
|
bzip2 -f -d ${.TARGET}.bz2
|
2017-03-28 21:35:18 +00:00
|
|
|
${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
|
2014-04-26 16:34:22 +00:00
|
|
|
|
2015-04-05 18:57:58 +00:00
|
|
|
CLEANFILES= boot1.efi boot1.efifat
|
2014-04-26 16:34:22 +00:00
|
|
|
|
2014-04-13 01:14:25 +00:00
|
|
|
.include <bsd.prog.mk>
|
|
|
|
|
2015-04-13 16:00:09 +00:00
|
|
|
beforedepend ${OBJS}: machine
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2015-04-13 16:00:09 +00:00
|
|
|
CLEANFILES+= machine
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2016-03-11 23:45:51 +00:00
|
|
|
machine: .NOMETA
|
2015-04-13 16:00:09 +00:00
|
|
|
ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
|
|
|
|
|
|
|
|
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
|
|
|
beforedepend ${OBJS}: x86
|
|
|
|
CLEANFILES+= x86
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2016-03-11 23:45:51 +00:00
|
|
|
x86: .NOMETA
|
2014-04-13 01:14:25 +00:00
|
|
|
ln -sf ${.CURDIR}/../../../x86/include x86
|
2015-04-03 15:25:59 +00:00
|
|
|
.endif
|