Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Create bootable images in ${RELEASEDIR}/${RELEASEMACHINEDIR}...



details:   https://anonhg.NetBSD.org/src/rev/2b96304285c4
branches:  trunk
changeset: 369561:2b96304285c4
user:      brook <brook%NetBSD.org@localhost>
date:      Sun Aug 21 15:01:08 2022 +0000

description:
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:

 BUILDING                    |   7 +++++++
 etc/etc.evbarm/Makefile.inc |  22 +++++++++++++++++++++-
 share/man/man7/release.7    |  12 +++++++++++-
 3 files changed, 39 insertions(+), 2 deletions(-)

diffs (86 lines):

diff -r 7d4710186bdd -r 2b96304285c4 BUILDING
--- a/BUILDING  Sun Aug 21 14:42:24 2022 +0000
+++ b/BUILDING  Sun Aug 21 15:01:08 2022 +0000
@@ -153,6 +153,13 @@
                        cannot usefully be set inside a Makefile, including
                        mk.conf or ${MAKECONF}.
 
+     INSTALLBOOT_UBOOT_PATHS
+                       A colon-separated list of search paths used by
+                       installboot to find U-Boot packages; see
+                       installboot(8).  If appropriate U-Boot packages
+                       are installed, bootable images are created as
+                       part of a release.
+
    "make" variables
      Several variables control the behavior of NetBSD builds.  Unless
      otherwise specified, these variables may be set in either the process
diff -r 7d4710186bdd -r 2b96304285c4 etc/etc.evbarm/Makefile.inc
--- a/etc/etc.evbarm/Makefile.inc       Sun Aug 21 14:42:24 2022 +0000
+++ b/etc/etc.evbarm/Makefile.inc       Sun Aug 21 15:01:08 2022 +0000
@@ -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.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 @@
        ${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
diff -r 7d4710186bdd -r 2b96304285c4 share/man/man7/release.7
--- a/share/man/man7/release.7  Sun Aug 21 14:42:24 2022 +0000
+++ b/share/man/man7/release.7  Sun Aug 21 15:01:08 2022 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: release.7,v 1.39 2020/07/13 07:26:27 jruoho Exp $
+.\"    $NetBSD: release.7,v 1.40 2022/08/21 15:01:08 brook Exp $
 .\"
 .\" Copyright (c) 1997, 2000, 2005 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -261,6 +261,16 @@
 .It Sy binary/
 system binaries
 .Bl -tag -width "SHA512/"
+.It Sy gzimg/
+compressed system images
+.Bl -tag -width "xserver.tgz"
+.It Ao Em machine Ac Ns Pa .tar.gz
+The primary system image on those platforms that provide them.  These
+images may not be bootable.
+.It Ao Em machine Ac Ns Pa - Ns Ao Em board Ac Ns Pa .tar.gz
+A bootable system image for a particular board, on platforms that
+provide them.
+.El
 .It Sy sets/
 installation sets
 .Bl -tag -width "xserver.tgz"



Home | Main Index | Thread Index | Old Index