Lines Matching +full:build +full:- +full:release
2 #-
3 # Copyright (c) 2020-2021 Rubicon Communications, LLC (netgate.com)
4 # Copyright (c) 2013-2019 The FreeBSD Foundation
33 # release.sh: check out source trees, and build release components with
35 # Based on release/generate-release.sh written by Nathan Whitehorn
42 # Prototypes that can be redefined per-chroot or per-target.
48 echo "Usage: $0 [-c release.conf]"
52 # env_setup(): Set up the default build environment variables, such as the
53 # CHROOTDIR, VCSCMD, GITROOT, etc. This is called before the release.conf
54 # file is sourced, if '-c <release.conf>' is specified.
56 # The directory within which the release will be built.
58 if [ -z "${RELENGDIR}" ]; then
64 [ -x "${_dir}/git" ] && VCSCMD="/${_dir}/git"
65 [ ! -z "${VCSCMD}" ] && break 2
68 if [ -z "${VCSCMD}" -a -z "${NOGIT}" ]; then
72 VCSCMD="/usr/local/bin/git clone -q"
87 # non-default settings.
93 # and 'make release'.
94 WORLD_FLAGS="-j$(sysctl -n hw.ncpu)"
95 KERNEL_FLAGS="-j$(( $(( $(sysctl -n hw.ncpu) + 1 )) / 2))"
96 RELEASE_FLAGS="-j$(( $(( $(sysctl -n hw.ncpu) + 1 )) / 2))"
98 MAKE_FLAGS="-s"
100 # The name of the kernel to build, defaults to GENERIC.
103 # Set to non-empty value to disable checkout of doc/ and/or ports/.
106 # Set to non-empty value to disable distributing source tree.
109 # Set to non-empty value to build dvd1.iso as part of the release.
113 # Set to non-empty value to build virtual machine images as part of
114 # the release.
119 # Set to non-empty value to build virtual machine images for various
120 # cloud providers as part of the release.
123 # Set to non-empty to build OCI images as part of the release
129 # env_check(): Perform sanity tests on the build environment, such as ensuring
130 # files/directories exist, as well as adding backwards-compatibility hacks if
132 # in env_setup() if '-c <release.conf>' is specified.
140 if [ -n "${EMBEDDEDBUILD}" ]; then
153 # as variables. The release makefile verifies definedness of the
156 if [ -n "${NOPORTS}" ]; then
159 if [ -n "${NOSRC}" ]; then
163 # The aggregated build-time flags based upon variables defined within
164 # this file, unless overridden by release.conf. In most cases, these
168 if [ -n "${TARGET}" ] && [ -n "${TARGET_ARCH}" ]; then
174 if [ -z "${CHROOTDIR}" ]; then
179 if [ $(id -u) -ne 0 ]; then
185 if [ ! -z "${CHROOTBUILD_SKIP}" -a ! -e ${CHROOTDIR}/bin/sh ]; then
207 # chroot_setup(): Prepare the build chroot environment for the release build.
210 mkdir -p ${CHROOTDIR}/usr
212 if [ -z "${SRC_UPDATE_SKIP}" ]; then
213 if [ -d "${CHROOTDIR}/usr/src/.git" ]; then
214 git -C ${CHROOTDIR}/usr/src pull -q
216 ${VCSCMD} ${SRC} -b ${SRCBRANCH} ${CHROOTDIR}/usr/src
219 if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then
220 if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then
221 git -C ${CHROOTDIR}/usr/ports pull -q
223 ${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports
227 if [ -z "${CHROOTBUILD_SKIP}" ]; then
239 # extra_chroot_setup(): Prepare anything additional within the build
240 # necessary for the release build.
242 mkdir -p ${CHROOTDIR}/dev
243 mount -t devfs devfs ${CHROOTDIR}/dev
244 [ -e /etc/resolv.conf -a ! -e ${CHROOTDIR}/etc/resolv.conf ] && \
246 # Run ldconfig(8) in the chroot directory so /var/run/ld-elf*.so.hints
247 # is created. This is needed by ports-mgmt/pkg.
252 if [ -e ${MAKE_CONF} ] && [ ! -c ${MAKE_CONF} ]; then
253 mkdir -p ${CHROOTDIR}/$(dirname ${MAKE_CONF})
256 if [ -e ${SRC_CONF} ] && [ ! -c ${SRC_CONF} ]; then
257 mkdir -p ${CHROOTDIR}/$(dirname ${SRC_CONF})
262 if [ -z "${NOGIT}" -a -z "${_gitcmd}" ]; then
265 if [ -d ${CHROOTDIR}/usr/ports ]; then
266 # Trick the ports 'run-autotools-fixup' target to do the right
268 _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)
269 REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION)
270 BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH)
271 UNAME_r=${REVISION}-${BRANCH}
283 make -C /usr/ports/devel/git FORCE_PKG_REGISTER=1 \
289 pkg install -y devel/git
291 pkg clean -y
295 if [ ! -z "${WITH_OCIIMAGES}" ]; then
298 if [ -d ${CHROOTDIR}/usr/ports ]; then
299 # Trick the ports 'run-autotools-fixup' target to do the right
301 _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)
302 REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION)
303 BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH)
304 UNAME_r=${REVISION}-${BRANCH}
315 eval chroot ${CHROOTDIR} env ${PBUILD_FLAGS} make -C \
321 pkg install -y sysutils/buildah sysutils/skopeo
323 pkg clean -y
326 # the build directory is on ZFS. The images are small so the
328 …eval chroot ${CHROOTDIR} sed -I .bak -e '/^driver/s/zfs/vfs/' /usr/local/etc/containers/storage.co…
330 eval chroot ${CHROOTDIR} buildah rmi -af
333 if [ ! -z "${EMBEDDEDPORTS}" ]; then
334 _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)
335 REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION)
336 BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH)
337 UNAME_r=${REVISION}-${BRANCH}
344 eval chroot ${CHROOTDIR} env ${PBUILD_FLAGS} make -C \
355 # chroot_build_target(): Build the userland and kernel for the build target.
358 if [ ! -z "${EMBEDDEDBUILD}" ]; then
366 eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_WMAKEFLAGS} buildworld
367 eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_KMAKEFLAGS} buildkernel
368 if [ ! -z "${WITH_OCIIMAGES}" ]; then
369 eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_WMAKEFLAGS} packages
375 # chroot_build_release(): Invoke the 'make release' target.
378 if [ ! -z "${WITH_VMIMAGES}" ]; then
379 if [ -z "${VMFORMATS}" ]; then
381 make -C /usr/src/release -V VMFORMATS)"
383 if [ -z "${VMSIZE}" ]; then
385 make -C /usr/src/release ${ARCH_FLAGS} -V VMSIZE)"
390 eval chroot ${CHROOTDIR} make -C /usr/src/release \
391 ${RELEASE_RMAKEFLAGS} release
392 eval chroot ${CHROOTDIR} make -C /usr/src/release \
423 if [ -e "${RELENGDIR}/tools/arm.subr" ]; then
430 [ ! -z "${RELEASECONF}" ] && . "${RELEASECONF}"
434 eval chroot ${CHROOTDIR} env WITH_UNIFIED_OBJDIR=1 make ${MAKE_FLAGS} -C /usr/src/release obj
435 export WORLDDIR="$(eval chroot ${CHROOTDIR} make ${MAKE_FLAGS} -C /usr/src/release -V WORLDDIR)"
436 …l chroot ${CHROOTDIR} env WITH_UNIFIED_OBJDIR=1 make ${MAKE_FLAGS} -C /usr/src/release -V .OBJDIR)"
439 export OSRELEASE="$(eval chroot ${CHROOTDIR} make ${MAKE_FLAGS} -C /usr/src/release \
441 -V OSRELEASE)"
442 chroot ${CHROOTDIR} mkdir -p ${DESTDIR}
443 chroot ${CHROOTDIR} truncate -s ${IMAGE_SIZE} ${IMGBASE##${CHROOTDIR}}
445 mdconfig -f ${IMGBASE##${CHROOTDIR}} ${MD_ARGS})
450 mdconfig -d -u ${mddev}
452 mv ${IMGBASE} ${CHROOTDIR}/${OBJDIR}/${OSRELEASE}-${BOARDNAME}.img
453 chroot ${CHROOTDIR} mkdir -p /R
454 chroot ${CHROOTDIR} cp -p ${OBJDIR}/${OSRELEASE}-${BOARDNAME}.img \
455 /R/${OSRELEASE}-${BOARDNAME}.img
456 chroot ${CHROOTDIR} xz -T ${XZ_THREADS} /R/${OSRELEASE}-${BOARDNAME}.img
467 set -e # Everything must succeed
479 shift $(($OPTIND - 1))
480 if [ ! -z "${RELEASECONF}" ]; then
481 if [ -e "${RELEASECONF}" ]; then
485 echo "Using default build environment."