Author: kevans
Date: Sun Feb 11 19:29:58 2018
New Revision: 329129
URL: https://svnweb.freebsd.org/changeset/base/329129

Log:
  MFC Loader Fixes 2017q4p1: r324321,r324359,r324360,r324388,r324449,r324450,
  r324451,r324452
  
  r324321: This README file was quite relevant for FreeBSD 3 or 4. No more.
  
  r324359: Add efi_devpath_is_prefix
  
  r324360: Encapsulate  ZFS preferences into efi_zfs_is_preferred
  
  r324388: Unbreak building efiboot with MK_ZFS == no
  
  r324449: Prefer ${LIBSTAND} to -lstand
  
  r324450: Define SASRC and use it
  
  r324451: Add missing -I${SASRC} in a couple of places so that stand.h
  doesn't accidentally come in via host pollution.
  
  r324452: Define LIBSA* and use them instead of overloaded LIBSTAND

Added:
  stable/11/sys/boot/userboot/Makefile.inc
     - copied unchanged from r324450, head/sys/boot/userboot/Makefile.inc
Deleted:
  stable/11/sys/boot/README
Modified:
  stable/11/sys/boot/Makefile.ficl
  stable/11/sys/boot/Makefile.inc
  stable/11/sys/boot/arm/uboot/Makefile
  stable/11/sys/boot/common/Makefile.inc
  stable/11/sys/boot/efi/boot1/Makefile
  stable/11/sys/boot/efi/fdt/Makefile
  stable/11/sys/boot/efi/include/efilib.h
  stable/11/sys/boot/efi/include/efizfs.h
  stable/11/sys/boot/efi/libefi/Makefile
  stable/11/sys/boot/efi/libefi/devpath.c
  stable/11/sys/boot/efi/libefi/efizfs.c
  stable/11/sys/boot/efi/loader/Makefile
  stable/11/sys/boot/efi/loader/main.c
  stable/11/sys/boot/fdt/Makefile
  stable/11/sys/boot/i386/gptboot/Makefile
  stable/11/sys/boot/i386/gptzfsboot/Makefile
  stable/11/sys/boot/i386/libfirewire/Makefile
  stable/11/sys/boot/i386/libi386/Makefile
  stable/11/sys/boot/i386/loader/Makefile
  stable/11/sys/boot/i386/zfsboot/Makefile
  stable/11/sys/boot/libstand32/Makefile
  stable/11/sys/boot/mips/beri/boot2/Makefile
  stable/11/sys/boot/mips/beri/loader/Makefile
  stable/11/sys/boot/mips/uboot/Makefile
  stable/11/sys/boot/ofw/libofw/Makefile
  stable/11/sys/boot/powerpc/kboot/Makefile
  stable/11/sys/boot/powerpc/ofw/Makefile
  stable/11/sys/boot/powerpc/ps3/Makefile
  stable/11/sys/boot/powerpc/uboot/Makefile
  stable/11/sys/boot/sparc64/loader/Makefile
  stable/11/sys/boot/uboot/fdt/Makefile
  stable/11/sys/boot/uboot/lib/Makefile
  stable/11/sys/boot/userboot/libstand/Makefile
  stable/11/sys/boot/userboot/userboot/Makefile
  stable/11/sys/boot/userboot/zfs/Makefile
  stable/11/sys/boot/zfs/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/boot/Makefile.ficl
==============================================================================
--- stable/11/sys/boot/Makefile.ficl    Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/Makefile.ficl    Sun Feb 11 19:29:58 2018        
(r329129)
@@ -27,7 +27,7 @@ CFLAGS+=      -m32 -mcpu=powerpc -I.
 .endif
 
 CFLAGS+=       -I${FICLDIR} -I${FICLDIR}/${FICL_CPUARCH} \
-               -I${FICLDIR}/../common
+               -I${FICLDIR}/../common -I${SASRC}
 
 .if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32)
 .if !exists(machine)

Modified: stable/11/sys/boot/Makefile.inc
==============================================================================
--- stable/11/sys/boot/Makefile.inc     Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/Makefile.inc     Sun Feb 11 19:29:58 2018        
(r329129)
@@ -2,6 +2,17 @@
 
 .include <src.opts.mk>
 
+.if !defined(__BOOT_MAKEFILE_INC__)
+__BOOT_MAKEFILE_INC__=${MFILE}
+
+SASRC=${SRCTOP}/lib/libstand
+# Normal stand alone library
+LIBSA=${OBJTOP}/lib/libstand/libstand.a
+# stand alone library compiled for 32-bit version of the processor
+LIBSA32=${OBJTOP}/sys/boot/libstand32/libstand.a
+# stand along library compiled for userboot
+LIBSAU=${OBJTOP}/sys/boot/userboot/libstand/libstand.a
+
 SSP_CFLAGS=
 
 .if ${MACHINE_CPUARCH} == "arm"
@@ -24,9 +35,9 @@ DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && e
 DD=dd ${DD_NOSTATUS}
 
 .if ${MK_LOADER_FORCE_LE} != "no"
-
 .if ${MACHINE_ARCH} == "powerpc64"
 CFLAGS+=       -mlittle-endian
+.endif
 .endif
 
 .endif

Modified: stable/11/sys/boot/arm/uboot/Makefile
==============================================================================
--- stable/11/sys/boot/arm/uboot/Makefile       Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/arm/uboot/Makefile       Sun Feb 11 19:29:58 2018        
(r329129)
@@ -112,16 +112,15 @@ LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a
 CFLAGS+=       -I${.CURDIR}/../../uboot/lib
 CFLAGS+=       -I${.OBJDIR}/../../uboot/lib
 
-# where to get libstand from
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=       -I${SASRC}
 
 CFLAGS+=       -fPIC
 
 # clang doesn't understand %D as a specifier to printf
 NO_WERROR.clang=
 
-DPADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
-LDADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
+DPADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
+LDADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
 
 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
 

Modified: stable/11/sys/boot/common/Makefile.inc
==============================================================================
--- stable/11/sys/boot/common/Makefile.inc      Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/common/Makefile.inc      Sun Feb 11 19:29:58 2018        
(r329129)
@@ -74,7 +74,7 @@ CFLAGS+=      -DBOOT_PROMPT_123
 
 .if defined(LOADER_INSTALL_SUPPORT)
 SRCS+= install.c
-CFLAGS+=-I${.CURDIR}/../../../../lib/libstand
+CFLAGS+=-I${SASRC}
 .endif
 
 CLEANFILES+=   vers.c

Modified: stable/11/sys/boot/efi/boot1/Makefile
==============================================================================
--- stable/11/sys/boot/efi/boot1/Makefile       Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/efi/boot1/Makefile       Sun Feb 11 19:29:58 2018        
(r329129)
@@ -90,8 +90,8 @@ LIBEFI=               ${.OBJDIR}/../libefi/libefi.a
 # __aeabi_* (arm) or __divdi3 (i386).
 # as well as required string and memory functions for all platforms.
 #
-DPADD+=                ${LIBEFI} ${LIBSTAND}
-LDADD+=                ${LIBEFI} -lstand
+DPADD+=                ${LIBEFI} ${LIBSA}
+LDADD+=                ${LIBEFI} ${LIBSA}
 
 DPADD+=                ${LDSCRIPT}
 

Modified: stable/11/sys/boot/efi/fdt/Makefile
==============================================================================
--- stable/11/sys/boot/efi/fdt/Makefile Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/efi/fdt/Makefile Sun Feb 11 19:29:58 2018        
(r329129)
@@ -17,7 +17,7 @@ CFLAGS+=      -mgeneral-regs-only
 CFLAGS+=       -msoft-float
 .endif
 
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=       -I${SASRC}
 
 # EFI library headers
 CFLAGS+=       -I${.CURDIR}/../include

Modified: stable/11/sys/boot/efi/include/efilib.h
==============================================================================
--- stable/11/sys/boot/efi/include/efilib.h     Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/efi/include/efilib.h     Sun Feb 11 19:29:58 2018        
(r329129)
@@ -82,6 +82,7 @@ EFI_HANDLE efi_devpath_handle(EFI_DEVICE_PATH *);
 EFI_DEVICE_PATH *efi_devpath_last_node(EFI_DEVICE_PATH *);
 EFI_DEVICE_PATH *efi_devpath_trim(EFI_DEVICE_PATH *);
 bool efi_devpath_match(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
+int efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
 CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *);
 void efi_free_devpath_name(CHAR16 *);
 

Modified: stable/11/sys/boot/efi/include/efizfs.h
==============================================================================
--- stable/11/sys/boot/efi/include/efizfs.h     Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/efi/include/efizfs.h     Sun Feb 11 19:29:58 2018        
(r329129)
@@ -27,6 +27,7 @@
  */
 
 #include <stdint.h>
+#include <stdbool.h>
 
 #ifndef _EFIZFS_H_
 #define _EFIZFS_H_
@@ -45,6 +46,7 @@ extern uint64_t pool_guid;
 
 extern void efi_zfs_probe(void);
 extern zfsinfo_list_t *efizfs_get_zfsinfo_list(void);
+extern bool efi_zfs_is_preferred(EFI_HANDLE *h);
 extern EFI_HANDLE efizfs_get_handle_by_guid(uint64_t);
 
 #endif

Modified: stable/11/sys/boot/efi/libefi/Makefile
==============================================================================
--- stable/11/sys/boot/efi/libefi/Makefile      Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/efi/libefi/Makefile      Sun Feb 11 19:29:58 2018        
(r329129)
@@ -37,7 +37,7 @@ CFLAGS+= -fPIC -mno-red-zone
 .endif
 CFLAGS+= -I${.CURDIR}/../include
 CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+= -I${SASRC}
 .if ${MK_ZFS} != "no"
 CFLAGS+=       -I${.CURDIR}/../../zfs
 CFLAGS+=       -I${.CURDIR}/../../../cddl/boot/zfs

Modified: stable/11/sys/boot/efi/libefi/devpath.c
==============================================================================
--- stable/11/sys/boot/efi/libefi/devpath.c     Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/efi/libefi/devpath.c     Sun Feb 11 19:29:58 2018        
(r329129)
@@ -166,3 +166,32 @@ efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVIC
        }
        return (true);
 }
+
+int
+efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEVICE_PATH *path)
+{
+       int len;
+
+       if (prefix == NULL || path == NULL)
+               return (0);
+
+       while (1) {
+               if (IsDevicePathEnd(prefix))
+                       break;
+
+               if (DevicePathType(prefix) != DevicePathType(path) ||
+                   DevicePathSubType(prefix) != DevicePathSubType(path))
+                       return (0);
+
+               len = DevicePathNodeLength(prefix);
+               if (len != DevicePathNodeLength(path))
+                       return (0);
+
+               if (memcmp(prefix, path, (size_t)len) != 0)
+                       return (0);
+
+               prefix = NextDevicePathNode(prefix);
+               path = NextDevicePathNode(path);
+       }
+       return (1);
+}

Modified: stable/11/sys/boot/efi/libefi/efizfs.c
==============================================================================
--- stable/11/sys/boot/efi/libefi/efizfs.c      Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/efi/libefi/efizfs.c      Sun Feb 11 19:29:58 2018        
(r329129)
@@ -81,12 +81,9 @@ efi_zfs_probe(void)
 {
        pdinfo_list_t *hdi;
        pdinfo_t *hd, *pd = NULL;
-       EFI_GUID imgid = LOADED_IMAGE_PROTOCOL;
-       EFI_LOADED_IMAGE *img;
        char devname[SPECNAMELEN + 1];
         uint64_t guid;
 
-       BS->HandleProtocol(IH, &imgid, (VOID**)&img);
        hdi = efiblk_get_pdinfo_list(&efipart_hddev);
        STAILQ_INIT(&zfsinfo);
 
@@ -105,7 +102,7 @@ efi_zfs_probe(void)
                         if (zfs_probe_dev(devname, &guid) == 0) {
                                 insert_zfs(pd->pd_handle, guid);
 
-                                if (pd->pd_handle == img->DeviceHandle)
+                                if (efi_zfs_is_preferred(pd->pd_handle))
                                         pool_guid = guid;
                         }
 

Modified: stable/11/sys/boot/efi/loader/Makefile
==============================================================================
--- stable/11/sys/boot/efi/loader/Makefile      Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/efi/loader/Makefile      Sun Feb 11 19:29:58 2018        
(r329129)
@@ -37,7 +37,7 @@ CWARNFLAGS.zfs.c+=    -Wno-missing-prototypes
 .endif
 
 .if defined(LOADER_NET_SUPPORT)
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+=       -I${SASRC}
 .endif
 
 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
@@ -156,9 +156,9 @@ loader.efi: ${PROG}
 
 LIBEFI=                ${.OBJDIR}/../libefi/libefi.a
 
-DPADD=         ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSTAND} \
+DPADD=         ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} \
                ${LDSCRIPT}
-LDADD=         ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSTAND}
+LDADD=         ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA}
 
 .include <bsd.prog.mk>
 

Modified: stable/11/sys/boot/efi/loader/main.c
==============================================================================
--- stable/11/sys/boot/efi/loader/main.c        Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/efi/loader/main.c        Sun Feb 11 19:29:58 2018        
(r329129)
@@ -72,6 +72,16 @@ EFI_GUID debugimg = DEBUG_IMAGE_INFO_TABLE_GUID;
 EFI_GUID fdtdtb = FDT_TABLE_GUID;
 EFI_GUID inputid = SIMPLE_TEXT_INPUT_PROTOCOL;
 
+static EFI_LOADED_IMAGE *img;
+
+#ifdef EFI_ZFS_BOOT
+bool
+efi_zfs_is_preferred(EFI_HANDLE *h)
+{
+        return (h == img->DeviceHandle);
+}
+#endif
+
 static int
 has_keyboard(void)
 {
@@ -300,7 +310,6 @@ EFI_STATUS
 main(int argc, CHAR16 *argv[])
 {
        char var[128];
-       EFI_LOADED_IMAGE *img;
        EFI_GUID *guid;
        int i, j, vargood, howto;
        UINTN k;
@@ -319,6 +328,9 @@ main(int argc, CHAR16 *argv[])
        archsw.arch_zfs_probe = efi_zfs_probe;
 #endif
 
+        /* Get our loaded image protocol interface structure. */
+       BS->HandleProtocol(IH, &imgid, (VOID**)&img);
+
        /* Init the time source */
        efi_time_init();
 
@@ -445,9 +457,6 @@ main(int argc, CHAR16 *argv[])
        for (i = 0; devsw[i] != NULL; i++)
                if (devsw[i]->dv_init != NULL)
                        (devsw[i]->dv_init)();
-
-       /* Get our loaded image protocol interface structure. */
-       BS->HandleProtocol(IH, &imgid, (VOID**)&img);
 
        printf("Command line arguments:");
        for (i = 0; i < argc; i++)

Modified: stable/11/sys/boot/fdt/Makefile
==============================================================================
--- stable/11/sys/boot/fdt/Makefile     Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/fdt/Makefile     Sun Feb 11 19:29:58 2018        
(r329129)
@@ -12,6 +12,7 @@ SRCS+=                fdt.c fdt_ro.c fdt_wip.c fdt_sw.c 
fdt_rw.c fdt
 # Loader's fdt commands extension sources.
 SRCS+=         fdt_loader_cmd.c
 
+CFLAGS+=       -I${SASRC}
 CFLAGS+=       -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/
 
 CFLAGS+=       -ffreestanding

Modified: stable/11/sys/boot/i386/gptboot/Makefile
==============================================================================
--- stable/11/sys/boot/i386/gptboot/Makefile    Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/i386/gptboot/Makefile    Sun Feb 11 19:29:58 2018        
(r329129)
@@ -50,8 +50,6 @@ OPENCRYPTO_XTS=       xform_aes_xts.o
 
 LD_FLAGS=${LD_FLAGS_BIN}
 
-LIBSTAND=      ${.OBJDIR}/../../libstand32/libstand.a
-
 # Pick up ../Makefile.inc early.
 .include <bsd.init.mk>
 
@@ -76,7 +74,7 @@ gptboot.bin: gptboot.out
        ${OBJCOPY} -S -O binary gptboot.out ${.TARGET}
 
 gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o util.o 
${OPENCRYPTO_XTS}
-       ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 
${LIBGELIBOOT} ${LIBSTAND}
+       ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 
${LIBGELIBOOT} ${LIBSA32}
 
 gptboot.o: ${.CURDIR}/../../common/ufsread.c
 

Modified: stable/11/sys/boot/i386/gptzfsboot/Makefile
==============================================================================
--- stable/11/sys/boot/i386/gptzfsboot/Makefile Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/i386/gptzfsboot/Makefile Sun Feb 11 19:29:58 2018        
(r329129)
@@ -60,8 +60,6 @@ CFLAGS.gcc+=  --param max-inline-insns-single=100
 
 LD_FLAGS=${LD_FLAGS_BIN}
 
-LIBSTAND=      ${.OBJDIR}/../../libstand32/libstand.a
-
 # Pick up ../Makefile.inc early.
 .include <bsd.init.mk>
 
@@ -87,7 +85,7 @@ gptzfsboot.bin: gptzfsboot.out
 
 gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o \
        skein.o skein_block.o ${OPENCRYPTO_XTS}
-       ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 
${LIBGELIBOOT} ${LIBSTAND}
+       ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 
${LIBGELIBOOT} ${LIBSA32}
 
 zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c
 

Modified: stable/11/sys/boot/i386/libfirewire/Makefile
==============================================================================
--- stable/11/sys/boot/i386/libfirewire/Makefile        Sun Feb 11 18:37:08 
2018        (r329128)
+++ stable/11/sys/boot/i386/libfirewire/Makefile        Sun Feb 11 19:29:58 
2018        (r329129)
@@ -10,7 +10,7 @@ SRCS+=                dcons.c fwcrom.c
 CFLAGS+=       -D_BOOT
 
 CFLAGS+=       -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+=       -I${SASRC}
 CFLAGS+=       -I${.CURDIR}/../btx/lib
 CFLAGS+=       -I${.CURDIR}/../libi386
 

Modified: stable/11/sys/boot/i386/libi386/Makefile
==============================================================================
--- stable/11/sys/boot/i386/libi386/Makefile    Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/i386/libi386/Makefile    Sun Feb 11 19:29:58 2018        
(r329129)
@@ -60,7 +60,7 @@ CFLAGS+=      -I${.CURDIR}/../../ficl -I${.CURDIR}/../../fi
                -I${.CURDIR}/../../../contrib/dev/acpica/include \
                -I${.CURDIR}/../../.. -I.
 # the location of libstand
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=       -I${SASRC}
 
 # Handle FreeBSD specific %b and %D printf format specifiers
 CFLAGS+= ${FORMAT_EXTENSIONS}

Modified: stable/11/sys/boot/i386/loader/Makefile
==============================================================================
--- stable/11/sys/boot/i386/loader/Makefile     Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/i386/loader/Makefile     Sun Feb 11 19:29:58 2018        
(r329129)
@@ -29,7 +29,7 @@ LIBZFSBOOT=   ${.OBJDIR}/../../zfs/libzfsboot.a
 .endif
 
 .if defined(LOADER_NET_SUPPORT)
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+=       -I${SASRC}
 .endif
 
 .if defined(LOADER_TFTP_SUPPORT)
@@ -90,8 +90,6 @@ LDFLAGS=      -static -Ttext 0x0
 LIBI386=       ${.OBJDIR}/../libi386/libi386.a
 CFLAGS+=       -I${.CURDIR}/..
 
-LIBSTAND=      ${.OBJDIR}/../../libstand32/libstand.a
-
 # BTX components
 CFLAGS+=       -I${.CURDIR}/../btx/lib
 
@@ -127,8 +125,8 @@ FILES+=     loader.rc menu.rc
 # XXX crt0.o needs to be first for pxeboot(8) to work
 OBJS=  ${BTXCRT}
 
-DPADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} 
${LIBSTAND}
-LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} 
${LIBSTAND}
+DPADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} 
${LIBSA32}
+LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} 
${LIBSA32}
 
 .include <bsd.prog.mk>
 

Modified: stable/11/sys/boot/i386/zfsboot/Makefile
==============================================================================
--- stable/11/sys/boot/i386/zfsboot/Makefile    Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/i386/zfsboot/Makefile    Sun Feb 11 19:29:58 2018        
(r329129)
@@ -40,8 +40,6 @@ CFLAGS+=      -DSKEIN_LOOP=111
 
 LD_FLAGS=${LD_FLAGS_BIN}
 
-LIBSTAND=      ${.OBJDIR}/../../libstand32/libstand.a
-
 # Pick up ../Makefile.inc early.
 .include <bsd.init.mk>
 
@@ -83,7 +81,7 @@ zfsboot.bin: zfsboot.out
        ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET}
 
 zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o skein.o 
skein_block.o
-       ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
+       ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
 
 SRCS=  zfsboot.c
 

Modified: stable/11/sys/boot/libstand32/Makefile
==============================================================================
--- stable/11/sys/boot/libstand32/Makefile      Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/libstand32/Makefile      Sun Feb 11 19:29:58 2018        
(r329129)
@@ -2,23 +2,25 @@
 
 .include <src.opts.mk>
 
-LIBSTAND_SRC=  ${.CURDIR}/../../../lib/libstand
+.include "../Makefile.inc"
+
 .if ${MACHINE_CPUARCH} == "amd64"
 LIBSTAND_CPUARCH=i386
 .else
 LIBSTAND_CPUARCH=${MACHINE_CPUARCH}
 .endif
-LIBC_SRC=      ${LIBSTAND_SRC}/../libc
+LIBSTAND_SRC=  ${SASRC}
+LIBC_SRC=      ${SRCTOP}/lib/libc
 INTERNALLIB=
 INCS=
 MAN=
-.PATH: ${LIBSTAND_SRC}
+.PATH: ${SASRC}
 
 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
 CFLAGS+=       -m32 -I.
 .endif
 
-.include "${LIBSTAND_SRC}/Makefile"
+.include "${SASRC}/Makefile"
 
 .if ${MACHINE_CPUARCH} == "amd64"
 CLEANFILES+= machine

Modified: stable/11/sys/boot/mips/beri/boot2/Makefile
==============================================================================
--- stable/11/sys/boot/mips/beri/boot2/Makefile Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/mips/beri/boot2/Makefile Sun Feb 11 19:29:58 2018        
(r329129)
@@ -58,8 +58,7 @@ CFLAGS=               -ffreestanding                  \
                -g
 
 # where to get libstand from
-CFLAGS+=       -I${.CURDIR}/../../../../../lib/libstand/
-LIBSTAND=      ${.OBJDIR}/../../../../../lib/libstand/libstand.a
+CFLAGS+=       -I${SASRC}
 
 LDFLAGS=       -nostdlib                       \
                -static                         \
@@ -72,7 +71,7 @@ CFLAGS+=      -I${.CURDIR}/../common
 
 flashboot.elf: relocate.o start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o
        ${CC} ${LDFLAGS} -T ${.CURDIR}/flashboot.ldscript -o ${.TARGET} \
-           ${.ALLSRC} ${LIBSTAND}
+           ${.ALLSRC} ${LIBSA}
 flashboot: flashboot.elf
        ${OBJCOPY} -S -O binary ${.TARGET}.elf ${.TARGET}
 flashboot.md5: flashboot
@@ -80,7 +79,7 @@ flashboot.md5: flashboot
 
 jtagboot: start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o
        ${CC} ${LDFLAGS} -T ${.CURDIR}/jtagboot.ldscript -o ${.TARGET}  \
-           ${.ALLSRC} ${LIBSTAND}
+           ${.ALLSRC} ${LIBSA}
 jtagboot.md5: jtagboot
        md5 jtagboot > jtagboot.md5
 

Modified: stable/11/sys/boot/mips/beri/loader/Makefile
==============================================================================
--- stable/11/sys/boot/mips/beri/loader/Makefile        Sun Feb 11 18:37:08 
2018        (r329128)
+++ stable/11/sys/boot/mips/beri/loader/Makefile        Sun Feb 11 19:29:58 
2018        (r329129)
@@ -108,11 +108,10 @@ LDFLAGS=  -nostdlib                               \
                -e __start
 
 # where to get libstand from
-CFLAGS+=       -I${.CURDIR}/../../../../../lib/libstand/
-LIBSTAND=      ${.OBJDIR}/../../../../../lib/libstand/libstand.a
+CFLAGS+=       -I${SASRC}
 
-DPADD=         ${LIBFICL} ${LIBSTAND}
-LDADD=         ${LIBFICL} ${LIBSTAND}
+DPADD=         ${LIBFICL} ${LIBSA}
+LDADD=         ${LIBFICL} ${LIBSA}
 
 loader.help: help.common help.mips
        cat ${.ALLSRC} | \

Modified: stable/11/sys/boot/mips/uboot/Makefile
==============================================================================
--- stable/11/sys/boot/mips/uboot/Makefile      Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/mips/uboot/Makefile      Sun Feb 11 19:29:58 2018        
(r329129)
@@ -116,15 +116,14 @@ CFLAGS+=  -I${.CURDIR}/../../uboot/lib
 CFLAGS+=       -I${.OBJDIR}/../../uboot/lib
 
 # where to get libstand from
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
-LIBSTAND=      ${.OBJDIR}/../../../../lib/libstand/libstand.a
+CFLAGS+=       -I${SASRC}
 
 # clang doesn't understand %D as a specifier to printf
 #NO_WERROR.clang=
 #NO_WERROR=
 
-DPADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
-LDADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
+DPADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
+LDADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
 
 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
 

Modified: stable/11/sys/boot/ofw/libofw/Makefile
==============================================================================
--- stable/11/sys/boot/ofw/libofw/Makefile      Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/ofw/libofw/Makefile      Sun Feb 11 19:29:58 2018        
(r329129)
@@ -9,7 +9,7 @@ SRCS=   devicename.c elf_freebsd.c ofw_console.c ofw_cop
 .PATH: ${.CURDIR}/../../zfs
 SRCS+=  devicename_stubs.c
 
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=       -I${SASRC}
 
 # Pick up the bootstrap header for some interface items
 CFLAGS+=       -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.

Modified: stable/11/sys/boot/powerpc/kboot/Makefile
==============================================================================
--- stable/11/sys/boot/powerpc/kboot/Makefile   Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/powerpc/kboot/Makefile   Sun Feb 11 19:29:58 2018        
(r329129)
@@ -94,11 +94,10 @@ CFLAGS+= -Wa,-mppc64bridge
 #.include      "${.CURDIR}/../../ofw/common/Makefile.inc"
 
 # where to get libstand from
-LIBSTAND=      ${.OBJDIR}/../../libstand32/libstand.a
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=       -I${SASRC}
 
-DPADD=         ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
-LDADD=         ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
+DPADD=         ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32}
+LDADD=         ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32}
 
 loader.help: help.common help.kboot ${.CURDIR}/../../fdt/help.fdt
        cat ${.ALLSRC} | \

Modified: stable/11/sys/boot/powerpc/ofw/Makefile
==============================================================================
--- stable/11/sys/boot/powerpc/ofw/Makefile     Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/powerpc/ofw/Makefile     Sun Feb 11 19:29:58 2018        
(r329129)
@@ -92,11 +92,10 @@ LIBOFW=             ${.OBJDIR}/../../ofw/libofw/libofw.a
 CFLAGS+=       -I${.CURDIR}/../../ofw/libofw
 
 # where to get libstand from
-LIBSTAND=      ${.OBJDIR}/../../libstand32/libstand.a
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=       -I${SASRC}
 
-DPADD=         ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
-LDADD=         ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
+DPADD=         ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32}
+LDADD=         ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32}
 
 loader.help: help.common help.ofw ${.CURDIR}/../../fdt/help.fdt
        cat ${.ALLSRC} | \

Modified: stable/11/sys/boot/powerpc/ps3/Makefile
==============================================================================
--- stable/11/sys/boot/powerpc/ps3/Makefile     Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/powerpc/ps3/Makefile     Sun Feb 11 19:29:58 2018        
(r329129)
@@ -91,11 +91,10 @@ LDFLAGS=    -nostdlib -static -T ${.CURDIR}/ldscript.powe
 #.include      "${.CURDIR}/../../ofw/common/Makefile.inc"
 
 # where to get libstand from
-LIBSTAND=      ${.OBJDIR}/../../libstand32/libstand.a
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=       -I${SASRC}
 
-DPADD=         ${LIBFICL} ${LIBOFW} ${LIBSTAND}
-LDADD=         ${LIBFICL} ${LIBOFW} ${LIBSTAND}
+DPADD=         ${LIBFICL} ${LIBOFW} ${LIBSA32}
+LDADD=         ${LIBFICL} ${LIBOFW} ${LIBSA32}
 
 SC_DFLT_FONT=cp437
 

Modified: stable/11/sys/boot/powerpc/uboot/Makefile
==============================================================================
--- stable/11/sys/boot/powerpc/uboot/Makefile   Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/powerpc/uboot/Makefile   Sun Feb 11 19:29:58 2018        
(r329129)
@@ -97,11 +97,10 @@ CFLAGS+=    -I${.CURDIR}/../../uboot/lib
 CFLAGS+=       -I${.OBJDIR}/../../uboot/lib
 
 # where to get libstand from
-LIBSTAND=      ${.OBJDIR}/../../libstand32/libstand.a
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=       -I${SASRC}
 
-DPADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
-LDADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
+DPADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA32}
+LDADD=         ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA32}
 
 loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
        cat ${.ALLSRC} | \

Modified: stable/11/sys/boot/sparc64/loader/Makefile
==============================================================================
--- stable/11/sys/boot/sparc64/loader/Makefile  Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/sparc64/loader/Makefile  Sun Feb 11 19:29:58 2018        
(r329129)
@@ -80,13 +80,13 @@ LIBOFW=             ${.OBJDIR}/../../ofw/libofw/libofw.a
 CFLAGS+=       -I${.CURDIR}/../../ofw/libofw/
 
 # where to get libstand from
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=       -I${SASRC}
 
 # Need sys/ for crypto/intake.h
 CFLAGS+=       -I${SRCTOP}/sys
 
-DPADD=         ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
-LDADD=         ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand
+DPADD=         ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA}
+LDADD=         ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA}
 
 loader.help: help.common help.sparc64
        cat ${.ALLSRC} | \

Modified: stable/11/sys/boot/uboot/fdt/Makefile
==============================================================================
--- stable/11/sys/boot/uboot/fdt/Makefile       Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/uboot/fdt/Makefile       Sun Feb 11 19:29:58 2018        
(r329129)
@@ -12,7 +12,7 @@ SRCS=         uboot_fdt.c
 
 CFLAGS+=       -ffreestanding -msoft-float
 
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=       -I${SASRC}
 
 # U-Boot library headers
 CFLAGS+=       -I${.CURDIR}/../lib

Modified: stable/11/sys/boot/uboot/lib/Makefile
==============================================================================
--- stable/11/sys/boot/uboot/lib/Makefile       Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/uboot/lib/Makefile       Sun Feb 11 19:29:58 2018        
(r329129)
@@ -13,7 +13,7 @@ SRCS+=        module.c net.c reboot.c time.c
 
 CFLAGS+=       -ffreestanding -msoft-float
 
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=       -I${SASRC}
 
 .if !defined(LOADER_NO_DISK_SUPPORT)
 SRCS+= disk.c

Copied: stable/11/sys/boot/userboot/Makefile.inc (from r324450, 
head/sys/boot/userboot/Makefile.inc)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/sys/boot/userboot/Makefile.inc    Sun Feb 11 19:29:58 2018        
(r329129, copy of r324450, head/sys/boot/userboot/Makefile.inc)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+.include "../Makefile.inc"

Modified: stable/11/sys/boot/userboot/libstand/Makefile
==============================================================================
--- stable/11/sys/boot/userboot/libstand/Makefile       Sun Feb 11 18:37:08 
2018        (r329128)
+++ stable/11/sys/boot/userboot/libstand/Makefile       Sun Feb 11 19:29:58 
2018        (r329129)
@@ -1,8 +1,9 @@
 # $FreeBSD$
 
 .include <src.opts.mk>
+.include "../Makefile.inc"
 
-LIBSTAND_SRC=  ${.CURDIR}/../../../../lib/libstand
+LIBSTAND_SRC=  ${SASRC}
 
 INTERNALLIB=
 INCS=

Modified: stable/11/sys/boot/userboot/userboot/Makefile
==============================================================================
--- stable/11/sys/boot/userboot/userboot/Makefile       Sun Feb 11 18:37:08 
2018        (r329128)
+++ stable/11/sys/boot/userboot/userboot/Makefile       Sun Feb 11 19:29:58 
2018        (r329129)
@@ -32,7 +32,7 @@ CFLAGS+=      -Wall
 CFLAGS+=       -I${.CURDIR}/..
 CFLAGS+=       -I${.CURDIR}/../../common
 CFLAGS+=       -I${.CURDIR}/../../..
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+=       -I${SASRC}
 CFLAGS+=       -ffreestanding -I.
 
 CWARNFLAGS.main.c += -Wno-implicit-function-declaration
@@ -49,8 +49,6 @@ CFLAGS+=      -DBF_DICTSIZE=15000
 LIBFICL=       ${.OBJDIR}/../ficl/libficl.a
 .endif
 
-LIBSTAND=      ${.OBJDIR}/../libstand/libstand.a
-
 .if ${MK_ZFS} != "no"
 CFLAGS+=       -DUSERBOOT_ZFS_SUPPORT
 LIBZFSBOOT=    ${.OBJDIR}/../zfs/libzfsboot.a
@@ -61,7 +59,7 @@ LIBZFSBOOT=   ${.OBJDIR}/../zfs/libzfsboot.a
 .include       "${.CURDIR}/../../common/Makefile.inc"
 CFLAGS+=       -I${.CURDIR}/../../common
 CFLAGS+=       -I.
-DPADD+=                ${LIBFICL} ${LIBZFSBOOT} ${LIBSTAND} 
-LDADD+=                ${LIBFICL} ${LIBZFSBOOT} ${LIBSTAND}
+DPADD+=                ${LIBFICL} ${LIBZFSBOOT} ${LIBSAU} 
+LDADD+=                ${LIBFICL} ${LIBZFSBOOT} ${LIBSAU}
 
 .include <bsd.lib.mk>

Modified: stable/11/sys/boot/userboot/zfs/Makefile
==============================================================================
--- stable/11/sys/boot/userboot/zfs/Makefile    Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/userboot/zfs/Makefile    Sun Feb 11 19:29:58 2018        
(r329129)
@@ -12,7 +12,7 @@ SRCS+=                zfs.c skein.c skein_block.c
 CFLAGS+=       -DSKEIN_LOOP=111
 
 CFLAGS+=       -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.
-CFLAGS+=       -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+=       -I${SASRC}
 CFLAGS+=       -I${.CURDIR}/../../../cddl/boot/zfs
 CFLAGS+=       -I${.CURDIR}/../../../crypto/skein
 

Modified: stable/11/sys/boot/zfs/Makefile
==============================================================================
--- stable/11/sys/boot/zfs/Makefile     Sun Feb 11 18:37:08 2018        
(r329128)
+++ stable/11/sys/boot/zfs/Makefile     Sun Feb 11 19:29:58 2018        
(r329129)
@@ -12,7 +12,7 @@ CFLAGS+=      -DSKEIN_LOOP=111
 
 CFLAGS+=       -DBOOTPROG=\"zfsloader\"
 CFLAGS+=       -I${.CURDIR}/../common -I${.CURDIR}/../.. -I.
-CFLAGS+=       -I${.CURDIR}/../../../lib/libstand
+CFLAGS+=       -I${SASRC}
 CFLAGS+=       -I${.CURDIR}/../../cddl/boot/zfs
 CFLAGS+=       -I${.CURDIR}/../../crypto/skein
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to