Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Nov 2020 17:13:13 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r555035 - in head/sysutils: . u-boot-master u-boot-sopine-spi u-boot-sopine-spi/files
Message-ID:  <202011131713.0ADHDDEH070520@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Fri Nov 13 17:13:13 2020
New Revision: 555035
URL: https://svnweb.freebsd.org/changeset/ports/555035

Log:
  u-boot-sopine-spi: Add new port
  
  While the u-boot-sopine port can boot from SPI on the Pine64-LTS and Sopine
  module the env is saved and read from the eMMC.
  This is a modified sopine u-boot that only read and store the env in the spi
  flash available on thoses boards.
  Additionally there is also a sopine-spi-flasher.img that can be burnt on a sdcard
  and when booted it will program the spi flash.

Added:
  head/sysutils/u-boot-sopine-spi/
  head/sysutils/u-boot-sopine-spi/Makefile   (contents, props changed)
  head/sysutils/u-boot-sopine-spi/files/
  head/sysutils/u-boot-sopine-spi/files/boot.cmd   (contents, props changed)
  head/sysutils/u-boot-sopine-spi/files/spi_fragment   (contents, props changed)
  head/sysutils/u-boot-sopine-spi/pkg-descr   (contents, props changed)
Modified:
  head/sysutils/Makefile
  head/sysutils/u-boot-master/Makefile

Modified: head/sysutils/Makefile
==============================================================================
--- head/sysutils/Makefile	Fri Nov 13 17:09:20 2020	(r555034)
+++ head/sysutils/Makefile	Fri Nov 13 17:13:13 2020	(r555035)
@@ -1392,6 +1392,7 @@
     SUBDIR += u-boot-rpi4
     SUBDIR += u-boot-sinovoip-bpi-m3
     SUBDIR += u-boot-sopine
+    SUBDIR += u-boot-sopine-spi
     SUBDIR += u-boot-tools
     SUBDIR += u-boot-utilite
     SUBDIR += u-boot-wandboard

Modified: head/sysutils/u-boot-master/Makefile
==============================================================================
--- head/sysutils/u-boot-master/Makefile	Fri Nov 13 17:09:20 2020	(r555034)
+++ head/sysutils/u-boot-master/Makefile	Fri Nov 13 17:13:13 2020	(r555035)
@@ -173,6 +173,13 @@ PLIST_FILES+=	${UBOOT_DIR}/${i}
 .endfor
 PLIST_FILES+=	${UBOOT_DIR}/README
 
+.if defined(PLIST_EXTRAS)
+.for i in ${PLIST_EXTRAS}
+PLIST_FILES+=	${UBOOT_DIR}/${i}
+.endfor
+.endif
+
+.if !defined(NO_METADATA)
 .if defined(UBOOT_METADATA_${FAMILY:tu}_METHOD)
 METADATA_METHOD=${UBOOT_METADATA_${FAMILY:tu}_METHOD}
 METADATA_FILES=${UBOOT_METADATA_${FAMILY:tu}_FILES}
@@ -184,6 +191,7 @@ METADATA_BS=${UBOOT_METADATA_${FAMILY:tu}_RAW_BS}
 .elif ${METADATA_METHOD} == "file"
 .else
 .error "Unsupported METADATA_METHOD"
+.endif
 .endif
 .endif
 

Added: head/sysutils/u-boot-sopine-spi/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/u-boot-sopine-spi/Makefile	Fri Nov 13 17:13:13 2020	(r555035)
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+MASTERDIR=	${.CURDIR}/../u-boot-master
+
+MODEL=		sopine-spi
+BOARD_CONFIG=	sopine_baseboard_defconfig
+FAMILY=		allwinner64
+
+CONFIG_FRAGMENT=	${.CURDIR}/../u-boot-sopine-spi/files/spi_fragment
+FRAGMENT_NAME=		spi_fragment
+NO_METADATA=		yes
+UBOOT_PLIST=		u-boot-sunxi-with-spl.bin \
+			boot.scr
+PLIST_EXTRAS=		sopine-spi-flasher.img
+
+post-build:
+	mkimage -C none -A arm64 -T script -d ${.CURDIR}/../u-boot-sopine-spi/files/boot.cmd ${WRKSRC}/boot.scr
+
+post-stage:
+	makefs -t msdos -s 5m ${WRKDIR}/sopine-spi-flash.msdos ${STAGEDIR}/${INST}
+	mkimg -v -s mbr -p fat32::5M:1M -o ${STAGEDIR}/${INST}/sopine-spi-flasher.img
+	dd if=${WRKDIR}/sopine-spi-flash.msdos of=${STAGEDIR}/${INST}/sopine-spi-flasher.img bs=1M oseek=1 conv=notrunc
+	dd if=${STAGEDIR}/${INST}/u-boot-sunxi-with-spl.bin of=${STAGEDIR}/${INST}/sopine-spi-flasher.img bs=1k oseek=8 conv=notrunc
+
+.include "${MASTERDIR}/Makefile"

Added: head/sysutils/u-boot-sopine-spi/files/boot.cmd
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/u-boot-sopine-spi/files/boot.cmd	Fri Nov 13 17:13:13 2020	(r555035)
@@ -0,0 +1,8 @@
+sf probe
+sf erase 0 0x100000
+fatload mmc 0 ${kernel_addr_r} u-boot-sunxi-with-spl.bin
+sf write ${kernel_addr_r} 0 0x100000
+echo "Flash programmed"
+while true; do
+sleep 1
+done

Added: head/sysutils/u-boot-sopine-spi/files/spi_fragment
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/u-boot-sopine-spi/files/spi_fragment	Fri Nov 13 17:13:13 2020	(r555035)
@@ -0,0 +1,5 @@
+CONFIG_ENV_SIZE=0x20000
+CONFIG_ENV_OFFSET=0x100000
+CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_ENV_IS_IN_FAT=n
+CONFIG_ENV_IS_IN_SPI_FLASH=y

Added: head/sysutils/u-boot-sopine-spi/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/u-boot-sopine-spi/pkg-descr	Fri Nov 13 17:13:13 2020	(r555035)
@@ -0,0 +1,18 @@
+U-Boot loader and related files for the Sopine SPI Flash.
+
+To install this bootloader on the spi flash just do from a running sopine system:
+dd if=/usr/local/share/u-boot/u-boot-sopine-spi/u-boot-sunxi-with-spl.bin of=/dev/flash/spi0 bs=64k conv=sync
+
+U-boot environment variables are save in the flash and not in the fat partition.
+
+You can also use the flasher image
+dd if=/usr/local/share/u-boot/u-boot-sopine-spi/sopine-spi-flasher.img of=/path/to/sdcard
+Boot the sdcard on the sopine/pine64-lts and it will erase and populate the spi flash
+with this u-boot.
+Since there is no led that we can flash do indicate that flashing is done the best way to
+know it to connect an uart adapter or hdmi monitor.
+
+For information about running FreeBSD on Allwinner boards, see
+ https://wiki.freebsd.org/FreeBSD/arm/Allwinner
+
+WWW: https://www.denx.de/wiki/U-Boot



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