3 # Copyright (c) 2013, 2014 The FreeBSD Foundation
6 # This software was developed by Glen Barber
7 # under sponsorship from the FreeBSD Foundation.
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
18 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 # This script is intended to be called by release/release.sh to build ARM
34 # images for release. It is not intended to be run directly. This sets up
35 # the software needed within a build chroot, then runs crochet to provide
36 # downloadable images for embedded devices.
47 KNOWNHASH="4150e5a4480707c55a8d5b4570262e43af68d8ed3bdc0a433d8e7df47989a69e"
48 UBOOT_VERSION="u-boot-2013.04"
52 KNOWNHASH="e08e20a6979bfca6eebb9a2b0e42aa4416af3d796332fd63a3470495a089d496"
53 UBOOT_VERSION="u-boot-2012.07"
57 KNOWNHASH="0d71e62beb952b41ebafb20a7ee4df2f960db64c31b054721ceb79ff14014c55"
58 UBOOT_VERSION="u-boot-2013.10"
64 if [ ! -z ${WANT_UBOOT} ]; then
65 chroot ${CHROOTDIR} fetch -o /tmp/crochet/${UBOOT_VERSION}.tar.bz2 \
66 http://people.freebsd.org/~gjb/${UBOOT_VERSION}.tar.bz2
67 UBOOT_HASH="$(sha256 -q ${CHROOTDIR}/tmp/crochet/${UBOOT_VERSION}.tar.bz2)"
68 if [ "${UBOOT_HASH}" != "${KNOWNHASH}" ]; then
69 echo "Checksum mismatch! Exiting now."
72 chroot ${CHROOTDIR} tar xf /tmp/crochet/${UBOOT_VERSION}.tar.bz2 \
78 chroot ${CHROOTDIR} svn co -q ${CROCHETSRC}/${CROCHETBRANCH} \
83 # Only fetch u-boot sources if UBOOTSRC is set; otherwise it is
85 if [ -n "${UBOOTSRC}" ]; then
90 chroot ${CHROOTDIR} svn co -q ${UBOOTSRC}/${UBOOTBRANCH} \
95 # Build gcc for use in the chroot for arm builds.
96 # This is not '-j'-safe, so force '-j1' to allow using
97 # additional, non-'-j' options specified in WORLD_FLAGS.
98 eval chroot ${CHROOTDIR} make -C /usr/src/gnu/usr.bin/cc \
99 WITH_GCC=1 ${WORLD_FLAGS} -j1 obj depend all install
100 # Build the 'xdev' target for crochet.
101 eval chroot ${CHROOTDIR} make -C /usr/src \
102 ${XDEV_FLAGS} XDEV=${XDEV} XDEV_ARCH=${XDEV_ARCH} \
105 # Run the ldconfig(8) startup script so /var/run/ld-elf*.so.hints
107 eval chroot ${CHROOTDIR} /etc/rc.d/ldconfig forcerestart
108 # Install security/ca_root_nss since we need to check the https
109 # certificate of github.
110 eval chroot ${CHROOTDIR} make -C /usr/ports/security/ca_root_nss \
111 OPTIONS_SET="ETCSYMLINK" BATCH=1 FORCE_PKG_REGISTER=1 \
112 install clean distclean
113 EMBEDDEDPORTS="${EMBEDDEDPORTS} devel/subversion"
114 for _PORT in ${EMBEDDEDPORTS}; do
115 eval chroot ${CHROOTDIR} make -C /usr/ports/${_PORT} \
116 BATCH=1 FORCE_PKG_REGISTER=1 install clean distclean
119 mkdir -p ${CHROOTDIR}/tmp/crochet/work
123 eval chroot ${CHROOTDIR} /bin/sh /tmp/crochet/crochet.sh \
124 -c /tmp/external/${XDEV}/crochet-${KERNEL}.conf
125 mkdir -p ${CHROOTDIR}/R/
126 cp -p ${CHROOTDIR}/usr/obj/*.img ${CHROOTDIR}/R/
127 bzip2 ${CHROOTDIR}/R/FreeBSD*.img
128 cd ${CHROOTDIR}/R/ && sha256 FreeBSD*.img.bz2 > CHECKSUM.SHA256
129 cd ${CHROOTDIR}/R/ && md5 FreeBSD*.img.bz2 > CHECKSUM.MD5