Last active
September 21, 2018 08:54
-
-
Save thinkycx/3d5f135475e0e95de61c6aea4ec4f941 to your computer and use it in GitHub Desktop.
download msm kernel、aosp、 compile-tools 、vendors with this script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Use to download AOSP kernel build-chains and vendors | |
# vendors needs run by youself | |
# test in ubuntu:14.04 docker, contact me if you need it | |
# author: thinkycx@gmail.com | |
# License: Gnu GPL v. 2 | |
# License is same as Linux kernel license, since the code helps compile the Linux kernel for a device | |
export BASE_FOLDER="/root/AOSP/" | |
export BASE_URL="https://aosp.tuna.tsinghua.edu.cn" | |
# export BASE_URL="https://android.googlesource.com" | |
# download kernel | |
export KERNEL_BRANCH="" # "android-msm-wahoo-4.4-oreo-mr1" #"android-msm-wahoo-4.4-oreo-dr1" | |
export KERNEL_COMMIT="" #4.4.56-g594d847d09a1" | |
# download aosp | |
export BRANCH_NAME=android-8.1.0_r12 #android-8.0.0_r33 | |
export REPO_SYNC_NUM=30 | |
# download tools | |
export TOOL_CHAIN="/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9" | |
# https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 | |
#download_vendors | |
#export VENDOR_FOLDER="vendors_android-8.0.0_r33_OPD1.170816.025" | |
#export VENDOR_URL1="https://dl.google.com/dl/android/aosp/google_devices-walleye-opd1.170816.025-b2e61e30.tgz" | |
#export VENDOR_URL2="https://dl.google.com/dl/android/aosp/qcom-walleye-opd1.170816.025-a1675f61.tgz" | |
export VENDOR_FOLDER="vendors_android-8.1.0_r12_OPM1.171019.019" | |
export VENDOR_URL1="https://dl.google.com/dl/android/aosp/google_devices-walleye-opm1.171019.019-cd268456.tgz" | |
export VENDOR_URL2="https://dl.google.com/dl/android/aosp/qcom-walleye-opm1.171019.019-416731be.tgz" | |
# [1] https://source.android.com/setup/start/build-numbers.html#source-code-tags-and-builds | |
# android-8.0.0_r33 -> OPD1.170816.025 android-8.0.0_r33 Oreo Pixel 2 XL, Pixel 2 | |
# [2] https://developers.google.com/android/drivers | |
# OPD1.170816.025 -> vendors url | |
# optional factory-images url: https://developers.google.com/android/images | |
download_vendors() | |
{ | |
cd ${BASE_FOLDER} | |
mkdir ${VENDOR_FOLDER} | |
cd ${VENDOR_FOLDER} | |
echo "download the vendors" | |
wget ${VENDOR_URL1} | |
wget ${VENDOR_URL2} | |
ls *.tgz | xargs -n1 tar xzvf | |
cp *.sh ${BASE_FOLDER}/${BRANCH_NAME} | |
cd ${BASE_FOLDER}/${BRANCH_NAME} | |
echo "execute vendor bash scritps by yourself" | |
echo "such as:" | |
echo " ./extract-google_devices-walleye.sh" | |
echo " ./extract-qcom-walleye.sh" | |
} | |
download_aosp() | |
{ | |
echo "[1] download repo binary" | |
mkdir ~/bin | |
PATH=~/bin:$PATH | |
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo | |
chmod a+x ~/bin/repo | |
git config --global user.name "Your Name" | |
git config --global user.email "you@example.com" | |
echo "[2] repo init and sync branch: ${BRANCH_NAME}" | |
cd ${BASE_FOLDER} | |
mkdir ${BRANCH_NAME} | |
cd ${BRANCH_NAME} | |
echo "start repo init" | |
repo init -u ${BASE_URL}/platform/manifest -b ${BRANCH_NAME} | |
# repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b ${BRANCH_NAME} | |
### now need to choose color | |
echo "start repo sync" | |
repo sync -j${REPO_SYNC_NUM} | |
echo "[3] AOSP branch download success: ${BRANCH_NAME}" | |
} | |
download_kernel() | |
{ | |
cd ${BASE_FOLDER} | |
git clone ${BASE_URL}/kernel/msm | |
cd msm | |
# checkout -b branch | |
if [ -z "${KERNEL_BRANCH}" ]; | |
then | |
echo "don't checkout" | |
else | |
echo "checkout ${KERNEL_BRANCH}" | |
git checkout -b ${KERNEL_BRANCH} origin/${KERNEL_BRANCH} | |
fi | |
# reset | |
if [ -z "${KERNEL_COMMIT}" ]; | |
then | |
echo "don't reset" | |
else | |
echo "git reset to ${KERNEL_COMMIT}" | |
git reset --hard ${KERNEL_COMMIT} | |
fi | |
} | |
download_tools() | |
{ | |
cd ${BASE_FOLDER} | |
mkdir "tools" | |
cd "tools" | |
git clone ${BASE_URL}${TOOL_CHAIN} | |
} | |
download_kernel || exit 1 | |
download_aosp || exit 1 | |
download_tools || exit 1 | |
download_vendors || exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment