diff --git a/stand/Makefile b/stand/Makefile index bc50e1bfb736..bacf39e26eca 100644 --- a/stand/Makefile +++ b/stand/Makefile @@ -1,41 +1,41 @@ # $FreeBSD$ .include # For amd64 we have to build 32 and 64 bit versions of things. For # others we don't. LIB32LIST is a list of libraries, which if # included, need to be built 32-bit as well. .if ${MACHINE_ARCH} == "amd64" LIB32LIST=libsa ficl liblua .endif S.yes+= libsa S.${MK_FORTH}+= ficl S.${MK_FORTH}+= forth S.${MK_LOADER_LUA}+= liblua S.${MK_LOADER_LUA}+= lua S.${MK_FDT}+= fdt -S.${MK_LOADER_OFW}+= ofw +S.${MK_LOADER_OFW}+= libofw S.yes+= defaults S.yes+= man .include S.${MK_EFI}+= efi S.${MK_LOADER_UBOOT}+= uboot .if exists(${.CURDIR}/${MACHINE}/.) S.yes+= ${MACHINE} .endif # Build the actual subdir list from S.yes, adding in the 32-bit # variant if necessary. .for _x in ${S.yes} SUBDIR+=${_x} .if defined(LIB32LIST) && ${LIB32LIST:M${_x}} SUBDIR+=${_x}32 .endif .endfor .include diff --git a/stand/defs.mk b/stand/defs.mk index 6ae9069664ac..514a6c9b98dc 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -1,230 +1,231 @@ # $FreeBSD$ .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} # We need to define all the MK_ options before including src.opts.mk # because it includes bsd.own.mk which needs the right MK_ values, # espeically MK_CTF. MK_CTF= no MK_SSP= no MK_PROFILE= no MAN= .if !defined(PIC) NO_PIC= INTERNALLIB= .endif .include WARNS?= 1 BOOTSRC= ${SRCTOP}/stand EFISRC= ${BOOTSRC}/efi EFIINC= ${EFISRC}/include EFIINCMD= ${EFIINC}/${MACHINE} FDTSRC= ${BOOTSRC}/fdt FICLSRC= ${BOOTSRC}/ficl LDRSRC= ${BOOTSRC}/common LIBLUASRC= ${BOOTSRC}/liblua +LIBOFWSRC= ${BOOTSRC}/libofw LUASRC= ${SRCTOP}/contrib/lua/src SASRC= ${BOOTSRC}/libsa SYSDIR= ${SRCTOP}/sys UBOOTSRC= ${BOOTSRC}/uboot ZFSSRC= ${SASRC}/zfs LIBCSRC= ${SRCTOP}/lib/libc BOOTOBJ= ${OBJTOP}/stand # BINDIR is where we install BINDIR?= /boot # LUAPATH is where we search for and install lua scripts. LUAPATH?= /boot/lua FLUASRC?= ${SRCTOP}/libexec/flua LIBSA= ${BOOTOBJ}/libsa/libsa.a .if ${MACHINE} == "i386" LIBSA32= ${LIBSA} .else LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a .endif # Standard options: CFLAGS+= -nostdinc .if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1 CFLAGS+= -I${BOOTOBJ}/libsa32 .else CFLAGS+= -I${BOOTOBJ}/libsa .endif CFLAGS+= -I${SASRC} -D_STANDALONE CFLAGS+= -I${SYSDIR} # Spike the floating point interfaces CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" # Slim down the image. This saves about 15% in size with clang 6 on x86 # Our most constrained /boot/loader env is BIOS booting on x86, where # our text + data + BTX have to fit into 640k below the ISA hole. # Experience has shown that problems arise between ~520k to ~530k. CFLAGS.clang+= -Oz CFLAGS.gcc+= -Os CFLAGS+= -ffunction-sections -fdata-sections .endif # GELI Support, with backward compat hooks (mostly) .if defined(LOADER_NO_GELI_SUPPORT) MK_LOADER_GELI=no .warning "Please move from LOADER_NO_GELI_SUPPORT to WITHOUT_LOADER_GELI" .endif .if defined(LOADER_GELI_SUPPORT) MK_LOADER_GELI=yes .warning "Please move from LOADER_GELI_SUPPORT to WITH_LOADER_GELI" .endif .if ${MK_LOADER_GELI} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT CFLAGS+= -I${SASRC}/geli .endif # MK_LOADER_GELI # These should be confined to loader.mk, but can't because uboot/lib # also uses it. It's part of loader, but isn't a loader so we can't # just include loader.mk .if ${LOADER_DISK_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_DISK_SUPPORT .endif # Machine specific flags for all builds here # All PowerPC builds are 32 bit. We have no 64-bit loaders on powerpc # or powerpc64. .if ${MACHINE_ARCH} == "powerpc64" CFLAGS+= -m32 -mcpu=powerpc .endif # For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is # build 32-bit and some 64-bit (lib*, efi). Centralize all the 32-bit magic here # and activate it when DO32 is explicitly defined to be 1. .if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1 CFLAGS+= -m32 # LD_FLAGS is passed directly to ${LD}, not via ${CC}: LD_FLAGS+= -m elf_i386_fbsd AFLAGS+= --32 .endif SSP_CFLAGS= # Add in the no float / no SIMD stuff and announce we're freestanding # aarch64 and riscv don't have -msoft-float, but all others do. riscv # currently has no /boot/loader, but may soon. CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD} .if ${MACHINE_CPUARCH} == "aarch64" CFLAGS+= -mgeneral-regs-only -fPIC .elif ${MACHINE_CPUARCH} == "riscv" CFLAGS+= -march=rv64imac -mabi=lp64 .else CFLAGS+= -msoft-float .endif # -msoft-float seems to be insufficient for powerpcspe .if ${MACHINE_ARCH} == "powerpcspe" CFLAGS+= -mno-spe .endif .if ${MACHINE_CPUARCH} == "i386" || (${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1) CFLAGS+= -march=i386 CFLAGS.gcc+= -mpreferred-stack-boundary=2 .endif .if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 0 CFLAGS+= -fPIC -mno-red-zone .endif .if ${MACHINE_CPUARCH} == "arm" # Do not generate movt/movw, because the relocation fixup for them does not # translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). # Also, the fpu is not available in a standalone environment. .if ${COMPILER_VERSION} < 30800 CFLAGS.clang+= -mllvm -arm-use-movt=0 .else CFLAGS.clang+= -mno-movt .endif CFLAGS.clang+= -mfpu=none CFLAGS+= -fPIC .endif # The boot loader build uses dd status=none, where possible, for reproducible # build output (since performance varies from run to run). Trouble is that # option was recently (10.3) added to FreeBSD and is non-standard. Only use it # when this test succeeds rather than require dd to be a bootstrap tool. DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true DD=dd ${DD_NOSTATUS} .if ${MACHINE_CPUARCH} == "mips" CFLAGS+= -G0 -fno-pic -mno-abicalls .endif .if ${MK_LOADER_FORCE_LE} != "no" .if ${MACHINE_ARCH} == "powerpc64" CFLAGS+= -mlittle-endian .endif .endif # # Have a sensible default # .if ${MK_LOADER_LUA} == "yes" LOADER_DEFAULT_INTERP?=lua .elif ${MK_FORTH} == "yes" LOADER_DEFAULT_INTERP?=4th .else LOADER_DEFAULT_INTERP?=simp .endif LOADER_INTERP?=${LOADER_DEFAULT_INTERP} # Make sure we use the machine link we're about to create CFLAGS+=-I. all: ${PROG} .if !defined(NO_OBJ) _ILINKS=include/machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" _ILINKS+=include/${MACHINE_CPUARCH} .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" _ILINKS+=include/x86 .endif CFLAGS+= -Iinclude CLEANDIRS+= include beforedepend: ${_ILINKS} beforebuild: ${_ILINKS} # Ensure that the links exist without depending on it when it exists which # causes all the modules to be rebuilt when the directory pointed to changes. .for _link in ${_ILINKS} .if !exists(${.OBJDIR}/${_link}) ${OBJS}: ${_link} .endif # _link exists .endfor .NOPATH: ${_ILINKS} ${_ILINKS}: .NOMETA @case ${.TARGET:T} in \ machine) \ if [ ${DO32:U0} -eq 0 ]; then \ path=${SYSDIR}/${MACHINE}/include ; \ else \ path=${SYSDIR}/${MACHINE:C/amd64/i386/}/include ; \ fi ;; \ *) \ path=${SYSDIR}/${.TARGET:T}/include ;; \ esac ; \ case ${.TARGET} in \ */*) mkdir -p ${.TARGET:H};; \ esac ; \ path=`(cd $$path && /bin/pwd)` ; \ ${ECHO} ${.TARGET} "->" $$path ; \ ln -fhs $$path ${.TARGET} .endif # !NO_OBJ .endif # __BOOT_DEFS_MK__ diff --git a/stand/ofw/libofw/Makefile b/stand/libofw/Makefile similarity index 100% rename from stand/ofw/libofw/Makefile rename to stand/libofw/Makefile diff --git a/stand/ofw/libofw/devicename.c b/stand/libofw/devicename.c similarity index 100% rename from stand/ofw/libofw/devicename.c rename to stand/libofw/devicename.c diff --git a/stand/ofw/libofw/libofw.h b/stand/libofw/libofw.h similarity index 100% rename from stand/ofw/libofw/libofw.h rename to stand/libofw/libofw.h diff --git a/stand/ofw/libofw/ofw_console.c b/stand/libofw/ofw_console.c similarity index 100% rename from stand/ofw/libofw/ofw_console.c rename to stand/libofw/ofw_console.c diff --git a/stand/ofw/libofw/ofw_copy.c b/stand/libofw/ofw_copy.c similarity index 100% rename from stand/ofw/libofw/ofw_copy.c rename to stand/libofw/ofw_copy.c diff --git a/stand/ofw/libofw/ofw_disk.c b/stand/libofw/ofw_disk.c similarity index 100% rename from stand/ofw/libofw/ofw_disk.c rename to stand/libofw/ofw_disk.c diff --git a/stand/ofw/libofw/ofw_memory.c b/stand/libofw/ofw_memory.c similarity index 100% rename from stand/ofw/libofw/ofw_memory.c rename to stand/libofw/ofw_memory.c diff --git a/stand/ofw/libofw/ofw_module.c b/stand/libofw/ofw_module.c similarity index 100% rename from stand/ofw/libofw/ofw_module.c rename to stand/libofw/ofw_module.c diff --git a/stand/ofw/libofw/ofw_net.c b/stand/libofw/ofw_net.c similarity index 100% rename from stand/ofw/libofw/ofw_net.c rename to stand/libofw/ofw_net.c diff --git a/stand/ofw/libofw/ofw_reboot.c b/stand/libofw/ofw_reboot.c similarity index 100% rename from stand/ofw/libofw/ofw_reboot.c rename to stand/libofw/ofw_reboot.c diff --git a/stand/ofw/libofw/ofw_time.c b/stand/libofw/ofw_time.c similarity index 100% rename from stand/ofw/libofw/ofw_time.c rename to stand/libofw/ofw_time.c diff --git a/stand/ofw/libofw/openfirm.c b/stand/libofw/openfirm.c similarity index 100% rename from stand/ofw/libofw/openfirm.c rename to stand/libofw/openfirm.c diff --git a/stand/ofw/libofw/openfirm.h b/stand/libofw/openfirm.h similarity index 100% rename from stand/ofw/libofw/openfirm.h rename to stand/libofw/openfirm.h diff --git a/stand/ofw/Makefile b/stand/ofw/Makefile deleted file mode 100644 index 3b881b780e87..000000000000 --- a/stand/ofw/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -SUBDIR= libofw - -.include diff --git a/stand/ofw/Makefile.inc b/stand/ofw/Makefile.inc deleted file mode 100644 index 265f86d1ed55..000000000000 --- a/stand/ofw/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -.include "../Makefile.inc" diff --git a/stand/powerpc/ofw/Makefile b/stand/powerpc/ofw/Makefile index de5d5e01037a..35c9d4ae546f 100644 --- a/stand/powerpc/ofw/Makefile +++ b/stand/powerpc/ofw/Makefile @@ -1,48 +1,48 @@ # $FreeBSD$ LOADER_CD9660_SUPPORT?= yes LOADER_EXT2FS_SUPPORT?= no LOADER_MSDOS_SUPPORT?= no LOADER_UFS_SUPPORT?= yes LOADER_NET_SUPPORT?= yes LOADER_NFS_SUPPORT?= yes LOADER_TFTP_SUPPORT?= no LOADER_GZIP_SUPPORT?= yes LOADER_BZIP2_SUPPORT?= no .include PROG= loader NEWVERSWHAT= "Open Firmware loader" ${MACHINE_ARCH} INSTALLFLAGS= -b # Architecture-specific loader code SRCS= conf.c vers.c main.c elf_freebsd.c ppc64_elf_freebsd.c start.c SRCS+= ucmpdi2.c .include "${BOOTSRC}/fdt.mk" .if ${MK_FDT} == "yes" SRCS+= ofwfdt.c .endif HELP_FILES= ${FDTSRC}/help.fdt # Always add MI sources .include "${BOOTSRC}/loader.mk" .PATH: ${SYSDIR}/libkern # load address. set in linker script RELOC?= 0x1C00000 CFLAGS+= -DRELOC=${RELOC} LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc # Open Firmware standalone support library -LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a -CFLAGS+= -I${BOOTSRC}/ofw/libofw +LIBOFW= ${BOOTOBJ}/libofw/libofw.a +CFLAGS+= -I${BOOTSRC}/libofw DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA} LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA} .include diff --git a/stand/sparc64/loader/Makefile b/stand/sparc64/loader/Makefile index 7bc2ee5aa9fa..c85093c0745a 100644 --- a/stand/sparc64/loader/Makefile +++ b/stand/sparc64/loader/Makefile @@ -1,56 +1,56 @@ # $FreeBSD$ HAVE_ZFS= ${MK_LOADER_ZFS} LOADER_DISK_SUPPORT?= yes LOADER_UFS_SUPPORT?= yes LOADER_CD9660_SUPPORT?= yes LOADER_EXT2FS_SUPPORT?= no LOADER_MSDOS_SUPPORT?= no LOADER_NET_SUPPORT?= yes LOADER_NFS_SUPPORT?= yes LOADER_TFTP_SUPPORT?= yes LOADER_GZIP_SUPPORT?= yes LOADER_BZIP2_SUPPORT?= no LOADER_DEBUG?= no .include PROG?= loader NEWVERSWHAT?= "bootstrap loader" sparc64 VERSION_FILE= ${.CURDIR}/../loader/version INSTALLFLAGS= -b .if ${MK_LOADER_ZFS} != "no" HAVE_ZFS= yes .endif # Architecture-specific loader code .PATH: ${BOOTSRC}/sparc64/loader SRCS= locore.S main.c vers.c .if ${LOADER_DEBUG} == "yes" CFLAGS+= -DLOADER_DEBUG .endif .if exists(${.CURDIR}/help.sparc64) HELP_FILES= ${.CURDIR}/help.sparc64 .endif # Always add MI sources .include "${BOOTSRC}/loader.mk" LDFLAGS+= -static .if ${MK_LOADER_ZFS} == "yes" LINKS= ${BINDIR}/loader ${BINDIR}/zfsloader .endif # Open Firmware standalone support library -LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a -CFLAGS+= -I${BOOTSRC}/ofw/libofw/ +LIBOFW= ${BOOTOBJ}/libofw/libofw.a +CFLAGS+= -I${BOOTSRC}/libofw DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} .include