git: 8c7293a0ea24 - stable/13 - stand: update mips uboot to uboot reorg

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 25 Jan 2023 15:23:04 UTC
The branch stable/13 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=8c7293a0ea2492344e17021550838600fbffdfc5

commit 8c7293a0ea2492344e17021550838600fbffdfc5
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-01-25 14:54:03 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-25 15:21:04 +0000

    stand: update mips uboot to uboot reorg
    
    uboot reorg in main happened after the mips support was removed. Go
    ahead and do the same reorg here. Move the mips files from mips/uboot to
    uboot/arch/mips. Move mips/uboot/Makefile to
    uboot/arch/mips/Makefile.inc and cut out the common lines. Split uboot
    target into uboot and uboot.bin to better fit into reorg.
    
    This is a direct commit to stable/13
---
 share/mk/src.opts.mk                               |  4 +-
 stand/mips/Makefile                                |  2 -
 stand/mips/uboot/Makefile                          | 64 ----------------------
 stand/mips/uboot/help.uboot                        | 27 ---------
 stand/mips/uboot/version                           | 10 ----
 stand/uboot/arch/mips/Makefile.inc                 | 26 +++++++++
 stand/{mips/uboot => uboot/arch/mips}/conf.c       |  0
 .../{mips/uboot => uboot/arch/mips}/ldscript.mips  |  0
 stand/{mips/uboot => uboot/arch/mips}/start.S      |  0
 9 files changed, 28 insertions(+), 105 deletions(-)

diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index fc98ce6c032b..962b58b82a25 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -320,8 +320,8 @@ BROKEN_OPTIONS+=LOADER_OFW
 .if ${__T} != "powerpc64" && ${__T} != "amd64"
 BROKEN_OPTIONS+=LOADER_KBOOT
 .endif
-# UBOOT is only for arm, and big-endian powerpc
-.if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
+# UBOOT is only for arm, mips, and big-endian powerpc
+.if (${__T:Marm*} == "" && ${__T:Mmips*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
 BROKEN_OPTIONS+=LOADER_UBOOT
 .endif
 # GELI and Lua in loader currently cause boot failures on powerpc.
diff --git a/stand/mips/Makefile b/stand/mips/Makefile
index 90341b2f7e50..e0c80f9ac031 100644
--- a/stand/mips/Makefile
+++ b/stand/mips/Makefile
@@ -2,8 +2,6 @@
 
 NO_OBJ=t
 
-SUBDIR= 	uboot
-
 #
 # The BERI boot loader port works only on 64-bit MIPS; not a hard port to
 # 32-bit if someone is interested.  Build on all 64-bit MIPS platforms to
diff --git a/stand/mips/uboot/Makefile b/stand/mips/uboot/Makefile
deleted file mode 100644
index 984582027de5..000000000000
--- a/stand/mips/uboot/Makefile
+++ /dev/null
@@ -1,64 +0,0 @@
-# $FreeBSD$
-
-LOADER_CD9660_SUPPORT?=	no
-LOADER_EXT2FS_SUPPORT?=	no
-LOADER_MSDOS_SUPPORT?=	yes
-LOADER_UFS_SUPPORT?=	yes
-LOADER_NET_SUPPORT?=	yes
-LOADER_NFS_SUPPORT?=	yes
-LOADER_TFTP_SUPPORT?=	no
-LOADER_GZIP_SUPPORT?=	no
-LOADER_BZIP2_SUPPORT?=	no
-
-.include <bsd.init.mk>
-
-FILES+=		ubldr
-
-NEWVERSWHAT=	"U-Boot loader" ${MACHINE_ARCH}
-INSTALLFLAGS=	-b
-WARNS?=		1
-# Address at which ubldr will be loaded.
-# This varies for different boards and SOCs.
-.if ${MACHINE_ARCH:Mmips64*}
-UBLDR_LOADADDR?=	0xffffffff80800000
-.else
-UBLDR_LOADADDR?=	0x80800000
-.endif
-
-# Architecture-specific loader code
-SRCS=		start.S conf.c vers.c
-
-HELP_FILES=	${.CURDIR}/help.uboot ${BOOTSRC}/fdt/help.fdt
-
-# Always add MI sources
-.include	"${BOOTSRC}/loader.mk"
-
-CFLAGS+=	-g
-
-LDFLAGS=	-nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
-
-.include	"${BOOTSRC}/uboot.mk"
-
-DPADD=		${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
-LDADD=		${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
-
-OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
-
-# ubldr on MIPS is built with '-mno-abicalls' flag,
-# which is incompatible with PIE
-MK_PIE=		no
-
-ldscript.abs:
-	echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET}
-
-ldscript.pie:
-	echo "UBLDR_LOADADDR = 0;" >${.TARGET}
-
-ubldr: ${OBJS} ldscript.abs ${.CURDIR}/ldscript.${MACHINE_CPUARCH} ${DPADD}
-	${CC} ${CFLAGS} -T ldscript.abs ${LDFLAGS} \
-	    -o ${.TARGET} ${OBJS} ${LDADD}
-	${OBJCOPY} -S -O binary ubldr ubldr.bin
-
-CLEANFILES+=	ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin
-
-.include <bsd.prog.mk>
diff --git a/stand/mips/uboot/help.uboot b/stand/mips/uboot/help.uboot
deleted file mode 100644
index c1574af92715..000000000000
--- a/stand/mips/uboot/help.uboot
+++ /dev/null
@@ -1,27 +0,0 @@
-$FreeBSD$
-
-###############################################################################
-# Tubenv DShow or import U-Boot environment variables
-
-	ubenv <import | show> [varname ...]
-
-	Display U-Boot environment variables, or import them into the
-	loader environment (which makes them available in the kernel).
-
-###############################################################################
-# Tubenv Simport DImport U-Boot env vars
-
-	ubenv import [varname ...]
-
-	If no variable names are specified, all U-Boot environment
-	variables are imported.  Each variable is prefixed with "uboot."
-	to avoid any possible conflicts with loader or kernel variables.
-
-###############################################################################
-# Tubenv Sshow DShow U-Boot env vars
-
-	ubenv show [varname ...]
-
-	If no variable names are specified, all U-Boot environment
-	variables are shown.
-
diff --git a/stand/mips/uboot/version b/stand/mips/uboot/version
deleted file mode 100644
index ec46b388b281..000000000000
--- a/stand/mips/uboot/version
+++ /dev/null
@@ -1,10 +0,0 @@
-$FreeBSD$
-
-NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
-file is important.  Make sure the current version number is on line 6.
-
-1.3:	Remove NAND FS support.
-1.2:	Extended with NAND FS support.
-1.1:	Flattened Device Tree blob support.
-1.0:	Added storage support. Booting from HDD, USB, etc. is now possible.
-0.5:	Initial U-Boot/arm version (netbooting only).
diff --git a/stand/uboot/arch/mips/Makefile.inc b/stand/uboot/arch/mips/Makefile.inc
new file mode 100644
index 000000000000..676b3c88d191
--- /dev/null
+++ b/stand/uboot/arch/mips/Makefile.inc
@@ -0,0 +1,26 @@
+# Address at which ubldr will be loaded.
+# This varies for different boards and SOCs.
+.if ${MACHINE_ARCH:Mmips64*}
+UBLDR_LOADADDR?=	0xffffffff80800000
+.else
+UBLDR_LOADADDR?=	0x80800000
+.endif
+
+# Architecture-specific loader code
+SRCS+=		start.S conf.c
+
+# ubldr on MIPS is built with '-mno-abicalls' flag,
+# which is incompatible with PIE
+MK_PIE=		no
+
+ldscript.abs:
+	echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET}
+
+ubldr: ${OBJS} ldscript.abs ${LDSCRIPT} ${DPADD}
+	${CC} ${CFLAGS} -T ldscript.abs ${LDFLAGS} \
+	    -o ${.TARGET} ${OBJS} ${LDADD}
+
+ubldr.bin: ubldr
+	${OBJCOPY} -S -O binary ubldr ubldr.bin
+
+CLEANFILES+=	ldscript.abs ubldr ubldr.pie ubldr.bin
diff --git a/stand/mips/uboot/conf.c b/stand/uboot/arch/mips/conf.c
similarity index 100%
rename from stand/mips/uboot/conf.c
rename to stand/uboot/arch/mips/conf.c
diff --git a/stand/mips/uboot/ldscript.mips b/stand/uboot/arch/mips/ldscript.mips
similarity index 100%
rename from stand/mips/uboot/ldscript.mips
rename to stand/uboot/arch/mips/ldscript.mips
diff --git a/stand/mips/uboot/start.S b/stand/uboot/arch/mips/start.S
similarity index 100%
rename from stand/mips/uboot/start.S
rename to stand/uboot/arch/mips/start.S