1999-08-28 01:08:13 +00:00
|
|
|
# $FreeBSD$
|
1998-08-21 03:17:42 +00:00
|
|
|
|
2017-10-22 22:50:08 +00:00
|
|
|
.PATH: ${LDRSRC} ${BOOTSRC}/libsa
|
2017-10-16 03:59:28 +00:00
|
|
|
|
2017-10-22 22:50:08 +00:00
|
|
|
CFLAGS+=-I${LDRSRC}
|
2017-10-12 14:56:54 +00:00
|
|
|
|
2012-08-05 12:15:15 +00:00
|
|
|
SRCS+= boot.c commands.c console.c devopen.c interp.c
|
2003-05-01 03:56:30 +00:00
|
|
|
SRCS+= interp_backslash.c interp_parse.c ls.c misc.c
|
loader: zfs should support bootonce an nextboot
bootonce feature is temporary, one time boot, activated by
"bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag.
By default, the bootonce setting is reset on attempt to boot and the next
boot will use previously active BE.
By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will
be set permanently active.
bootonce dataset name is recorded in boot pool labels, bootenv area.
in case of nextboot, the nextboot_enable boolean variable is recorded in
freebsd:nvstore nvlist, also stored in boot pool label bootenv area.
On boot, the loader will process /boot/nextboot.conf if nextboot_enable
is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf
processing on next boot.
bootonce and nextboot features are usable in both UEFI and BIOS boot.
To use bootonce/nextboot features, the boot loader needs to be updated on disk;
if loader.efi is stored on ESP, then ESP needs to be updated and
for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated
(gpart or other tools).
At this time, only lua loader is updated.
Sponsored by: Netflix, Klara Inc.
Differential Revision: https://reviews.freebsd.org/D25512
2020-09-21 09:01:10 +00:00
|
|
|
SRCS+= module.c nvstore.c
|
1998-09-14 18:27:06 +00:00
|
|
|
|
2010-08-23 01:43:47 +00:00
|
|
|
.if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64"
|
2004-10-24 12:32:41 +00:00
|
|
|
SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c
|
|
|
|
SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c
|
2015-04-14 13:55:01 +00:00
|
|
|
.elif ${MACHINE_CPUARCH} == "aarch64"
|
|
|
|
SRCS+= load_elf64.c reloc_elf64.c
|
2010-08-25 16:23:50 +00:00
|
|
|
.elif ${MACHINE_CPUARCH} == "arm"
|
2004-08-28 23:03:05 +00:00
|
|
|
SRCS+= load_elf32.c reloc_elf32.c
|
2010-08-23 01:43:47 +00:00
|
|
|
.elif ${MACHINE_CPUARCH} == "powerpc"
|
2010-07-12 00:49:22 +00:00
|
|
|
SRCS+= load_elf32.c reloc_elf32.c
|
|
|
|
SRCS+= load_elf64.c reloc_elf64.c
|
2018-02-13 03:44:50 +00:00
|
|
|
SRCS+= metadata.c
|
2016-10-31 15:33:58 +00:00
|
|
|
.elif ${MACHINE_ARCH:Mmips64*} != ""
|
2014-02-23 22:11:26 +00:00
|
|
|
SRCS+= load_elf64.c reloc_elf64.c
|
2018-02-13 03:44:50 +00:00
|
|
|
SRCS+= metadata.c
|
2016-03-04 05:36:53 +00:00
|
|
|
.elif ${MACHINE} == "mips"
|
2016-02-29 07:27:49 +00:00
|
|
|
SRCS+= load_elf32.c reloc_elf32.c
|
2018-02-13 03:44:50 +00:00
|
|
|
SRCS+= metadata.c
|
2020-07-06 18:19:42 +00:00
|
|
|
.elif ${MACHINE_CPUARCH} == "riscv"
|
|
|
|
SRCS+= load_elf64.c reloc_elf64.c
|
|
|
|
SRCS+= metadata.c
|
2003-05-01 03:56:30 +00:00
|
|
|
.endif
|
|
|
|
|
2017-10-16 03:59:52 +00:00
|
|
|
.if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
|
2020-03-19 21:05:11 +00:00
|
|
|
CFLAGS.part.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
|
2019-04-26 17:58:44 +00:00
|
|
|
SRCS+= disk.c part.c vdisk.c
|
2012-08-05 12:15:15 +00:00
|
|
|
.endif
|
2017-10-16 03:59:52 +00:00
|
|
|
|
|
|
|
.if ${LOADER_NET_SUPPORT:Uno} == "yes"
|
|
|
|
SRCS+= dev_net.c
|
2017-03-28 06:39:54 +00:00
|
|
|
.endif
|
2012-08-05 12:15:15 +00:00
|
|
|
|
2006-11-02 00:26:45 +00:00
|
|
|
.if defined(HAVE_BCACHE)
|
|
|
|
SRCS+= bcache.c
|
|
|
|
.endif
|
|
|
|
|
2009-12-13 01:20:32 +00:00
|
|
|
.if defined(MD_IMAGE_SIZE)
|
|
|
|
CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE}
|
|
|
|
SRCS+= md.c
|
2017-10-17 19:11:29 +00:00
|
|
|
.else
|
|
|
|
CLEANFILES+= md.o
|
2009-12-13 01:20:32 +00:00
|
|
|
.endif
|
|
|
|
|
1998-09-14 18:27:06 +00:00
|
|
|
# Machine-independant ISA PnP
|
2004-02-07 11:05:10 +00:00
|
|
|
.if defined(HAVE_ISABUS)
|
1998-09-14 18:27:06 +00:00
|
|
|
SRCS+= isapnp.c
|
|
|
|
.endif
|
2004-02-07 11:05:10 +00:00
|
|
|
.if defined(HAVE_PNP)
|
1998-09-14 18:27:06 +00:00
|
|
|
SRCS+= pnp.c
|
|
|
|
.endif
|
1998-11-04 00:29:01 +00:00
|
|
|
|
2018-08-14 18:44:41 +00:00
|
|
|
.if ${LOADER_INTERP} == "lua"
|
Add Lua as a scripting langauge to /boot/loader
liblua glues the lua run time into the boot loader. It implements all
the runtime routines that lua expects. In addition, it has a few
standard 'C' headers that nueter various aspects of the LUA build that
are too specific to lua to be in libsa. Many refinements from the
original code to improve implementation and the number of included lua
libraries. Use int64_t for lua_Number. Have "/boot/lua" be the default
module path. Numerous cleanups from the original GSoC project,
including hacking libsa to allow lua to be built with only one change
outside luaconf.h.
Add the final bit of lua glue to bring in liblua and plug into the
multiple interpreter framework, previously committed.
Add LOADER_LUA option, currently off by default.
Presently, this is an experimental option. One must opt-in to using
this by defining WITH_LOADER_LUA and WITHOUT_FORTH. It's been
lightly tested, so keep a backup copy of your old loader handy.
The menu code, coming in the next commit, hasn't been exhaustively
tested. A LUA boot loader is 60k larger than a FORTH one, which is
80k larger than a no-interpreter one. Subtle changes in size
may tip things past some subtle limit (the binary is ~430k now
when built with LUA). A future version may offer coexistance.
Bump FreeBSD version to 1200058 to mark the milestone.
Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur,
Zakary Nafziger and Wojciech A. Koszek also contributed. Warner Losh
reworked it extensively into its current form.
Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader
Sponsored by: Google Summer of Code
Relnotes: Yes
MFC After: 1 month
Differential Review: https://reviews.freebsd.org/D14295
2018-02-12 15:31:53 +00:00
|
|
|
SRCS+= interp_lua.c
|
|
|
|
.include "${BOOTSRC}/lua.mk"
|
|
|
|
LDR_INTERP= ${LIBLUA}
|
|
|
|
LDR_INTERP32= ${LIBLUA32}
|
2019-11-18 23:21:13 +00:00
|
|
|
CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/modules
|
2018-08-14 18:44:41 +00:00
|
|
|
.elif ${LOADER_INTERP} == "4th"
|
1998-11-04 00:29:01 +00:00
|
|
|
SRCS+= interp_forth.c
|
2017-10-22 22:50:08 +00:00
|
|
|
.include "${BOOTSRC}/ficl.mk"
|
Add Lua as a scripting langauge to /boot/loader
liblua glues the lua run time into the boot loader. It implements all
the runtime routines that lua expects. In addition, it has a few
standard 'C' headers that nueter various aspects of the LUA build that
are too specific to lua to be in libsa. Many refinements from the
original code to improve implementation and the number of included lua
libraries. Use int64_t for lua_Number. Have "/boot/lua" be the default
module path. Numerous cleanups from the original GSoC project,
including hacking libsa to allow lua to be built with only one change
outside luaconf.h.
Add the final bit of lua glue to bring in liblua and plug into the
multiple interpreter framework, previously committed.
Add LOADER_LUA option, currently off by default.
Presently, this is an experimental option. One must opt-in to using
this by defining WITH_LOADER_LUA and WITHOUT_FORTH. It's been
lightly tested, so keep a backup copy of your old loader handy.
The menu code, coming in the next commit, hasn't been exhaustively
tested. A LUA boot loader is 60k larger than a FORTH one, which is
80k larger than a no-interpreter one. Subtle changes in size
may tip things past some subtle limit (the binary is ~430k now
when built with LUA). A future version may offer coexistance.
Bump FreeBSD version to 1200058 to mark the milestone.
Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur,
Zakary Nafziger and Wojciech A. Koszek also contributed. Warner Losh
reworked it extensively into its current form.
Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader
Sponsored by: Google Summer of Code
Relnotes: Yes
MFC After: 1 month
Differential Review: https://reviews.freebsd.org/D14295
2018-02-12 15:31:53 +00:00
|
|
|
LDR_INTERP= ${LIBFICL}
|
|
|
|
LDR_INTERP32= ${LIBFICL32}
|
2018-08-14 18:44:41 +00:00
|
|
|
.elif ${LOADER_INTERP} == "simp"
|
2018-01-31 22:46:05 +00:00
|
|
|
SRCS+= interp_simple.c
|
2018-08-14 18:44:41 +00:00
|
|
|
.else
|
|
|
|
.error Unknown interpreter ${LOADER_INTERP}
|
1998-11-04 00:29:01 +00:00
|
|
|
.endif
|
2000-05-19 08:52:16 +00:00
|
|
|
|
2019-02-26 06:22:10 +00:00
|
|
|
.if ${MK_LOADER_VERIEXEC} != "no"
|
|
|
|
CFLAGS+= -DLOADER_VERIEXEC -I${SRCTOP}/lib/libsecureboot/h
|
2020-03-08 17:42:42 +00:00
|
|
|
.if ${MK_LOADER_VERIEXEC_VECTX} != "no"
|
|
|
|
CFLAGS+= -DLOADER_VERIEXEC_VECTX
|
|
|
|
.endif
|
2019-02-26 06:22:10 +00:00
|
|
|
.endif
|
|
|
|
|
2019-04-03 03:57:37 +00:00
|
|
|
.if ${MK_LOADER_VERIEXEC_PASS_MANIFEST} != "no"
|
|
|
|
CFLAGS+= -DLOADER_VERIEXEC_PASS_MANIFEST -I${SRCTOP}/lib/libsecureboot/h
|
|
|
|
.endif
|
|
|
|
|
2009-11-12 01:30:17 +00:00
|
|
|
.if defined(BOOT_PROMPT_123)
|
|
|
|
CFLAGS+= -DBOOT_PROMPT_123
|
|
|
|
.endif
|
|
|
|
|
2014-08-06 00:36:04 +00:00
|
|
|
.if defined(LOADER_INSTALL_SUPPORT)
|
|
|
|
SRCS+= install.c
|
|
|
|
.endif
|
2016-12-19 14:40:59 +00:00
|
|
|
|
2017-12-16 21:33:21 +00:00
|
|
|
# Filesystem support
|
|
|
|
.if ${LOADER_CD9660_SUPPORT:Uno} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_CD9660_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_EXT2FS_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_MSDOS_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_UFS_SUPPORT:Uyes} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_UFS_SUPPORT
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# Compression
|
|
|
|
.if ${LOADER_GZIP_SUPPORT:Uno} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_GZIP_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_BZIP2_SUPPORT
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# Network related things
|
|
|
|
.if ${LOADER_NET_SUPPORT:Uno} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_NET_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_NFS_SUPPORT:Uno} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_NFS_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_TFTP_SUPPORT:Uno} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_TFTP_SUPPORT
|
|
|
|
.endif
|
|
|
|
|
2017-12-29 18:08:35 +00:00
|
|
|
# Partition support
|
2017-12-16 21:33:21 +00:00
|
|
|
.if ${LOADER_GPT_SUPPORT:Uyes} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_GPT_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_MBR_SUPPORT:Uyes} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_MBR_SUPPORT
|
|
|
|
.endif
|
|
|
|
|
2018-07-20 05:17:37 +00:00
|
|
|
.if ${HAVE_ZFS:Uno} == "yes"
|
2017-11-10 23:54:31 +00:00
|
|
|
CFLAGS+= -DLOADER_ZFS_SUPPORT
|
|
|
|
CFLAGS+= -I${ZFSSRC}
|
|
|
|
CFLAGS+= -I${SYSDIR}/cddl/boot/zfs
|
2020-06-20 06:23:31 +00:00
|
|
|
CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common
|
2018-02-21 15:57:36 +00:00
|
|
|
SRCS+= zfs_cmd.c
|
2017-11-10 23:54:31 +00:00
|
|
|
.endif
|
|
|
|
|
2017-12-18 04:51:45 +00:00
|
|
|
LIBFICL= ${BOOTOBJ}/ficl/libficl.a
|
|
|
|
.if ${MACHINE} == "i386"
|
|
|
|
LIBFICL32= ${LIBFICL}
|
|
|
|
.else
|
|
|
|
LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a
|
|
|
|
.endif
|
Add Lua as a scripting langauge to /boot/loader
liblua glues the lua run time into the boot loader. It implements all
the runtime routines that lua expects. In addition, it has a few
standard 'C' headers that nueter various aspects of the LUA build that
are too specific to lua to be in libsa. Many refinements from the
original code to improve implementation and the number of included lua
libraries. Use int64_t for lua_Number. Have "/boot/lua" be the default
module path. Numerous cleanups from the original GSoC project,
including hacking libsa to allow lua to be built with only one change
outside luaconf.h.
Add the final bit of lua glue to bring in liblua and plug into the
multiple interpreter framework, previously committed.
Add LOADER_LUA option, currently off by default.
Presently, this is an experimental option. One must opt-in to using
this by defining WITH_LOADER_LUA and WITHOUT_FORTH. It's been
lightly tested, so keep a backup copy of your old loader handy.
The menu code, coming in the next commit, hasn't been exhaustively
tested. A LUA boot loader is 60k larger than a FORTH one, which is
80k larger than a no-interpreter one. Subtle changes in size
may tip things past some subtle limit (the binary is ~430k now
when built with LUA). A future version may offer coexistance.
Bump FreeBSD version to 1200058 to mark the milestone.
Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur,
Zakary Nafziger and Wojciech A. Koszek also contributed. Warner Losh
reworked it extensively into its current form.
Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader
Sponsored by: Google Summer of Code
Relnotes: Yes
MFC After: 1 month
Differential Review: https://reviews.freebsd.org/D14295
2018-02-12 15:31:53 +00:00
|
|
|
|
|
|
|
LIBLUA= ${BOOTOBJ}/liblua/liblua.a
|
|
|
|
.if ${MACHINE} == "i386"
|
2018-03-09 14:16:33 +00:00
|
|
|
LIBLUA32= ${LIBLUA}
|
Add Lua as a scripting langauge to /boot/loader
liblua glues the lua run time into the boot loader. It implements all
the runtime routines that lua expects. In addition, it has a few
standard 'C' headers that nueter various aspects of the LUA build that
are too specific to lua to be in libsa. Many refinements from the
original code to improve implementation and the number of included lua
libraries. Use int64_t for lua_Number. Have "/boot/lua" be the default
module path. Numerous cleanups from the original GSoC project,
including hacking libsa to allow lua to be built with only one change
outside luaconf.h.
Add the final bit of lua glue to bring in liblua and plug into the
multiple interpreter framework, previously committed.
Add LOADER_LUA option, currently off by default.
Presently, this is an experimental option. One must opt-in to using
this by defining WITH_LOADER_LUA and WITHOUT_FORTH. It's been
lightly tested, so keep a backup copy of your old loader handy.
The menu code, coming in the next commit, hasn't been exhaustively
tested. A LUA boot loader is 60k larger than a FORTH one, which is
80k larger than a no-interpreter one. Subtle changes in size
may tip things past some subtle limit (the binary is ~430k now
when built with LUA). A future version may offer coexistance.
Bump FreeBSD version to 1200058 to mark the milestone.
Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur,
Zakary Nafziger and Wojciech A. Koszek also contributed. Warner Losh
reworked it extensively into its current form.
Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader
Sponsored by: Google Summer of Code
Relnotes: Yes
MFC After: 1 month
Differential Review: https://reviews.freebsd.org/D14295
2018-02-12 15:31:53 +00:00
|
|
|
.else
|
|
|
|
LIBLUA32= ${BOOTOBJ}/liblua32/liblua.a
|
2017-12-18 04:51:45 +00:00
|
|
|
.endif
|
|
|
|
|
2016-12-19 14:40:59 +00:00
|
|
|
CLEANFILES+= vers.c
|
|
|
|
VERSION_FILE?= ${.CURDIR}/version
|
2016-12-19 14:45:59 +00:00
|
|
|
.if ${MK_REPRODUCIBLE_BUILD} != no
|
|
|
|
REPRO_FLAG= -r
|
|
|
|
.endif
|
2017-10-22 22:50:08 +00:00
|
|
|
vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE}
|
|
|
|
sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \
|
2016-12-19 14:45:59 +00:00
|
|
|
${NEWVERSWHAT}
|
2017-11-10 23:54:58 +00:00
|
|
|
|
2019-01-07 05:49:27 +00:00
|
|
|
.if ${MK_LOADER_VERBOSE} != "no"
|
|
|
|
CFLAGS+= -DELF_VERBOSE
|
|
|
|
.endif
|
|
|
|
|
2017-11-10 23:54:58 +00:00
|
|
|
.if !empty(HELP_FILES)
|
2017-12-18 04:51:34 +00:00
|
|
|
HELP_FILES+= ${LDRSRC}/help.common
|
|
|
|
|
2017-11-10 23:54:58 +00:00
|
|
|
CLEANFILES+= loader.help
|
|
|
|
FILES+= loader.help
|
|
|
|
|
|
|
|
loader.help: ${HELP_FILES}
|
|
|
|
cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET}
|
|
|
|
.endif
|