| #!/bin/bash |
| |
| . $(dirname $0)/functions |
| |
| PATCHES=0 |
| if [ -n "$1" ]; then |
| AOSP="$1" |
| else |
| AOSP="`pwd`" |
| fi |
| |
| if ! [ -d "$AOSP" ] && ! [ -d "$AOSP/bionic" ] && [ -d "$AOSP"/build ]; then |
| echo "This script must be run from the AOSP source directory" |
| echo "or with the AOSP source directory as its first parameter." |
| exit 1 |
| fi |
| |
| function apply_android_review_mainline_patch(){ |
| local commit_id=$1 && shift |
| local dst_dir="common" |
| if [ -n "$1" ]; then |
| dst_dir="$1" |
| fi |
| |
| if [ -d "${dst_dir}" ]; then |
| curl_am https://android-git.linaro.org/kernel/common.git/patch/?id=${commit_id} "${dst_dir}" |
| else |
| echo "${dst_dir} does not exist, skip to apply commit:${commit_id}" |
| fi |
| } |
| |
| function apply_gerrit_kernel_common_patch(){ |
| local patch_on_linaro=$1 && shift |
| local gerrit_id=$1 && shift |
| local dst_dir="common" |
| if [ -n "$1" ]; then |
| dst_dir="$1" |
| fi |
| |
| if [ -d "${dst_dir}" ]; then |
| if [ -n "${patch_on_linaro}" ] && [ "X${patch_on_linaro}" = "Xfalse" ]; then |
| apply --local ${dst_dir} --remote kernel/common ${gerrit_id} |
| else |
| apply --linaro --local ${dst_dir} --remote kernel/common ${gerrit_id} |
| fi |
| else |
| echo "${dst_dir} does not exist, skip to apply commit:${commit_id}" |
| fi |
| } |
| |
| function apply_android_review_kernel_common_patch(){ |
| local gerrit_id=$1 && shift |
| local dst_dir="common" |
| if [ -n "$1" ]; then |
| dst_dir="$1" |
| fi |
| apply_gerrit_kernel_common_patch true "${gerrit_id}" "${dst_dir}" |
| } |
| |
| function apply_google_review_kernel_common_patch(){ |
| local gerrit_id=$1 && shift |
| local dst_dir="common" |
| if [ -n "$1" ]; then |
| dst_dir="$1" |
| fi |
| apply_gerrit_kernel_common_patch false "${gerrit_id}" "${dst_dir}" |
| } |
| ################################################## |
| ################ Linaro hack ################### |
| ################################################## |