Implement cross build support for embedded devices into
release.sh: - Modify release/release.sh to recognize an 'EMBEDDEDBUILD' variable. When set, release/release.sh will build the chroot userland as is done for big-iron builds. - Instead of running the 'buildworld', 'buildkernel', and 'release' targets in the chroot, a separate script is run. The script tools/release/${XDEV}/release.sh sets up the rest of the chroot workspace, such as installing ports that will be needed, and building the 'xdev' target. - crochet (by kientzle@) is checked out from the upstream repository (and if needed, u-boot, in the case of Raspberry Pi). - tools/release/${XDEV}/release.sh then runs crochet with a configuration file specific to the ${KERNCONF} being built. Note that this is effectively a first-pass attempt to integrate this into the release process. Tested against: head@r259961 Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
df5e2cbe16
commit
34d63eb560
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/user/gjb/hacking/release-embedded/; revision=259994
37
release/arm/RPI-B.conf
Normal file
37
release/arm/RPI-B.conf
Normal file
@ -0,0 +1,37 @@
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
# This is only supported on amd64 right now. It may work on
|
||||
# i386, but I do not have the hardware to test, so until I get
|
||||
# a VM set up to make sure, be cautious and assume it will not.
|
||||
if [ "$(uname -p)" != "amd64" ] || [ "$(uname -m)" != "amd64" ]; then
|
||||
echo "This is only supported on amd64 right now."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Build chroot configuration
|
||||
TARGET="amd64"
|
||||
TARGET_ARCH="amd64"
|
||||
SVNROOT="svn://svn.FreeBSD.org"
|
||||
SRCBRANCH="base/head@rHEAD"
|
||||
DOCBRANCH="doc/head@rHEAD"
|
||||
PORTBRANCH="ports/head@rHEAD"
|
||||
NODOC=yes
|
||||
|
||||
# Build target configuration
|
||||
# Since this file is sourced by a script that runs another
|
||||
# script, these must be exported.
|
||||
set -a
|
||||
CHROOTDIR="/scratch"
|
||||
EMBEDDEDBUILD=1
|
||||
EMBEDDEDPORTS="lang/python textproc/gsed"
|
||||
XDEV="arm"
|
||||
XDEV_ARCH="arm"
|
||||
KERNEL="RPI-B"
|
||||
CROCHETSRC="https://github.com/kientzle/crochet-freebsd"
|
||||
CROCHETBRANCH="trunk"
|
||||
UBOOTSRC="https://github.com/gonzoua/u-boot-pi"
|
||||
UBOOTBRANCH="trunk"
|
||||
UBOOTDIR="/tmp/crochet/u-boot-rpi"
|
||||
set +a
|
57
release/arm/release.sh
Executable file
57
release/arm/release.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
# This script is intended to be called by release/release.sh to build ARM
|
||||
# images for release. It is not intended to be run directly. This sets up
|
||||
# the software needed within a build chroot, then runs crochet to provide
|
||||
# downloadable images for embedded devices.
|
||||
|
||||
set -e
|
||||
|
||||
install_crochet() {
|
||||
chroot ${CHROOTDIR} svn co -q ${CROCHETSRC}/${CROCHETBRANCH} \
|
||||
/tmp/crochet
|
||||
}
|
||||
|
||||
install_uboot() {
|
||||
# Only fetch u-boot sources if UBOOTSRC is set; otherwise it is
|
||||
# not needed.
|
||||
if [ "X${UBOOTSRC}" != "X" ]; then
|
||||
continue
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
chroot ${CHROOTDIR} svn co -q ${UBOOTSRC}/${UBOOTBRANCH} \
|
||||
/${UBOOTDIR}
|
||||
}
|
||||
|
||||
main() {
|
||||
# Build the 'xdev' target for crochet.
|
||||
eval chroot ${CHROOTDIR} make -C /usr/src \
|
||||
XDEV=${XDEV} XDEV_ARCH=${XDEV_ARCH} WITH_GCC=1 xdev
|
||||
|
||||
# Run the ldconfig(8) startup script so /var/run/ld-elf*.so.hints
|
||||
# is created.
|
||||
eval chroot ${CHROOTDIR} /etc/rc.d/ldconfig forcerestart
|
||||
# Install security/ca_root_nss since we need to check the https
|
||||
# certificate of github.
|
||||
eval chroot ${CHROOTDIR} make -C /usr/ports/security/ca_root_nss \
|
||||
OPTIONS_SET="ETCSYMLINK" BATCH=1 FORCE_PKG_REGISTER=1 \
|
||||
install clean distclean
|
||||
EMBEDDEDPORTS="${EMBEDDEDPORTS} devel/subversion"
|
||||
for _PORT in ${EMBEDDEDPORTS}; do
|
||||
eval chroot ${CHROOTDIR} make -C /usr/ports/${_PORT} \
|
||||
BATCH=1 FORCE_PKG_REGISTER=1 install clean distclean
|
||||
done
|
||||
|
||||
install_crochet
|
||||
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
|
||||
}
|
||||
|
||||
main "$@"
|
||||
exit 0
|
@ -45,6 +45,9 @@ SRCBRANCH="base/head@rHEAD"
|
||||
DOCBRANCH="doc/head@rHEAD"
|
||||
PORTBRANCH="ports/head@rHEAD"
|
||||
|
||||
# Set for embedded device builds.
|
||||
EMBEDDEDBUILD=
|
||||
|
||||
# Sometimes one needs to checkout src with --force svn option.
|
||||
# If custom kernel configs copied to src tree before checkout, e.g.
|
||||
SRC_FORCE_CHECKOUT=
|
||||
@ -98,6 +101,11 @@ while getopts c: opt; do
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
if [ "x${EMBEDDEDBUILD}" != "x" ]; then
|
||||
WITH_DVD=
|
||||
NODOC=yes
|
||||
fi
|
||||
|
||||
# If PORTS is set and NODOC is unset, force NODOC=yes because the ports tree
|
||||
# is required to build the documentation set.
|
||||
if [ "x${NOPORTS}" != "x" ] && [ "x${NODOC}" = "x" ]; then
|
||||
@ -184,6 +192,21 @@ if [ -e ${SRC_CONF} ] && [ ! -c ${SRC_CONF} ]; then
|
||||
cp ${SRC_CONF} ${CHROOTDIR}/${SRC_CONF}
|
||||
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
|
||||
fi
|
||||
# If the script does not exist for this architecture, exit.
|
||||
# This probably should be checked earlier, but allowing the rest
|
||||
# of the build process to get this far will at least set up the
|
||||
# chroot environment for testing.
|
||||
exit 0
|
||||
else
|
||||
# Not embedded.
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -d ${CHROOTDIR}/usr/ports ]; then
|
||||
# Run ldconfig(8) in the chroot directory so /var/run/ld-elf*.so.hints
|
||||
# is created. This is needed by ports-mgmt/pkg.
|
||||
|
29
tools/release/arm/crochet-RPI-B.conf
Normal file
29
tools/release/arm/crochet-RPI-B.conf
Normal file
@ -0,0 +1,29 @@
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
# This is the configuration file for use with crochet to produce
|
||||
# FreeBSD Raspberry Pi images.
|
||||
|
||||
board_setup RaspberryPi
|
||||
#option UsrPorts
|
||||
#option UsrSrc
|
||||
# 4GB
|
||||
option ImageSize 3900mb
|
||||
|
||||
export MAKEOBJDIRPREFIX=/usr/obj
|
||||
FREEBSD_SRC=/usr/src
|
||||
__MAKE_CONF=/dev/null
|
||||
SRCCONF=/dev/null
|
||||
WORKDIR=/usr/obj
|
||||
_BRANCH=$(make -C ${FREEBSD_SRC}/release -V BRANCH)
|
||||
_REVISION=$(make -C ${FREEBSD_SRC}/release -V REVISION)
|
||||
KERNCONF=RPI-B
|
||||
FREEBSD_BUILDWORLD_EXTRA_ARGS=""
|
||||
FREEBSD_INSTALLWORLD_EXTRA_ARGS=""
|
||||
FREEBSD_BUILDKERNEL_EXTRA_ARGS=""
|
||||
FREEBSD_INSTALLKERNEL_EXTRA_ARGS=""
|
||||
FREEBSD_WORLD_EXTRA_ARGS=""
|
||||
FREEBSD_KERNEL_EXTRA_ARGS=""
|
||||
FREEBSD_EXTRA_ARGS=""
|
||||
IMG=${WORKDIR}/FreeBSD-${_REVISION}-${_BRANCH}-${KERNCONF}.img
|
Loading…
Reference in New Issue
Block a user