1999-08-28 01:08:13 +00:00
|
|
|
# $FreeBSD$
|
1998-10-14 00:24:16 +00:00
|
|
|
|
2010-09-24 19:49:12 +00:00
|
|
|
.PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../common ${.CURDIR}/../../common
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
FILES= gptboot
|
2013-07-01 22:38:36 +00:00
|
|
|
MAN= gptboot.8
|
2001-07-31 19:50:09 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
NM?= nm
|
1999-07-20 01:19:23 +00:00
|
|
|
|
1999-01-10 14:48:05 +00:00
|
|
|
BOOT_COMCONSOLE_PORT?= 0x3f8
|
|
|
|
BOOT_COMCONSOLE_SPEED?= 9600
|
1998-10-20 20:20:48 +00:00
|
|
|
B2SIOFMT?= 0x3
|
|
|
|
|
2002-10-08 12:09:16 +00:00
|
|
|
REL1= 0x700
|
1998-10-12 21:16:26 +00:00
|
|
|
ORG1= 0x7c00
|
2007-10-24 21:33:00 +00:00
|
|
|
ORG2= 0x0
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
# Decide level of UFS support.
|
2007-10-24 21:33:00 +00:00
|
|
|
GPTBOOT_UFS?= UFS1_AND_UFS2
|
|
|
|
#GPTBOOT_UFS?= UFS2_ONLY
|
|
|
|
#GPTBOOT_UFS?= UFS1_ONLY
|
2004-02-06 21:58:32 +00:00
|
|
|
|
2010-09-24 19:49:12 +00:00
|
|
|
CFLAGS= -DBOOTPROG=\"gptboot\" \
|
2011-09-13 14:03:55 +00:00
|
|
|
-O1 \
|
2010-09-24 19:49:12 +00:00
|
|
|
-DGPT \
|
2007-10-24 21:33:00 +00:00
|
|
|
-D${GPTBOOT_UFS} \
|
2004-02-17 07:13:04 +00:00
|
|
|
-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
|
|
|
|
-DSIOFMT=${B2SIOFMT} \
|
|
|
|
-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
|
2002-06-05 11:10:38 +00:00
|
|
|
-I${.CURDIR}/../../common \
|
2010-09-24 19:49:12 +00:00
|
|
|
-I${.CURDIR}/../common \
|
2007-10-26 15:56:22 +00:00
|
|
|
-I${.CURDIR}/../btx/lib -I. \
|
2007-10-24 21:33:00 +00:00
|
|
|
-I${.CURDIR}/../boot2 \
|
2010-10-08 10:27:52 +00:00
|
|
|
-I${.CURDIR}/../../.. \
|
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
|
|
|
-Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
|
1998-10-12 21:16:26 +00:00
|
|
|
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
|
2007-05-19 05:07:47 +00:00
|
|
|
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
|
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
|
|
|
-Winline -Wno-pointer-sign
|
2014-01-05 21:03:49 +00:00
|
|
|
|
|
|
|
CFLAGS.gcc+= --param max-inline-insns-single=100
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2016-03-16 23:12:19 +00:00
|
|
|
.if !defined(LOADER_NO_GELI_SUPPORT)
|
|
|
|
CFLAGS+= -DLOADER_GELI_SUPPORT
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../geli
|
Implement boot-time encryption key passing (keybuf)
This patch adds a general mechanism for providing encryption keys to the
kernel from the boot loader. This is intended to enable GELI support at
boot time, providing a better mechanism for passing keys to the kernel
than environment variables. It is designed to be extensible to other
applications, and can easily handle multiple encrypted volumes with
different keys.
This mechanism is currently used by the pending GELI EFI work.
Additionally, this mechanism can potentially be used to interface with
GRUB, opening up options for coreboot+GRUB configurations with completely
encrypted disks.
Another benefit over the existing system is that it does not require
re-deriving the user key from the password at each boot stage.
Most of this patch was written by Eric McCorkle. It was extended by
Allan Jude with a number of minor enhancements and extending the keybuf
feature into boot2.
GELI user keys are now derived once, in boot2, then passed to the loader,
which reuses the key, then passes it to the kernel, where the GELI module
destroys the keybuf after decrypting the volumes.
Submitted by: Eric McCorkle <eric@metricspace.net> (Original Version)
Reviewed by: oshogbo (earlier version), cem (earlier version)
MFC after: 3 weeks
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D9575
2017-04-01 05:05:22 +00:00
|
|
|
CFLAGS+= -I${.CURDIR}/../../..
|
2016-03-16 23:12:19 +00:00
|
|
|
LIBGELIBOOT= ${.OBJDIR}/../../geli/libgeliboot.a
|
|
|
|
.PATH: ${.CURDIR}/../../../opencrypto
|
|
|
|
OPENCRYPTO_XTS= xform_aes_xts.o
|
|
|
|
.endif
|
|
|
|
|
2016-09-03 15:26:28 +00:00
|
|
|
LD_FLAGS=${LD_FLAGS_BIN}
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
# Pick up ../Makefile.inc early.
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
CLEANFILES= gptboot
|
2004-02-06 21:58:32 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptboot: gptldr.bin gptboot.bin ${BTXKERN}
|
|
|
|
btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
|
|
|
|
-o ${.TARGET} gptboot.bin
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
CLEANFILES+= gptldr.bin gptldr.out gptldr.o
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptldr.bin: gptldr.out
|
2015-04-02 06:58:17 +00:00
|
|
|
${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
|
2002-05-11 21:39:59 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptldr.out: gptldr.o
|
2013-12-30 19:05:50 +00:00
|
|
|
${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
|
2004-02-06 21:58:32 +00:00
|
|
|
|
2016-03-16 23:12:19 +00:00
|
|
|
CLEANFILES+= gptboot.bin gptboot.out gptboot.o sio.o crc32.o drv.o \
|
|
|
|
cons.o util.o ${OPENCRYPTO_XTS}
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptboot.bin: gptboot.out
|
2015-04-02 06:58:17 +00:00
|
|
|
${OBJCOPY} -S -O binary gptboot.out ${.TARGET}
|
1998-10-12 21:16:26 +00:00
|
|
|
|
2016-03-16 23:12:19 +00:00
|
|
|
gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o util.o ${OPENCRYPTO_XTS}
|
2017-10-09 22:12:46 +00:00
|
|
|
${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32}
|
2001-07-31 19:50:09 +00:00
|
|
|
|
2007-10-24 21:33:00 +00:00
|
|
|
gptboot.o: ${.CURDIR}/../../common/ufsread.c
|
2003-06-26 03:51:57 +00:00
|
|
|
|
2010-08-23 01:42:09 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
2007-10-24 21:33:00 +00:00
|
|
|
beforedepend gptboot.o: machine
|
2004-02-07 08:10:07 +00:00
|
|
|
CLEANFILES+= machine
|
2016-03-11 23:45:51 +00:00
|
|
|
machine: .NOMETA
|
2003-06-26 03:51:57 +00:00
|
|
|
ln -sf ${.CURDIR}/../../../i386/include machine
|
|
|
|
.endif
|
|
|
|
|
2004-02-06 21:58:32 +00:00
|
|
|
.include <bsd.prog.mk>
|
2012-02-28 18:30:18 +00:00
|
|
|
|
|
|
|
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
|
|
|
CFLAGS.gptldr.S= ${CLANG_NO_IAS}
|