aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishal Bhoj <vishal.bhoj@linaro.org>2016-05-23 22:35:26 +0530
committerFathi Boudra <fathi.boudra@linaro.org>2016-05-24 09:52:39 +0300
commit9445ec0cb350e885832705b86fbab6f64acb4d00 (patch)
tree475ea14bb7521c1e9e22dc9764e355c7f578a26c
parent043215cb0a7fb1b02bf5c4de094078f49f01861b (diff)
update script to generate build script for latest ubuntu versions
Change-Id: Ibfc99d849bfab1d05061b1ba1558762652461d99 Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
-rwxr-xr-xbuild-scripts/create-user-build-script222
1 files changed, 96 insertions, 126 deletions
diff --git a/build-scripts/create-user-build-script b/build-scripts/create-user-build-script
index 3cc2fc7..41dad69 100755
--- a/build-scripts/create-user-build-script
+++ b/build-scripts/create-user-build-script
@@ -5,15 +5,15 @@ set -e
source "${BUILD_SCRIPT_ROOT}"/helpers
setup-repo-vars
-#Translate
+# Translate
# https://android-build.linaro.org/jenkins/job/doanac_build-script-generation/6/
# into
# http://snapshots.linaro.org/android/~doanac/build-script-generation/6/
-PINNED_MANIFEST_URL=${BUILD_URL/http*jenkins\/job\//http://snapshots.linaro.org/android/~}
-# change the dash in doanac_build... to doanac/build...
+PINNED_MANIFEST_URL=${BUILD_URL/http*jenkins\/job\//http://snapshots.linaro.org/android/}
+# Change the dash in doanac_build... to doanac/build...
PINNED_MANIFEST_URL=${PINNED_MANIFEST_URL/_/\/}
-if [ -n "$SOURCE_OVERLAY" ]; then
+if [ -n "${SOURCE_OVERLAY}" ]; then
USAGE_SUM="'Usage: \$0 -m <manifest.xml> -o <overlay.tar> [ -t -d directory -l login ]'"
USAGE_OVERLAY="'\\n -m <manifest> If -t is not used, then using a browser with cookies you\\n must download the pinned manifest from:\\n $PINNED_MANIFEST_URL\\n -o The path to the vendor required overlay.\\n Can be downloaded from http://snapshots.linaro.org/android/binaries/$SOURCE_OVERLAY\\n'"
USAGE_OPTOVERLAY="m:o:"
@@ -33,15 +33,15 @@ set -e
EXACT=0
INTERACTIVE=1
DIR=android
-if [ -z "\${LINARO_ANDROID_ACCESS_ID}" ] ; then
+if [ -z "\${LINARO_ANDROID_ACCESS_ID}" ]; then
LINARO_ANDROID_ACCESS_ID=\${USER}
fi
SOURCE_OVERLAY_OPTIONAL=1
usage()
{
- echo $USAGE_SUM
- echo -e $USAGE_OVERLAY
+ echo ${USAGE_SUM}
+ echo -e ${USAGE_OVERLAY}
echo " -t Reproduce the build from the tip of the branch rather than doing"
echo " an exact replica build"
echo " -d <directory> The directory to download code and build from"
@@ -55,110 +55,79 @@ usage()
}
while getopts "${USAGE_OPTOVERLAY}d:l:hty" optn; do
- case \$optn in
- $USAGE_OPTHANDLER
- d ) DIR=\$OPTARG;;
- l ) LINARO_ANDROID_ACCESS_ID=\$OPTARG;;
+ case \${optn} in
+ ${USAGE_OPTHANDLER}
+ d ) DIR=\${OPTARG};;
+ l ) LINARO_ANDROID_ACCESS_ID=\${OPTARG};;
t ) EXACT=0;;
y ) INTERACTIVE=0;;
h ) usage; exit 1;;
\? ) usage; exit 1;;
- esac
+ esac
done
-UBUNTU=\`cat /etc/issue.net | cut -d' ' -f2\`
-HOST_ARCH=\`uname -m\`
-if [ \${HOST_ARCH} == "x86_64" ] ; then
- PKGS='gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc vim-common python-parted python-yaml wget uuid-dev python-mako'
-else
+UBUNTU=\$(lsb_release -sc)
+HOST_ARCH=\$(uname -m)
+if [ \${HOST_ARCH} != "x86_64" ]; then
echo "ERROR: Only 64bit Host(Build) machines are supported at the moment."
exit 1
fi
-if [[ \${UBUNTU} =~ "14.04" || \${UBUNTU} =~ "13." || \${UBUNTU} =~ "12.10" ]]; then
- #Install basic dev package missing in chrooted environments
- sudo apt-get install software-properties-common
- sudo dpkg --add-architecture i386
- PKGS+=' libstdc++6:i386 git-core'
- if [[ \${UBUNTU} =~ "14.04" ]]; then
- PKGS+=' u-boot-tools bc acpica-tools'
- elif [[ \${UBUNTU} =~ "13.10" ]]; then
- PKGS+=' u-boot-tools bc iasl'
- else
- PKGS+=' uboot-mkimage acpica-tools'
- fi
-elif [[ \${UBUNTU} =~ "12.04" || \${UBUNTU} =~ "10.04" ]] ; then
- #Install basic dev package missing in chrooted environments
- sudo apt-get install python-software-properties
- if [[ \${UBUNTU} =~ "12.04" ]]; then
- PKGS+=' libstdc++6:i386 git-core'
- else
- PKGS+=' ia32-libs libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext'
- fi
-else
- echo "ERROR: Only Ubuntu 10.04, 12.*, 13.* and 14.04 versions are supported."
- exit 1
-fi
+# Install basic dev package missing in chrooted environments
echo
echo "Setting up Ubuntu software repositories..."
-sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu \$(lsb_release -sc) main universe restricted multiverse"
-sudo add-apt-repository ppa:linaro-maintainers/tools
sudo apt-get update
-echo
-echo "Install OpenJDK v1.7?"
-echo "*** If you are building AOSP master based builds then you should install OpenJDK v1.7. ***"
-echo "*** But if you are building Android 4.4.4 or earlier Android releases then OpenJDK v1.6 is OK to use. ***"
-echo "Press "y" to install OpenJDK v1.7, OR"
-echo "Press "n" to install OpenJDK v1.6, OR"
-echo "Press any other key to continue with the existing JDK installation."
-read JDK
-if [ "\${JDK}" == y ] ; then
- PKGS+=' openjdk-7-jdk openjdk-7-jre'
-elif [ "\${JDK}" == n ] ; then
- PKGS+=' openjdk-6-jdk openjdk-6-jre'
-else
- echo "Continue with the existing JDK installation .."
-fi
-echo
-echo "Installing missing dependencies if any..."
-if [ \$INTERACTIVE -eq 1 ] ; then
- sudo apt-get install \${PKGS}
-else
- sudo apt-get -y install \${PKGS}
-fi
-# Obsolete git version 1.7.04 in lucid official repositories
-# repo need at least git v1.7.2
-if [[ \${UBUNTU} =~ "10.04" ]]; then
+sudo apt-get install software-properties-common
+PKGS='git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip vim-common python-parted python-yaml wget uuid-dev python-mako u-boot-tools bc acpica-tools'
+
+if [[ \${UBUNTU} =~ "trusty" || \${UBUNTU} =~ "utopic" || \${UBUNTU} =~ "vivid" || \${UBUNTU} =~ "wily" || \${UBUNTU} =~ "xenial" ]]; then
echo
- echo "repo tool complains of obsolete git version 1.7.04 in lucid official repositories"
- echo "Building git for lucid from precise sources .."
- wget http://archive.ubuntu.com/ubuntu/pool/main/g/git/git_1.7.9.5.orig.tar.gz
- tar xzf git_1.7.9.5.orig.tar.gz
- cd git-1.7.9.5/
- make prefix=/usr
- sudo make prefix=/usr install
-fi
+ echo "Installing missing dependencies if any..."
+ if [[ \${UBUNTU} =~ "trusty" ]]; then
+ PKGS+=' openjdk-7-jdk openjdk-7-jre'
+ else
+ if [[ \${UBUNTU} =~ "utopic" || \${UBUNTU} =~ "vivid" ]]; then
+ sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
+ fi
+ sudo add-apt-repository ppa:openjdk-r/ppa
+ sudo apt-get update
+ PKGS+=' openjdk-7-jdk openjdk-7-jre'
+ fi
+
+ if [ \${INTERACTIVE} -eq 1 ]; then
+ sudo apt-get install \${PKGS}
+ else
+ sudo apt-get -y install \${PKGS}
+ fi
+else
+ echo "WARNING: Only Ubuntu 14.04 and above are supported. Press "y" to continue building AOSP without installing dependencies? "
+ echo "Press any other key to continue with the existing JDK installation."
+ read BUILD
+ if [ "\${BUILD}" != y ]; then
+ exit 1
+ fi
+fi
EOF
if [ -n "$SOURCE_OVERLAY" ]; then
cat <<EOF
-if [ \$EXACT -eq 1 ]; then
- if [ "a\$MANIFEST" == "a" -o ! -f \$MANIFEST ]; then
- echo "ERROR: no pinned manifest provided. Please download from $PINNED_MANIFEST_URL. This must be done from a browser that accepts cookies."
+if [ \${EXACT} -eq 1 ]; then
+ if [ "a\${MANIFEST}" == "a" -o ! -f \${MANIFEST} ]; then
+ echo "ERROR: no pinned manifest provided. Please download from ${PINNED_MANIFEST_URL}. This must be done from a browser that accepts cookies."
exit 1
fi
fi
-if [ \$SOURCE_OVERLAY_OPTIONAL -ne 1 ]; then
- if [ "a\$SOURCE_OVERLAY" == "a" -o ! -f \$SOURCE_OVERLAY ]; then
- echo "ERROR: no source overlay provided. Please download from http://snapshots.linaro.org/android/binaries/$SOURCE_OVERLAY. This must be done from a browser that accepts cookies."
+if [ \${SOURCE_OVERLAY_OPTIONAL} -ne 1 ]; then
+ if [ "a\${SOURCE_OVERLAY}" == "a" -o ! -f \${SOURCE_OVERLAY} ]; then
+ echo "ERROR: no source overlay provided. Please download from http://snapshots.linaro.org/android/binaries/${SOURCE_OVERLAY}. This must be done from a browser that accepts cookies."
exit 1
fi
fi
EOF
fi
cat <<EOF
-if [ -d \${DIR} ] ; then
- if [ \$INTERACTIVE -eq 1 ] ; then
+if [ -d \${DIR} ]; then
+ if [ \${INTERACTIVE} -eq 1 ]; then
echo "Directory \${DIR} exists. Are you sure you want to use this? (y/n) "
read CONTINUE
[ \${CONTINUE} == y ] || exit 1
@@ -176,25 +145,25 @@ EOF
jenkins_configs_method()
{
cat <<EOF
-# check for linaro private manifests
-PM=\`echo ${MANIFEST_REPO} | grep -i "linaro-private" | wc -l\`
-if [ \${PM} -gt 0 -a \${INTERACTIVE} -eq 1 ] ; then
- if [ "\${LINARO_ANDROID_ACCESS_ID}" == "\${USER}" ] ; then
+# Check for linaro private manifests
+PM=\$(echo ${MANIFEST_REPO} | grep -i "linaro-private" | wc -l)
+if [ \${PM} -gt 0 -a \${INTERACTIVE} -eq 1 ]; then
+ if [ "\${LINARO_ANDROID_ACCESS_ID}" == "\${USER}" ]; then
echo "You must specify valid login/access-id to clone from linaro-private manifest repositories."
echo "Press "y" to continue with login: \${USER}, OR"
echo "Press "n" to enter new login details, OR"
echo "Press "h" for help."
read NEXT
- if [ \${NEXT} == n ] ; then
+ if [ \${NEXT} == n ]; then
echo "Enter login/access-id:"
read LINARO_ANDROID_ACCESS_ID
- elif [ \${NEXT} == h ] ; then
+ elif [ \${NEXT} == h ]; then
usage
fi
fi
fi
-export MANIFEST_REPO=\`echo ${MANIFEST_REPO} | sed 's/\/\/.*-bot@/\/\/'"\${LINARO_ANDROID_ACCESS_ID}"'@/'\`
-export LOCAL_MANIFEST=\`echo ${LOCAL_MANIFEST} | sed 's/\/\/.*-bot@/\/\/'"\${LINARO_ANDROID_ACCESS_ID}"'@/'\`
+export MANIFEST_REPO=\$(echo ${MANIFEST_REPO} | sed 's/\/\/.*-bot@/\/\/'"\${LINARO_ANDROID_ACCESS_ID}"'@/')
+export LOCAL_MANIFEST=\$(echo ${LOCAL_MANIFEST} | sed 's/\/\/.*-bot@/\/\/'"\${LINARO_ANDROID_ACCESS_ID}"'@/')
export MANIFEST_BRANCH=${MANIFEST_BRANCH}
export LOCAL_MANIFEST_BRANCH=${LOCAL_MANIFEST_BRANCH}
export MANIFEST_FILENAME=${MANIFEST_FILENAME}
@@ -202,7 +171,7 @@ export TARGET_PRODUCT=${TARGET_PRODUCT}
export PATCHSETS="${PATCHSETS}"
export LUNCH=${LUNCH}
EOF
- if [ -n "$TARGET_KERNEL_SOURCE" ] ; then
+ if [ -n "${TARGET_KERNEL_SOURCE}" ]; then
cat <<EOF
export TARGET_KERNEL_SOURCE=${TARGET_KERNEL_SOURCE}
EOF
@@ -210,7 +179,7 @@ EOF
cat <<EOF
export TARGET_SIMULATOR=false
export BUILD_TINY_ANDROID=${BUILD_TINY_ANDROID}
-export CPUS=\`grep -c processor /proc/cpuinfo\`
+export CPUS=\$(getconf _NPROCESSORS_ONLN)
export INCLUDE_PERF=${INCLUDE_PERF}
export TARGET_BUILD_VARIANT=${TARGET_BUILD_VARIANT}
export BUILD_FS_IMAGE=${BUILD_FS_IMAGE}
@@ -221,7 +190,7 @@ export ANDROID_64=${ANDROID_64}
export WITH_HOST_DALVIK=${WITH_HOST_DALVIK}
export USE_LINARO_TOOLCHAIN=${USE_LINARO_TOOLCHAIN}
EOF
- if [ -n "$TOOLCHAIN_URL" ] ; then
+ if [ -n "${TOOLCHAIN_URL}" ]; then
cat <<EOF
export TOOLCHAIN_URL=${TOOLCHAIN_URL}
export TARGET_TOOLS_PREFIX=android-toolchain-eabi/bin/arm-linux-androideabi-
@@ -241,58 +210,58 @@ export BUILD_CONFIG_REPO=${BUILD_CONFIG_REPO}
export BUILD_CONFIG_BRANCH=${BUILD_CONFIG_BRANCH}
export BUILD_CONFIG_FILENAME=${BUILD_CONFIG_FILENAME}
-git clone "\$BUILD_CONFIG_REPO" configs_repo
-git --git-dir=configs_repo/.git checkout "\$BUILD_CONFIG_BRANCH"
-CONFIGURATION=\$(cat configs_repo/"\$BUILD_CONFIG_FILENAME")
+git clone "\${BUILD_CONFIG_REPO}" configs_repo
+git --git-dir=configs_repo/.git checkout "\${BUILD_CONFIG_BRANCH}"
+CONFIGURATION=\$(cat configs_repo/"\${BUILD_CONFIG_FILENAME}")
set -a
-eval \$CONFIGURATION
+eval \${CONFIGURATION}
EOF
}
sync_commands()
{
- if [ -n "$SOURCE_OVERLAY" ]; then
- CP_CMD="cp \$MANIFEST .repo/manifest.xml"
+ if [ -n "${SOURCE_OVERLAY}" ]; then
+ CP_CMD="cp -a \${MANIFEST} .repo/manifest.xml"
else
CP_CMD="curl -k ${PINNED_MANIFEST_URL}/pinned-manifest.xml > .repo/manifest.xml"
fi
- if [ "$REPO_GROUPS" != "all,-notdefault,-eclipse" ]; then
- REPO_GROUPS_OPTION="-g $REPO_GROUPS"
+ if [ "${REPO_GROUPS}" != "all,-notdefault,-eclipse" ]; then
+ REPO_GROUPS_OPTION="-g ${REPO_GROUPS}"
else
REPO_GROUPS_OPTION=""
fi
cat <<EOF
-# download the repo tool for android
+# Download the repo tool for android
curl "https://android-git.linaro.org/gitweb?p=tools/repo.git;a=blob_plain;f=repo;hb=refs/heads/stable" > repo
chmod +x repo
-# download the android code
-./repo init -u \${MANIFEST_REPO} -b \${MANIFEST_BRANCH} -m \${MANIFEST_FILENAME} ${REPO_MIRROR} $REPO_GROUPS_OPTION
-if [ \${EXACT} -eq 1 ] ; then
+# Download the android code
+./repo init -u \${MANIFEST_REPO} -b \${MANIFEST_BRANCH} -m \${MANIFEST_FILENAME} ${REPO_MIRROR} ${REPO_GROUPS_OPTION}
+if [ \${EXACT} -eq 1 ]; then
rm .repo/manifest.xml
- $CP_CMD
+ ${CP_CMD}
fi
rm -rf .repo/local_manifests
if [[ -n \${LOCAL_MANIFEST} && ! -n \${MANIFEST} ]]; then
cd .repo/
- git clone \${LOCAL_MANIFEST} -b \${LOCAL_MANIFEST_BRANCH} local_manifests
- cd -
+ git clone \${LOCAL_MANIFEST} -b \${LOCAL_MANIFEST_BRANCH} local_manifests
+ cd -
fi
-# check for linaro private git repositories
-PRI=\`grep -i "linaro-private" .repo/manifest.xml | wc -l\`
-if [ \${PRI} -gt 0 -a \${INTERACTIVE} -eq 1 ] ; then
- if [ "\${LINARO_ANDROID_ACCESS_ID}" == "\${USER}" ] ; then
+# Check for linaro private git repositories
+PRI=\$(grep -i "linaro-private" .repo/manifest.xml | wc -l)
+if [ \${PRI} -gt 0 -a \${INTERACTIVE} -eq 1 ]; then
+ if [ "\${LINARO_ANDROID_ACCESS_ID}" == "\${USER}" ]; then
echo "You must specify valid login/access-id to clone from linaro-private git repositories."
echo "Press "y" to continue with login: \${USER}, OR"
echo "Press "n" to enter new login details, OR"
echo "Press "h" for help."
read NEXT
- if [ \${NEXT} == n ] ; then
+ if [ \${NEXT} == n ]; then
echo "Enter login/access-id:"
read LINARO_ANDROID_ACCESS_ID
- elif [ \${NEXT} == h ] ; then
+ elif [ \${NEXT} == h ]; then
usage
fi
fi
@@ -305,28 +274,28 @@ fi
EOF
- if [ -n "$TOOLCHAIN_URL" ] ; then
+ if [ -n "${TOOLCHAIN_URL}" ]; then
cat <<EOF
-# download the toolchain to build with
+# Download the toolchain
curl -k \${TOOLCHAIN_URL} > toolchain.tar.bz2
tar -jxf toolchain.tar.bz2
rm toolchain.tar.bz2
EOF
fi
- if [ -n "$PATCHSETS" ] ; then
+ if [ -n "${PATCHSETS}" ]; then
cat <<EOF
-# download and apply the patches
-for i in \$PATCHSETS; do
- sh ./android-patchsets/\$i
+# Download and apply the patches
+for i in \${PATCHSETS}; do
+ sh ./android-patchsets/\${i}
done
EOF
fi
- if [ -n "$SOURCE_OVERLAY" ]; then
+ if [ -n "${SOURCE_OVERLAY}" ]; then
cat <<EOF
if [ -n "\${SOURCE_OVERLAY}" ]; then
- # extract the vendor's source overlay
+ # Extract the vendor's source overlay
tar -x -a -f "\${SOURCE_OVERLAY}" -C .
source_overlay_name=\$(basename \${SOURCE_OVERLAY})
[ -f ./\${source_overlay_name} ] || cp -uv "\${SOURCE_OVERLAY}" .
@@ -339,7 +308,7 @@ EOF
build_commands()
{
cat <<EOF
-# build the code
+# Build the code
source build/envsetup.sh
lunch \${LUNCH}
make -j\${CPUS} ${MAKE_TARGETS}
@@ -348,7 +317,7 @@ EOF
{
header
- if [ -n "$BUILD_CONFIG_REPO" ]; then
+ if [ -n "${BUILD_CONFIG_REPO}" ]; then
git_configs_method
else
jenkins_configs_method
@@ -356,4 +325,5 @@ EOF
sync_commands
build_commands
} > linaro_android_build_cmds.sh
+
chmod +x linaro_android_build_cmds.sh