Hi,
this patch adds a flavor to sysutils/u-boot so tools like mkimage
can be installed in openbsd.
https://u-boot.readthedocs.io/en/latest/build/tools.html
Regards,
adr.
==========================================
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/u-boot/Makefile,v
retrieving revision 1.90
diff -u -p -u -r1.90 Makefile
--- Makefile 15 Jan 2022 11:56:50 -0000 1.90
+++ Makefile 1 Mar 2022 14:30:07 -0000
@@ -3,7 +3,7 @@
BROKEN-sparc64= Error: the specified option is not accepted in ISB at
operand 1 -- isb sy
BROKEN-arm= lib/time.c:187:1: internal compiler error: Bus error
-FLAVORS= aarch64 arm riscv64
+FLAVORS= aarch64 arm riscv64 tools
FLAVOR?= arm
COMMENT= U-Boot firmware
@@ -150,6 +150,11 @@ BOARDS=\
BOARDS=\
qemu-riscv64_smode \
sifive_unmatched
+.elif "${FLAVOR}" == "tools"
+WANTLIB += c crypto ssl
+MAKE_FLAGS+= KBUILD_CFLAGS+="-I/usr/include"
+MAKE_FLAGS+= CC="${CC}"
+BOARDS= tools-only
.endif
FILES=\
@@ -169,6 +174,16 @@ FILES=\
spl/sunxi-spl.bin \
spl/u-boot-spl.bin
+TOOLS=\
+ dumpimage \
+ fdtgrep \
+ fit_check_sign \
+ gen_eth_addr \
+ gen_ethaddr_crc \
+ img2srec \
+ mkenvimage \
+ mkimage
+
do-build:
.for BOARD in ${BOARDS}
cd ${WRKSRC} && \
@@ -176,8 +191,11 @@ do-build:
${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
O="build/${BOARD}" \
-f ${MAKE_FILE} "${BOARD}"_defconfig
-.if "${BOARD:M*-rk3399*}"
+.if "${BOARD}" == "tools-only"
cd ${WRKSRC} && \
+ ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
+ O="build/${BOARD}" -f ${MAKE_FILE} ${BOARD}
+.elif "${BOARD:M*-rk3399*}"
${SETENV} ${MAKE_ENV} BL31=${RK3399_BL31} ${MAKE_PROGRAM} \
${MAKE_FLAGS} O="build/${BOARD}" \
-f ${MAKE_FILE} ${ALL_TARGET}
@@ -232,11 +250,17 @@ do-build:
.endfor
do-install:
+.if "${FLAVOR}" == "tools"
+.for f in ${TOOLS}
+ ${INSTALL_PROGRAM} ${WRKSRC}/build/tools-only/tools/${f} ${PREFIX}/bin/
+.endfor
+.else
${INSTALL_DATA_DIR} ${PREFIX}/share/u-boot
.for BOARD in ${BOARDS} ${SUNXI64}
${INSTALL_DATA_DIR} ${PREFIX}/share/u-boot/${BOARD}
-cd ${WRKSRC}/build/${BOARD} && \
cp ${FILES} ${PREFIX}/share/u-boot/${BOARD}/
.endfor
+.endif
.include <bsd.port.mk>
Index: pkg/PFRAG.tools
===================================================================
RCS file: pkg/PFRAG.tools
diff -N pkg/PFRAG.tools
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/PFRAG.tools 1 Mar 2022 14:30:08 -0000
@@ -0,0 +1,9 @@
+@comment $OpenBSD: PLIST,v 1.6 2021/04/28 04:03:28 jsg Exp $
+@bin bin/dumpimage
+@bin bin/fdtgrep
+@bin bin/fit_check_sign
+@bin bin/gen_eth_addr
+@bin bin/gen_ethaddr_crc
+@bin bin/img2srec
+@bin bin/mkenvimage
+@bin bin/mkimage
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/sysutils/u-boot/pkg/PLIST,v
retrieving revision 1.6
diff -u -p -u -r1.6 PLIST
--- pkg/PLIST 28 Apr 2021 04:03:28 -0000 1.6
+++ pkg/PLIST 1 Mar 2022 14:30:08 -0000
@@ -2,3 +2,4 @@
%%aarch64%%
%%arm%%
%%riscv64%%
+%%tools%%
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/u-boot/Makefile,v
retrieving revision 1.90
diff -u -p -u -r1.90 Makefile
--- Makefile 15 Jan 2022 11:56:50 -0000 1.90
+++ Makefile 1 Mar 2022 14:30:07 -0000
@@ -3,7 +3,7 @@
BROKEN-sparc64= Error: the specified option is not accepted in ISB at operand 1 -- isb sy
BROKEN-arm= lib/time.c:187:1: internal compiler error: Bus error
-FLAVORS= aarch64 arm riscv64
+FLAVORS= aarch64 arm riscv64 tools
FLAVOR?= arm
COMMENT= U-Boot firmware
@@ -150,6 +150,11 @@ BOARDS=\
BOARDS=\
qemu-riscv64_smode \
sifive_unmatched
+.elif "${FLAVOR}" == "tools"
+WANTLIB += c crypto ssl
+MAKE_FLAGS+= KBUILD_CFLAGS+="-I/usr/include"
+MAKE_FLAGS+= CC="${CC}"
+BOARDS= tools-only
.endif
FILES=\
@@ -169,6 +174,16 @@ FILES=\
spl/sunxi-spl.bin \
spl/u-boot-spl.bin
+TOOLS=\
+ dumpimage \
+ fdtgrep \
+ fit_check_sign \
+ gen_eth_addr \
+ gen_ethaddr_crc \
+ img2srec \
+ mkenvimage \
+ mkimage
+
do-build:
.for BOARD in ${BOARDS}
cd ${WRKSRC} && \
@@ -176,8 +191,11 @@ do-build:
${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
O="build/${BOARD}" \
-f ${MAKE_FILE} "${BOARD}"_defconfig
-.if "${BOARD:M*-rk3399*}"
+.if "${BOARD}" == "tools-only"
cd ${WRKSRC} && \
+ ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
+ O="build/${BOARD}" -f ${MAKE_FILE} ${BOARD}
+.elif "${BOARD:M*-rk3399*}"
${SETENV} ${MAKE_ENV} BL31=${RK3399_BL31} ${MAKE_PROGRAM} \
${MAKE_FLAGS} O="build/${BOARD}" \
-f ${MAKE_FILE} ${ALL_TARGET}
@@ -232,11 +250,17 @@ do-build:
.endfor
do-install:
+.if "${FLAVOR}" == "tools"
+.for f in ${TOOLS}
+ ${INSTALL_PROGRAM} ${WRKSRC}/build/tools-only/tools/${f} ${PREFIX}/bin/
+.endfor
+.else
${INSTALL_DATA_DIR} ${PREFIX}/share/u-boot
.for BOARD in ${BOARDS} ${SUNXI64}
${INSTALL_DATA_DIR} ${PREFIX}/share/u-boot/${BOARD}
-cd ${WRKSRC}/build/${BOARD} && \
cp ${FILES} ${PREFIX}/share/u-boot/${BOARD}/
.endfor
+.endif
.include <bsd.port.mk>
Index: pkg/PFRAG.tools
===================================================================
RCS file: pkg/PFRAG.tools
diff -N pkg/PFRAG.tools
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/PFRAG.tools 1 Mar 2022 14:30:08 -0000
@@ -0,0 +1,9 @@
+@comment $OpenBSD: PLIST,v 1.6 2021/04/28 04:03:28 jsg Exp $
+@bin bin/dumpimage
+@bin bin/fdtgrep
+@bin bin/fit_check_sign
+@bin bin/gen_eth_addr
+@bin bin/gen_ethaddr_crc
+@bin bin/img2srec
+@bin bin/mkenvimage
+@bin bin/mkimage
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/sysutils/u-boot/pkg/PLIST,v
retrieving revision 1.6
diff -u -p -u -r1.6 PLIST
--- pkg/PLIST 28 Apr 2021 04:03:28 -0000 1.6
+++ pkg/PLIST 1 Mar 2022 14:30:08 -0000
@@ -2,3 +2,4 @@
%%aarch64%%
%%arm%%
%%riscv64%%
+%%tools%%