From owner-svn-src-user@FreeBSD.ORG Sat Dec 28 02:27:07 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9C2A2B6; Sat, 28 Dec 2013 02:27:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8A35514F4; Sat, 28 Dec 2013 02:27:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBS2R7ni044930; Sat, 28 Dec 2013 02:27:07 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBS2R6XJ044924; Sat, 28 Dec 2013 02:27:06 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201312280227.rBS2R6XJ044924@svn.freebsd.org> From: Glen Barber Date: Sat, 28 Dec 2013 02:27:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r259994 - in user/gjb/hacking/release-embedded: release release/arm tools/release tools/release/arm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Dec 2013 02:27:07 -0000 Author: gjb Date: Sat Dec 28 02:27:06 2013 New Revision: 259994 URL: http://svnweb.freebsd.org/changeset/base/259994 Log: 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 Added: user/gjb/hacking/release-embedded/release/arm/ user/gjb/hacking/release-embedded/release/arm/RPI-B.conf (contents, props changed) user/gjb/hacking/release-embedded/release/arm/release.sh (contents, props changed) user/gjb/hacking/release-embedded/tools/release/ user/gjb/hacking/release-embedded/tools/release/arm/ user/gjb/hacking/release-embedded/tools/release/arm/crochet-RPI-B.conf (contents, props changed) Modified: user/gjb/hacking/release-embedded/release/release.sh Added: user/gjb/hacking/release-embedded/release/arm/RPI-B.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/gjb/hacking/release-embedded/release/arm/RPI-B.conf Sat Dec 28 02:27:06 2013 (r259994) @@ -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 Added: user/gjb/hacking/release-embedded/release/arm/release.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/gjb/hacking/release-embedded/release/arm/release.sh Sat Dec 28 02:27:06 2013 (r259994) @@ -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 Modified: user/gjb/hacking/release-embedded/release/release.sh ============================================================================== --- user/gjb/hacking/release-embedded/release/release.sh Sat Dec 28 02:15:30 2013 (r259993) +++ user/gjb/hacking/release-embedded/release/release.sh Sat Dec 28 02:27:06 2013 (r259994) @@ -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_CO 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. Added: user/gjb/hacking/release-embedded/tools/release/arm/crochet-RPI-B.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/gjb/hacking/release-embedded/tools/release/arm/crochet-RPI-B.conf Sat Dec 28 02:27:06 2013 (r259994) @@ -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