Came here to tinker with one board in particular, but always building
everything was taking so too much time, so I noticed `make BOARDS=foo'
would build just that board... anyways, here's some cleanup that also
enables us to split the +1G build assets from the ~90M sources:
- use TLS
- drop python handling in pre-build; done automatically in pre-configure
- use python 3 at build
- introduce ${MK} helper variable: better readability, less repitition
- turn ${WRKSRC}/build/${BOARD} into ${WRKBUILD}/${BOARD}
- create build directories at once prior to build
- pass BL31 as make flag not environment variable to enable unified ${MK}
Bits are still written to WRKSRC as its size increases by a few
megabytes after build, but I think the split is still worth it and makes
it easier to look into these remaining matters.
The resulting u-boot images files slightly differ at various offsets,
but this also happens when I simply build the unmodified port myself.
Other FILES only differ in embedded timestamps with my diff.
Tested on amd64 with obviously no PLIST change.
Feedback? OK?
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/u-boot/Makefile,v
retrieving revision 1.55
diff -u -p -r1.55 Makefile
--- Makefile 30 Jul 2019 17:55:47 -0000 1.55
+++ Makefile 2 Sep 2019 19:22:30 -0000
@@ -12,13 +12,13 @@ DISTNAME= u-boot-${VERSION}
PKGNAME= u-boot-${FLAVOR}-${VERSION:S/-//}
FULLPKGNAME= ${PKGNAME}
CATEGORIES= sysutils
-HOMEPAGE= http://www.denx.de/wiki/U-Boot
+HOMEPAGE= https://www.denx.de/wiki/U-Boot
MAINTAINER= Jonathan Gray <[email protected]>
# GPLv2
PERMIT_PACKAGE= Yes
-MASTER_SITES= ftp://ftp.denx.de/pub/u-boot/
+MASTER_SITES= https://ftp.denx.de/pub/u-boot/
EXTRACT_SUFX= .tar.bz2
PKG_ARCH= *
@@ -28,6 +28,7 @@ BUILD_DEPENDS= devel/bison \
textproc/gsed
MODULES= lang/python
+MODPY_VERSION= ${MODPY_DEFAULT_VERSION_3}
MODPY_RUNDEP= No
MODPY_ADJ_FILES=\
@@ -48,6 +49,7 @@ BUILD_DEPENDS+= devel/arm-none-eabi/gcc-
MAKE_ENV+= CROSS_COMPILE="arm-none-eabi-"
.endif
+SEPARATE_BUILD= Yes
USE_GMAKE= Yes
NO_TEST= Yes
@@ -144,57 +146,37 @@ FILES=\
spl/sunxi-spl.bin \
pre-build:
-.for f in ${MODPY_ADJ_FILES}
- ${MODPY_BIN_ADJ} ${WRKSRC}/${f}
-.endfor
+ cd ${WRKBUILD} && mkdir -p ${BOARDS} ${SUNXI64}
do-build:
.for BOARD in ${BOARDS}
- cd ${WRKSRC} && \
- mkdir -p build/${BOARD} && \
- ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
- O="build/${BOARD}" \
- -f ${MAKE_FILE} "${BOARD}"_defconfig && \
- ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
- O="build/${BOARD}" \
- -f ${MAKE_FILE} ${ALL_TARGET}
-.if "${BOARD}" == "tinker-rk3288"
- cd ${WRKSRC}/build/${BOARD} && \
+ ${MK} O=${WRKBUILD}/${BOARD} ${BOARD}_defconfig
+ ${MK} O=${WRKBUILD}/${BOARD} ${ALL_TARGET}
+. if "${BOARD}" == "tinker-rk3288"
+ cd ${WRKBUILD}/${BOARD} && \
tools/mkimage -n rk3288 -T rksd -d tpl/u-boot-tpl.bin \
idbloader.img && \
cat spl/u-boot-spl-dtb.bin >> idbloader.img
-.endif
-.if "${BOARD}" == "firefly-rk3399"
- cd ${WRKSRC}/build/${BOARD} && \
- ${SETENV} ${MAKE_ENV} BL31=${RK3399_BL31} ${MAKE_PROGRAM} \
- ${MAKE_FLAGS} O="build/${BOARD}" \
- -f ${MAKE_FILE} u-boot.itb && \
+. elif "${BOARD}" == "firefly-rk3399"
+ ${MK} O=${WRKBUILD}/${BOARD} BL31=${RK3399_BL31} u-boot.itb
+ cd ${WRKBUILD}/${BOARD} && \
tools/mkimage -n rk3399 -T rksd -d tpl/u-boot-tpl.bin \
- idbloader.img && \
+ idbloader.img && \
cat spl/u-boot-spl-dtb.bin >> idbloader.img
-.endif
+. endif
.endfor
.for BOARD in ${SUNXI64}
- cd ${WRKSRC} && \
- mkdir -p build/${BOARD} && \
- ${SETENV} ${MAKE_ENV} BL31=${SUNXI_BL31} ${MAKE_PROGRAM} \
- ${MAKE_FLAGS} O="build/${BOARD}" \
- -f ${MAKE_FILE} "${BOARD}"_defconfig && \
- ${SETENV} ${MAKE_ENV} BL31=${SUNXI_BL31} ${MAKE_PROGRAM} \
- ${MAKE_FLAGS} O="build/${BOARD}" \
- -f ${MAKE_FILE} ${ALL_TARGET}
- if [[ -f ${WRKSRC}/build/${BOARD}/spl/sunxi-spl.bin && \
- -f ${WRKSRC}/build/${BOARD}/u-boot.itb ]]; then \
- cd ${WRKSRC}/build/${BOARD} && \
- cat spl/sunxi-spl.bin u-boot.itb >
u-boot-sunxi-with-spl.bin ; \
- fi
+ ${MK} O=${WRKBUILD}/${BOARD} BL31=${SUNXI_BL31} ${BOARD}_defconfig
+ ${MK} O=${WRKBUILD}/${BOARD} BL31=${SUNXI_BL31} ${ALL_TARGET}
+ cd ${WRKBUILD}/${BOARD} && \
+ [[ -f spl/sunxi-spl.bin && -f u-boot.itb ]] && \
+ cat spl/sunxi-spl.bin u-boot.itb > u-boot-sunxi-with-spl.bin
.endfor
do-install:
- ${INSTALL_DATA_DIR} ${PREFIX}/share/u-boot
.for BOARD in ${BOARDS} ${SUNXI64}
${INSTALL_DATA_DIR} ${PREFIX}/share/u-boot/${BOARD}
- -cd ${WRKSRC}/build/${BOARD} && \
+ -cd ${WRKBUILD}/${BOARD} && \
cp ${FILES} ${PREFIX}/share/u-boot/${BOARD}/
.endfor
===================================================================
Stats: --- 38 lines 1454 chars
Stats: +++ 20 lines 838 chars
Stats: -18 lines
Stats: -616 chars