summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorbrook <brook@NetBSD.org>2022-08-21 15:01:08 +0000
committerbrook <brook@NetBSD.org>2022-08-21 15:01:08 +0000
commit682ebb1c17947bed680c55cc7c8c19b751e3844e (patch)
treef03a4f696ddb6f3ef9ba7c2ed49bece636f5c896 /etc
parent4fdb353dce4e460ce4fe0ee91ab30e90ee49d8df (diff)
Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg.
Release builds for arm platforms create compressed images in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. However, in some cases, e.g., armv7.img.gz, they are not bootable. Consequently, boot blocks must be manually installed in the images, which is an extra barrier for testing systems or adopting NetBSD. This has prompted creation of external repositories, e.g., armbsd.org, to host a collection of bootable images. However, this does not ease the burden on developers compiling their own systems; for them, manual installation of boot blocks is still required. For arm platforms, etc/etc.evbarm/Makefile.inc contains the commands used to create system images. Because installboot(8) can write boot blocks directly to system images, a loop through possible boards can create a series of bootable images during the normal build process. In the case of many arm platforms, installboot(8) uses U-Boot boot blocks, which are not part of the NetBSD source code. Developers can, however, install as many U-Boot boot blocks as desired, either in the default location of /usr/pkg/share/u-boot or in a set of directories pointed to by the U-Boot search path, the INSTALLBOOT_UBOOT_PATHS environment variable. For each board with an available boot block, a board-specific bootable image will be created in ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/gzimg. If a boot block is not available, which is the typical situation currently, no additional image will be created. This facility creates opportunities to build bootable images for any number of boards within the scope of a standard release build. However, that is not required and will not occur without the intervention of installing U-Boot boot blocks prior to the build.
Diffstat (limited to 'etc')
-rw-r--r--etc/etc.evbarm/Makefile.inc22
1 files changed, 21 insertions, 1 deletions
diff --git a/etc/etc.evbarm/Makefile.inc b/etc/etc.evbarm/Makefile.inc
index 3f71de8bf16..4c0372916d6 100644
--- a/etc/etc.evbarm/Makefile.inc
+++ b/etc/etc.evbarm/Makefile.inc
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.126 2022/05/20 16:12:34 rin Exp $
+# $NetBSD: Makefile.inc,v 1.127 2022/08/21 15:01:08 brook Exp $
#
# etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
#
@@ -92,6 +92,15 @@ IMAGE.dir= ${IMAGE.rel}/binary/gzimg
IMAGE.kern= ${IMAGE.rel}/binary/kernel
IMAGE.instk= ${IMAGE.rel}/installation/instkernel
+# list of boards supported by installboot(8); a bootable image will be
+# created for each (if the corresponding U-Boot package is installed
+# in one of the directories listed in the environment variable
+# INSTALLBOOT_UBOOT_PATHS)
+#
+INSTALLBOOT_BOARDS!= \
+ ${TOOL_INSTALLBOOT} -m ${MACHINE} 2>&1 \
+ | ${TOOL_AWK} 'BEGIN { FS=" " } { if (BOARDS) print $$1 } /^Known boards/{ BOARDS=1 }'
+
__mkimage: .USE
TOOL_MAKE=${MAKE} \
TOOL_MAKEFS=${TOOL_MAKEFS} \
@@ -110,6 +119,17 @@ __mkimage: .USE
${HOST_SH} ${MKIMAGE} -x -h ${.TARGET:S/smp_//} -D ${DESTDIR} \
-S ${NETBSDSRCDIR} -B ${IMAGEENDIAN} ${MKI_OPTS.${.TARGET}} \
${IMAGE.dir}/${.TARGET:S/smp_//}.img.gz
+ ${TOOL_GZIP} -cd ${IMAGE.dir}/${.TARGET:S/smp_//}.img.gz \
+ > ${IMAGE.dir}/${.TARGET:S/smp_//}.img
+.for f in ${INSTALLBOOT_BOARDS}
+ @echo "===> Making bootable image ${IMAGE.dir:T}/${.TARGET:S/smp_//}-${f}.img.gz"
+ @cp ${IMAGE.dir}/${.TARGET:S/smp_//}.img ${IMAGE.dir}/${.TARGET:S/smp_//}-${f}.img
+ @${TOOL_INSTALLBOOT} -m ${MACHINE} -o board=${f} \
+ ${IMAGE.dir}/${.TARGET:S/smp_//}-${f}.img \
+ && ${TOOL_GZIP} -f ${IMAGE.dir}/${.TARGET:S/smp_//}-${f}.img \
+ || rm ${IMAGE.dir}/${.TARGET:S/smp_//}-${f}.img
+.endfor
+ rm ${IMAGE.dir}/${.TARGET:S/smp_//}.img
ARCHES.earmv4= armv4
ARCHES.earmv4eb= armv4