When bootstrapping the build chroot, the default environment is

set up for the amd64/amd64 TARGET/TARGET_ARCH combination.

Some of the build tools used here (u-boot in particular) require
use of gcc(1).  The lang/gcc* from ports/ will install as 'gccNN'
instead of 'gcc', so they cannot be used without extra hacks.

Add an EMBEDDED_WORLD_FLAGS variable to be used to properly set
up the build chroot.  For the RPI-B case, EMBEDDED_WORLD_FLAGS
is set to 'WITH_GCC=1', which is used to set up the build chroot.

While here, in followup to r260895, do not rely on the necessary
configuration files and/or scripts to exist in the build target
src/ tree.

To work around cases where files do not exist, copy (from the
local release/ checkout) the tools/${XDEV}/crochet-${KERNEL}.conf
to ${CHROOTDIR}/tmp/external/crochet-${KERNEL}.conf to make them
accessible to the external utilities that need them (i.e., crochet).

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Glen Barber 2014-01-19 22:25:57 +00:00
parent 37c587b8a1
commit b479fd538c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/user/gjb/hacking/release-embedded/; revision=260896
4 changed files with 25 additions and 6 deletions

View file

@ -17,6 +17,7 @@ SVNROOT="svn://svn.FreeBSD.org"
SRCBRANCH="base/head@rHEAD"
DOCBRANCH="doc/head@rHEAD"
PORTBRANCH="ports/head@rHEAD"
EMBEDDED_WORLD_FLAGS="WITH_GCC=1"
NODOC=yes
# Build target configuration

View file

@ -50,7 +50,7 @@ main() {
install_uboot
mkdir -p ${CHROOTDIR}/tmp/crochet/work
eval chroot ${CHROOTDIR} /bin/sh /tmp/crochet/crochet.sh \
-c /usr/src/tools/release/${XDEV}/crochet-${KERNEL}.conf
-c /tmp/external/${XDEV}/crochet-${KERNEL}.conf
}
main "$@"

View file

@ -40,3 +40,11 @@ PORTBRANCH="ports/head@rHEAD"
#NOPORTS=
#RELSTRING=
#WITH_DVD=
## Set when building embedded images.
#EMBEDDEDBUILD=
## Set to specify userland-specific make(1) flags that affect the
## build chroot environment.
#EMBEDDED_WORLD_FLAGS=""

View file

@ -37,6 +37,7 @@ export PATH
# The directory within which the release will be built.
CHROOTDIR="/scratch"
RELENGDIR="$(realpath $(dirname $(basename ${0})))"
# The default svn checkout server, and svn branches for src/, doc/,
# and ports/.
@ -47,6 +48,7 @@ PORTBRANCH="ports/head@rHEAD"
# Set for embedded device builds.
EMBEDDEDBUILD=
EMBEDDED_WORLD_FLAGS=
# Sometimes one needs to checkout src with --force svn option.
# If custom kernel configs copied to src tree before checkout, e.g.
@ -135,9 +137,9 @@ else
ARCH_FLAGS=
fi
CHROOT_MAKEENV="MAKEOBJDIRPREFIX=${CHROOTDIR}/tmp/obj"
CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES}"
CHROOT_IMAKEFLAGS="${CONF_FILES}"
CHROOT_DMAKEFLAGS="${CONF_FILES}"
CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES} ${EMBEDDED_WORLD_FLAGS}"
CHROOT_IMAKEFLAGS="${CONF_FILES} ${EMBEDDED_WORLD_FLAGS}"
CHROOT_DMAKEFLAGS="${CONF_FILES} ${EMBEDDED_WORLD_FLAGS}"
RELEASE_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${ARCH_FLAGS} ${CONF_FILES}"
RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} KERNCONF=\"${KERNEL}\" ${ARCH_FLAGS} ${CONF_FILES}"
RELEASE_RMAKEFLAGS="${ARCH_FLAGS} KERNCONF=\"${KERNEL}\" ${CONF_FILES} \
@ -194,8 +196,16 @@ fi
# Embedded builds do not use the 'make release' target.
if [ "X${EMBEDDEDBUILD}" != "X" ]; then
if [ -e ${CHROOTDIR}/usr/src/release/${XDEV}/release.sh ]; then
/bin/sh ${CHROOTDIR}/usr/src/release/${XDEV}/release.sh
# If a crochet configuration file exists in *this* checkout of
# release/, copy it to the /tmp/external directory within the chroot.
# This allows building embedded releases without relying on updated
# scripts and/or configurations to exist in the branch being built.
if [ -e ${RELENGDIR}/tools/${XDEV}/crochet-${KERNEL}.conf ] && \
[ -e ${RELENGDIR}/${XDEV}/release.sh ]; then
mkdir -p ${CHROOTDIR}/tmp/external/${XDEV}/
cp ${RELENGDIR}/tools/${XDEV}/crochet-${KERNEL}.conf \
${CHROOTDIR}/tmp/external/${XDEV}/crochet-${KERNEL}.conf
/bin/sh ${RELENGDIR}/${XDEV}/release.sh
fi
# If the script does not exist for this architecture, exit.
# This probably should be checked earlier, but allowing the rest