From 7f20726e4badbe62a3b6d45a2e61bd68ac1d4cd3 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 16 Oct 2017 03:59:28 +0000 Subject: Move common/Makefile.inc to sys/boot/loader.mk. Makefile.inc has a specific meaning in the tree, and common/Makefile.inc doesn't quite fit into that. Rename it to loader.mk and it will be a place to collect common things to all /boot/loader programs there. Sponsored by: Netflix --- sys/boot/arm/uboot/Makefile | 6 +-- sys/boot/common/Makefile.inc | 83 ---------------------------------- sys/boot/efi/boot1/Makefile | 4 +- sys/boot/efi/loader/Makefile | 4 +- sys/boot/i386/loader/Makefile | 6 +-- sys/boot/loader.mk | 88 +++++++++++++++++++++++++++++++++++++ sys/boot/mips/beri/loader/Makefile | 10 +---- sys/boot/mips/uboot/Makefile | 6 +-- sys/boot/powerpc/kboot/Makefile | 8 ++-- sys/boot/powerpc/ofw/Makefile | 8 ++-- sys/boot/powerpc/ps3/Makefile | 8 ++-- sys/boot/powerpc/uboot/Makefile | 8 ++-- sys/boot/sparc64/loader/Makefile | 6 +-- sys/boot/userboot/userboot/Makefile | 5 +-- 14 files changed, 117 insertions(+), 133 deletions(-) delete mode 100644 sys/boot/common/Makefile.inc create mode 100644 sys/boot/loader.mk (limited to 'sys/boot') diff --git a/sys/boot/arm/uboot/Makefile b/sys/boot/arm/uboot/Makefile index 990c78d48d35..ba56279b0f8b 100644 --- a/sys/boot/arm/uboot/Makefile +++ b/sys/boot/arm/uboot/Makefile @@ -90,9 +90,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a .endif # Always add MI sources -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common +.include "../../loader.mk" CFLAGS+= -I. CLEANFILES+= loader.help @@ -124,7 +122,7 @@ OBJS+= ${SRCS:N*.h:R:S/$/.o/g} loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} + awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} ldscript.abs: echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET} diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc deleted file mode 100644 index 867035907a99..000000000000 --- a/sys/boot/common/Makefile.inc +++ /dev/null @@ -1,83 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/boot/common ${SRCTOP}/sys/boot/libsa - -SRCS+= boot.c commands.c console.c devopen.c interp.c -SRCS+= interp_backslash.c interp_parse.c ls.c misc.c -SRCS+= module.c - -.if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" -SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c -SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c -.elif ${MACHINE_CPUARCH} == "aarch64" -SRCS+= load_elf64.c reloc_elf64.c -.elif ${MACHINE_CPUARCH} == "arm" -SRCS+= load_elf32.c reloc_elf32.c -.elif ${MACHINE_CPUARCH} == "powerpc" -SRCS+= load_elf32.c reloc_elf32.c -SRCS+= load_elf64.c reloc_elf64.c -.elif ${MACHINE_CPUARCH} == "sparc64" -SRCS+= load_elf64.c reloc_elf64.c -.elif ${MACHINE_ARCH:Mmips64*} != "" -SRCS+= load_elf64.c reloc_elf64.c -.elif ${MACHINE} == "mips" -SRCS+= load_elf32.c reloc_elf32.c -.endif - -.if defined(LOADER_NET_SUPPORT) -SRCS+= dev_net.c -.endif - -.if !defined(LOADER_NO_DISK_SUPPORT) -SRCS+= disk.c part.c -CFLAGS+= -DLOADER_DISK_SUPPORT -.if !defined(LOADER_NO_GPT_SUPPORT) -CFLAGS+= -DLOADER_GPT_SUPPORT -.endif -.if !defined(LOADER_NO_MBR_SUPPORT) -CFLAGS+= -DLOADER_MBR_SUPPORT -.endif -.endif -.if !defined(LOADER_NO_GELI_SUPPORT) -CFLAGS+= -DLOADER_GELI_SUPPORT -.endif - -.if defined(HAVE_BCACHE) -SRCS+= bcache.c -.endif - -.if defined(MD_IMAGE_SIZE) -CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE} -SRCS+= md.c -.endif - -# Machine-independant ISA PnP -.if defined(HAVE_ISABUS) -SRCS+= isapnp.c -.endif -.if defined(HAVE_PNP) -SRCS+= pnp.c -.endif - -# Forth interpreter -.if defined(BOOT_FORTH) -SRCS+= interp_forth.c -.include "../ficl.mk" -.endif - -.if defined(BOOT_PROMPT_123) -CFLAGS+= -DBOOT_PROMPT_123 -.endif - -.if defined(LOADER_INSTALL_SUPPORT) -SRCS+= install.c -.endif - -CLEANFILES+= vers.c -VERSION_FILE?= ${.CURDIR}/version -.if ${MK_REPRODUCIBLE_BUILD} != no -REPRO_FLAG= -r -.endif -vers.c: ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} - sh ${SRCTOP}/sys/boot/common/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ - ${NEWVERSWHAT} diff --git a/sys/boot/efi/boot1/Makefile b/sys/boot/efi/boot1/Makefile index 95508df8bbd9..6375a796886f 100644 --- a/sys/boot/efi/boot1/Makefile +++ b/sys/boot/efi/boot1/Makefile @@ -53,9 +53,7 @@ CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif # Always add MI sources -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common +.include "../../loader.mk" .PATH: ${.CURDIR}/arch/${MACHINE} diff --git a/sys/boot/efi/loader/Makefile b/sys/boot/efi/loader/Makefile index 89a58f7c31c2..006e544f19e3 100644 --- a/sys/boot/efi/loader/Makefile +++ b/sys/boot/efi/loader/Makefile @@ -103,9 +103,7 @@ CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE} .endif # Always add MI sources -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common +.include "../../loader.mk" FILES+= loader.efi FILESMODE_loader.efi= ${BINMODE} diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile index 034b77536baf..b5b169e2717c 100644 --- a/sys/boot/i386/loader/Makefile +++ b/sys/boot/i386/loader/Makefile @@ -72,9 +72,7 @@ CFLAGS+= -I${.CURDIR}/../../.. -D_STAND .endif # Always add MI sources -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common +.include "../../loader.mk" CFLAGS+= -I. CLEANFILES= ${LOADER} ${LOADER}.bin loader.help @@ -104,7 +102,7 @@ ${LOADER}.bin: ${LOADER}.sym strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC} loader.help: help.common help.i386 - cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} + cat ${.ALLSRC} | awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} FILES= ${LOADER} # XXX INSTALLFLAGS_loader= -b diff --git a/sys/boot/loader.mk b/sys/boot/loader.mk new file mode 100644 index 000000000000..bf241a127526 --- /dev/null +++ b/sys/boot/loader.mk @@ -0,0 +1,88 @@ +# $FreeBSD$ + +BOOTDIR=${SRCTOP}/sys/boot +LDR_MI=${BOOTDIR}/common + +.PATH: ${LDR_MI} ${BOOTDIR}/libsa + +CFLAGS+=-I${LDR_MI} + +SRCS+= boot.c commands.c console.c devopen.c interp.c +SRCS+= interp_backslash.c interp_parse.c ls.c misc.c +SRCS+= module.c + +.if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" +SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c +SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c +.elif ${MACHINE_CPUARCH} == "aarch64" +SRCS+= load_elf64.c reloc_elf64.c +.elif ${MACHINE_CPUARCH} == "arm" +SRCS+= load_elf32.c reloc_elf32.c +.elif ${MACHINE_CPUARCH} == "powerpc" +SRCS+= load_elf32.c reloc_elf32.c +SRCS+= load_elf64.c reloc_elf64.c +.elif ${MACHINE_CPUARCH} == "sparc64" +SRCS+= load_elf64.c reloc_elf64.c +.elif ${MACHINE_ARCH:Mmips64*} != "" +SRCS+= load_elf64.c reloc_elf64.c +.elif ${MACHINE} == "mips" +SRCS+= load_elf32.c reloc_elf32.c +.endif + +.if defined(LOADER_NET_SUPPORT) +SRCS+= dev_net.c +.endif + +.if !defined(LOADER_NO_DISK_SUPPORT) +SRCS+= disk.c part.c +CFLAGS+= -DLOADER_DISK_SUPPORT +.if !defined(LOADER_NO_GPT_SUPPORT) +CFLAGS+= -DLOADER_GPT_SUPPORT +.endif +.if !defined(LOADER_NO_MBR_SUPPORT) +CFLAGS+= -DLOADER_MBR_SUPPORT +.endif +.endif +.if !defined(LOADER_NO_GELI_SUPPORT) +CFLAGS+= -DLOADER_GELI_SUPPORT +.endif + +.if defined(HAVE_BCACHE) +SRCS+= bcache.c +.endif + +.if defined(MD_IMAGE_SIZE) +CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE} +SRCS+= md.c +.endif + +# Machine-independant ISA PnP +.if defined(HAVE_ISABUS) +SRCS+= isapnp.c +.endif +.if defined(HAVE_PNP) +SRCS+= pnp.c +.endif + +# Forth interpreter +.if defined(BOOT_FORTH) +SRCS+= interp_forth.c +.include "${BOOTDIR}/ficl.mk" +.endif + +.if defined(BOOT_PROMPT_123) +CFLAGS+= -DBOOT_PROMPT_123 +.endif + +.if defined(LOADER_INSTALL_SUPPORT) +SRCS+= install.c +.endif + +CLEANFILES+= vers.c +VERSION_FILE?= ${.CURDIR}/version +.if ${MK_REPRODUCIBLE_BUILD} != no +REPRO_FLAG= -r +.endif +vers.c: ${LDR_MI}/newvers.sh ${VERSION_FILE} + sh ${LDR_MI}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ + ${NEWVERSWHAT} diff --git a/sys/boot/mips/beri/loader/Makefile b/sys/boot/mips/beri/loader/Makefile index 1bdf5a99351a..aec550cc038c 100644 --- a/sys/boot/mips/beri/loader/Makefile +++ b/sys/boot/mips/beri/loader/Makefile @@ -76,14 +76,8 @@ CFLAGS+= -I${.CURDIR}/../../../ficl/mips64 LIBFICL= ${.OBJDIR}/../../../ficl/libficl.a .endif -# Common code across BERI boot loader parts -.PATH: ${.CURDIR}/../common -CFLAGS+= -I${.CURDIR}/../common - # Always add MI sources -.PATH: ${.CURDIR}/../../../common -.include "${.CURDIR}/../../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../../common +.include "../../../loader.mk" # BERI files common to boot2 and loader .PATH: ${.CURDIR}/../common @@ -112,7 +106,7 @@ LDADD= ${LIBFICL} ${LIBSA} loader.help: help.common help.mips cat ${.ALLSRC} | \ - awk -f ${.CURDIR}/../../../common/merge_help.awk > ${.TARGET} + awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../../forth .include "${.CURDIR}/../../../forth/Makefile.inc" diff --git a/sys/boot/mips/uboot/Makefile b/sys/boot/mips/uboot/Makefile index 86a07a7e6a02..3efafafe23af 100644 --- a/sys/boot/mips/uboot/Makefile +++ b/sys/boot/mips/uboot/Makefile @@ -94,9 +94,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a .endif # Always add MI sources -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common +.include "../../loader.mk" CFLAGS+= -I. CLEANFILES+= loader.help @@ -126,7 +124,7 @@ OBJS+= ${SRCS:N*.h:R:S/$/.o/g} loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} + awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} ldscript.abs: echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET} diff --git a/sys/boot/powerpc/kboot/Makefile b/sys/boot/powerpc/kboot/Makefile index c42267bf0930..f5767f972ac9 100644 --- a/sys/boot/powerpc/kboot/Makefile +++ b/sys/boot/powerpc/kboot/Makefile @@ -72,9 +72,9 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a CFLAGS+= -mcpu=powerpc64 # Always add MI sources -.PATH: ${.CURDIR}/../../common ${.CURDIR}/../../../libkern -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. +.include "../../loader.mk" +.PATH: ${.CURDIR}/../../../libkern +CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -I. CLEANFILES+= loader.help @@ -98,7 +98,7 @@ LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} loader.help: help.common help.kboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} + awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../forth .include "${.CURDIR}/../../forth/Makefile.inc" diff --git a/sys/boot/powerpc/ofw/Makefile b/sys/boot/powerpc/ofw/Makefile index 458d7dd237b5..b170812559f6 100644 --- a/sys/boot/powerpc/ofw/Makefile +++ b/sys/boot/powerpc/ofw/Makefile @@ -69,9 +69,9 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a .endif # Always add MI sources -.PATH: ${.CURDIR}/../../common ${.CURDIR}/../../../libkern -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. +.include "../../loader.mk" +.PATH: ${.CURDIR}/../../../libkern +CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -I. CLEANFILES+= loader.help @@ -96,7 +96,7 @@ LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} loader.help: help.common help.ofw ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} + awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../forth .include "${.CURDIR}/../../forth/Makefile.inc" diff --git a/sys/boot/powerpc/ps3/Makefile b/sys/boot/powerpc/ps3/Makefile index 4df5b4196030..f6b3d41c2b98 100644 --- a/sys/boot/powerpc/ps3/Makefile +++ b/sys/boot/powerpc/ps3/Makefile @@ -72,9 +72,9 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a CFLAGS+= -mcpu=powerpc64 # Always add MI sources -.PATH: ${.CURDIR}/../../common ${.CURDIR}/../../../libkern -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. +.include "../../loader.mk" +.PATH: ${.CURDIR}/../../../libkern +CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -I. CLEANFILES+= loader.help @@ -100,7 +100,7 @@ font.h: loader.help: help.common help.ps3 ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} + awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../forth .include "${.CURDIR}/../../forth/Makefile.inc" diff --git a/sys/boot/powerpc/uboot/Makefile b/sys/boot/powerpc/uboot/Makefile index c153719b5fc8..5a88546d5ce3 100644 --- a/sys/boot/powerpc/uboot/Makefile +++ b/sys/boot/powerpc/uboot/Makefile @@ -75,9 +75,9 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a .endif # Always add MI sources -.PATH: ${.CURDIR}/../../common ${.CURDIR}/../../../libkern -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. +.include "../../loader.mk" +.PATH: ${.CURDIR}/../../../libkern +CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -I. CLEANFILES+= ${PROG}.help @@ -101,7 +101,7 @@ LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA32} loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} + awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../forth FILES= loader.help diff --git a/sys/boot/sparc64/loader/Makefile b/sys/boot/sparc64/loader/Makefile index bc7b870ae5b2..4825a76ddd6b 100644 --- a/sys/boot/sparc64/loader/Makefile +++ b/sys/boot/sparc64/loader/Makefile @@ -66,9 +66,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a .endif # Always add MI sources -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common +.include "../../loader.mk" CFLAGS+= -I. CLEANFILES+= loader.help @@ -87,7 +85,7 @@ LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} loader.help: help.common help.sparc64 cat ${.ALLSRC} | \ - awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} + awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../forth .include "${.CURDIR}/../../forth/Makefile.inc" diff --git a/sys/boot/userboot/userboot/Makefile b/sys/boot/userboot/userboot/Makefile index 3f5dcace6162..9a8963c9ed65 100644 --- a/sys/boot/userboot/userboot/Makefile +++ b/sys/boot/userboot/userboot/Makefile @@ -30,7 +30,6 @@ SRCS+= vers.c CFLAGS+= -Wall CFLAGS+= -I${.CURDIR}/.. -CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -ffreestanding -I. @@ -54,9 +53,7 @@ LIBZFSBOOT= ${.OBJDIR}/../zfs/libzfsboot.a .endif # Always add MI sources -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common +.include "../../loader.mk" CFLAGS+= -I. DPADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSA} LDADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSA} -- cgit v1.2.3