summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2016-05-18 14:42:13 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2016-05-18 14:42:13 +0800
commitd3db4a3d4faa6b2f61eb0443e3208cec387b7d20 (patch)
tree815096cc38fa080603c296d80cac258e139b9866
parent4f7f01f0e395c747ec616efc903c9b0a5ce3af99 (diff)
improvement to support --reference option
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rwxr-xr-xscripts-common/sync-common.sh95
-rwxr-xr-xsync-marshmallow.sh192
2 files changed, 153 insertions, 134 deletions
diff --git a/scripts-common/sync-common.sh b/scripts-common/sync-common.sh
deleted file mode 100755
index 0918941..0000000
--- a/scripts-common/sync-common.sh
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/env sh
-export BASE=`pwd`
-export MIRROR="https://android.googlesource.com/platform/manifest"
-repo_url="git://android-git.linaro.org/tools/repo"
-export base_manifest="default.xml"
-sync_linaro=true
-branch="master"
-
-LOCAL_MANIFEST="git://android-git.linaro.org/platform/manifest.git"
-LOCAL_MANIFEST_BRANCH="linaro-master"
-
-print_usage(){
- echo "$(basename $0) [-nl|--nolinaro] [-b|--branch branch] [-m|--mirror mirror_url]"
- echo "\t -nl|--nolinaro: do not sync linaro source"
- echo "\t -b|--branch branch: sync the specified branch, default master"
- echo "\t -u|--mirror mirror_url: specify the url where you want to sync from"
- echo "\t\t default: $repo_url"
- echo "$(basename $0) [-h|--help]"
- echo "\t -h|--help: print this usage"
-}
-
-function parseArgs(){
- while [ -n "$1" ]; do
- case "X$1" in
- X-nl|X--nolinaro)
- sync_linaro=false
- shift
- ;;
- X-b|X--branch)
- if [ -z "$2" ]; then
- echo "Please specify the branch name for the -b|--branch option"
- exit 1
- fi
- branch="$2"
- shift
- ;;
- X-h|X--help)
- print_usage
- exit 1
- ;;
- X-*)
- echo "Unknown option: $1"
- print_usage
- exit 1
- ;;
- X*)
- echo "Unknown option: $1"
- print_usage
- exit 1
- ;;
- esac
- done
-}
-
-sync_init(){
- #while ! repo init -u $MIRROR -m ${base_manifest} -b ${branch} --no-repo-verify --repo-url=${repo_url} -g "default,-device,-non-default,hikey,flounder,-darwin,-mips,-x86" --depth=1 -p linux; do
- while ! repo init -u $MIRROR -m ${base_manifest} -b ${branch} --no-repo-verify --repo-url=${repo_url} --depth=1 -g "default,device,-notdefault,-darwin,-mips,-x86" -p linux; do
- sleep 30
- done
-}
-
-sync(){
- #Syncronize and check out
- CPUS=$(grep processor /proc/cpuinfo |wc -l)
- while ! repo sync -j ${CPUS} -c --force-sync; do
- sleep 30
- done
-}
-
-sync_linaro(){
- mkdir -p .repo && cd .repo
- if [ -d ./local_manifests ]; then
- cd ./local_manifests
- git pull
- else
- git clone ${LOCAL_MANIFEST} -b ${LOCAL_MANIFEST_BRANCH} local_manifests
- fi
-
- cd ${BASE}
-
- if [ -n "$(ls patches-hook/local_manifests/*.xml)" ]; then
- cp -uvf patches-hook/local_manifests/*.xml .repo/local_manifests
- fi
-}
-
-main(){
- # update myself first
- git pull
- parseArgs "$@"
- if $sync_linaro; then
- sync_linaro
- fi
- sync_init
- sync
-}
diff --git a/sync-marshmallow.sh b/sync-marshmallow.sh
index 860cf95..e650699 100755
--- a/sync-marshmallow.sh
+++ b/sync-marshmallow.sh
@@ -1,21 +1,120 @@
#!/bin/bash
export BASE=$(cd $(dirname $0);pwd)
-source ${BASE}/scripts-common/sync-common.sh
-
-export MIRROR="/SATA3/aosp-mirror/platform/manifest.git"
-#export MIRROR="git://android-git.linaro.org/platform/manifest.git"
-branch="android-6.0.1_r43"
+BASE_MIRROR="git://android-git.linaro.org/platform/manifest.git"
+#BASE_MIRROR="/SATA3/aosp-mirror/platform/manifest.git"
+BASE_REFERENCE=""
+BASE_BRANCH="android-6.0.1_r43"
+BASE_MANIFEST="default.xml"
+REPO_URL="git://android-git.linaro.org/tools/repo"
+BASE_INITIAL=false
+###############################################################################
+#### PLEASE DO NOT MODIFY LINES BELOW
+###############################################################################
LOCAL_MANIFEST="https://github.com/96boards/android_manifest"
LOCAL_MANIFEST_BRANCH="android-6.0"
-main "$@"
+function print_usage(){
+ echo "$(basename $0) [-i|--initial] [-u|--url manifest_url] [-b|--branch branch] [-m|--manifest-name manifest_file_name] [-r|--reference reference_url] "
+ echo "\t -i|--initial: initial the AOSP base, this will help to repo sync all the AOSP source based on options specified, default false"
+ echo "\t -u|--url: manifest repository location used for repo init -u option, default git://android-git.linaro.org/platform/manifest.git"
+ echo "\t -b|--branch: manifest branch or revision used for repo init -b option, default android-6.0.1_r43"
+ echo "\t -m|--manifest-name: initial manifest file used for repo init -m option, default default.xml"
+ echo "\t -r|--reference: location of mirror directory used for repo init --reference option"
+ echo "$(basename $0) [-h|--help]"
+ echo "\t -h|--help: print this usage"
+}
+
+function parseArgs(){
+ while [ -n "$1" ]; do
+ case "X$1" in
+ X-i|X--initial)
+ BASE_INITIAL=true
+ shift
+ ;;
+ X-u|X--url)
+ if [ -z "$2" ]; then
+ echo "Please specify the branch name for the -u|--url option"
+ exit 1
+ fi
+ BASE_MIRROR="$2"
+ shift 2
+ ;;
+ X-m|X--manifest-name)
+ if [ -z "$2" ]; then
+ echo "Please specify the branch name for the -m|--manifest-name option"
+ exit 1
+ fi
+ BASE_MANIFEST="$2"
+ shift 2
+ ;;
+ X-b|X--branch)
+ if [ -z "$2" ]; then
+ echo "Please specify the branch name for the -b|--branch option"
+ exit 1
+ fi
+ BASE_BRANCH="$2"
+ shift 2
+ ;;
+ X-r|X--reference)
+ if [ -z "$2" ]; then
+ echo "Please specify the branch name for the -r|--reference option"
+ exit 1
+ fi
+ BASE_REFERENCE="$2"
+ shift 2
+ ;;
+ X-h|X--help)
+ print_usage
+ exit 1
+ ;;
+ X-*)
+ echo "Unknown option: $1"
+ print_usage
+ exit 1
+ ;;
+ X*)
+ echo "Unknown option: $1"
+ print_usage
+ exit 1
+ ;;
+ esac
+ done
+}
+
+function repo_init(){
+ local cmd_repo_init="repo init -u ${BASE_MIRROR} \
+ -m ${BASE_MANIFEST} \
+ -b ${BASE_BRANCH} \
+ --no-repo-verify \
+ --repo-url=${REPO_URL} \
+ --depth=1 \
+ -g \"default,device,-notdefault,-darwin,-mips,-x86\" \
+ -p linux \
+ "
+ if [ -n "${REFERENCE_DIR}" ]; then
+ cmd_repo_init="${cmd_repo_init} --reference=${BASE_REFERENCE}"
+ fi
+ while ! ${cmd_repo_init}; do
+ sleep 30
+ done
+}
-./sync-projects.sh \
- device/linaro/hikey \
- kernel/linaro/hisilicon \
+function copy_local_manifest(){
+ mkdir -p .repo/local_manifests
+ if [ -n "$(ls patches-hook/local_manifests/*.xml)" ]; then
+ cp -uvf patches-hook/local_manifests/*.xml .repo/local_manifests
+ fi
+}
+function repo_sync(){
+ #Syncronize and check out
+ CPUS=$(grep processor /proc/cpuinfo |wc -l)
+ while ! repo sync -j ${CPUS} -c --force-sync; do
+ sleep 30
+ done
+}
function apply_patch(){
local patch_name=$1
@@ -34,33 +133,48 @@ function apply_patch(){
fi
}
-if [ -n "$(ls android-patchsets/*)" ]; then
- cp -ufv patches-hook/android-patchsets/* android-patchsets
-fi
-
-apply_patch hikey-m-workarounds
-apply_patch hikey-optee
-apply_patch hikey-optee-kernel-4.4
-
-# Download and extract HDMI binaries
-binary_base_name="linaro-hikey-20160226-67c37b1a.tgz"
-binary_file_url="https://dl.google.com/dl/android/aosp/${binary_base_name}"
-wget ${binary_file_url}
-if [ $? -ne 0 ]; then
- echo "Failed to download the binaries from ${binary_file_url}"
- exit 1
-fi
-
-tar xzf "${binary_base_name}"
-if [ $? -ne 0 ]; then
- echo "Failed to decompress file ${binary_base_name}"
- exit 1
-fi
-./extract-linaro-hikey.sh
-if [ $? -ne 0 ]; then
- echo "Failed to extract the binary files"
- exit 1
-fi
-
-#./build.sh
-exit
+function get_hikey_binary(){
+ # Download and extract HDMI binaries
+ binary_base_name="linaro-hikey-20160226-67c37b1a.tgz"
+ binary_file_url="https://dl.google.com/dl/android/aosp/${binary_base_name}"
+ wget ${binary_file_url}
+ if [ $? -ne 0 ]; then
+ echo "Failed to download the binaries from ${binary_file_url}"
+ exit 1
+ fi
+
+ tar xzf "${binary_base_name}"
+ if [ $? -ne 0 ]; then
+ echo "Failed to decompress file ${binary_base_name}"
+ exit 1
+ fi
+ ./extract-linaro-hikey.sh
+ if [ $? -ne 0 ]; then
+ echo "Failed to extract the binary files"
+ exit 1
+ fi
+}
+
+function main(){
+ if ${BASE_INITIAL}; then
+ repo_init
+ fi
+ copy_local_manifest
+ repo_sync
+
+ ${BASE}/sync-projects.sh \
+ device/linaro/hikey \
+ kernel/linaro/hisilicon \
+
+
+ if [ -n "$(ls android-patchsets/*)" ]; then
+ cp -ufv patches-hook/android-patchsets/* android-patchsets
+ fi
+
+ apply_patch hikey-m-workarounds
+ apply_patch hikey-optee
+ apply_patch hikey-optee-kernel-4.4
+ get_hikey_binary
+}
+
+main "$@"