From 781c4d47f283dac2dc2000a4211b27529c2e0bf3 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 10 Nov 2017 23:54:58 +0000 Subject: [PATCH] Install the 4th files in sys/boot/forth instead of each loader Also, move generation of loader.help into loader.mk. Set HELP_FILES= to disable this (so we only install one help file, for now). At the same time remove some duplicate -I lines. Fix several FILES= and CLEANFILES= into the += form since we're touching both of those in the .mk files. Make sure we only build one loader.help file per platform in a unified way (we were building many on some, with the last to install winning, though often they were the same text). Also, we're now installing loader.rc and menu.rc everywhere. arm and mips uboot installed these as menu.rc.sample, but there's no need since the loader.rc for those platforms doesn't do menu.rc processing by default. pcibios.4th is now installed everywhere, but will failsafe on non x86 platforms (it isn't loaded by default anywhere). These changes are too intertwined to do separately since aspects of each are required to have a bug-free commit. Sponsored by: Netflix --- sys/boot/arm/uboot/Makefile | 22 +++------------- sys/boot/defs.mk | 7 +++++ sys/boot/efi/boot1/Makefile | 4 +-- sys/boot/efi/fdt/Makefile | 2 +- sys/boot/efi/libefi/Makefile | 1 - sys/boot/efi/loader/Makefile | 2 +- sys/boot/efi/loader/arch/arm64/Makefile.inc | 13 --------- sys/boot/ficl/Makefile | 2 +- sys/boot/forth/Makefile | 29 +++++++++++++++++++++ sys/boot/forth/Makefile.inc | 26 ------------------ sys/boot/geli/Makefile | 1 - sys/boot/i386/boot2/Makefile | 4 +-- sys/boot/i386/gptboot/Makefile | 5 ++-- sys/boot/i386/gptzfsboot/Makefile | 5 ++-- sys/boot/i386/libfirewire/Makefile | 2 +- sys/boot/i386/libi386/Makefile | 3 +-- sys/boot/i386/loader/Makefile | 22 ++++++---------- sys/boot/i386/pxeldr/Makefile | 2 +- sys/boot/i386/zfsboot/Makefile | 4 +-- sys/boot/i386/zfsloader/Makefile | 2 -- sys/boot/libsa/Makefile | 2 +- sys/boot/libsa32/Makefile | 2 -- sys/boot/loader.mk | 8 ++++++ sys/boot/mips/beri/boot2/Makefile | 1 - sys/boot/mips/beri/loader/Makefile | 13 ++------- sys/boot/mips/uboot/Makefile | 22 +++------------- sys/boot/ofw/libofw/Makefile | 2 +- sys/boot/powerpc/boot1.chrp/Makefile | 2 +- sys/boot/powerpc/kboot/Makefile | 14 ++-------- sys/boot/powerpc/ofw/Makefile | 15 ++--------- sys/boot/powerpc/ps3/Makefile | 14 +--------- sys/boot/powerpc/uboot/Makefile | 12 +-------- sys/boot/sparc64/boot1/Makefile | 2 +- sys/boot/sparc64/loader/Makefile | 21 +++++---------- sys/boot/uboot/fdt/Makefile | 2 +- sys/boot/uboot/lib/Makefile | 2 +- sys/boot/userboot/test/Makefile | 1 - sys/boot/userboot/userboot/Makefile | 4 +-- sys/boot/zfs/Makefile | 2 +- 39 files changed, 96 insertions(+), 203 deletions(-) delete mode 100644 sys/boot/forth/Makefile.inc diff --git a/sys/boot/arm/uboot/Makefile b/sys/boot/arm/uboot/Makefile index 9f44e0f46d4..5bf7d533b94 100644 --- a/sys/boot/arm/uboot/Makefile +++ b/sys/boot/arm/uboot/Makefile @@ -12,7 +12,7 @@ LOADER_BZIP2_SUPPORT?= no .include -FILES= ubldr ubldr.bin +FILES+= ubldr ubldr.bin NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH} INSTALLFLAGS= -b @@ -28,11 +28,10 @@ SRCS= start.S conf.c self_reloc.c vers.c CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif +HELP_FILES+= help.uboot ${BOOTSRC}/fdt/help.fdt + # Always add MI sources .include "${BOOTSRC}/loader.mk" -CFLAGS+= -I. - -CLEANFILES+= loader.help CFLAGS+= -ffreestanding -msoft-float @@ -49,10 +48,6 @@ LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} -loader.help: help.common help.uboot ${BOOTSRC}/fdt/help.fdt - cat ${.ALLSRC} | \ - awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} - ldscript.abs: echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET} @@ -72,15 +67,4 @@ ubldr.bin: ubldr.pie CLEANFILES+= ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin -.if !defined(LOADER_ONLY) -.PATH: ${BOOTSRC}/forth -.include "${BOOTSRC}/forth/Makefile.inc" - -# Install loader.rc. -FILES+= loader.rc -# Put sample menu.rc on disk but don't enable it by default. -FILES+= menu.rc -FILESNAME_menu.rc= menu.rc.sample -.endif - .include diff --git a/sys/boot/defs.mk b/sys/boot/defs.mk index b08ffa7c9b2..2753e21bdb2 100644 --- a/sys/boot/defs.mk +++ b/sys/boot/defs.mk @@ -122,6 +122,9 @@ LD_FLAGS+= -m elf_i386_fbsd AFLAGS+= --32 .endif +# Make sure we use the machine link we're about to create +CFLAGS+=-I. + _ILINKS=machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" _ILINKS+=${MACHINE_CPUARCH} @@ -161,4 +164,8 @@ ${_ILINKS}: ${ECHO} ${.TARGET:T} "->" $$path ; \ ln -fhs $$path ${.TARGET:T} +# For loader implementations, we generate a loader.help file. This can be suppressed by +# setting HELP_FILES to nothing. +HELP_FILES= ${LDRSRC}/help.common + .endif # __BOOT_DEFS_MK__ diff --git a/sys/boot/efi/boot1/Makefile b/sys/boot/efi/boot1/Makefile index 8f5aed50dce..f2e69460593 100644 --- a/sys/boot/efi/boot1/Makefile +++ b/sys/boot/efi/boot1/Makefile @@ -41,11 +41,9 @@ LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif -CFLAGS+= -I. CFLAGS+= -I${EFIINC} CFLAGS+= -I${EFIINCMD} CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include -CFLAGS+= -I${SYSDIR} CFLAGS+= -DEFI_UFS_BOOT .ifdef(EFI_DEBUG) CFLAGS+= -DEFI_DEBUG @@ -126,6 +124,6 @@ boot1.efifat: boot1.efi xz -d -c ${.CURDIR}/fat-${MACHINE}.tmpl.xz > ${.TARGET} ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc -CLEANFILES= boot1.efi boot1.efifat +CLEANFILES+= boot1.efi boot1.efifat .include diff --git a/sys/boot/efi/fdt/Makefile b/sys/boot/efi/fdt/Makefile index 01dbeed05ea..7308ce94e45 100644 --- a/sys/boot/efi/fdt/Makefile +++ b/sys/boot/efi/fdt/Makefile @@ -25,6 +25,6 @@ CFLAGS+= -I${EFISRC}/include/${MACHINE} CFLAGS+= -I${FDTSRC} # Pick up the bootstrap header for some interface items -CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I. +CFLAGS+= -I${LDRSRC} .include diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile index 99fe2bde2f9..e0ffd7b80f6 100644 --- a/sys/boot/efi/libefi/Makefile +++ b/sys/boot/efi/libefi/Makefile @@ -34,7 +34,6 @@ CFLAGS+= -mgeneral-regs-only .if ${MACHINE_ARCH} == "amd64" CFLAGS+= -fPIC -mno-red-zone .endif -CFLAGS+= -I${SYSDIR} CFLAGS+= -I${EFIINC} CFLAGS+= -I${EFIINCMD} .if ${MK_ZFS} != "no" diff --git a/sys/boot/efi/loader/Makefile b/sys/boot/efi/loader/Makefile index 3561d6e46a3..a3a23c87dfe 100644 --- a/sys/boot/efi/loader/Makefile +++ b/sys/boot/efi/loader/Makefile @@ -55,7 +55,6 @@ CFLAGS+= -I${.CURDIR}/arch/${MACHINE} CFLAGS+= -I${EFISRC}/include CFLAGS+= -I${EFISRC}/include/${MACHINE} CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include -CFLAGS+= -I${SYSDIR} CFLAGS+= -I${BOOTSRC}/i386/libi386 CFLAGS+= -DNO_PCI -DEFI @@ -84,6 +83,7 @@ CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE} .endif # Always add MI sources +HELP_FILES= .include "${BOOTSRC}/loader.mk" FILES+= loader.efi diff --git a/sys/boot/efi/loader/arch/arm64/Makefile.inc b/sys/boot/efi/loader/arch/arm64/Makefile.inc index b62ce41c0e2..a71bcc2e1a1 100644 --- a/sys/boot/efi/loader/arch/arm64/Makefile.inc +++ b/sys/boot/efi/loader/arch/arm64/Makefile.inc @@ -10,16 +10,3 @@ CFLAGS+=-I${BOOTSRC}/arm64/libarm64 SRCS+= cache.c CFLAGS+= -mgeneral-regs-only - -CLEANFILES+= loader.help - -loader.help: help.common - cat ${.ALLSRC} | \ - awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} - -.if !defined(LOADER_ONLY) -.PATH: ${BOOTSRC}/forth -.include "${BOOTSRC}/forth/Makefile.inc" - -FILES+= loader.rc -.endif diff --git a/sys/boot/ficl/Makefile b/sys/boot/ficl/Makefile index 6a92e6bf77c..9a13614a7fe 100644 --- a/sys/boot/ficl/Makefile +++ b/sys/boot/ficl/Makefile @@ -8,7 +8,7 @@ BASE_SRCS= dict.c ficl.c fileaccess.c float.c loader.c math64.c \ prefix.c search.c stack.c tools.c vm.c words.c SRCS= ${BASE_SRCS} sysdep.c softcore.c -CLEANFILES= softcore.c testmain testmain.o +CLEANFILES+= softcore.c testmain testmain.o .include .ifmake testmain diff --git a/sys/boot/forth/Makefile b/sys/boot/forth/Makefile index 1f42003f9dc..a0a55864fa5 100644 --- a/sys/boot/forth/Makefile +++ b/sys/boot/forth/Makefile @@ -11,4 +11,33 @@ MAN+= beastie.4th.8 \ menusets.4th.8 \ version.4th.8 +FILES+= beastie.4th +FILES+= brand.4th +FILES+= brand-fbsd.4th +FILES+= check-password.4th +FILES+= color.4th +FILES+= delay.4th +FILES+= efi.4th +FILES+= frames.4th +FILES+= loader.4th +FILES+= loader.conf +FILES+= logo-beastie.4th +FILES+= logo-beastiebw.4th +FILES+= logo-fbsdbw.4th +FILES+= logo-orb.4th +FILES+= logo-orbbw.4th +FILES+= menu.4th +FILES+= menu-commands.4th +FILES+= menusets.4th +FILES+= pcibios.4th +FILES+= screen.4th +FILES+= shortcuts.4th +FILES+= support.4th +FILES+= version.4th +FILESDIR_loader.conf= /boot/defaults + +# Everybody has these, but you can override +.PATH: ${BOOTSRC}/${MACHINE:C/amd64/i386/}/common ${BOOTSRC}/forth +FILES+= loader.rc menu.rc + .include diff --git a/sys/boot/forth/Makefile.inc b/sys/boot/forth/Makefile.inc deleted file mode 100644 index d31ff3f2629..00000000000 --- a/sys/boot/forth/Makefile.inc +++ /dev/null @@ -1,26 +0,0 @@ -# $FreeBSD$ - -FILES+= beastie.4th -FILES+= brand.4th -FILES+= brand-fbsd.4th -FILES+= check-password.4th -FILES+= color.4th -FILES+= delay.4th -FILES+= efi.4th -FILES+= frames.4th -FILES+= loader.4th -FILES+= loader.conf -FILES+= loader.help -FILES+= logo-beastie.4th -FILES+= logo-beastiebw.4th -FILES+= logo-fbsdbw.4th -FILES+= logo-orb.4th -FILES+= logo-orbbw.4th -FILES+= menu.4th -FILES+= menu-commands.4th -FILES+= menusets.4th -FILES+= screen.4th -FILES+= shortcuts.4th -FILES+= support.4th -FILES+= version.4th -FILESDIR_loader.conf= /boot/defaults diff --git a/sys/boot/geli/Makefile b/sys/boot/geli/Makefile index 89d6a9f956e..c7904311c08 100644 --- a/sys/boot/geli/Makefile +++ b/sys/boot/geli/Makefile @@ -38,7 +38,6 @@ SRCS+= md5c.c # AES implementation from sys/crypto .PATH: ${SYSDIR}/crypto/rijndael -CFLAGS+= -I${SYSDIR} CFLAGS+= -I${LDRSRC} # Remove asserts CFLAGS+= -DNDEBUG diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile index 9f9e5191e13..c3146b3e906 100644 --- a/sys/boot/i386/boot2/Makefile +++ b/sys/boot/i386/boot2/Makefile @@ -31,7 +31,7 @@ CFLAGS+=-fomit-frame-pointer \ -DSIOFMT=${B2SIOFMT} \ -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ -I${LDRSRC} \ - -I${BTXLIB} -I. \ + -I${BTXLIB} \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ @@ -48,7 +48,7 @@ CFLAGS.clang+= -Oz ${CLANG_OPT_SMALL} LD_FLAGS+=${LD_FLAGS_BIN} -CLEANFILES= boot +CLEANFILES+= boot boot: boot1 boot2 cat boot1 boot2 > boot diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile index efe45cb6dbd..9e62007c55a 100644 --- a/sys/boot/i386/gptboot/Makefile +++ b/sys/boot/i386/gptboot/Makefile @@ -33,9 +33,8 @@ CFLAGS+=-DBOOTPROG=\"gptboot\" \ -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ -I${LDRSRC} \ -I${BOOTSRC}/i386/common \ - -I${BTXLIB} -I. \ + -I${BTXLIB} \ -I${BOOTSRC}/i386/boot2 \ - -I${SYSDIR} \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ @@ -45,7 +44,7 @@ CFLAGS.gcc+= --param max-inline-insns-single=100 LD_FLAGS+=${LD_FLAGS_BIN} -CLEANFILES= gptboot +CLEANFILES+= gptboot gptboot: gptldr.bin gptboot.bin ${BTXKERN} btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \ diff --git a/sys/boot/i386/gptzfsboot/Makefile b/sys/boot/i386/gptzfsboot/Makefile index d2751c217e7..97f19544515 100644 --- a/sys/boot/i386/gptzfsboot/Makefile +++ b/sys/boot/i386/gptzfsboot/Makefile @@ -31,9 +31,8 @@ CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ -I${BOOTSRC}/i386/common \ -I${ZFSSRC} \ -I${SYSDIR}/cddl/boot/zfs \ - -I${BOOTSRC}/i386/btx/lib -I. \ + -I${BOOTSRC}/i386/btx/lib \ -I${BOOTSRC}/i386/boot2 \ - -I${SYSDIR} \ -Wall -Waggregate-return -Wbad-function-cast \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ @@ -56,7 +55,7 @@ CFLAGS.gcc+= --param max-inline-insns-single=100 LD_FLAGS+=${LD_FLAGS_BIN} -CLEANFILES= gptzfsboot +CLEANFILES+= gptzfsboot gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN} btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \ diff --git a/sys/boot/i386/libfirewire/Makefile b/sys/boot/i386/libfirewire/Makefile index be906ff9463..d3f88c448b6 100644 --- a/sys/boot/i386/libfirewire/Makefile +++ b/sys/boot/i386/libfirewire/Makefile @@ -11,7 +11,7 @@ SRCS+= dcons.c fwcrom.c CFLAGS+= -D_BOOT -CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I. +CFLAGS+= -I${LDRSRC} CFLAGS+= -I${BTXLIB} CFLAGS+= -I${BOOTSRC}/i386/libi386 diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile index 43d191dec19..8d65513436c 100644 --- a/sys/boot/i386/libi386/Makefile +++ b/sys/boot/i386/libi386/Makefile @@ -49,8 +49,7 @@ CFLAGS+= -Dalloca=__builtin_alloca CFLAGS+= -I${BOOTSRC}/ficl -I${BOOTSRC}/ficl/i386 \ -I${LDRSRC} -I${BOOTSRC}/i386/common \ -I${BTXLIB} \ - -I${SYSDIR}/contrib/dev/acpica/include \ - -I${SYSDIR} -I. + -I${SYSDIR}/contrib/dev/acpica/include # Handle FreeBSD specific %b and %D printf format specifiers CFLAGS+= ${FORMAT_EXTENSIONS} diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile index a79b4fbdbcc..40ac46ce0cf 100644 --- a/sys/boot/i386/loader/Makefile +++ b/sys/boot/i386/loader/Makefile @@ -40,11 +40,16 @@ CFLAGS+= -DLOADER_FIREWIRE_SUPPORT LIBFIREWIRE= ${BOOTOBJ}/i386/libfirewire/libfirewire.a .endif +.if exists(${.CURDIR}/help.i386) +HELP_FILES+= help.i386 +.else +HELP_FILES= +.endif + # Always add MI sources .include "${BOOTSRC}/loader.mk" -CFLAGS+= -I. -CLEANFILES= ${LOADER} ${LOADER}.bin loader.help +CLEANFILES+= ${LOADER} ${LOADER}.bin CFLAGS+= -Wall LDFLAGS+= -static -Ttext 0x0 @@ -67,21 +72,10 @@ ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} ${LOADER}.bin: ${LOADER}.sym strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC} -loader.help: help.common help.i386 - cat ${.ALLSRC} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} - -FILES= ${LOADER} +FILES+= ${LOADER} # XXX INSTALLFLAGS_loader= -b FILESMODE_${LOADER}= ${BINMODE} -b -.if !defined(LOADER_ONLY) -.PATH: ${BOOTSRC}/forth -.include "${BOOTSRC}/forth/Makefile.inc" -FILES+= pcibios.4th - -FILES+= loader.rc menu.rc -.endif - # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} diff --git a/sys/boot/i386/pxeldr/Makefile b/sys/boot/i386/pxeldr/Makefile index 57931a5206c..819283cf8a2 100644 --- a/sys/boot/i386/pxeldr/Makefile +++ b/sys/boot/i386/pxeldr/Makefile @@ -7,7 +7,7 @@ INTERNALPROG= FILES= ${BOOT} MAN= ${BOOT}.8 SRCS= ${LDR}.S -CLEANFILES= ${BOOT} +CLEANFILES+= ${BOOT} BOOT= pxeboot LDR= pxeldr diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile index 81ab6f39a3d..f0523dfa261 100644 --- a/sys/boot/i386/zfsboot/Makefile +++ b/sys/boot/i386/zfsboot/Makefile @@ -30,7 +30,7 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -I${BOOTSRC}/i386 \ -I${ZFSSRC} \ -I${SYSDIR}/cddl/boot/zfs \ - -I${BTXLIB} -I. \ + -I${BTXLIB} \ -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ @@ -46,7 +46,7 @@ LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a LD_FLAGS+=${LD_FLAGS_BIN} -CLEANFILES= zfsboot +CLEANFILES+= zfsboot zfsboot: zfsboot1 zfsboot2 cat zfsboot1 zfsboot2 > zfsboot diff --git a/sys/boot/i386/zfsloader/Makefile b/sys/boot/i386/zfsloader/Makefile index 6111e47f12f..a9fa913e7e1 100644 --- a/sys/boot/i386/zfsloader/Makefile +++ b/sys/boot/i386/zfsloader/Makefile @@ -2,8 +2,6 @@ LOADER= zfsloader NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 -LOADER_ONLY= yes HAVE_ZFS= yes .include "${.CURDIR}/../loader/Makefile" - diff --git a/sys/boot/libsa/Makefile b/sys/boot/libsa/Makefile index 057eb7615be..9aa228847c8 100644 --- a/sys/boot/libsa/Makefile +++ b/sys/boot/libsa/Makefile @@ -19,7 +19,7 @@ LIB?= sa NO_PIC= WARNS?= 0 -CFLAGS+= -I${SASRC} -I${SYSDIR} +CFLAGS+= -I${SASRC} # standalone components and stuff we have modified locally SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \ diff --git a/sys/boot/libsa32/Makefile b/sys/boot/libsa32/Makefile index f09811b6212..eba6c00bd89 100644 --- a/sys/boot/libsa32/Makefile +++ b/sys/boot/libsa32/Makefile @@ -7,7 +7,5 @@ DO32=1 LIB=sa32 LIBSA_CPUARCH=${MACHINE_CPUARCH:C/amd64/i386/} -CFLAGS+= -I. - .PATH: ${SASRC} .include "${SASRC}/Makefile" diff --git a/sys/boot/loader.mk b/sys/boot/loader.mk index 8b99153589d..7236c8614e0 100644 --- a/sys/boot/loader.mk +++ b/sys/boot/loader.mk @@ -90,3 +90,11 @@ REPRO_FLAG= -r vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ ${NEWVERSWHAT} + +.if !empty(HELP_FILES) +CLEANFILES+= loader.help +FILES+= loader.help + +loader.help: ${HELP_FILES} + cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} +.endif diff --git a/sys/boot/mips/beri/boot2/Makefile b/sys/boot/mips/beri/boot2/Makefile index 9a993e22cda..d36934078e1 100644 --- a/sys/boot/mips/beri/boot2/Makefile +++ b/sys/boot/mips/beri/boot2/Makefile @@ -51,7 +51,6 @@ CFLAGS= -ffreestanding \ -I${.CURDIR} \ -I${SASRC} \ -I${LDRSRC} \ - -I${SYSDIR} \ -D_KERNEL \ -Wall \ -G0 \ diff --git a/sys/boot/mips/beri/loader/Makefile b/sys/boot/mips/beri/loader/Makefile index 35a2ab33319..763b3b34662 100644 --- a/sys/boot/mips/beri/loader/Makefile +++ b/sys/boot/mips/beri/loader/Makefile @@ -67,6 +67,8 @@ SRCS+= altera_jtag_uart.c \ # Since we don't have a backward compatibility issue, default to this on BERI. CFLAGS+= -DBOOT_PROMPT_123 +HELP_FILES+= help.mips + # Always add MI sources .include "${BOOTSRC}/loader.mk" @@ -77,8 +79,6 @@ CFLAGS+= -I${BOOTSRC}/mips/beri/common # Loader-specific MD headers CFLAGS+= -I${.CURDIR} -CLEANFILES+= loader.help - # Generate code appropriate for the loader environment CFLAGS+= -G0 \ -fno-pic \ @@ -95,15 +95,6 @@ LDFLAGS= -nostdlib \ DPADD= ${LIBFICL} ${LIBSA} LDADD= ${LIBFICL} ${LIBSA} -loader.help: help.common help.mips - cat ${.ALLSRC} | \ - awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} - -.PATH: ${BOOTSRC}/forth -.include "${BOOTSRC}/forth/Makefile.inc" - -FILES+= loader.rc menu.rc - .if defined(LOADER_USB_SUPPORT) # Do garbage collection CFLAGS+= -ffunction-sections -fdata-sections diff --git a/sys/boot/mips/uboot/Makefile b/sys/boot/mips/uboot/Makefile index a262b875692..b941ba34243 100644 --- a/sys/boot/mips/uboot/Makefile +++ b/sys/boot/mips/uboot/Makefile @@ -12,7 +12,7 @@ LOADER_BZIP2_SUPPORT?= no .include -FILES= ubldr +FILES+= ubldr NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH} INSTALLFLAGS= -b @@ -24,11 +24,10 @@ UBLDR_LOADADDR?= 0xffffffff80800000 # Architecture-specific loader code SRCS= start.S conf.c vers.c +HELP_FILES+= help.uboot ${BOOTSRC}/fdt/help.fdt + # Always add MI sources .include "${BOOTSRC}/loader.mk" -CFLAGS+= -I. - -CLEANFILES+= loader.help CFLAGS+= -ffreestanding -msoft-float -g @@ -41,10 +40,6 @@ LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} -loader.help: help.common help.uboot ${BOOTSRC}/fdt/help.fdt - cat ${.ALLSRC} | \ - awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} - ldscript.abs: echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET} @@ -58,16 +53,5 @@ ubldr: ${OBJS} ldscript.abs ${.CURDIR}/ldscript.${MACHINE_CPUARCH} ${DPADD} CLEANFILES+= ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin -.if !defined(LOADER_ONLY) -.PATH: ${BOOTSRC}/forth -.include "${BOOTSRC}/forth/Makefile.inc" - -# Install loader.rc. -FILES+= loader.rc -# Put sample menu.rc on disk but don't enable it by default. -FILES+= menu.rc -FILESNAME_menu.rc= menu.rc.sample -.endif - .include .include diff --git a/sys/boot/ofw/libofw/Makefile b/sys/boot/ofw/libofw/Makefile index 836e2a821d1..8e9ac804c5f 100644 --- a/sys/boot/ofw/libofw/Makefile +++ b/sys/boot/ofw/libofw/Makefile @@ -12,7 +12,7 @@ SRCS= devicename.c elf_freebsd.c ofw_console.c ofw_copy.c ofw_disk.c \ SRCS+= devicename_stubs.c # Pick up the bootstrap header for some interface items -CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I. +CFLAGS+= -I${LDRSRC} CFLAGS+= -ffreestanding .if ${MACHINE_CPUARCH} == "powerpc" diff --git a/sys/boot/powerpc/boot1.chrp/Makefile b/sys/boot/powerpc/boot1.chrp/Makefile index 8439d140b68..384d0abc278 100644 --- a/sys/boot/powerpc/boot1.chrp/Makefile +++ b/sys/boot/powerpc/boot1.chrp/Makefile @@ -34,7 +34,7 @@ boot1.hfs: boot1.elf bootinfo.txt ${DD} if=${.CURDIR}/bootinfo.txt of=${.TARGET} seek=${BOOTINFO_OFFSET} \ conv=notrunc -CLEANFILES= boot1.hfs +CLEANFILES+= boot1.hfs boot1.o: ${SASRC}/ufsread.c diff --git a/sys/boot/powerpc/kboot/Makefile b/sys/boot/powerpc/kboot/Makefile index 2d45796f506..bed586e6732 100644 --- a/sys/boot/powerpc/kboot/Makefile +++ b/sys/boot/powerpc/kboot/Makefile @@ -28,12 +28,9 @@ SRCS+= ucmpdi2.c CFLAGS+= -mcpu=powerpc64 # Always add MI sources +HELP_FILES= # Disable .include "${BOOTSRC}/loader.mk" .PATH: ${SYSDIR}/libkern -CFLAGS+= -I${SYSDIR} -CFLAGS+= -I. - -CLEANFILES+= loader.help CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM # load address. set in linker script @@ -48,13 +45,6 @@ CFLAGS+= -Wa,-mppc64bridge DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA} LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA} -loader.help: help.common ${FDTSRC}/help.fdt - cat ${.ALLSRC} | \ - awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} - -.PATH: ${BOOTSRC}/forth -.include "${BOOTSRC}/forth/Makefile.inc" - -FILES+= loader.rc menu.rc +HELP_FILES+= ${FDTSRC}/help.fdt .include diff --git a/sys/boot/powerpc/ofw/Makefile b/sys/boot/powerpc/ofw/Makefile index ae3dfbd54f2..1853b2596fc 100644 --- a/sys/boot/powerpc/ofw/Makefile +++ b/sys/boot/powerpc/ofw/Makefile @@ -27,14 +27,12 @@ SRCS+= ucmpdi2.c SRCS+= ofwfdt.c .endif +HELP_FILES+= ${FDTSRC}/help.fdt + # Always add MI sources .include "${BOOTSRC}/loader.mk" .PATH: ${SYSDIR}/libkern -CFLAGS+= -I${SYSDIR} -CFLAGS+= -I. - -CLEANFILES+= loader.help CFLAGS+= -ffreestanding -msoft-float # load address. set in linker script @@ -54,13 +52,4 @@ CFLAGS+= -I${BOOTSRC}/ofw/libofw DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA} LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA} -loader.help: help.common ${FDTSRC}/help.fdt - cat ${.ALLSRC} | \ - awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} - -.PATH: ${BOOTSRC}/forth -.include "${BOOTSRC}/forth/Makefile.inc" - -FILES+= loader.rc menu.rc - .include diff --git a/sys/boot/powerpc/ps3/Makefile b/sys/boot/powerpc/ps3/Makefile index 793edbcd23c..07ad135d979 100644 --- a/sys/boot/powerpc/ps3/Makefile +++ b/sys/boot/powerpc/ps3/Makefile @@ -26,12 +26,9 @@ SRCS+= ucmpdi2.c CFLAGS+= -mcpu=powerpc64 # Always add MI sources +HELP_FILES= # Disable .include "${BOOTSRC}/loader.mk" .PATH: ${SYSDIR}/libkern -CFLAGS+= -I${SYSDIR} -CFLAGS+= -I. - -CLEANFILES+= loader.help CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM # load address. set in linker script @@ -48,13 +45,4 @@ SC_DFLT_FONT=cp437 font.h: uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h -loader.help: help.common - cat ${.ALLSRC} | \ - awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} - -.PATH: ${BOOTSRC}/forth -.include "${BOOTSRC}/forth/Makefile.inc" - -FILES+= loader.rc menu.rc - .include diff --git a/sys/boot/powerpc/uboot/Makefile b/sys/boot/powerpc/uboot/Makefile index 06130306d0d..d543aceeee4 100644 --- a/sys/boot/powerpc/uboot/Makefile +++ b/sys/boot/powerpc/uboot/Makefile @@ -21,12 +21,9 @@ SRCS= start.S conf.c vers.c SRCS+= ucmpdi2.c # Always add MI sources +HELP_FILES= # Disable .include "${BOOTSRC}/loader.mk" .PATH: ${SYSDIR}/libkern -CFLAGS+= -I${SYSDIR} -CFLAGS+= -I. - -CLEANFILES+= ${PROG}.help CFLAGS+= -ffreestanding @@ -37,11 +34,4 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} -loader.help: help.common ${BOOTSRC}/fdt/help.fdt - cat ${.ALLSRC} | \ - awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} - -.PATH: ${BOOTSRC}/forth -FILES= loader.help - .include diff --git a/sys/boot/sparc64/boot1/Makefile b/sys/boot/sparc64/boot1/Makefile index 7d501a0f75b..36e39689610 100644 --- a/sys/boot/sparc64/boot1/Makefile +++ b/sys/boot/sparc64/boot1/Makefile @@ -7,7 +7,7 @@ INTERNALPROG= MAN= FILES?= boot1 SRCS= _start.s boot1.c -CLEANFILES=${FILES} boot1.aout +CLEANFILES+=${FILES} boot1.aout BOOTBLOCKBASE= 0x4000 diff --git a/sys/boot/sparc64/loader/Makefile b/sys/boot/sparc64/loader/Makefile index f7fb0300d41..5388761cf52 100644 --- a/sys/boot/sparc64/loader/Makefile +++ b/sys/boot/sparc64/loader/Makefile @@ -29,11 +29,14 @@ SRCS= locore.S main.c metadata.c vers.c CFLAGS+= -DLOADER_DEBUG .endif +.if exists(${.CURDIR}/help.sparc64) +HELP_FILES+= help.sparc64 +.else +HELP_FILES= +.endif + # Always add MI sources .include "${BOOTSRC}/loader.mk" -CFLAGS+= -I. - -CLEANFILES+= loader.help LDFLAGS+= -static @@ -41,19 +44,7 @@ LDFLAGS+= -static LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a CFLAGS+= -I${BOOTSRC}/ofw/libofw/ -# Need sys/ for crypto/intake.h -CFLAGS+= -I${SRCTOP}/sys - DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} -loader.help: help.common help.sparc64 - cat ${.ALLSRC} | \ - awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} - -.PATH: ${BOOTSRC}/forth -.include "${BOOTSRC}/forth/Makefile.inc" - -FILES+= loader.rc menu.rc - .include diff --git a/sys/boot/uboot/fdt/Makefile b/sys/boot/uboot/fdt/Makefile index 87bebca5c0d..4bc38ec7c6f 100644 --- a/sys/boot/uboot/fdt/Makefile +++ b/sys/boot/uboot/fdt/Makefile @@ -19,7 +19,7 @@ CFLAGS+= -I${UBOOTSRC}/lib CFLAGS+= -I${FDTSRC} # Pick up the bootstrap header for some interface items -CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I. +CFLAGS+= -I${LDRSRC} .include .include diff --git a/sys/boot/uboot/lib/Makefile b/sys/boot/uboot/lib/Makefile index 6eebbaaa33e..d12d48cafaa 100644 --- a/sys/boot/uboot/lib/Makefile +++ b/sys/boot/uboot/lib/Makefile @@ -20,7 +20,7 @@ SRCS+= disk.c .include "${BOOTSRC}/fdt.mk" # Pick up the bootstrap header for some interface items -CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I. +CFLAGS+= -I${LDRSRC} .ifdef(BOOT_DISK_DEBUG) # Make the disk code more talkative diff --git a/sys/boot/userboot/test/Makefile b/sys/boot/userboot/test/Makefile index cfca6971d12..1bc66798aac 100644 --- a/sys/boot/userboot/test/Makefile +++ b/sys/boot/userboot/test/Makefile @@ -10,6 +10,5 @@ PROG= test INTERNALPROG= CFLAGS+= -I${BOOTSRC}/userboot -CFLAGS+= -I${SYSDIR} .include diff --git a/sys/boot/userboot/userboot/Makefile b/sys/boot/userboot/userboot/Makefile index ae0c35db945..cbada8227ba 100644 --- a/sys/boot/userboot/userboot/Makefile +++ b/sys/boot/userboot/userboot/Makefile @@ -36,8 +36,7 @@ SRCS+= vers.c CFLAGS+= -Wall CFLAGS+= -I${BOOTSRC}/userboot -CFLAGS+= -I${SYSDIR} -CFLAGS+= -ffreestanding -I. +CFLAGS+= -ffreestanding CWARNFLAGS.main.c += -Wno-implicit-function-declaration @@ -51,6 +50,7 @@ LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif # Always add MI sources +HELP_FILES= # Disable .include "${BOOTSRC}/loader.mk" CFLAGS+= -I. DPADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSA} diff --git a/sys/boot/zfs/Makefile b/sys/boot/zfs/Makefile index 7575aa9207e..e86c84b02fc 100644 --- a/sys/boot/zfs/Makefile +++ b/sys/boot/zfs/Makefile @@ -12,7 +12,7 @@ CFLAGS+= -DSKEIN_LOOP=111 .PATH: ${SYSDIR}/crypto/skein CFLAGS+= -DBOOTPROG=\"zfsloader\" -CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I. +CFLAGS+= -I${LDRSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs CFLAGS+= -I${SYSDIR}/crypto/skein