pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Add SCP, u-boot and ATF for crust firmware.



Module Name:	pkgsrc-wip
Committed By:	Maya Rashish <coypu%sdf.org@localhost>
Pushed By:	coypu
Date:		Mon Jul 15 21:04:42 2019 +0300
Changeset:	293120e57394e1f745fde36dd13f06a78a7fcd8f

Added Files:
	arm-trusted-firmware-sun50i_a64-crust/DESCR
	arm-trusted-firmware-sun50i_a64-crust/Makefile
	arm-trusted-firmware-sun50i_a64-crust/PLIST
	arm-trusted-firmware-sun50i_a64-crust/buildlink3.mk
	arm-trusted-firmware-sun50i_a64-crust/distinfo
	crust-firmware/DESCR
	crust-firmware/Makefile
	crust-firmware/PLIST
	crust-firmware/buildlink3.mk
	crust-firmware/distinfo
	crust-firmware/patches/patch-Makefile
	u-boot-pinebook-crust/DESCR
	u-boot-pinebook-crust/MESSAGE
	u-boot-pinebook-crust/Makefile
	u-boot-pinebook-crust/PLIST
	u-boot-pinebook-crust/distinfo
	u-boot-pinebook-crust/files/installboot.plist
	u-boot-pinebook-crust/patches/patch-arch_arm_cpu_armv8_Kconfig
	u-boot-pinebook-crust/patches/patch-board_sunxi_mksunxi__fit__atf.sh
	u-boot-pinebook-crust/patches/patch-common_spl_spl__fit.c
	u-boot-pinebook-crust/patches/patch-include_configs_sunxi-common.h
	u-boot-pinebook-crust/patches/patch-include_spl.h
	u-boot-pinebook-crust/patches/patch-lib_bch.c

Log Message:
Add SCP, u-boot and ATF for crust firmware.

This is an open source firmware running on the or1k coprocessor of
Allwinner boards.

The patches to u-boot originate from:
https://github.com/crust-firmware/u-boot/

Applied to anarsoul's fork of u-boot for pinebook.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=293120e57394e1f745fde36dd13f06a78a7fcd8f

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 arm-trusted-firmware-sun50i_a64-crust/DESCR        |  22 ++++
 arm-trusted-firmware-sun50i_a64-crust/Makefile     |  47 +++++++++
 arm-trusted-firmware-sun50i_a64-crust/PLIST        |   2 +
 .../buildlink3.mk                                  |  15 +++
 arm-trusted-firmware-sun50i_a64-crust/distinfo     |   6 ++
 crust-firmware/DESCR                               |  19 ++++
 crust-firmware/Makefile                            |  40 +++++++
 crust-firmware/PLIST                               |   2 +
 crust-firmware/buildlink3.mk                       |  14 +++
 crust-firmware/distinfo                            |   7 ++
 crust-firmware/patches/patch-Makefile              |  13 +++
 u-boot-pinebook-crust/DESCR                        |   5 +
 u-boot-pinebook-crust/MESSAGE                      |   1 +
 u-boot-pinebook-crust/Makefile                     |  33 ++++++
 u-boot-pinebook-crust/PLIST                        |   3 +
 u-boot-pinebook-crust/distinfo                     |  12 +++
 u-boot-pinebook-crust/files/installboot.plist      |  47 +++++++++
 .../patches/patch-arch_arm_cpu_armv8_Kconfig       |  15 +++
 .../patches/patch-board_sunxi_mksunxi__fit__atf.sh | 116 +++++++++++++++++++++
 .../patches/patch-common_spl_spl__fit.c            |  53 ++++++++++
 .../patches/patch-include_configs_sunxi-common.h   |  12 +++
 u-boot-pinebook-crust/patches/patch-include_spl.h  |  18 ++++
 u-boot-pinebook-crust/patches/patch-lib_bch.c      |  26 +++++
 23 files changed, 528 insertions(+)

diffs:
diff --git a/arm-trusted-firmware-sun50i_a64-crust/DESCR b/arm-trusted-firmware-sun50i_a64-crust/DESCR
new file mode 100644
index 0000000000..40691ce830
--- /dev/null
+++ b/arm-trusted-firmware-sun50i_a64-crust/DESCR
@@ -0,0 +1,22 @@
+ARM Trusted Firmware (ATF) provides a reference implementation of secure
+world software for ARMv8-A, including a Secure Monitor executing at
+Exception Level 3 (EL3). It implements various ARM interface standards,
+such as:
+
+    The Power State Coordination Interface (PSCI)
+    Trusted Board Boot Requirements (TBBR, ARM DEN0006C-1)
+    SMC Calling Convention
+    System Control and Management Interface
+
+As far as possible the code is designed for reuse or porting to other
+ARMv8-A model and hardware platforms.
+
+ARM will continue development in collaboration with interested parties to
+provide a full reference implementation of Secure Monitor code and ARM
+standards to the benefit of all developers working with ARMv8-A TrustZone
+technology.
+
+This package provides mainline ATF for the sun50i_a64 platform,
+for example used by u-boot for the Pinebook.
+
+This is a variant patched to support the crust SCP firmware.
diff --git a/arm-trusted-firmware-sun50i_a64-crust/Makefile b/arm-trusted-firmware-sun50i_a64-crust/Makefile
new file mode 100644
index 0000000000..b54197136d
--- /dev/null
+++ b/arm-trusted-firmware-sun50i_a64-crust/Makefile
@@ -0,0 +1,47 @@
+# $NetBSD: Makefile,v 1.3 2019/02/27 06:23:39 martin Exp $
+
+VERSION=	2.0.20181021	# v2.0 is too old
+GITHUB_PROJECT=	arm-trusted-firmware
+# GITHUB_TAG=	v${VERSION}	# only for real releases
+GITHUB_TAG=	5d8d246fcbd5fb110311224337199442e48cdb43
+
+DISTNAME=	${GITHUB_PROJECT}-${VERSION}
+PLATFORM=	sun50i_a64
+PKGNAME=	${GITHUB_PROJECT}-${PLATFORM}-crust-${VERSION}
+CATEGORIES=	sysutils
+MASTER_SITES=	${MASTER_SITE_GITHUB:=crust-firmware/}
+EXTRACT_SUFX=	.zip
+
+MAINTAINER=	port-arm%NetBSD.org@localhost
+HOMEPAGE=	https://github.com/crust-firmware/arm-trusted-firmware/
+COMMENT=	ARM Trusted Firmware, patched for crust SCP firmware
+LICENSE=	modified-bsd
+
+USE_TOOLS+=	gmake
+
+# We are too space-constrained. -O2 builds will fail, and CFLAGS is -O2 by default.
+CFLAGS=		-Os
+
+MAKE_FLAGS+=	CROSS_COMPILE=${PREFIX}/cross-aarch64-none-elf/bin/aarch64-none-elf-
+MAKE_FLAGS+=	PLAT=${PLATFORM}
+MAKE_FLAGS+=	DEBUG=0
+MAKE_FLAGS+=	V=1
+MAKE_FLAGS+=	BUILD_STRING=${GITHUB_TAG}
+BUILD_TARGET=	bl31
+
+SSP_SUPPORTED=		no
+FORTIFY_SUPPORTED=	no
+
+BUILD_DEPENDS+=	cross-aarch64-none-elf-gcc-[0-9]*:../../cross/aarch64-none-elf-gcc
+
+do-install:
+	${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/arm-trusted-firmware/${PLATFORM}
+	${INSTALL_DATA} ${WRKSRC}/build/${PLATFORM}/release/bl31.bin \
+	    ${DESTDIR}${PREFIX}/share/arm-trusted-firmware/${PLATFORM}/
+
+
+# XXX kludge. pkgsrc passes down run path flags in LDFLAGS assuming
+# gcc is used for linking, but here we call the linker directly.
+COMPILER_RPATH_FLAG=-R
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/arm-trusted-firmware-sun50i_a64-crust/PLIST b/arm-trusted-firmware-sun50i_a64-crust/PLIST
new file mode 100644
index 0000000000..54cf1882c8
--- /dev/null
+++ b/arm-trusted-firmware-sun50i_a64-crust/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.2 2019/02/23 06:24:37 martin Exp $
+share/arm-trusted-firmware/sun50i_a64/bl31.bin
diff --git a/arm-trusted-firmware-sun50i_a64-crust/buildlink3.mk b/arm-trusted-firmware-sun50i_a64-crust/buildlink3.mk
new file mode 100644
index 0000000000..b37db5adc4
--- /dev/null
+++ b/arm-trusted-firmware-sun50i_a64-crust/buildlink3.mk
@@ -0,0 +1,15 @@
+# $NetBSD: buildlink3.mk,v 1.3 2019/02/27 06:23:39 martin Exp $
+
+BUILDLINK_DEPMETHOD.arm-trusted-firmware-sun50i_a64-crust?=	build
+
+BUILDLINK_TREE+=	arm-trusted-firmware-sun50i_a64-crust
+
+.if !defined(ARM_TRUSTED_FIRMWARE_SUN50I_A64_CRUST_BUILDLINK3_MK)
+ARM_TRUSTED_FIRMWARE_SUN50I_A64_CRUST_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.arm-trusted-firmware-sun50i_a64-crust+=	arm-trusted-firmware-sun50i_a64-crust>2.0
+BUILDLINK_PKGSRCDIR.arm-trusted-firmware-sun50i_a64-crust?=	../../sysutils/arm-trusted-firmware-sun50i_a64-crust
+.endif	# ARM_TRUSTED_FIRMWARE_SUN50I_A64_CRUST_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-arm-trusted-firmware-sun50i_a64-crust
+
diff --git a/arm-trusted-firmware-sun50i_a64-crust/distinfo b/arm-trusted-firmware-sun50i_a64-crust/distinfo
new file mode 100644
index 0000000000..2a04d1400c
--- /dev/null
+++ b/arm-trusted-firmware-sun50i_a64-crust/distinfo
@@ -0,0 +1,6 @@
+$NetBSD: distinfo,v 1.2 2019/02/27 06:23:39 martin Exp $
+
+SHA1 (arm-trusted-firmware-2.0.20181021-5d8d246fcbd5fb110311224337199442e48cdb43.zip) = 6bf4b20810613d1ae0e4715c9746a0094f3716bb
+RMD160 (arm-trusted-firmware-2.0.20181021-5d8d246fcbd5fb110311224337199442e48cdb43.zip) = e435b7fcc58102067b877bc1903d2c5424ae8a2d
+SHA512 (arm-trusted-firmware-2.0.20181021-5d8d246fcbd5fb110311224337199442e48cdb43.zip) = 7b88fe07dd98750ab8ac37235096db3f35400d47d88b3e488ad355ef341a6f14d1310d724373d490ad7feb71b27a838ab104906e00ee227798c18bcda29bd609
+Size (arm-trusted-firmware-2.0.20181021-5d8d246fcbd5fb110311224337199442e48cdb43.zip) = 4948429 bytes
diff --git a/crust-firmware/DESCR b/crust-firmware/DESCR
new file mode 100644
index 0000000000..126fe69249
--- /dev/null
+++ b/crust-firmware/DESCR
@@ -0,0 +1,19 @@
+ARM Trusted Firmware (ATF) provides a reference implementation of secure
+world software for ARMv8-A, including a Secure Monitor executing at
+Exception Level 3 (EL3). It implements various ARM interface standards,
+such as:
+
+    The Power State Coordination Interface (PSCI)
+    Trusted Board Boot Requirements (TBBR, ARM DEN0006C-1)
+    SMC Calling Convention
+    System Control and Management Interface
+
+As far as possible the code is designed for reuse or porting to other
+ARMv8-A model and hardware platforms.
+
+ARM will continue development in collaboration with interested parties to
+provide a full reference implementation of Secure Monitor code and ARM
+standards to the benefit of all developers working with ARMv8-A TrustZone
+technology.
+
+This package provides ATF for Allwinner H6 family SoCs.
diff --git a/crust-firmware/Makefile b/crust-firmware/Makefile
new file mode 100644
index 0000000000..4a63260508
--- /dev/null
+++ b/crust-firmware/Makefile
@@ -0,0 +1,40 @@
+# $NetBSD: Makefile,v 1.2 2018/09/29 16:26:53 tnn Exp $
+
+VERSION=	20190427
+GITHUB_TAG=	0d214325cf80fe54339e421a1a9f139fbb7fcd86
+GITHUB_PROJECT=	crust
+
+PKGNAME=	crust-firmware-${VERSION}
+DISTNAME=	${PKGNAME}
+MASTER_SITES=	${MASTER_SITE_GITHUB:=crust-firmware/}
+CATEGORIES=	sysutils
+EXTRACT_SUFX=	.zip
+
+MAINTAINER=	port-arm%NetBSD.org@localhost
+HOMEPAGE=	https://github.com/crust-firmware/crust/
+COMMENT=	SCP firmware for sunxi SoCs
+LICENSE=	modified-bsd
+
+USE_TOOLS+=	gmake yacc flex
+
+BUILD_DEPENDS+=	cross-or1k-none-elf-gcc-[0-9]*:../../cross/or1k-none-elf-gcc
+
+MAKE_FLAGS+=	CROSS_COMPILE=${PREFIX}/cross-or1k-none-elf/bin/or1k-none-elf-
+
+do-configure:
+	cd ${WRKSRC} && ${GMAKE} defconfig
+
+	
+do-install:
+	${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/crust-firmware/
+	${INSTALL_DATA} ${WRKSRC}/build/scp/scp.bin \
+	    ${DESTDIR}${PREFIX}/share/crust-firmware/
+
+
+.include "../../mk/bsd.prefs.mk"
+# XXX kludge. pkgsrc passes down run path flags in LDFLAGS but the
+# cross ld(1) doesn't understand -R. If we pass down -L instead it
+# will be safely ignored.
+COMPILER_RPATH_FLAG=-L
+	
+.include "../../mk/bsd.pkg.mk"
diff --git a/crust-firmware/PLIST b/crust-firmware/PLIST
new file mode 100644
index 0000000000..42882cec5f
--- /dev/null
+++ b/crust-firmware/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD$
+share/crust-firmware/scp.bin
diff --git a/crust-firmware/buildlink3.mk b/crust-firmware/buildlink3.mk
new file mode 100644
index 0000000000..e572c7ed19
--- /dev/null
+++ b/crust-firmware/buildlink3.mk
@@ -0,0 +1,14 @@
+# $NetBSD: buildlink3.mk,v 1.1 2018/05/26 17:51:33 jmcneill Exp $
+
+BUILDLINK_DEPMETHOD.arm-trusted-firmware-sun50i-h6?=	build
+
+BUILDLINK_TREE+=	arm-trusted-firmware-sun50i-h6
+
+.if !defined(ARM_TRUSTED_FIRMWARE_SUN50I_H6_BUILDLINK3_MK)
+ARM_TRUSTED_FIRMWARE_SUN50I_H6_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.arm-trusted-firmware-sun50i-h6+=	arm-trusted-firmware-sun50i-h6>=20180207
+BUILDLINK_PKGSRCDIR.arm-trusted-firmware-sun50i-h6?=	../../sysutils/arm-trusted-firmware-sun50i-h6
+.endif	# ARM_TRUSTED_FIRMWARE_SUN50I_H6_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-arm-trusted-firmware-sun50i-h6
diff --git a/crust-firmware/distinfo b/crust-firmware/distinfo
new file mode 100644
index 0000000000..61f2fcbdeb
--- /dev/null
+++ b/crust-firmware/distinfo
@@ -0,0 +1,7 @@
+$NetBSD: distinfo,v 1.1 2018/05/26 17:51:33 jmcneill Exp $
+
+SHA1 (crust-firmware-20190427-0d214325cf80fe54339e421a1a9f139fbb7fcd86.zip) = 40ecf64105406d411a44cbc52297b66a50460558
+RMD160 (crust-firmware-20190427-0d214325cf80fe54339e421a1a9f139fbb7fcd86.zip) = bfeb9d8cae185b3ec8e29c1a8a8bbccc3e083616
+SHA512 (crust-firmware-20190427-0d214325cf80fe54339e421a1a9f139fbb7fcd86.zip) = 2fb9b26f4c7adf8d18e1f73adde92a3db7c395db85d8c583afb33df3621372827e09b53b46c4ca2e2cb27ab3919e71559b37e5c0bb587bdef2e48631667a2630
+Size (crust-firmware-20190427-0d214325cf80fe54339e421a1a9f139fbb7fcd86.zip) = 254376 bytes
+SHA1 (patch-Makefile) = 0ec66661567e70337bf4b3fc9b1b69aae0324856
diff --git a/crust-firmware/patches/patch-Makefile b/crust-firmware/patches/patch-Makefile
new file mode 100644
index 0000000000..a114f88ff9
--- /dev/null
+++ b/crust-firmware/patches/patch-Makefile
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- Makefile.orig	2019-04-27 18:12:40.000000000 +0000
++++ Makefile
+@@ -16,7 +16,7 @@ OBJCOPY		 = $(CROSS_COMPILE)objcopy
+ HOSTAR		 = ar
+ HOSTCC		 = cc
+ 
+-LEX		 = lex
++LEX		 = flex
+ YACC		 = yacc
+ 
+ HAVE_GCC9	:= $(findstring version 9,$(shell $(CC) -v 2>&1;:))
diff --git a/u-boot-pinebook-crust/DESCR b/u-boot-pinebook-crust/DESCR
new file mode 100644
index 0000000000..dbf032fc26
--- /dev/null
+++ b/u-boot-pinebook-crust/DESCR
@@ -0,0 +1,5 @@
+U-Boot is a bootloader for embedded boards based on PowerPC, ARM, MIPS and
+several other processors, which can be installed in a boot ROM and used to
+initialize and test the hardware or to download and run application code.
+
+This package provides U-Boot for the Pine64 Pinebook.
diff --git a/u-boot-pinebook-crust/MESSAGE b/u-boot-pinebook-crust/MESSAGE
new file mode 100644
index 0000000000..7d14580d9a
--- /dev/null
+++ b/u-boot-pinebook-crust/MESSAGE
@@ -0,0 +1 @@
+WARNING! this package does not work yet! do not use.
diff --git a/u-boot-pinebook-crust/Makefile b/u-boot-pinebook-crust/Makefile
new file mode 100644
index 0000000000..b82077208d
--- /dev/null
+++ b/u-boot-pinebook-crust/Makefile
@@ -0,0 +1,33 @@
+# $NetBSD: Makefile,v 1.13 2019/05/07 14:06:25 thorpej Exp $
+
+UBOOT_VERSION=		2018.11rc3
+UBOOT_TARGET=		pinebook
+UBOOT_CONFIG=		pinebook_defconfig
+UBOOT_BIN=		u-boot-sunxi-with-spl.bin
+
+UBOOT_INSTALLBOOT_PLIST=installboot.plist
+
+# Use anarsoul's fork of mainline U-Boot with Pinebook support patched in
+MASTER_SITES=		${MASTER_SITE_GITHUB:=anarsoul/}
+GITHUB_PROJECT=		u-boot-pine64
+GITHUB_TAG=		88eea875b3b82a0e50cbb112e0aea2259dc2e011
+DISTNAME=		u-boot-${UBOOT_TARGET}-${UBOOT_VERSION}
+EXTRACT_SUFX=		.tar.gz
+PKGREVISION=		3
+
+DISTINFO_FILE=		${.CURDIR}/../../sysutils/u-boot-pinebook/distinfo
+PATCHDIR=		${.CURDIR}/../../sysutils/u-boot-pinebook/patches
+
+BUILD_DEPENDS+=		crust-firmware-[0-9]*:../../sysutils/crust-firmware
+
+post-extract:
+	${CP} ${PREFIX}/share/arm-trusted-firmware/sun50i_a64/bl31.bin ${WRKSRC}
+	${CP} ${PREFIX}/share/crust-firmware/scp.bin ${WRKSRC}
+
+post-build:
+	${CAT} ${WRKSRC}/spl/sunxi-spl.bin ${WRKSRC}/u-boot.itb > ${WRKSRC}/u-boot-sunxi-with-spl.bin
+
+.include "../../sysutils/arm-trusted-firmware-sun50i_a64-crust/buildlink3.mk"
+.include "../../sysutils/u-boot/u-boot-arm64.mk"
+
+CHECK_PORTABILITY_SKIP+=tools/imx_cntr_image.sh
diff --git a/u-boot-pinebook-crust/PLIST b/u-boot-pinebook-crust/PLIST
new file mode 100644
index 0000000000..ef831a7198
--- /dev/null
+++ b/u-boot-pinebook-crust/PLIST
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.2 2019/05/07 14:06:25 thorpej Exp $
+share/u-boot/pinebook/installboot.plist
+share/u-boot/pinebook/u-boot-sunxi-with-spl.bin
diff --git a/u-boot-pinebook-crust/distinfo b/u-boot-pinebook-crust/distinfo
new file mode 100644
index 0000000000..70747d7df3
--- /dev/null
+++ b/u-boot-pinebook-crust/distinfo
@@ -0,0 +1,12 @@
+$NetBSD: distinfo,v 1.6 2018/11/08 19:41:30 jakllsch Exp $
+
+SHA1 (u-boot-pinebook-2018.11rc3-88eea875b3b82a0e50cbb112e0aea2259dc2e011.tar.gz) = 01c5758bc57eb98917931026d018109a36aa300c
+RMD160 (u-boot-pinebook-2018.11rc3-88eea875b3b82a0e50cbb112e0aea2259dc2e011.tar.gz) = e863c04c13bdf7fdaa5353a094fa47ef257991ac
+SHA512 (u-boot-pinebook-2018.11rc3-88eea875b3b82a0e50cbb112e0aea2259dc2e011.tar.gz) = 8eae2de988815a7ad12917997defab3d6011d87db011dd9c68852053f40802857b1d49321e81a095423e3f7d357aa485d53e25c77d602e7ee291c5dc29c81a29
+Size (u-boot-pinebook-2018.11rc3-88eea875b3b82a0e50cbb112e0aea2259dc2e011.tar.gz) = 16611473 bytes
+SHA1 (patch-arch_arm_cpu_armv8_Kconfig) = 82dee7f627ba721ba3548b49569ee2491764d86a
+SHA1 (patch-board_sunxi_mksunxi__fit__atf.sh) = d0e4cdefa3cac9c31fd0eeb3f4a86a95f391de4b
+SHA1 (patch-common_spl_spl__fit.c) = 95579abd7b4196e754ff32e0c51a216575859920
+SHA1 (patch-include_configs_sunxi-common.h) = edd57b5cd9820e23e287b124809da3d42a8a82fb
+SHA1 (patch-include_spl.h) = 0ae94ed7ae69cf3b2149ffdc84572443af8299ed
+SHA1 (patch-lib_bch.c) = 00a80689266d3ab8d2af862327e7c852220a0713
diff --git a/u-boot-pinebook-crust/files/installboot.plist b/u-boot-pinebook-crust/files/installboot.plist
new file mode 100644
index 0000000000..0a920ec4b7
--- /dev/null
+++ b/u-boot-pinebook-crust/files/installboot.plist
@@ -0,0 +1,47 @@
+<!-- $NetBSD: installboot.plist,v 1.1 2019/05/08 05:02:39 thorpej Exp $ -->
+<!--
+  Copyright (c) 2019 The NetBSD Foundation, Inc.
+  All rights reserved.
+ 
+  This code is derived from software contributed to The NetBSD Foundation
+  by Jason R. Thorpe.
+ 
+  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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+-->
+<plist>
+<dict>
+	<key>pine64,pinebook</key>
+	<dict>
+		<key>description</key>
+		<string>Pinebook</string>
+		<key>u-boot-install</key>
+		<array>
+			<dict>
+				<key>file-name</key>
+				<string>u-boot-sunxi-with-spl.bin</string>
+				<key>image-offset</key>
+				<integer>8192</integer>
+			</dict>
+		</array>
+	</dict>
+</dict>
+</plist>
diff --git a/u-boot-pinebook-crust/patches/patch-arch_arm_cpu_armv8_Kconfig b/u-boot-pinebook-crust/patches/patch-arch_arm_cpu_armv8_Kconfig
new file mode 100644
index 0000000000..98ae7ac9ca
--- /dev/null
+++ b/u-boot-pinebook-crust/patches/patch-arch_arm_cpu_armv8_Kconfig
@@ -0,0 +1,15 @@
+$NetBSD: patch-arch_arm_cpu_armv8_Kconfig,v 1.2 2018/02/18 12:27:20 jmcneill Exp $
+
+--- arch/arm/cpu/armv8/Kconfig.orig	2018-01-23 06:50:34.000000000 +0000
++++ arch/arm/cpu/armv8/Kconfig
+@@ -132,6 +132,10 @@ config ARMV8_PSCI_CPUS_PER_CLUSTER
+ 	  A value 0 or no definition of it works for single cluster system.
+ 	  System with multi-cluster should difine their own exact value.
+ 
++config ARMV8_SWITCH_TO_EL1
++	bool "Switch to EL1 before booting kernel"
++	default n
++
+ if SYS_HAS_ARMV8_SECURE_BASE
+ 
+ config ARMV8_SECURE_BASE
diff --git a/u-boot-pinebook-crust/patches/patch-board_sunxi_mksunxi__fit__atf.sh b/u-boot-pinebook-crust/patches/patch-board_sunxi_mksunxi__fit__atf.sh
new file mode 100644
index 0000000000..4a88d99999
--- /dev/null
+++ b/u-boot-pinebook-crust/patches/patch-board_sunxi_mksunxi__fit__atf.sh
@@ -0,0 +1,116 @@
+$NetBSD$
+
+Add SCP firmware into FIT image.
+
+From https://github.com/crust-firmware/u-boot/
+
+--- board/sunxi/mksunxi_fit_atf.sh.orig	2019-07-15 12:45:54.389576712 +0000
++++ board/sunxi/mksunxi_fit_atf.sh
+@@ -1,13 +1,14 @@
+ #!/bin/sh
+ #
+-# script to generate FIT image source for 64-bit sunxi boards with
+-# ARM Trusted Firmware and multiple device trees (given on the command line)
++# script to generate FIT image source for 64-bit sunxi boards with ARM Trusted
++# Firmware, SCP firmware, and multiple device trees (given on the command line)
+ #
+ # usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
+ 
+ [ -z "$BL31" ] && BL31="bl31.bin"
++[ -z "$SCP" ] && SCP="scp.bin"
+ 
+-if [ ! -f $BL31 ]; then
++if [ ! -f "$BL31" ]; then
+ 	echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
+ 	echo "Please read the section on ARM Trusted Firmware (ATF) in board/sunxi/README.sunxi64" >&2
+ 	BL31=/dev/null
+@@ -15,15 +16,17 @@ fi
+ 
+ if grep -q "^CONFIG_MACH_SUN50I_H6=y" .config; then
+ 	BL31_ADDR=0x104000
++	SCP_ADDR=0x110000
+ else
+ 	BL31_ADDR=0x44000
++	SCP_ADDR=0x4c000
+ fi
+ 
+ cat << __HEADER_EOF
+ /dts-v1/;
+ 
+ / {
+-	description = "Configuration to load ATF before U-Boot";
++	description = "Configuration to load ATF and SCP before U-Boot";
+ 	#address-cells = <1>;
+ 
+ 	images {
+@@ -32,6 +35,7 @@ cat << __HEADER_EOF
+ 			data = /incbin/("u-boot-nodtb.bin");
+ 			type = "standalone";
+ 			arch = "arm64";
++			os = "u-boot";
+ 			compression = "none";
+ 			load = <0x4a000000>;
+ 		};
+@@ -40,14 +44,28 @@ cat << __HEADER_EOF
+ 			data = /incbin/("$BL31");
+ 			type = "firmware";
+ 			arch = "arm64";
++			os = "arm-trusted-firmware";
+ 			compression = "none";
+ 			load = <$BL31_ADDR>;
+ 			entry = <$BL31_ADDR>;
+ 		};
+ __HEADER_EOF
+ 
++if [ -f "$SCP" ]; then
++	cat << __SCP_EOF
++		scp {
++			description = "SCP Firmware";
++			data = /incbin/("$SCP");
++			type = "firmware";
++			arch = "or1k";
++			compression = "none";
++			load = <$SCP_ADDR>;
++		};
++__SCP_EOF
++fi
++
+ cnt=1
+-for dtname in $*
++for dtname
+ do
+ 	cat << __FDT_IMAGE_EOF
+ 		fdt_$cnt {
+@@ -67,21 +85,27 @@ cat << __CONF_HEADER_EOF
+ 
+ __CONF_HEADER_EOF
+ 
++if [ -f "$SCP" ]; then
++	LOADABLES='"uboot", "scp"'
++else
++	LOADABLES='"uboot"'
++fi
++
+ cnt=1
+-for dtname in $*
++for dtname
+ do
+ 	cat << __CONF_SECTION_EOF
+ 		config_$cnt {
+ 			description = "$(basename $dtname .dtb)";
+-			firmware = "uboot";
+-			loadables = "atf";
++			firmware = "atf";
++			loadables = $LOADABLES;
+ 			fdt = "fdt_$cnt";
+ 		};
+ __CONF_SECTION_EOF
+ 	cnt=$((cnt+1))
+ done
+ 
+-cat << __ITS_EOF
++cat << __FOOTER_EOF
+ 	};
+ };
+-__ITS_EOF
++__FOOTER_EOF
diff --git a/u-boot-pinebook-crust/patches/patch-common_spl_spl__fit.c b/u-boot-pinebook-crust/patches/patch-common_spl_spl__fit.c
new file mode 100644
index 0000000000..a9dd7f128c
--- /dev/null
+++ b/u-boot-pinebook-crust/patches/patch-common_spl_spl__fit.c
@@ -0,0 +1,53 @@
+$NetBSD$
+
+Misc change to support FIT_IMAGE_TINY. from crust-firmware/u-boot
+
+--- common/spl/spl_fit.c.orig	2018-11-07 03:37:06.000000000 +0000
++++ common/spl/spl_fit.c
+@@ -170,7 +170,6 @@ static int spl_load_fit_image(struct spl
+ 	void *src;
+ 	ulong overhead;
+ 	int nr_sectors;
+-	int align_len = ARCH_DMA_MINALIGN - 1;
+ 	uint8_t image_comp = -1, type = -1;
+ 	const void *data;
+ 	bool external_data = false;
+@@ -205,7 +204,7 @@ static int spl_load_fit_image(struct spl
+ 		if (fit_image_get_data_size(fit, node, &len))
+ 			return -ENOENT;
+ 
+-		load_ptr = (load_addr + align_len) & ~align_len;
++		load_ptr = CONFIG_SYS_LOAD_ADDR;
+ 		length = len;
+ 
+ 		overhead = get_aligned_image_overhead(info, offset);
+@@ -325,7 +324,16 @@ static int spl_fit_record_loadable(const
+ static int spl_fit_image_get_os(const void *fit, int noffset, uint8_t *os)
+ {
+ #if CONFIG_IS_ENABLED(FIT_IMAGE_TINY)
+-	return -ENOTSUPP;
++	const char *str;
++	int len;
++
++	str = fdt_getprop(fit, noffset, FIT_OS_PROP, &len);
++	if (str && !strcmp(str, "u-boot"))
++		*os = IH_OS_U_BOOT;
++	else
++		*os = IH_OS_INVALID;
++
++	return 0;
+ #else
+ 	return fit_image_get_os(fit, noffset, os);
+ #endif
+@@ -451,7 +459,11 @@ int spl_load_simple_fit(struct spl_image
+ 	 * as a U-Boot image, if no OS-type has been declared.
+ 	 */
+ 	if (!spl_fit_image_get_os(fit, node, &spl_image->os))
++#if CONFIG_IS_ENABLED(FIT_IMAGE_TINY)
++		debug("Image OS is %d\n", spl_image->os);
++#else
+ 		debug("Image OS is %s\n", genimg_get_os_name(spl_image->os));
++#endif
+ #if !defined(CONFIG_SPL_OS_BOOT)
+ 	else
+ 		spl_image->os = IH_OS_U_BOOT;
diff --git a/u-boot-pinebook-crust/patches/patch-include_configs_sunxi-common.h b/u-boot-pinebook-crust/patches/patch-include_configs_sunxi-common.h
new file mode 100644
index 0000000000..b879f429ae
--- /dev/null
+++ b/u-boot-pinebook-crust/patches/patch-include_configs_sunxi-common.h
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- include/configs/sunxi-common.h.orig	2019-07-15 12:38:43.332852802 +0000
++++ include/configs/sunxi-common.h
+@@ -416,7 +416,6 @@ extern int soft_i2c_gpio_scl;
+ 	BOOT_TARGET_DEVICES_MMC(func) \
+ 	BOOT_TARGET_DEVICES_SCSI(func) \
+ 	BOOT_TARGET_DEVICES_USB(func) \
+-	func(PXE, pxe, na) \
+ 	func(DHCP, dhcp, na)
+ 
+ #ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
diff --git a/u-boot-pinebook-crust/patches/patch-include_spl.h b/u-boot-pinebook-crust/patches/patch-include_spl.h
new file mode 100644
index 0000000000..bde8cc2358
--- /dev/null
+++ b/u-boot-pinebook-crust/patches/patch-include_spl.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Make SPL serial optional
+
+--- include/spl.h.orig	2018-11-07 03:37:06.000000000 +0000
++++ include/spl.h
+@@ -79,7 +79,11 @@ int spl_load_simple_fit(struct spl_image
+ #define SPL_COPY_PAYLOAD_ONLY	1
+ 
+ /* SPL common functions */
++#ifdef CONFIG_SPL_SERIAL_SUPPORT
+ void preloader_console_init(void);
++#else
++static inline void preloader_console_init(void) {}
++#endif
+ u32 spl_boot_device(void);
+ u32 spl_boot_mode(const u32 boot_device);
+ int spl_boot_partition(const u32 boot_device);
diff --git a/u-boot-pinebook-crust/patches/patch-lib_bch.c b/u-boot-pinebook-crust/patches/patch-lib_bch.c
new file mode 100644
index 0000000000..1ea3e88b24
--- /dev/null
+++ b/u-boot-pinebook-crust/patches/patch-lib_bch.c
@@ -0,0 +1,26 @@
+$NetBSD: patch-lib_bch.c,v 1.3 2018/02/18 12:27:20 jmcneill Exp $
+
+--- lib/bch.c.orig	2018-01-23 06:50:34.000000000 +0000
++++ lib/bch.c
+@@ -61,8 +61,11 @@
+ #include <linux/bitops.h>
+ #else
+ #include <errno.h>
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+ #include <sys/endian.h>
++#elif defined(__APPLE__)
++#include <machine/endian.h>
++#define htobe32 htonl
+ #else
+ #include <endian.h>
+ #endif
+@@ -117,7 +120,7 @@ struct gf_poly_deg1 {
+ };
+ 
+ #ifdef USE_HOSTCC
+-#if !defined(__DragonFly__) && !defined(__FreeBSD__)
++#if !defined(__DragonFly__) && !defined(__FreeBSD__) && !defined(__APPLE__)
+ static int fls(int x)
+ {
+ 	int r = 32;


Home | Main Index | Thread Index | Old Index