Date: Mon, 12 Feb 2018 01:08:44 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329145 - in stable/11: . lib/libefivar release/powerpc release/tools share/examples/bootforth share/examples/etc share/man/man5 share/man/man7 share/man/man8 stand stand/arm stand/arm6... Message-ID: <201802120108.w1C18iU5072435@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Mon Feb 12 01:08:44 2018 New Revision: 329145 URL: https://svnweb.freebsd.org/changeset/base/329145 Log: MFC r325834,r325997,326502: Move sys/boot to stand/ This is effectively a direct commit to stable/11, due to differences between stable/11 and head. Changes to DTS in sys/boot/fdt/dts were often accompanied by kernel changes. Many of these were also risc-v updates that likely had many more dependencies to MFC. Because of this, sys/boot/fdt/dts remains as-is while everything else in sys/boot relocates to stand/. r325834: Move sys/boot to stand. Fix all references to new location r325997: Remove empty directories. r326502: Document the sys/boot -> stand move in hier.7 and the top-level README. Added: stable/11/stand/ stable/11/stand/Makefile - copied unchanged from r329144, stable/11/sys/boot/Makefile stable/11/stand/Makefile.amd64 - copied unchanged from r329144, stable/11/sys/boot/Makefile.amd64 stable/11/stand/Makefile.arm - copied unchanged from r329144, stable/11/sys/boot/Makefile.arm stable/11/stand/Makefile.arm64 - copied unchanged from r329144, stable/11/sys/boot/Makefile.arm64 stable/11/stand/Makefile.i386 - copied unchanged from r329144, stable/11/sys/boot/Makefile.i386 stable/11/stand/Makefile.inc - copied unchanged from r329144, stable/11/sys/boot/Makefile.inc stable/11/stand/Makefile.mips - copied unchanged from r329144, stable/11/sys/boot/Makefile.mips stable/11/stand/Makefile.pc98 - copied unchanged from r329144, stable/11/sys/boot/Makefile.pc98 stable/11/stand/Makefile.powerpc - copied unchanged from r329144, stable/11/sys/boot/Makefile.powerpc stable/11/stand/Makefile.sparc64 - copied unchanged from r329144, stable/11/sys/boot/Makefile.sparc64 stable/11/stand/arm/ - copied from r329144, stable/11/sys/boot/arm/ stable/11/stand/arm64/ - copied from r329144, stable/11/sys/boot/arm64/ stable/11/stand/common/ - copied from r329144, stable/11/sys/boot/common/ stable/11/stand/defs.mk - copied, changed from r329144, stable/11/sys/boot/defs.mk stable/11/stand/efi/ - copied from r329144, stable/11/sys/boot/efi/ stable/11/stand/fdt/ stable/11/stand/fdt.mk - copied unchanged from r329144, stable/11/sys/boot/fdt.mk stable/11/stand/fdt/Makefile - copied unchanged from r329144, stable/11/sys/boot/fdt/Makefile stable/11/stand/fdt/Makefile.depend - copied unchanged from r329144, stable/11/sys/boot/fdt/Makefile.depend stable/11/stand/fdt/fdt_loader_cmd.c - copied unchanged from r329144, stable/11/sys/boot/fdt/fdt_loader_cmd.c stable/11/stand/fdt/fdt_platform.h - copied unchanged from r329144, stable/11/sys/boot/fdt/fdt_platform.h stable/11/stand/fdt/help.fdt - copied unchanged from r329144, stable/11/sys/boot/fdt/help.fdt stable/11/stand/ficl/ - copied from r329144, stable/11/sys/boot/ficl/ stable/11/stand/ficl.mk - copied unchanged from r329144, stable/11/sys/boot/ficl.mk stable/11/stand/ficl32/ - copied from r329144, stable/11/sys/boot/ficl32/ stable/11/stand/forth/ - copied from r329144, stable/11/sys/boot/forth/ stable/11/stand/geli/ - copied from r329144, stable/11/sys/boot/geli/ stable/11/stand/i386/ - copied from r329144, stable/11/sys/boot/i386/ stable/11/stand/kshim/ - copied from r329144, stable/11/sys/boot/kshim/ stable/11/stand/libsa/ - copied from r329144, stable/11/sys/boot/libsa/ stable/11/stand/libsa32/ - copied from r329144, stable/11/sys/boot/libsa32/ stable/11/stand/loader.mk - copied unchanged from r329144, stable/11/sys/boot/loader.mk stable/11/stand/man/ - copied from r329144, stable/11/sys/boot/man/ stable/11/stand/mips/ - copied from r329144, stable/11/sys/boot/mips/ stable/11/stand/ofw/ - copied from r329144, stable/11/sys/boot/ofw/ stable/11/stand/pc98/ - copied from r329144, stable/11/sys/boot/pc98/ stable/11/stand/powerpc/ - copied from r329144, stable/11/sys/boot/powerpc/ stable/11/stand/sparc64/ - copied from r329144, stable/11/sys/boot/sparc64/ stable/11/stand/uboot/ - copied from r329144, stable/11/sys/boot/uboot/ stable/11/stand/uboot.mk - copied unchanged from r329144, stable/11/sys/boot/uboot.mk stable/11/stand/usb/ - copied from r329144, stable/11/sys/boot/usb/ stable/11/stand/userboot/ - copied from r329144, stable/11/sys/boot/userboot/ stable/11/stand/zfs/ - copied from r329144, stable/11/sys/boot/zfs/ stable/11/stand/zfs32/ - copied from r329144, stable/11/sys/boot/zfs32/ Deleted: stable/11/stand/userboot/ficl/ stable/11/stand/userboot/libstand/ stable/11/stand/userboot/zfs/ stable/11/sys/boot/Makefile stable/11/sys/boot/Makefile.amd64 stable/11/sys/boot/Makefile.arm stable/11/sys/boot/Makefile.arm64 stable/11/sys/boot/Makefile.i386 stable/11/sys/boot/Makefile.inc stable/11/sys/boot/Makefile.mips stable/11/sys/boot/Makefile.pc98 stable/11/sys/boot/Makefile.powerpc stable/11/sys/boot/Makefile.sparc64 stable/11/sys/boot/arm/ stable/11/sys/boot/arm64/ stable/11/sys/boot/common/ stable/11/sys/boot/defs.mk stable/11/sys/boot/efi/ stable/11/sys/boot/fdt.mk stable/11/sys/boot/fdt/Makefile stable/11/sys/boot/fdt/Makefile.depend stable/11/sys/boot/fdt/fdt_loader_cmd.c stable/11/sys/boot/fdt/fdt_platform.h stable/11/sys/boot/fdt/help.fdt stable/11/sys/boot/ficl/ stable/11/sys/boot/ficl.mk stable/11/sys/boot/ficl32/ stable/11/sys/boot/forth/ stable/11/sys/boot/geli/ stable/11/sys/boot/i386/ stable/11/sys/boot/kshim/ stable/11/sys/boot/libsa/ stable/11/sys/boot/libsa32/ stable/11/sys/boot/loader.mk stable/11/sys/boot/man/ stable/11/sys/boot/mips/ stable/11/sys/boot/ofw/ stable/11/sys/boot/pc98/ stable/11/sys/boot/powerpc/ stable/11/sys/boot/sparc64/ stable/11/sys/boot/uboot/ stable/11/sys/boot/uboot.mk stable/11/sys/boot/usb/ stable/11/sys/boot/userboot/ stable/11/sys/boot/zfs/ stable/11/sys/boot/zfs32/ Modified: stable/11/MAINTAINERS stable/11/Makefile.inc1 stable/11/README stable/11/lib/libefivar/Makefile stable/11/release/powerpc/generate-hfs.sh stable/11/release/tools/vmimage.subr stable/11/share/examples/bootforth/README stable/11/share/examples/etc/make.conf stable/11/share/man/man5/make.conf.5 stable/11/share/man/man7/hier.7 stable/11/share/man/man8/diskless.8 stable/11/stand/forth/pnp.4th stable/11/stand/forth/support.4th stable/11/stand/i386/Makefile.inc stable/11/stand/pc98/Makefile.inc stable/11/sys/Makefile stable/11/sys/contrib/dev/acpica/acpica_prep.sh stable/11/tools/boot/universe.sh stable/11/tools/tools/bootparttest/Makefile stable/11/tools/tools/zfsboottest/Makefile stable/11/usr.sbin/bhyveload/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/MAINTAINERS ============================================================================== --- stable/11/MAINTAINERS Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/MAINTAINERS Mon Feb 12 01:08:44 2018 (r329145) @@ -87,7 +87,7 @@ sh(1) jilles Pre-commit review requested. This also compiled in as builtins. share/mk imp, bapt, bdrewery, emaste, sjg Make is hard. share/mk/*.test.mk freebsd-testing,ngie (same list as share/mk too) Pre-commit review requested. -sys/boot/forth dteske Pre-commit review requested. +stand/forth dteske Pre-commit review requested. sys/compat/linuxkpi hselasky If in doubt, ask. sys/dev/e1000 erj Pre-commit phabricator review requested. sys/dev/ixgbe erj Pre-commit phabricator review requested. Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/Makefile.inc1 Mon Feb 12 01:08:44 2018 (r329145) @@ -252,6 +252,9 @@ SUBDIR+=secure .if !defined(NO_SHARE) SUBDIR+=share .endif +.if ${MK_BOOT} != "no" +SUBDIR+=stand +.endif SUBDIR+=sys usr.bin usr.sbin .if ${MK_TESTS} != "no" SUBDIR+= tests @@ -1903,7 +1906,7 @@ _clang_libs= lib/clang _gcc= gnu/usr.bin/cc .endif .if ${MK_USB} != "no" -_usb_tools= sys/boot/usb/tools +_usb_tools= stand/usb/tools .endif cross-tools: .MAKE .PHONY Modified: stable/11/README ============================================================================== --- stable/11/README Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/README Mon Feb 12 01:08:44 2018 (r329145) @@ -66,6 +66,8 @@ secure Cryptographic libraries and commands. share Shared resources. +stand Boot loader sources. + sys Kernel sources. tests Regression tests which can be run by Kyua. See tests/README Modified: stable/11/lib/libefivar/Makefile ============================================================================== --- stable/11/lib/libefivar/Makefile Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/lib/libefivar/Makefile Mon Feb 12 01:08:44 2018 (r329145) @@ -26,7 +26,7 @@ .include <src.opts.mk> -EFIBOOT=${SRCTOP}/sys/boot/efi +EFIBOOT=${SRCTOP}/stand/efi EDK2INC=${SRCTOP}/sys/contrib/edk2/Include .PATH: ${EFIBOOT}/libefi Modified: stable/11/release/powerpc/generate-hfs.sh ============================================================================== --- stable/11/release/powerpc/generate-hfs.sh Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/release/powerpc/generate-hfs.sh Mon Feb 12 01:08:44 2018 (r329145) @@ -32,7 +32,7 @@ cat > bootinfo.txt << EOF <CHRP-BOOT> <DESCRIPTION>FreeBSD/powerpc bootloader</DESCRIPTION> <OS-NAME>FreeBSD</OS-NAME> -<VERSION> $FreeBSD: head/sys/boot/powerpc/boot1.chrp/bootinfo.txt 184490 2008-10 +<VERSION> $FreeBSD: head/stand/powerpc/boot1.chrp/bootinfo.txt 184490 2008-10 -31 00:52:31Z nwhitehorn $ </VERSION> <COMPATIBLE> Modified: stable/11/release/tools/vmimage.subr ============================================================================== --- stable/11/release/tools/vmimage.subr Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/release/tools/vmimage.subr Mon Feb 12 01:08:44 2018 (r329145) @@ -17,9 +17,9 @@ write_partition_layout() { _OBJDIR="$(make -C ${WORLDDIR} -V .OBJDIR)" _OBJDIR="$(realpath ${_OBJDIR})" if [ -d "${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}" ]; then - BOOTFILES="/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/sys/boot" + BOOTFILES="/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/stand" else - BOOTFILES="/${_OBJDIR}/sys/boot" + BOOTFILES="/${_OBJDIR}/stand" fi case "${TARGET}:${TARGET_ARCH}" in Modified: stable/11/share/examples/bootforth/README ============================================================================== --- stable/11/share/examples/bootforth/README Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/share/examples/bootforth/README Mon Feb 12 01:08:44 2018 (r329145) @@ -1,6 +1,6 @@ Here you can find some simple examples how to use BootFORTH (part of the new bootloader) together with terminal emulation code (available when -compiling /sys/boot/i386/libi386 with -DTERM_EMU). +compiling /stand/i386/libi386 with -DTERM_EMU). Normally, you can place the files in /boot as they are here, and they will be automatically loaded by /boot/loader. You must choose between boot.4th or Modified: stable/11/share/examples/etc/make.conf ============================================================================== --- stable/11/share/examples/etc/make.conf Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/share/examples/etc/make.conf Mon Feb 12 01:08:44 2018 (r329145) @@ -171,7 +171,7 @@ #BOOT_COMCONSOLE_SPEED= 115200 # # By default the 'pxeboot' loader retrieves the kernel via NFS. Defining -# this and recompiling /usr/src/sys/boot will cause it to retrieve the kernel +# this and recompiling /usr/src/stand will cause it to retrieve the kernel # via TFTP. This allows pxeboot to load a custom BOOTP diskless kernel yet # still mount the server's '/' (i.e. rather than load the server's kernel). # Modified: stable/11/share/man/man5/make.conf.5 ============================================================================== --- stable/11/share/man/man5/make.conf.5 Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/share/man/man5/make.conf.5 Mon Feb 12 01:08:44 2018 (r329145) @@ -369,7 +369,7 @@ By default the .Xr pxeboot 8 loader retrieves the kernel via NFS. Defining this and recompiling -.Pa /usr/src/sys/boot +.Pa /usr/src/stand will cause it to retrieve the kernel via TFTP. This allows .Xr pxeboot 8 @@ -380,7 +380,7 @@ rather than load the server's kernel. .It Va LOADER_FIREWIRE_SUPPORT .Pq Vt bool Defining this and recompiling -.Pa /usr/src/sys/boot/i386 +.Pa /usr/src/stand/i386 will add .Xr dcons 4 console driver to Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/share/man/man7/hier.7 Mon Feb 12 01:08:44 2018 (r329145) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 15, 2018 +.Dd February 11, 2018 .Dt HIER 7 .Os .Sh NAME @@ -696,6 +696,8 @@ build directory for files in .It Pa share/ source for files in .Pa /usr/share +.It Pa stand/ +boot loader source code .It Pa sys/ kernel source code .Bl -tag -width "opencrypto/" -compact Modified: stable/11/share/man/man8/diskless.8 ============================================================================== --- stable/11/share/man/man8/diskless.8 Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/share/man/man8/diskless.8 Mon Feb 12 01:08:44 2018 (r329145) @@ -124,7 +124,7 @@ the .Nm machine, which may not be what you want to have happen. .Bd -literal -offset indent -cd /usr/src/sys/boot/i386 +cd /usr/src/stand/i386 make clean; make; make install cp /boot/pxeboot /tftpdir/ .Ed Copied: stable/11/stand/Makefile (from r329144, stable/11/sys/boot/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile) @@ -0,0 +1,20 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +SUBDIR+= libsa +.if ${MK_FORTH} != "no" +# Build the add-in FORTH interpreter. +SUBDIR+= ficl +SUBDIR+= forth +.endif + +SUBDIR+= man + +.include <bsd.arch.inc.mk> + +.if exists(${.CURDIR}/${MACHINE}/.) +SUBDIR+= ${MACHINE} +.endif + +.include <bsd.subdir.mk> Copied: stable/11/stand/Makefile.amd64 (from r329144, stable/11/sys/boot/Makefile.amd64) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.amd64 Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.amd64) @@ -0,0 +1,18 @@ +# $FreeBSD$ + +SUBDIR+= libsa32 +.if ${MK_ZFS} != "no" +SUBDIR+= zfs zfs32 +.endif +.if ${MK_FORTH} != "no" +SUBDIR+= ficl32 +.endif + +SUBDIR+= efi +SUBDIR+= userboot + +.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" +SUBDIR+= geli +.endif + +SUBDIR+= i386 Copied: stable/11/stand/Makefile.arm (from r329144, stable/11/sys/boot/Makefile.arm) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.arm Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.arm) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.if ${MK_FDT} != "no" +SUBDIR+= fdt +.endif +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif + +SUBDIR+= efi uboot Copied: stable/11/stand/Makefile.arm64 (from r329144, stable/11/sys/boot/Makefile.arm64) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.arm64 Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.arm64) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.if ${MK_FDT} != "no" +SUBDIR+= fdt +.endif +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif + +SUBDIR+= efi Copied: stable/11/stand/Makefile.i386 (from r329144, stable/11/sys/boot/Makefile.i386) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.i386 Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.i386) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" +SUBDIR+= geli +.endif +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif + +SUBDIR+= efi Copied: stable/11/stand/Makefile.inc (from r329144, stable/11/sys/boot/Makefile.inc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.inc Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.inc) @@ -0,0 +1,37 @@ +# $FreeBSD$ + +.include "defs.mk" + +.if !defined(__BOOT_MAKEFILE_INC__) +__BOOT_MAKEFILE_INC__=${MFILE} + +CFLAGS+=-I${SASRC} + +SSP_CFLAGS= + +.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 +.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 ${MK_LOADER_FORCE_LE} != "no" +.if ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -mlittle-endian +.endif +.endif + +.endif Copied: stable/11/stand/Makefile.mips (from r329144, stable/11/sys/boot/Makefile.mips) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.mips Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.mips) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +.if ${MK_FDT} != "no" +SUBDIR+= fdt +.endif + +SUBDIR+= uboot Copied: stable/11/stand/Makefile.pc98 (from r329144, stable/11/sys/boot/Makefile.pc98) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.pc98 Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.pc98) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +SUBDIR+= libstand32 Copied: stable/11/stand/Makefile.powerpc (from r329144, stable/11/sys/boot/Makefile.powerpc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.powerpc Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.powerpc) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.if ${MK_FDT} != "no" +SUBDIR+= fdt +.endif + +SUBDIR+= ofw +SUBDIR+= uboot Copied: stable/11/stand/Makefile.sparc64 (from r329144, stable/11/sys/boot/Makefile.sparc64) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.sparc64 Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.sparc64) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +SUBDIR+= ofw +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif Copied and modified: stable/11/stand/defs.mk (from r329144, stable/11/sys/boot/defs.mk) ============================================================================== --- stable/11/sys/boot/defs.mk Sun Feb 11 22:38:16 2018 (r329144, copy source) +++ stable/11/stand/defs.mk Mon Feb 12 01:08:44 2018 (r329145) @@ -5,7 +5,7 @@ .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} -BOOTSRC= ${SRCTOP}/sys/boot +BOOTSRC= ${SRCTOP}/stand EFISRC= ${BOOTSRC}/efi EFIINC= ${EFISRC}/include EFIINCMD= ${EFIINC}/${MACHINE} @@ -17,7 +17,7 @@ SYSDIR= ${SRCTOP}/sys UBOOTSRC= ${BOOTSRC}/uboot ZFSSRC= ${BOOTSRC}/zfs -BOOTOBJ= ${OBJTOP}/sys/boot +BOOTOBJ= ${OBJTOP}/stand # BINDIR is where we install BINDIR?= /boot Copied: stable/11/stand/fdt.mk (from r329144, stable/11/sys/boot/fdt.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/fdt.mk Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/fdt.mk) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.if ${MK_FDT} == "yes" +CFLAGS+= -I${FDTSRC} +CFLAGS+= -I${BOOTOBJ}/fdt +CFLAGS+= -I${SYSDIR}/contrib/libfdt +CFLAGS+= -DLOADER_FDT_SUPPORT +LIBFDT= ${BOOTOBJ}/fdt/libfdt.a +.endif Copied: stable/11/stand/fdt/Makefile (from r329144, stable/11/sys/boot/fdt/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/fdt/Makefile Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/fdt/Makefile) @@ -0,0 +1,28 @@ +# $FreeBSD$ + +.include <bsd.init.mk> + +.PATH: ${SYSDIR}/contrib/libfdt/ + +LIB= fdt +INTERNALLIB= + +# Vendor sources of libfdt. +SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c \ + fdt_empty_tree.c fdt_addresses.c fdt_overlay.c + +# Loader's fdt commands extension sources. +SRCS+= fdt_loader_cmd.c + +CFLAGS+= -I${SYSDIR}/contrib/libfdt/ -I${LDRSRC} + +CFLAGS+= -ffreestanding + +.if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" +CFLAGS+= -msoft-float +.endif + +CFLAGS+= -Wformat -Wall + +.include <bsd.stand.mk> +.include <bsd.lib.mk> Copied: stable/11/stand/fdt/Makefile.depend (from r329144, stable/11/sys/boot/fdt/Makefile.depend) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/fdt/Makefile.depend Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/fdt/Makefile.depend) @@ -0,0 +1,14 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + include \ + include/xlocale \ + lib/libstand \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Copied: stable/11/stand/fdt/fdt_loader_cmd.c (from r329144, stable/11/sys/boot/fdt/fdt_loader_cmd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/fdt/fdt_loader_cmd.c Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/fdt/fdt_loader_cmd.c) @@ -0,0 +1,1796 @@ +/*- + * Copyright (c) 2009-2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Semihalf under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <stand.h> +#include <libfdt.h> +#include <fdt.h> +#include <sys/param.h> +#include <sys/linker.h> +#include <machine/elf.h> + +#include "bootstrap.h" +#include "fdt_platform.h" + +#ifdef DEBUG +#define debugf(fmt, args...) do { printf("%s(): ", __func__); \ + printf(fmt,##args); } while (0) +#else +#define debugf(fmt, args...) +#endif + +#define FDT_CWD_LEN 256 +#define FDT_MAX_DEPTH 12 + +#define FDT_PROP_SEP " = " + +#define COPYOUT(s,d,l) archsw.arch_copyout(s, d, l) +#define COPYIN(s,d,l) archsw.arch_copyin(s, d, l) + +#define FDT_STATIC_DTB_SYMBOL "fdt_static_dtb" + +#define CMD_REQUIRES_BLOB 0x01 + +/* Location of FDT yet to be loaded. */ +/* This may be in read-only memory, so can't be manipulated directly. */ +static struct fdt_header *fdt_to_load = NULL; +/* Location of FDT on heap. */ +/* This is the copy we actually manipulate. */ +static struct fdt_header *fdtp = NULL; +/* Size of FDT blob */ +static size_t fdtp_size = 0; +/* Location of FDT in kernel or module. */ +/* This won't be set if FDT is loaded from disk or memory. */ +/* If it is set, we'll update it when fdt_copy() gets called. */ +static vm_offset_t fdtp_va = 0; + +static int fdt_load_dtb(vm_offset_t va); +static void fdt_print_overlay_load_error(int err, const char *filename); + +static int fdt_cmd_nyi(int argc, char *argv[]); +static int fdt_load_dtb_overlays_string(const char * filenames); + +static int fdt_cmd_addr(int argc, char *argv[]); +static int fdt_cmd_mkprop(int argc, char *argv[]); +static int fdt_cmd_cd(int argc, char *argv[]); +static int fdt_cmd_hdr(int argc, char *argv[]); +static int fdt_cmd_ls(int argc, char *argv[]); +static int fdt_cmd_prop(int argc, char *argv[]); +static int fdt_cmd_pwd(int argc, char *argv[]); +static int fdt_cmd_rm(int argc, char *argv[]); +static int fdt_cmd_mknode(int argc, char *argv[]); +static int fdt_cmd_mres(int argc, char *argv[]); + +typedef int cmdf_t(int, char *[]); + +struct cmdtab { + const char *name; + cmdf_t *handler; + int flags; +}; + +static const struct cmdtab commands[] = { + { "addr", &fdt_cmd_addr, 0 }, + { "alias", &fdt_cmd_nyi, 0 }, + { "cd", &fdt_cmd_cd, CMD_REQUIRES_BLOB }, + { "header", &fdt_cmd_hdr, CMD_REQUIRES_BLOB }, + { "ls", &fdt_cmd_ls, CMD_REQUIRES_BLOB }, + { "mknode", &fdt_cmd_mknode, CMD_REQUIRES_BLOB }, + { "mkprop", &fdt_cmd_mkprop, CMD_REQUIRES_BLOB }, + { "mres", &fdt_cmd_mres, CMD_REQUIRES_BLOB }, + { "prop", &fdt_cmd_prop, CMD_REQUIRES_BLOB }, + { "pwd", &fdt_cmd_pwd, CMD_REQUIRES_BLOB }, + { "rm", &fdt_cmd_rm, CMD_REQUIRES_BLOB }, + { NULL, NULL } +}; + +static char cwd[FDT_CWD_LEN] = "/"; + +static vm_offset_t +fdt_find_static_dtb() +{ + Elf_Ehdr *ehdr; + Elf_Shdr *shdr; + Elf_Sym sym; + vm_offset_t strtab, symtab, fdt_start; + uint64_t offs; + struct preloaded_file *kfp; + struct file_metadata *md; + char *strp; + int i, sym_count; + + debugf("fdt_find_static_dtb()\n"); + + sym_count = symtab = strtab = 0; + strp = NULL; + + offs = __elfN(relocation_offset); + + kfp = file_findfile(NULL, NULL); + if (kfp == NULL) + return (0); + + /* Locate the dynamic symbols and strtab. */ + md = file_findmetadata(kfp, MODINFOMD_ELFHDR); + if (md == NULL) + return (0); + ehdr = (Elf_Ehdr *)md->md_data; + + md = file_findmetadata(kfp, MODINFOMD_SHDR); + if (md == NULL) + return (0); + shdr = (Elf_Shdr *)md->md_data; + + for (i = 0; i < ehdr->e_shnum; ++i) { + if (shdr[i].sh_type == SHT_DYNSYM && symtab == 0) { + symtab = shdr[i].sh_addr + offs; + sym_count = shdr[i].sh_size / sizeof(Elf_Sym); + } else if (shdr[i].sh_type == SHT_STRTAB && strtab == 0) { + strtab = shdr[i].sh_addr + offs; + } + } + + /* + * The most efficient way to find a symbol would be to calculate a + * hash, find proper bucket and chain, and thus find a symbol. + * However, that would involve code duplication (e.g. for hash + * function). So we're using simpler and a bit slower way: we're + * iterating through symbols, searching for the one which name is + * 'equal' to 'fdt_static_dtb'. To speed up the process a little bit, + * we are eliminating symbols type of which is not STT_NOTYPE, or(and) + * those which binding attribute is not STB_GLOBAL. + */ + fdt_start = 0; + while (sym_count > 0 && fdt_start == 0) { + COPYOUT(symtab, &sym, sizeof(sym)); + symtab += sizeof(sym); + --sym_count; + if (ELF_ST_BIND(sym.st_info) != STB_GLOBAL || + ELF_ST_TYPE(sym.st_info) != STT_NOTYPE) + continue; + strp = strdupout(strtab + sym.st_name); + if (strcmp(strp, FDT_STATIC_DTB_SYMBOL) == 0) + fdt_start = (vm_offset_t)sym.st_value + offs; + free(strp); + } + return (fdt_start); +} + +static int +fdt_load_dtb(vm_offset_t va) +{ + struct fdt_header header; + int err; + + debugf("fdt_load_dtb(0x%08jx)\n", (uintmax_t)va); + + COPYOUT(va, &header, sizeof(header)); + err = fdt_check_header(&header); + if (err < 0) { + if (err == -FDT_ERR_BADVERSION) { + snprintf(command_errbuf, sizeof(command_errbuf), + "incompatible blob version: %d, should be: %d", + fdt_version(fdtp), FDT_LAST_SUPPORTED_VERSION); + } else { + snprintf(command_errbuf, sizeof(command_errbuf), + "error validating blob: %s", fdt_strerror(err)); + } + return (1); + } + + /* + * Release previous blob + */ + if (fdtp) + free(fdtp); + + fdtp_size = fdt_totalsize(&header); + fdtp = malloc(fdtp_size); + + if (fdtp == NULL) { + command_errmsg = "can't allocate memory for device tree copy"; + return (1); + } + + fdtp_va = va; + COPYOUT(va, fdtp, fdtp_size); + debugf("DTB blob found at 0x%jx, size: 0x%jx\n", (uintmax_t)va, (uintmax_t)fdtp_size); + + return (0); +} + +int +fdt_load_dtb_addr(struct fdt_header *header) +{ + int err; + + debugf("fdt_load_dtb_addr(%p)\n", header); + + fdtp_size = fdt_totalsize(header); + err = fdt_check_header(header); + if (err < 0) { + snprintf(command_errbuf, sizeof(command_errbuf), + "error validating blob: %s", fdt_strerror(err)); + return (err); + } + free(fdtp); + if ((fdtp = malloc(fdtp_size)) == NULL) { + command_errmsg = "can't allocate memory for device tree copy"; + return (1); + } + + fdtp_va = 0; // Don't write this back into module or kernel. + bcopy(header, fdtp, fdtp_size); + return (0); +} + +int +fdt_load_dtb_file(const char * filename) +{ + struct preloaded_file *bfp, *oldbfp; + int err; + + debugf("fdt_load_dtb_file(%s)\n", filename); + + oldbfp = file_findfile(NULL, "dtb"); + + /* Attempt to load and validate a new dtb from a file. */ + if ((bfp = file_loadraw(filename, "dtb", 1)) == NULL) { + snprintf(command_errbuf, sizeof(command_errbuf), + "failed to load file '%s'", filename); + return (1); + } + if ((err = fdt_load_dtb(bfp->f_addr)) != 0) { + file_discard(bfp); + return (err); + } + + /* A new dtb was validated, discard any previous file. */ + if (oldbfp) + file_discard(oldbfp); + return (0); +} + +static int +fdt_load_dtb_overlay(const char * filename) +{ + struct preloaded_file *bfp; + struct fdt_header header; + int err; + + debugf("fdt_load_dtb_overlay(%s)\n", filename); + + /* Attempt to load and validate a new dtb from a file. FDT_ERR_NOTFOUND + * is normally a libfdt error code, but libfdt would actually return + * -FDT_ERR_NOTFOUND. We re-purpose the error code here to convey a + * similar meaning: the file itself was not found, which can still be + * considered an error dealing with FDT pieces. + */ + if ((bfp = file_loadraw(filename, "dtbo", 1)) == NULL) + return (FDT_ERR_NOTFOUND); + + COPYOUT(bfp->f_addr, &header, sizeof(header)); + err = fdt_check_header(&header); + + if (err < 0) { + file_discard(bfp); + return (err); + } + + return (0); +} + +static void +fdt_print_overlay_load_error(int err, const char *filename) +{ + + switch (err) { + case FDT_ERR_NOTFOUND: + printf("%s: failed to load file\n", filename); + break; + case -FDT_ERR_BADVERSION: + printf("%s: incompatible blob version: %d, should be: %d\n", + filename, fdt_version(fdtp), + FDT_LAST_SUPPORTED_VERSION); + break; + default: + /* libfdt errs are negative */ + if (err < 0) + printf("%s: error validating blob: %s\n", + filename, fdt_strerror(err)); + else + printf("%s: unknown load error\n", filename); + break; + } +} + +static int +fdt_load_dtb_overlays_string(const char * filenames) +{ + char *names; + char *name, *name_ext; + char *comaptr; + int err, namesz; + + debugf("fdt_load_dtb_overlays_string(%s)\n", filenames); + + names = strdup(filenames); + if (names == NULL) + return (1); + name = names; + do { + comaptr = strchr(name, ','); + if (comaptr) + *comaptr = '\0'; + err = fdt_load_dtb_overlay(name); + if (err == FDT_ERR_NOTFOUND) { + /* Allocate enough to append ".dtbo" */ + namesz = strlen(name) + 6; + name_ext = malloc(namesz); + if (name_ext == NULL) { + fdt_print_overlay_load_error(err, name); + name = comaptr + 1; + continue; + } + snprintf(name_ext, namesz, "%s.dtbo", name); + err = fdt_load_dtb_overlay(name_ext); + free(name_ext); + } + /* Catch error with either initial load or fallback load */ + if (err != 0) + fdt_print_overlay_load_error(err, name); + name = comaptr + 1; + } while(comaptr); + + free(names); + return (0); +} + +void +fdt_apply_overlays() +{ + struct preloaded_file *fp; + size_t max_overlay_size, next_fdtp_size; + size_t current_fdtp_size; + void *current_fdtp; + void *next_fdtp; + void *overlay; + int rv; + + if ((fdtp == NULL) || (fdtp_size == 0)) + return; + + max_overlay_size = 0; + for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { + if (max_overlay_size < fp->f_size) + max_overlay_size = fp->f_size; + } + + /* Nothing to apply */ + if (max_overlay_size == 0) + return; + + overlay = malloc(max_overlay_size); + if (overlay == NULL) { + printf("failed to allocate memory for DTB blob with overlays\n"); + return; + } + current_fdtp = fdtp; + current_fdtp_size = fdtp_size; + for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { + printf("applying DTB overlay '%s'\n", fp->f_name); + next_fdtp_size = current_fdtp_size + fp->f_size; + next_fdtp = malloc(next_fdtp_size); + if (next_fdtp == NULL) { + /* + * Output warning, then move on to applying other + * overlays in case this one is simply too large. + */ + printf("failed to allocate memory for overlay base\n"); + continue; + } + rv = fdt_open_into(current_fdtp, next_fdtp, next_fdtp_size); + if (rv != 0) { + free(next_fdtp); + printf("failed to open base dtb into overlay base\n"); + continue; + } + COPYOUT(fp->f_addr, overlay, fp->f_size); + /* Both overlay and next_fdtp may be modified in place */ + rv = fdt_overlay_apply(next_fdtp, overlay); + if (rv == 0) { + /* Rotate next -> current */ + if (current_fdtp != fdtp) + free(current_fdtp); + current_fdtp = next_fdtp; + current_fdtp_size = next_fdtp_size; + } else { + /* + * Assume here that the base we tried to apply on is + * either trashed or in an inconsistent state. Trying to + * load it might work, but it's better to discard it and + * play it safe. */ + free(next_fdtp); + printf("failed to apply overlay: %s\n", + fdt_strerror(rv)); + } + } + /* We could have failed to apply all overlays; then we do nothing */ + if (current_fdtp != fdtp) { + free(fdtp); + fdtp = current_fdtp; + fdtp_size = current_fdtp_size; + } + free(overlay); +} + +int +fdt_setup_fdtp() +{ + struct preloaded_file *bfp; + vm_offset_t va; + + debugf("fdt_setup_fdtp()\n"); + + /* If we already loaded a file, use it. */ + if ((bfp = file_findfile(NULL, "dtb")) != NULL) { + if (fdt_load_dtb(bfp->f_addr) == 0) { + printf("Using DTB from loaded file '%s'.\n", + bfp->f_name); + return (0); + } + } + + /* If we were given the address of a valid blob in memory, use it. */ + if (fdt_to_load != NULL) { + if (fdt_load_dtb_addr(fdt_to_load) == 0) { + printf("Using DTB from memory address %p.\n", + fdt_to_load); + return (0); + } + } + + if (fdt_platform_load_dtb() == 0) + return (0); + + /* If there is a dtb compiled into the kernel, use it. */ + if ((va = fdt_find_static_dtb()) != 0) { + if (fdt_load_dtb(va) == 0) { + printf("Using DTB compiled into kernel.\n"); + return (0); + } + } + + command_errmsg = "No device tree blob found!\n"; + return (1); +} + +#define fdt_strtovect(str, cellbuf, lim, cellsize) _fdt_strtovect((str), \ + (cellbuf), (lim), (cellsize), 0); + +/* Force using base 16 */ +#define fdt_strtovectx(str, cellbuf, lim, cellsize) _fdt_strtovect((str), \ + (cellbuf), (lim), (cellsize), 16); + +static int +_fdt_strtovect(const char *str, void *cellbuf, int lim, unsigned char cellsize, + uint8_t base) +{ + const char *buf = str; + const char *end = str + strlen(str) - 2; + uint32_t *u32buf = NULL; + uint8_t *u8buf = NULL; + int cnt = 0; + + if (cellsize == sizeof(uint32_t)) + u32buf = (uint32_t *)cellbuf; + else + u8buf = (uint8_t *)cellbuf; + + if (lim == 0) + return (0); + + while (buf < end) { + + /* Skip white whitespace(s)/separators */ + while (!isxdigit(*buf) && buf < end) + buf++; + + if (u32buf != NULL) + u32buf[cnt] = + cpu_to_fdt32((uint32_t)strtol(buf, NULL, base)); + + else + u8buf[cnt] = (uint8_t)strtol(buf, NULL, base); + + if (cnt + 1 <= lim - 1) + cnt++; + else + break; + buf++; + /* Find another number */ + while ((isxdigit(*buf) || *buf == 'x') && buf < end) + buf++; + } + return (cnt); +} + +void +fdt_fixup_ethernet(const char *str, char *ethstr, int len) +{ + uint8_t tmp_addr[6]; + + /* Convert macaddr string into a vector of uints */ + fdt_strtovectx(str, &tmp_addr, 6, sizeof(uint8_t)); + /* Set actual property to a value from vect */ + fdt_setprop(fdtp, fdt_path_offset(fdtp, ethstr), + "local-mac-address", &tmp_addr, 6 * sizeof(uint8_t)); +} + +void +fdt_fixup_cpubusfreqs(unsigned long cpufreq, unsigned long busfreq) +{ + int lo, o = 0, o2, maxo = 0, depth; + const uint32_t zero = 0; + + /* We want to modify every subnode of /cpus */ + o = fdt_path_offset(fdtp, "/cpus"); + if (o < 0) + return; + + /* maxo should contain offset of node next to /cpus */ + depth = 0; + maxo = o; + while (depth != -1) + maxo = fdt_next_node(fdtp, maxo, &depth); + + /* Find CPU frequency properties */ + o = fdt_node_offset_by_prop_value(fdtp, o, "clock-frequency", + &zero, sizeof(uint32_t)); + + o2 = fdt_node_offset_by_prop_value(fdtp, o, "bus-frequency", &zero, + sizeof(uint32_t)); + + lo = MIN(o, o2); + + while (o != -FDT_ERR_NOTFOUND && o2 != -FDT_ERR_NOTFOUND) { + + o = fdt_node_offset_by_prop_value(fdtp, lo, + "clock-frequency", &zero, sizeof(uint32_t)); + + o2 = fdt_node_offset_by_prop_value(fdtp, lo, "bus-frequency", + &zero, sizeof(uint32_t)); + + /* We're only interested in /cpus subnode(s) */ + if (lo > maxo) + break; + + fdt_setprop_inplace_cell(fdtp, lo, "clock-frequency", + (uint32_t)cpufreq); + + fdt_setprop_inplace_cell(fdtp, lo, "bus-frequency", + (uint32_t)busfreq); + + lo = MIN(o, o2); + } +} + +#ifdef notyet +static int *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802120108.w1C18iU5072435>