aboutsummaryrefslogtreecommitdiff
path: root/build-scripts/create-user-kernel-script
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2012-03-19 15:38:36 +0000
committerAndy Doan <andy.doan@linaro.org>2012-03-19 15:38:36 +0000
commitb1bf5e6e7360e355b947cb6f7a01fdccdb8c1462 (patch)
tree3ed23faea7f51615c8257a7e1afd401f911f3c41 /build-scripts/create-user-kernel-script
parent859567627cce0b5f2281df5f98a11730e26df724 (diff)
add code to produce a kernel build script for end user
the create-user-kernel-script will create a script that can reproduce a kernel for a given android build.
Diffstat (limited to 'build-scripts/create-user-kernel-script')
-rwxr-xr-xbuild-scripts/create-user-kernel-script91
1 files changed, 91 insertions, 0 deletions
diff --git a/build-scripts/create-user-kernel-script b/build-scripts/create-user-kernel-script
new file mode 100755
index 0000000..0968682
--- /dev/null
+++ b/build-scripts/create-user-kernel-script
@@ -0,0 +1,91 @@
+#!/bin/bash
+
+set -e
+
+source "${BUILD_SCRIPT_ROOT}"/helpers
+setup-repo-vars
+
+#Translate
+# https://android-build.linaro.org/jenkins/job/doanac_build-script-generation/6/
+# into
+# http://snapshots.linaro.org/android/~doanac/build-script-generation/6/
+SNAPSHOT_URL=${BUILD_URL/http*jenkins\/job\//http://snapshots.linaro.org/android/~}
+# change the dash in doanac_build... to doanac/build...
+SNAPSHOT_URL=${SNAPSHOT_URL/_/\/}
+
+header()
+{
+ cat <<EOF
+#!/bin/bash
+
+set -e
+
+EXACT=1
+DIR=linaro-kernel
+
+CPUS=\`grep -c processor /proc/cpuinfo\`
+
+usage()
+{
+ echo 'Usage: \$0 [ -t -d directory ]'
+ echo " -t Reproduce the 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"
+ echo " Default: \${DIR}"
+ exit 1
+}
+
+while getopts "d:ht" optn; do
+ case \$optn in
+ d ) DIR=\$OPTARG;;
+ t ) EXACT=0;;
+ h ) usage; exit 1;;
+ esac
+done
+
+EOF
+}
+
+sync_commands()
+{
+GITINFO=`PYTHONPATH=.repo/repo ${BUILD_SCRIPT_ROOT}/repo_project_info.py -d ./`
+GITURL=`echo $GITINFO | cut -d\| -f1`
+GITREV=`echo $GITINFO | cut -d\| -f2`
+ cat <<EOF
+# download the kernel
+if [ -d \${DIR} ] ; then
+ echo "Directory \${DIR} exists. If the kernel code exists in this directory you may continue without cloning the git repository for the kernel. Are you sure you want to do this? (y/n) "
+ read CONTINUE
+ [ \${CONTINUE} == y ] || exit 1
+else
+ git clone $GITURL \$DIR
+fi
+
+cd \$DIR
+git checkout $GITREV
+
+# download the kernel config
+curl -q $SNAPSHOT_URL/kernel_config > linaro_kernel_config
+
+EOF
+}
+
+build_commands()
+{
+ cat <<EOF
+# build the code
+CROSS_COMPILE=\`which arm-linux-gnueabi-gcc |sed -e 's,gcc,,'\`
+[ -d out ] || mkdir out
+[ -f out/.config ] || cp linaro_kernel_config out/.config
+make -j\${CPUS} O=out ARCH=arm CROSS_COMPILE=\$CROSS_COMPILE uImage modules
+mkdir out/modules_for_android
+make O=out ARCH=arm modules_install INSTALL_MOD_PATH=modules_for_android
+EOF
+}
+
+{
+ header
+ sync_commands
+ build_commands
+} > linaro_kernel_build_cmds.sh
+chmod +x linaro_kernel_build_cmds.sh