diff options
author | Khem Raj <raj.khem@gmail.com> | 2013-11-02 13:46:52 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2013-11-02 13:46:52 -0700 |
commit | 79f4ef691227e29327ed4f851221126ba7dfe4d9 (patch) | |
tree | 0b14b9b4aa780594e3ecbe6a51a279232f780a9c | |
parent | 80547bc1cea41e61abfc8490abcdd07b17d3eb65 (diff) |
make a wrapper for setup-environment
This is because repo does not allow symlinking and only copying
when we create sandbox. So we create a wrapper which will call
the real worker script which can change and when it changes we
do care for regenerating the environment
Change-Id: Ieda32b9c1072685fa0ad50e13393773cd63dde31
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | setup-environment | 98 | ||||
-rw-r--r-- | setup-environment-internal | 116 |
2 files changed, 117 insertions, 97 deletions
diff --git a/setup-environment b/setup-environment index cf7f540..14560f9 100644 --- a/setup-environment +++ b/setup-environment @@ -18,100 +18,4 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # - -if [ "$(whoami)" = "root" ]; then - echo "ERROR: do not use the BSP as root. Exiting..." -fi - -if [ -z "$MACHINE" ]; then - MACHINE='beaglebone' -fi - -if [ -z "$SDKMACHINE" ]; then - SDKMACHINE='x86-64' -fi - -CWD=$PWD -OEROOT=$CWD - -cd $OEROOT - -# Clean up PATH, because if it includes tokens to current directories somehow, -# wrong binaries can be used instead of the expected ones during task execution -export PATH="`echo $PATH | sed 's/\(:.\|:\)*:/:/g;s/^.\?://;s/:.\?$//'`" -export PATH=${OEROOT}/sources/openembedded-core/scripts:${OEROOT}/sources/bitbake/bin:${PATH} - -if [ ! -e conf/checksum ] -then - sha512sum ${OEROOT}/setup-environment 2>&1 > conf/checksum -fi -sha512sum --quiet -c conf/checksum > /dev/null 2>&1 -if [ $? -eq 0 ] -then - return -fi - -# re-evaluate new checksum and regenerate the conf files -sha512sum ${OEROOT}/setup-environment 2>&1 > conf/checksum - -TEMPLATES=$CWD/.repo/manifests/conf - -mkdir -p conf - -ln -sf $TEMPLATES/local.conf conf/local.conf -ln -sf $TEMPLATES/bblayers.conf conf/bblayers.conf - -DISTRO=$(grep -w DISTRO conf/local.conf | grep -v '^#' | awk -F\" '{print $2}') -export DISTRO_DIRNAME=`echo $DISTRO | sed s#[.-]#_#g` - -NCPU=`grep -c processor /proc/cpuinfo` -cat > conf/auto.conf <<EOF -BB_NUMBER_THREADS = "$NCPU" -PARALLEL_MAKE = "-j $NCPU" -MACHINE ?= "$MACHINE" -SDKMACHINE ?= "$SDKMACHINE" -EOF -if [ ! -e conf/site.conf ]; then - cat > conf/site.conf <<_EOF - -SCONF_VERSION = "1" - -# Where to store sources -DL_DIR = "${OEROOT}/downloads" - -# Where to save shared state -SSTATE_DIR = "${OEROOT}/build/sstate-cache" - -# Which files do we want to parse: -BBFILES ?= "${OEROOT}/sources/openembedded-core/meta/recipes-*/*/*.bb" - -TMPDIR = "${OEROOT}/build/tmp-${DISTRO_DIRNAME}" - -# Go through the Firewall -#HTTP_PROXY = "http://${PROXYHOST}:${PROXYPORT}/" - -_EOF -fi - -cat <<EOF - -Welcome to Ångström ( A Yocto Project Compatible Distribution ) - -For more information about OpenEmbedded see their website: - http://www.openembedded.org/ - -Your build environemnt has been configured with: - - MACHINE=$MACHINE - SDKMACHINE=$SDKMACHINE - DISTRO=$DISTRO - -You can now run 'bitbake <target>' - -Common targets are: - systemd-image - systemd-gnome-image - meta-toolchain - meta-toolchain-sdk - -EOF +. .git/manifests/setup-environment-internal diff --git a/setup-environment-internal b/setup-environment-internal new file mode 100644 index 0000000..2e77ea5 --- /dev/null +++ b/setup-environment-internal @@ -0,0 +1,116 @@ +#!/bin/sh +# -*- mode: shell-script-mode; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +# +# Copyright (C) 2012-13 O.S. Systems Software LTDA. +# Authored-by: Otavio Salvador <otavio@ossystems.com.br> +# Adopted to Angstrom: Khem Raj <raj.khem@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +if [ "$(whoami)" = "root" ]; then + echo "ERROR: do not use the BSP as root. Exiting..." +fi + +if [ -z "${MACHINE}" ]; then + MACHINE='beaglebone' +fi + +if [ -z "${SDKMACHINE}" ]; then + SDKMACHINE='x86-64' +fi + +OEROOT=${PWD} +TEMPLATES=${OEROOT}/.repo/manifests + +cd $OEROOT + +# Clean up PATH, because if it includes tokens to current directories somehow, +# wrong binaries can be used instead of the expected ones during task execution +export PATH="`echo ${PATH} | sed 's/\(:.\|:\)*:/:/g;s/^.\?://;s/:.\?$//'`" +export PATH=${OEROOT}/sources/openembedded-core/scripts:${OEROOT}/sources/bitbake/bin:${PATH} + +if [ ! -e conf/checksum ] +then + sha512sum ${TEMPLATES}/setup-environment-internal 2>&1 > conf/checksum +fi +sha512sum --quiet -c conf/checksum > /dev/null 2>&1 +if [ $? -eq 0 ] +then + return +fi + +# re-evaluate new checksum and regenerate the conf files +sha512sum ${TEMPLATES}/setup-environment-internal 2>&1 > conf/checksum + + +mkdir -p conf + +ln -sf ${TEMPLATES}/conf/local.conf conf/local.conf +ln -sf ${TEMPLATES}/conf/bblayers.conf conf/bblayers.conf + +DISTRO=$(grep -w DISTRO conf/local.conf | grep -v '^#' | awk -F\" '{print $2}') +export DISTRO_DIRNAME=`echo ${DISTRO} | sed s#[.-]#_#g` + +NCPU=`grep -c processor /proc/cpuinfo` +cat > conf/auto.conf <<EOF +BB_NUMBER_THREADS = "${NCPU}" +PARALLEL_MAKE = "-j ${NCPU}" +MACHINE ?= "${MACHINE}" +SDKMACHINE ?= "${SDKMACHINE}" +EOF +if [ ! -e conf/site.conf ]; then + cat > conf/site.conf <<_EOF + +SCONF_VERSION = "1" + +# Where to store sources +DL_DIR = "${OEROOT}/downloads" + +# Where to save shared state +SSTATE_DIR = "${OEROOT}/build/sstate-cache" + +# Which files do we want to parse: +BBFILES ?= "${OEROOT}/sources/openembedded-core/meta/recipes-*/*/*.bb" + +TMPDIR = "${OEROOT}/build/tmp-${DISTRO_DIRNAME}" + +# Go through the Firewall +#HTTP_PROXY = "http://${PROXYHOST}:${PROXYPORT}/" + +_EOF +fi + +cat <<EOF + +Welcome to Ångström ( A Yocto Project Compatible Distribution ) + +For more information about OpenEmbedded see their website: + http://www.openembedded.org/ + +Your build environemnt has been configured with: + + MACHINE=${MACHINE} + SDKMACHINE=${SDKMACHINE} + DISTRO=${DISTRO} + +You can now run 'bitbake <target>' + +Common targets are: + systemd-image + systemd-gnome-image + meta-toolchain + meta-toolchain-sdk + +EOF |