Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jun 2017 00:08:36 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320252 - in head/release: . arm64 tools
Message-ID:  <201706230008.v5N08aR3003361@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gjb
Date: Fri Jun 23 00:08:36 2017
New Revision: 320252
URL: https://svnweb.freebsd.org/changeset/base/320252

Log:
  In release/release.sh:
  - Rename chroot_arm_armv6_build_release() to chroot_arm_build_release()
    and make it hardware agnostic (such as armv6 -vs- armv7 -vs- arm64).
  
  - Evaluate EMBEDDED_TARGET differently so release/tools/arm.subr can
    be used for arm/armv6 and arm64/aarch64.
  
  - Update comments and copyright.
  
  In release/tools/arm.subr:
  - In arm_create_disk(), change the default alignment from 63 to 512k,
    fixing a boot issue on arm64 and EFI. [1]
  
  - Update comments and copyright.
  
  Add a RPI3 configuration file, pieces obtained from Crochet.
  
  Obtained from:	Crochet [1]
  MFC after:	5 days
  X-MFC-Note:	maybe
  Sponsored by:	The FreeBSD Foundation

Added:
  head/release/arm64/RPI3.conf   (contents, props changed)
Modified:
  head/release/release.sh
  head/release/tools/arm.subr

Added: head/release/arm64/RPI3.conf
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/release/arm64/RPI3.conf	Fri Jun 23 00:08:36 2017	(r320252)
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+CHROOT_MAKEENV="TARGET=amd64 TARGET_ARCH=amd64"
+SRCBRANCH="base/head@rHEAD"
+EMBEDDEDBUILD=1
+EMBEDDED_TARGET="arm64"
+EMBEDDED_TARGET_ARCH="aarch64"
+EMBEDDEDPORTS="sysutils/u-boot-rpi3 security/ca_root_nss"
+KERNEL="GENERIC"
+#MAKE_FLAGS="${MAKE_FLAGS} -s"
+WORLD_FLAGS="${WORLD_FLAGS} -j48 UBLDR_LOADADDR=0x42000000"
+IMAGE_SIZE="2G"
+PART_SCHEME="MBR"
+FAT_SIZE="50m -b 1m"
+FAT_TYPE="16"
+MD_ARGS="-x 63 -y 255"
+NODOC=1
+DTB_REPO="https://github.com/raspberrypi/firmware/blob/master/boot"
+DTB="bcm2710-rpi-3-b.dtb"
+OVERLAYS="mmc.dtbo pi3-disable-bt.dtbo"
+export BOARDNAME="RPI3"
+
+arm_install_uboot() {
+	UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi3"
+	UBOOT_FILES="LICENCE.broadcom README armstub8.bin bootcode.bin config.txt \
+		fixup.dat fixup_cd.dat fixup_x.dat start.elf start_cd.elf \
+		start_x.elf u-boot.bin"
+	FATMOUNT="${DESTDIR%${KERNEL}}fat"
+	UFSMOUNT="${DESTDIR%${KERNEL}}ufs"
+	chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
+	chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
+	chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}
+	for _UF in ${UBOOT_FILES}; do
+		chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/${_UF} \
+			${FATMOUNT}/${_UF}
+	done
+	chroot ${CHROOTDIR} fetch -o "${FATMOUNT}/${DTB}" "${DTB_REPO}/${DTB}?raw=true"
+	chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/overlays
+	for _OL in ${OVERLAYS}; do
+		chroot ${CHROOTDIR} fetch -o "${FATMOUNT}/overlays/${_OL}"\
+			"${DTB_REPO}/overlays/${_OL}?raw=true"
+	done
+
+	_OBJDIR="$(chroot ${CHROOTDIR} make -C ${WORLDDIR} -V .OBJDIR)"
+	_OBJDIR="$(realpath ${_OBJDIR})"
+	if [ -d "${CHROOTDIR}/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}" ]; then
+		BOOTFILES="/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/sys/boot"
+	else
+		BOOTFILES="/${_OBJDIR}/sys/boot"
+	fi
+
+	chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/EFI/BOOT
+	chroot ${CHROOTDIR} cp -p ${BOOTFILES}/efi/boot1/boot1.efi \
+		${FATMOUNT}/EFI/BOOT/bootaa64.efi
+	chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot
+	sync
+	umount_loop ${CHROOTDIR}/${FATMOUNT}
+	umount_loop ${CHROOTDIR}/${UFSMOUNT}
+	chroot ${CHROOTDIR} rmdir ${FATMOUNT}
+	chroot ${CHROOTDIR} rmdir ${UFSMOUNT}
+	
+	return 0
+}

Modified: head/release/release.sh
==============================================================================
--- head/release/release.sh	Fri Jun 23 00:00:00 2017	(r320251)
+++ head/release/release.sh	Fri Jun 23 00:08:36 2017	(r320252)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #-
-# Copyright (c) 2013-2015 The FreeBSD Foundation
+# Copyright (c) 2013-2017 The FreeBSD Foundation
 # Copyright (c) 2013 Glen Barber
 # Copyright (c) 2011 Nathan Whitehorn
 # All rights reserved.
@@ -148,10 +148,11 @@ env_check() {
 		WITH_COMPRESSED_IMAGES=
 		NODOC=yes
 		case ${EMBEDDED_TARGET}:${EMBEDDED_TARGET_ARCH} in
-			arm:armv6)
-				chroot_build_release_cmd="chroot_arm_armv6_build_release"
+			arm:armv6|arm64:aarch64)
+				chroot_build_release_cmd="chroot_arm_build_release"
 				;;
 			*)
+				;;
 		esac
 	fi
 
@@ -346,13 +347,19 @@ chroot_build_release() {
 	return 0
 } # chroot_build_release()
 
-# chroot_arm_armv6_build_release(): Create arm/armv6 SD card image.
-chroot_arm_armv6_build_release() {
+# chroot_arm_build_release(): Create arm SD card image.
+chroot_arm_build_release() {
 	load_target_env
 	eval chroot ${CHROOTDIR} make -C /usr/src/release obj
-	if [ -e "${RELENGDIR}/tools/${EMBEDDED_TARGET}.subr" ]; then
-		. "${RELENGDIR}/tools/${EMBEDDED_TARGET}.subr"
-	fi
+	case ${EMBEDDED_TARGET} in
+		arm|arm64)
+			if [ -e "${RELENGDIR}/tools/arm.subr" ]; then
+				. "${RELENGDIR}/tools/arm.subr"
+			fi
+			;;
+		*)
+			;;
+	esac
 	[ ! -z "${RELEASECONF}" ] && . "${RELEASECONF}"
 	WORLDDIR="$(eval chroot ${CHROOTDIR} make -C /usr/src/release -V WORLDDIR)"
 	OBJDIR="$(eval chroot ${CHROOTDIR} make -C /usr/src/release -V .OBJDIR)"
@@ -381,7 +388,7 @@ chroot_arm_armv6_build_release() {
 		> CHECKSUM.SHA256
 
 	return 0
-} # chroot_arm_armv6_build_release()
+} # chroot_arm_build_release()
 
 # main(): Start here.
 main() {

Modified: head/release/tools/arm.subr
==============================================================================
--- head/release/tools/arm.subr	Fri Jun 23 00:00:00 2017	(r320251)
+++ head/release/tools/arm.subr	Fri Jun 23 00:08:36 2017	(r320252)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #-
-# Copyright (c) 2015 The FreeBSD Foundation
+# Copyright (c) 2015-2017 The FreeBSD Foundation
 # All rights reserved.
 #
 # Portions of this software were developed by Glen Barber
@@ -27,7 +27,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# Common subroutines used to build arm/armv6 images.
+# Common subroutines used to build arm SD card images.
 #
 # $FreeBSD$
 #
@@ -65,7 +65,7 @@ umount_loop() {
 arm_create_disk() {
 	# Create the target raw file and temporary work directory.
 	chroot ${CHROOTDIR} gpart create -s ${PART_SCHEME} ${mddev}
-	chroot ${CHROOTDIR} gpart add -t '!12' -a 63 -s ${FAT_SIZE} ${mddev}
+	chroot ${CHROOTDIR} gpart add -t '!12' -a 512k -s ${FAT_SIZE} ${mddev}
 	chroot ${CHROOTDIR} gpart set -a active -i 1 ${mddev}
 	chroot ${CHROOTDIR} newfs_msdos -L msdosboot -F ${FAT_TYPE} /dev/${mddev}s1
 	chroot ${CHROOTDIR} gpart add -t freebsd ${mddev}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706230008.v5N08aR3003361>