2013-12-28 03:27:06 +01:00
|
|
|
#!/bin/sh
|
Merge ^/projects/release-embedded into ^/head.
After several months of testing and fixing (and breaking)
various parts of release/release.sh changes, it is now
possible to build FreeBSD/arm images as part of the release
process.
When EMBEDDEDBUILD is set in the release.conf file, release.sh
will create the build environment, then run a separate script
in release/${XDEV}/release.sh [1]. Currently, only arm is
supported.
The release/${XDEV}/release.sh configures the build environment
specific for the target image, such as installing gcc(1),
installing additional third-party software from the ports tree,
and fetching external sources.
Once the build environment is set up, release/${XDEV}/release.sh
runs Crochet, written by Tim Kientzle, which builds the userland
and kernel, and creates an image that can be written to an SD
card with dd(1). Many thanks to Tim for his work on Crochet.
Sample configurations for FreeBSD/arm boards are in the
release/arm/ directory, and Crochet configuration files for each
board are located in release/tools/arm/. Supported boards at this
time are: BEAGLEBONE, PANDABOARD, RPI-B, and WANDBOARD-QUAD.
Adding support for additional boards will continue in the
projects/release-embedded/ branch, and incrementally merged back
to head/.
Many thanks to the FreeBSD Foundation for the support and
sponsorship of this project.
[1] XDEV is used in order to keep the various configurations
organized by architecture, but since TARGET and TARGET_ARCH
are used to build the chroot, the values of those variables
cannot be used.
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
2014-03-06 00:17:53 +01:00
|
|
|
#-
|
|
|
|
# Copyright (c) 2013, 2014 The FreeBSD Foundation
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This software was developed by Glen Barber
|
|
|
|
# under sponsorship from the FreeBSD Foundation.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
# SUCH DAMAGE.
|
2013-12-28 03:27:06 +01:00
|
|
|
#
|
|
|
|
# $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
|
|
|
|
|
2014-01-24 23:12:59 +01:00
|
|
|
before_build() {
|
Merge the following:
^/user/gjb/hacking/release-embedded:
259994,260000,260895-260896,261139,261152,
261174,261176,261210,261221,261237,261239,
261448,261489
^/user/gjb/release-embedded:
262305,262307
svn:mergeinfo is intentionally not included in the commit, so it does
not propagate to head/.
Sponsored by: The FreeBSD Foundation
2014-02-22 00:18:35 +01:00
|
|
|
WANT_UBOOT=
|
|
|
|
KNOWNHASH=
|
|
|
|
UBOOT_VERSION=
|
2014-01-24 23:12:59 +01:00
|
|
|
case ${KERNEL} in
|
|
|
|
BEAGLEBONE)
|
Merge the following:
^/user/gjb/hacking/release-embedded:
259994,260000,260895-260896,261139,261152,
261174,261176,261210,261221,261237,261239,
261448,261489
^/user/gjb/release-embedded:
262305,262307
svn:mergeinfo is intentionally not included in the commit, so it does
not propagate to head/.
Sponsored by: The FreeBSD Foundation
2014-02-22 00:18:35 +01:00
|
|
|
WANT_UBOOT=1
|
2014-01-24 23:12:59 +01:00
|
|
|
KNOWNHASH="4150e5a4480707c55a8d5b4570262e43af68d8ed3bdc0a433d8e7df47989a69e"
|
Merge the following:
^/user/gjb/hacking/release-embedded:
259994,260000,260895-260896,261139,261152,
261174,261176,261210,261221,261237,261239,
261448,261489
^/user/gjb/release-embedded:
262305,262307
svn:mergeinfo is intentionally not included in the commit, so it does
not propagate to head/.
Sponsored by: The FreeBSD Foundation
2014-02-22 00:18:35 +01:00
|
|
|
UBOOT_VERSION="u-boot-2013.04"
|
2014-01-24 23:12:59 +01:00
|
|
|
;;
|
2014-01-28 04:09:57 +01:00
|
|
|
PANDABOARD)
|
Merge the following:
^/user/gjb/hacking/release-embedded:
259994,260000,260895-260896,261139,261152,
261174,261176,261210,261221,261237,261239,
261448,261489
^/user/gjb/release-embedded:
262305,262307
svn:mergeinfo is intentionally not included in the commit, so it does
not propagate to head/.
Sponsored by: The FreeBSD Foundation
2014-02-22 00:18:35 +01:00
|
|
|
WANT_UBOOT=1
|
2014-01-28 04:09:57 +01:00
|
|
|
KNOWNHASH="e08e20a6979bfca6eebb9a2b0e42aa4416af3d796332fd63a3470495a089d496"
|
Merge the following:
^/user/gjb/hacking/release-embedded:
259994,260000,260895-260896,261139,261152,
261174,261176,261210,261221,261237,261239,
261448,261489
^/user/gjb/release-embedded:
262305,262307
svn:mergeinfo is intentionally not included in the commit, so it does
not propagate to head/.
Sponsored by: The FreeBSD Foundation
2014-02-22 00:18:35 +01:00
|
|
|
UBOOT_VERSION="u-boot-2012.07"
|
|
|
|
;;
|
|
|
|
WANDBOARD-QUAD)
|
|
|
|
WANT_UBOOT=1
|
|
|
|
KNOWNHASH="0d71e62beb952b41ebafb20a7ee4df2f960db64c31b054721ceb79ff14014c55"
|
|
|
|
UBOOT_VERSION="u-boot-2013.10"
|
2014-01-28 04:09:57 +01:00
|
|
|
;;
|
2014-01-24 23:12:59 +01:00
|
|
|
*)
|
|
|
|
# Fallthrough.
|
|
|
|
;;
|
|
|
|
esac
|
Merge the following:
^/user/gjb/hacking/release-embedded:
259994,260000,260895-260896,261139,261152,
261174,261176,261210,261221,261237,261239,
261448,261489
^/user/gjb/release-embedded:
262305,262307
svn:mergeinfo is intentionally not included in the commit, so it does
not propagate to head/.
Sponsored by: The FreeBSD Foundation
2014-02-22 00:18:35 +01:00
|
|
|
if [ ! -z ${WANT_UBOOT} ]; then
|
|
|
|
chroot ${CHROOTDIR} fetch -o /tmp/crochet/${UBOOT_VERSION}.tar.bz2 \
|
|
|
|
http://people.freebsd.org/~gjb/${UBOOT_VERSION}.tar.bz2
|
|
|
|
UBOOT_HASH="$(sha256 -q ${CHROOTDIR}/tmp/crochet/${UBOOT_VERSION}.tar.bz2)"
|
|
|
|
if [ "${UBOOT_HASH}" != "${KNOWNHASH}" ]; then
|
|
|
|
echo "Checksum mismatch! Exiting now."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
chroot ${CHROOTDIR} tar xf /tmp/crochet/${UBOOT_VERSION}.tar.bz2 \
|
|
|
|
-C /tmp/crochet/
|
|
|
|
fi
|
2014-01-24 23:12:59 +01:00
|
|
|
}
|
|
|
|
|
2013-12-28 03:27:06 +01:00
|
|
|
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.
|
Merge ^/projects/release-embedded into ^/head.
After several months of testing and fixing (and breaking)
various parts of release/release.sh changes, it is now
possible to build FreeBSD/arm images as part of the release
process.
When EMBEDDEDBUILD is set in the release.conf file, release.sh
will create the build environment, then run a separate script
in release/${XDEV}/release.sh [1]. Currently, only arm is
supported.
The release/${XDEV}/release.sh configures the build environment
specific for the target image, such as installing gcc(1),
installing additional third-party software from the ports tree,
and fetching external sources.
Once the build environment is set up, release/${XDEV}/release.sh
runs Crochet, written by Tim Kientzle, which builds the userland
and kernel, and creates an image that can be written to an SD
card with dd(1). Many thanks to Tim for his work on Crochet.
Sample configurations for FreeBSD/arm boards are in the
release/arm/ directory, and Crochet configuration files for each
board are located in release/tools/arm/. Supported boards at this
time are: BEAGLEBONE, PANDABOARD, RPI-B, and WANDBOARD-QUAD.
Adding support for additional boards will continue in the
projects/release-embedded/ branch, and incrementally merged back
to head/.
Many thanks to the FreeBSD Foundation for the support and
sponsorship of this project.
[1] XDEV is used in order to keep the various configurations
organized by architecture, but since TARGET and TARGET_ARCH
are used to build the chroot, the values of those variables
cannot be used.
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
2014-03-06 00:17:53 +01:00
|
|
|
if [ -n "${UBOOTSRC}" ]; then
|
2013-12-28 03:27:06 +01:00
|
|
|
continue
|
|
|
|
else
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
chroot ${CHROOTDIR} svn co -q ${UBOOTSRC}/${UBOOTBRANCH} \
|
|
|
|
/${UBOOTDIR}
|
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
2014-01-26 02:27:53 +01:00
|
|
|
# Build gcc for use in the chroot for arm builds.
|
2014-02-04 17:18:38 +01:00
|
|
|
# This is not '-j'-safe, so force '-j1' to allow using
|
|
|
|
# additional, non-'-j' options specified in WORLD_FLAGS.
|
2014-01-26 02:27:53 +01:00
|
|
|
eval chroot ${CHROOTDIR} make -C /usr/src/gnu/usr.bin/cc \
|
2014-02-04 17:18:38 +01:00
|
|
|
WITH_GCC=1 ${WORLD_FLAGS} -j1 obj depend all install
|
2013-12-28 03:27:06 +01:00
|
|
|
# Build the 'xdev' target for crochet.
|
|
|
|
eval chroot ${CHROOTDIR} make -C /usr/src \
|
2014-02-04 17:18:38 +01:00
|
|
|
XDEV=${XDEV} XDEV_ARCH=${XDEV_ARCH} WITH_GCC=1 \
|
|
|
|
${WORLD_FLAGS} xdev
|
2013-12-28 03:27:06 +01:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2014-01-24 23:12:59 +01:00
|
|
|
mkdir -p ${CHROOTDIR}/tmp/crochet/work
|
|
|
|
before_build
|
2013-12-28 03:27:06 +01:00
|
|
|
install_crochet
|
|
|
|
install_uboot
|
|
|
|
eval chroot ${CHROOTDIR} /bin/sh /tmp/crochet/crochet.sh \
|
2014-01-19 23:25:57 +01:00
|
|
|
-c /tmp/external/${XDEV}/crochet-${KERNEL}.conf
|
2014-01-27 14:28:55 +01:00
|
|
|
mkdir -p ${CHROOTDIR}/R/
|
|
|
|
cp -p ${CHROOTDIR}/usr/obj/*.img ${CHROOTDIR}/R/
|
2014-01-28 18:23:44 +01:00
|
|
|
bzip2 ${CHROOTDIR}/R/FreeBSD*.img
|
|
|
|
cd ${CHROOTDIR}/R/ && sha256 FreeBSD*.img.bz2 > CHECKSUM.SHA256
|
|
|
|
cd ${CHROOTDIR}/R/ && md5 FreeBSD*.img.bz2 > CHECKSUM.MD5
|
2013-12-28 03:27:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|
|
|
|
exit 0
|