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="7b6444bd23eb61068c43bd1d44ec7e7bfdbce5cadeca20c833eee186b4d3fd31"
48 UBOOT_VERSION="u-boot-2014.04"
52 KNOWNHASH="e08e20a6979bfca6eebb9a2b0e42aa4416af3d796332fd63a3470495a089d496"
53 UBOOT_VERSION="u-boot-2012.07"
57 KNOWNHASH="b4f83b8db325c21671a997198ec3a373e2e00dde2fcf17be9b9afd7cfd727f56"
58 UBOOT_VERSION="u-boot-2014.07"
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 # Fix broken ports that use kern.osreldate.
96 OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)
98 REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION)
99 BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH)
100 UNAME_r=${REVISION}-${BRANCH}
102 export XZ_CMD=$(chroot ${CHROOTDIR} make -C /usr/src/release -V XZ_CMD)
104 # Build the 'xdev' target for crochet.
105 eval chroot ${CHROOTDIR} make -C /usr/src \
106 ${XDEV_FLAGS} XDEV=${XDEV} XDEV_ARCH=${XDEV_ARCH} \
107 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
110 # Install the cross-build symlinks to /usr/bin to make crochet
112 eval chroot ${CHROOTDIR} make -C /usr/src \
113 ${XDEV_FLAGS} XDEV=${XDEV} XDEV_ARCH=${XDEV_ARCH} \
114 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
115 ${WORLD_FLAGS} xdev-links || true
117 # Run the ldconfig(8) startup script so /var/run/ld-elf*.so.hints
119 eval chroot ${CHROOTDIR} /etc/rc.d/ldconfig forcerestart
120 # Install security/ca_root_nss since we need to check the https
121 # certificate of github.
122 eval chroot ${CHROOTDIR} make -C /usr/ports/security/ca_root_nss \
123 OPTIONS_SET="ETCSYMLINK" BATCH=1 FORCE_PKG_REGISTER=1 \
124 install clean distclean
125 EMBEDDEDPORTS="${EMBEDDEDPORTS} devel/subversion"
126 for _PORT in ${EMBEDDEDPORTS}; do
127 eval chroot ${CHROOTDIR} make -C /usr/ports/${_PORT} \
128 BATCH=1 FORCE_PKG_REGISTER=1 install clean distclean
131 # Certain u-boot versions hardcode the use of a host gcc, and gcc's
132 # build relies on having gperf installed.
133 eval chroot ${CHROOTDIR} make -C /usr/src/gnu/usr.bin/gperf \
134 WITH_GCC=1 ${WORLD_FLAGS} obj
135 eval chroot ${CHROOTDIR} make -C /usr/src/gnu/usr.bin/gperf \
136 WITH_GCC=1 ${WORLD_FLAGS} -j1 depend all
137 eval chroot ${CHROOTDIR} make -C /usr/src/gnu/usr.bin/gperf \
138 WITH_GCC=1 ${WORLD_FLAGS} -j1 install
139 eval chroot ${CHROOTDIR} make -C /usr/src/gnu/usr.bin/cc \
140 WITH_GCC=1 ${WORLD_FLAGS} -j1 obj depend all install
142 mkdir -p ${CHROOTDIR}/tmp/crochet/work
146 eval chroot ${CHROOTDIR} /bin/sh /tmp/crochet/crochet.sh \
147 -c /tmp/external/${XDEV}/crochet-${KERNEL}.conf
148 mkdir -p ${CHROOTDIR}/R/
149 cp -p ${CHROOTDIR}/usr/obj/*.img ${CHROOTDIR}/R/
150 ${XZ_CMD} ${CHROOTDIR}/R/FreeBSD*.img
151 cd ${CHROOTDIR}/R/ && sha256 FreeBSD*.img.xz > CHECKSUM.SHA256
152 cd ${CHROOTDIR}/R/ && md5 FreeBSD*.img.xz > CHECKSUM.MD5