u-boot: Update to v2018.01

- Track upstream directly We cannot build u-boot directly on FreeBSD as
   it needs gmake, gsed etc ... Earlier update dealt with that using
   BINARY_ALIAS to avoid patching. The cache patches have been sent upstream
   (a V2 is needed as some arch don't have those functions) so put them in
   the ports tree for now. This is the only patches needed to build a
   u-boot for armv6/armv7/arm64 so do not use the freebsd github fork anymore
   as they will go away soon.
 - We now use boot.scr (converted with mkimage from sysutils/u-boot-tools)
   instead of patching u-boot. U-Boot have two way for dealing with distribution
   one is boot scripts and the other is extlinux. extlinux will be harder as we
   use raw binary for ubldr and use go $address, this cannot fail and the boot
   process could be in a bad state so this is something that upstream doesn't
   want to merge in mainline. boot script are easy to write and compile and
   also give a way to the user to customize it's boot
   (printing a message, setting variable etc ...)
 - CONFIG_API isn't defined by default so use a configuration fragment and
   generate our final config with scripts/kconfig/merge_config.sh
   Other configuration value could be added in the futur.
   For now only arm uses it as we don't use CONFIG_API on arm64.
 - Switch the maintainer to uboot@freebsd.org

Reviewed by:	imp (previous version)
Approved by:	imp
Differential Revision:	https://reviews.freebsd.org/D14230
This commit is contained in:
Emmanuel Vadot 2018-03-24 20:40:27 +00:00
parent b7f9b0f297
commit c621488269
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=465468
7 changed files with 73 additions and 15 deletions

View file

@ -5,29 +5,25 @@
PORTNAME= u-boot
PORTVERSION= ${UBOOT_VERSION}
PORTREVISION= 2
DISTVERSIONPREFIX= ports-v
CATEGORIES= sysutils
PKGNAMESUFFIX?= -${MODEL}
MASTER_SITES= ftp://ftp.denx.de/pub/u-boot/
MAINTAINER= imp@FreeBSD.org
MAINTAINER= uboot@FreeBSD.org
COMMENT= Cross-build das u-boot for model ${MODEL}
LICENSE= GPLv2
BUILD_DEPENDS+= gsed:textproc/gsed \
swig3.0:devel/swig30 \
dtc>=1.4.1:sysutils/dtc
dtc>=1.4.1:sysutils/dtc \
mkimage:sysutils/u-boot-tools
BUILD_DEPENDS+= ${COMPILER}:devel/${COMPILER}
USES= gmake python:2.7,build shebangfix
BINARY_ALIAS= swig=swig3.0 sed=gsed
USES= tar:bz2 gmake python:2.7,build shebangfix
BINARY_ALIAS= swig=swig3.0 sed=gsed dtc=${LOCALBASE}/bin/dtc
USE_GITHUB= yes
GH_ACCOUNT= freebsd
GH_PROJECT= u-boot
SHEBANG_FILES= lib/libfdt/pylibfdt/setup.py
SHEBANG_FILES= tools/binman/binman.py
SSP_UNSAFE= yes
UBOOT_DIR= share/u-boot/${PORTNAME}${PKGNAMESUFFIX}
INST= ${PREFIX}/${UBOOT_DIR}
@ -74,7 +70,7 @@ UBOOT_PLIST_RPI= u-boot.bin
.if !defined(UBOOT_VERSION) && defined(UBOOT_VERSION_${FAMILY:tu})
UBOOT_VERSION=${UBOOT_VERSION_${FAMILY:tu}}
.endif
UBOOT_VERSION?= 2017.09.00
UBOOT_VERSION?= 2018.03
.if !defined(UBOOT_PLIST) && defined(UBOOT_PLIST_${FAMILY:tu})
UBOOT_PLIST=${UBOOT_PLIST_${FAMILY:tu}}
@ -89,6 +85,7 @@ UBOOT_ARCH?= arm
.if ${UBOOT_ARCH} == arm
CROSS_COMPILE=arm-none-eabi-
ARCHFLAGS=ARCH=${UBOOT_ARCH}
UBOOT_PLIST+= boot.scr
.elif ${UBOOT_ARCH} == aarch64
CROSS_COMPILE=aarch64-none-elf-
ARCHFLAGS=ARCH=arm
@ -115,8 +112,20 @@ PLIST_FILES+= ${UBOOT_DIR}/${i}
.endfor
PLIST_FILES+= ${UBOOT_DIR}/README
post-patch:
@${REINPLACE_CMD} -e "s|make|${MAKE_CMD}|" ${WRKSRC}/scripts/kconfig/merge_config.sh
${CP} ${FILESDIR}/FreeBSD_Fragment ${WRKSRC}/configs/
${CP} ${FILESDIR}/boot.cmd ${WRKSRC}/
.if ${UBOOT_ARCH} == arm
# For armv6/v7 we want CONFIG_API
# Use a KConfig fragment for that
do-configure:
(cd ${WRKSRC}; ${SETENV} ${CONFIGURE_ENV} scripts/kconfig/merge_config.sh configs/${BOARD_CONFIG} configs/FreeBSD_Fragment)
.else
do-configure:
(cd ${WRKSRC}; ${SETENV} ${CONFIGURE_ENV} ${MAKE_CMD} ${BOARD_CONFIG})
.endif
# U-Boot for Allwinner 64bits SoCs is splited in two parts
# Generate a single binary to ease deployement on sdcard
@ -125,6 +134,11 @@ post-build:
${CAT} ${WRKSRC}/spl/sunxi-spl.bin ${WRKSRC}/u-boot.itb > ${WRKSRC}/u-boot-sunxi-with-spl.bin
.endif
.if ${UBOOT_ARCH} == arm
post-build:
mkimage -C none -A arm -T script -d ${FILESDIR}/boot.cmd ${WRKSRC}/boot.scr
.endif
# If we need to put anything into WRKSRC, do so now so we can build the PLIST
# in do-install
.if defined(UBOOT_MOVE)

View file

@ -1,3 +1,3 @@
TIMESTAMP = 1508182195
SHA256 (freebsd-u-boot-ports-v2017.09.00_GH0.tar.gz) = 5e408dee8be45e11293771a7d8a91250dad20711088195f5d6da99d42f5d4f7e
SIZE (freebsd-u-boot-ports-v2017.09.00_GH0.tar.gz) = 14429809
TIMESTAMP = 1521912727
SHA256 (u-boot-2018.03.tar.bz2) = 7e7477534409d5368eb1371ffde6820f0f79780a1a1f676161c48442cb303dfd
SIZE (u-boot-2018.03.tar.bz2) = 12304292

View file

@ -0,0 +1 @@
CONFIG_API=y

View file

@ -0,0 +1,2 @@
fatload ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ubldr.bin && go ${kernel_addr_r}
echo "Cannot load ubldr.bin"

View file

@ -0,0 +1,14 @@
--- api/api.c.orig 2018-01-09 01:25:29 UTC
+++ api/api.c
@@ -290,6 +290,11 @@ static int API_dev_close(va_list ap)
if (!err)
di->state = DEV_STA_CLOSED;
+ if (dcache_status())
+ flush_dcache_all();
+ if (icache_status())
+ invalidate_icache_all();
+
return err;
}

View file

@ -0,0 +1,13 @@
--- cmd/boot.c.orig 2018-01-09 01:25:29 UTC
+++ cmd/boot.c
@@ -19,6 +19,10 @@ __attribute__((weak))
unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
char * const argv[])
{
+ if (dcache_status())
+ flush_dcache_all();
+ if (icache_status())
+ invalidate_icache_all();
return entry (argc, argv);
}

View file

@ -0,0 +1,14 @@
--- cmd/elf.c.orig 2018-01-09 01:25:29 UTC
+++ cmd/elf.c
@@ -109,6 +109,11 @@ static unsigned long do_bootelf_exec(ulong (*entry)(in
{
unsigned long ret;
+ if (dcache_status())
+ flush_dcache_all();
+ if (icache_status())
+ invalidate_icache_all();
+
/*
* pass address parameter as argv[0] (aka command name),
* and all remaining args