forked from Lainports/freebsd-ports
- 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
156 lines
4.1 KiB
Makefile
156 lines
4.1 KiB
Makefile
# $FreeBSD$
|
|
#
|
|
# Common infrastructure for u-boot ports
|
|
#
|
|
|
|
PORTNAME= u-boot
|
|
PORTVERSION= ${UBOOT_VERSION}
|
|
CATEGORIES= sysutils
|
|
PKGNAMESUFFIX?= -${MODEL}
|
|
MASTER_SITES= ftp://ftp.denx.de/pub/u-boot/
|
|
|
|
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 \
|
|
mkimage:sysutils/u-boot-tools
|
|
BUILD_DEPENDS+= ${COMPILER}:devel/${COMPILER}
|
|
|
|
USES= tar:bz2 gmake python:2.7,build shebangfix
|
|
BINARY_ALIAS= swig=swig3.0 sed=gsed dtc=${LOCALBASE}/bin/dtc
|
|
|
|
SHEBANG_FILES= tools/binman/binman.py
|
|
SSP_UNSAFE= yes
|
|
UBOOT_DIR= share/u-boot/${PORTNAME}${PKGNAMESUFFIX}
|
|
INST= ${PREFIX}/${UBOOT_DIR}
|
|
DESCR?= ${.CURDIR}/pkg-descr
|
|
|
|
MAKE_ARGS+= V=1 CROSS_COMPILE=${CROSS_COMPILE} DTC=${LOCALBASE}/bin/dtc PYTHON=${PYTHON_CMD} ${ARCHFLAGS}
|
|
|
|
NO_ARCH= yes
|
|
|
|
# Sanity checks
|
|
.if !defined(MODEL) && !defined(BOARD_CONFIG) && !defined(FAMILY)
|
|
MODEL= NONE
|
|
IGNORE= is a metaport; there is nothing to build
|
|
.else
|
|
.if !defined(MODEL)
|
|
IGNORE+= MODEL is not defined
|
|
.endif
|
|
.if !defined(BOARD_CONFIG)
|
|
IGNORE+= BOARD_CONFIG is not defined
|
|
.endif
|
|
.if !defined(FAMILY)
|
|
IGNORE+= FAMILY is not defined
|
|
.endif
|
|
.endif
|
|
|
|
# Overrides for OMAP family
|
|
UBOOT_PLIST_OMAP=u-boot.img MLO
|
|
|
|
# Overrides for ALLWINNER family
|
|
UBOOT_PLIST_ALLWINNER=u-boot.img u-boot-sunxi-with-spl.bin
|
|
|
|
# Overrides for ALLWINNER64 family
|
|
UBOOT_PLIST_ALLWINNER64=u-boot-sunxi-with-spl.bin
|
|
UBOOT_ARCH_ALLWINNER64=aarch64
|
|
|
|
# Overrides for Zynq 7000 family
|
|
UBOOT_PLIST_ZYNQ_7000=u-boot.img boot.bin uEnv.txt
|
|
UBOOT_MOVE_ZYNQ_7000=${WRKSRC}/spl/boot.bin ${.CURDIR}/files/uEnv.txt
|
|
|
|
# Overrides for RPI family
|
|
UBOOT_PLIST_RPI= u-boot.bin
|
|
|
|
# Uboot variables
|
|
.if !defined(UBOOT_VERSION) && defined(UBOOT_VERSION_${FAMILY:tu})
|
|
UBOOT_VERSION=${UBOOT_VERSION_${FAMILY:tu}}
|
|
.endif
|
|
UBOOT_VERSION?= 2018.03
|
|
|
|
.if !defined(UBOOT_PLIST) && defined(UBOOT_PLIST_${FAMILY:tu})
|
|
UBOOT_PLIST=${UBOOT_PLIST_${FAMILY:tu}}
|
|
.endif
|
|
UBOOT_PLIST?=u-boot.img
|
|
|
|
.if !defined(UBOOT_ARCH) && defined(UBOOT_ARCH_${FAMILY:tu})
|
|
UBOOT_ARCH=${UBOOT_ARCH_${FAMILY:tu}}
|
|
.endif
|
|
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
|
|
.else
|
|
# Best guess for other architectures
|
|
CROSS_COMPILE=${UBOOT_ARCH}-none-elf-
|
|
ARCHFLAGS=ARCH=${UBOOT_ARCH}
|
|
.endif
|
|
COMPILER?=${CROSS_COMPILE}gcc
|
|
|
|
.if !defined(UBOOT_MOVE) && defined(UBOOT_MOVE_${FAMILY:tu})
|
|
UBOOT_MOVE=${UBOOT_MOVE_${FAMILY:tu}}
|
|
.endif
|
|
|
|
# Per family dependancies
|
|
.if defined(FAMILY) && ${FAMILY} == allwinner64
|
|
BUILD_DEPENDS+= ${LOCALBASE}/share/atf-allwinner/bl31.bin:sysutils/atf-allwinner
|
|
MAKE_ENV+= BL31=${LOCALBASE}/share/atf-allwinner/bl31.bin
|
|
.endif
|
|
|
|
# Each u-boot family has different files to include, bring them in.
|
|
.for i in ${UBOOT_PLIST}
|
|
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
|
|
.if defined(FAMILY) && ${FAMILY} == allwinner64
|
|
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)
|
|
pre-install:
|
|
${CP} ${UBOOT_MOVE} ${WRKSRC}
|
|
.endif
|
|
|
|
do-install:
|
|
${MKDIR} ${STAGEDIR}/${INST}
|
|
.for i in ${UBOOT_PLIST}
|
|
${INSTALL_DATA} ${WRKSRC}/${i} ${STAGEDIR}/${INST}
|
|
.endfor
|
|
${INSTALL_DATA} ${DESCR} ${STAGEDIR}/${INST}/README
|
|
|
|
.include <bsd.port.mk>
|