欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

下载github上面的android源码来学习(已附android源码下载地址)

程序员文章站 2022-06-07 22:21:55
...
本文主要分享一个从Github上下载android源码的脚本及本人下载到的android源码。
脚本代码如下:
#!/bin/bash

# --------------------------------------------------------------------------
# Filename:             gitandroid.sh
# Revision:             1.1
# Date:                 2013/09/01
# Author:               Geek_Soledad
# Email:                msdx.android@qq.com
# WebSite:              http://maosidiaoxian.iteye.com
# Description:  a shell to download android source form github.com/android
# Modify:
# Revision      Author          comment
# 1.1           Geek_Soledad    显示完成了多少
# --------------------------------------------------------------------------
# Copyright (c) 2013 CFuture09, Institute of Software, 
# Guangdong Ocean University, Zhanjiang, GuangDong, China.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


#根本目录
ROOT_DIR=`pwd`

ALL_REPO=0
DONE_REPO=0

#$1为保存的地址,$2为下载地址
function cloneit()
{
        cd ${ROOT_DIR}
        ((ALL_REPO++))
        if [ -d $1 ]
        then
                echo -e "\033[0;38;40m $2 has been git clone \033[0m"
                echo "git pull --depth 1 $1"
                cd $1
                git pull --depth 1
        else 
                echo -e "\033[0;31;40m git clone --depth=1 $2 $1 \033[0m"
                git clone --depth=1 $2 $1 
        fi
        local rtnvalue=$?
        if [[ 0 = ${rtnvalue} ]]
        then
                ((DONE_REPO++))
        else
                echo "the return value is ${rtnvalue}"
        fi
        echo finish $(date) $1
        echo "done ${DONE_REPO} / ${ALL_REPO}  repo"
}

#下载路径
function cloneall()
{
        cloneit platform/frameworks/base https://github.com/android/platform_frameworks_base.git
        cloneit platform/build https://github.com/android/platform_build.git
        cloneit platform/system/core https://github.com/android/platform_system_core.git
        cloneit platform/packages/apps/music https://github.com/android/platform_packages_apps_music.git
        cloneit platform/hardware/libhardware https://github.com/android/platform_hardware_libhardware.git
        cloneit platform/dalvik https://github.com/android/platform_dalvik.git
        cloneit platform/external/neven https://github.com/android/platform_external_neven.git
        cloneit platform/external/netperf https://github.com/android/platform_external_netperf.git
        cloneit platform/external/netcat https://github.com/android/platform_external_netcat.git
        cloneit platform/external/skia https://github.com/android/platform_external_skia.git
        cloneit platform/external/safe-iop https://github.com/android/platform_external_safe-iop.git
        cloneit platform/external/qemu https://github.com/android/platform_external_qemu.git
        cloneit platform/external/libpcap https://github.com/android/platform_external_libpcap.git
        cloneit platform/external/jhead https://github.com/android/platform_external_jhead.git
        cloneit platform/external/libxml2 https://github.com/android/platform_external_libxml2.git
        cloneit platform/external/libpng https://github.com/android/platform_external_libpng.git
        cloneit platform/external/protobuf https://github.com/android/platform_external_protobuf.git
        cloneit platform/external/ppp https://github.com/android/platform_external_ppp.git
        cloneit platform/external/oprofile https://github.com/android/platform_external_oprofile.git
        cloneit platform/external/openssl https://github.com/android/platform_external_openssl.git
        cloneit platform/external/sonivox https://github.com/android/platform_external_sonivox.git
        cloneit platform/frameworks/support https://github.com/android/platform_frameworks_support.git
        cloneit platform/packages/providers/downloadprovider https://github.com/android/platform_packages_providers_downloadprovider.git
        cloneit platform/system/bluetooth https://github.com/android/platform_system_bluetooth.git
        cloneit platform/packages/providers/telephonyprovider https://github.com/android/platform_packages_providers_telephonyprovider.git
        cloneit platform/packages/providers/mediaprovider https://github.com/android/platform_packages_providers_mediaprovider.git
        cloneit platform/packages/providers/contactsprovider https://github.com/android/platform_packages_providers_contactsprovider.git
        cloneit platform/packages/apps/phone https://github.com/android/platform_packages_apps_phone.git
        cloneit platform/packages/providers/drmprovider https://github.com/android/platform_packages_providers_drmprovider.git
        cloneit platform/packages/apps/voicedialer https://github.com/android/platform_packages_apps_voicedialer.git
        cloneit platform/packages/apps/mms https://github.com/android/platform_packages_apps_mms.git
        cloneit platform/packages/apps/camera https://github.com/android/platform_packages_apps_camera.git
        cloneit platform/packages/apps/calendar https://github.com/android/platform_packages_apps_calendar.git
        cloneit platform/hardware/ril https://github.com/android/platform_hardware_ril.git
        cloneit platform/packages/providers/calendarprovider https://github.com/android/platform_packages_providers_calendarprovider.git
        cloneit platform/packages/apps/stk https://github.com/android/platform_packages_apps_stk.git
        cloneit platform/packages/apps/packageinstaller https://github.com/android/platform_packages_apps_packageinstaller.git
        cloneit platform/packages/apps/email https://github.com/android/platform_packages_apps_email.git
        cloneit platform/packages/apps/settings https://github.com/android/platform_packages_apps_settings.git
        cloneit platform/manifest https://github.com/android/platform_manifest.git
        cloneit platform/packages/apps/contacts https://github.com/android/platform_packages_apps_contacts.git
        cloneit platform/packages/apps/browser https://github.com/android/platform_packages_apps_browser.git
        cloneit platform/external/webkit https://github.com/android/platform_external_webkit.git
        cloneit platform/external/zlib https://github.com/android/platform_external_zlib.git
        cloneit platform/bionic https://github.com/android/platform_bionic.git
        cloneit platform/external/srec https://github.com/android/platform_external_srec.git
        cloneit platform/external/sqlite https://github.com/android/platform_external_sqlite.git
        cloneit platform/external/dbus https://github.com/android/platform_external_dbus.git
        cloneit platform/external/expat https://github.com/android/platform_external_expat.git
        cloneit platform/development https://github.com/android/platform_development.git
        cloneit platform/external/jpeg https://github.com/android/platform_external_jpeg.git
        cloneit platform/external/dhcpcd https://github.com/android/platform_external_dhcpcd.git
        cloneit platform/external/emma https://github.com/android/platform_external_emma.git
        cloneit platform/external/elfutils https://github.com/android/platform_external_elfutils.git
        cloneit platform/external/icu4c https://github.com/android/platform_external_icu4c.git
        cloneit platform/external/iptables https://github.com/android/platform_external_iptables.git
        cloneit platform/external/ping https://github.com/android/platform_external_ping.git
        cloneit platform/packages/apps/htmlviewer https://github.com/android/platform_packages_apps_htmlviewer.git
        cloneit platform/packages/apps/calculator https://github.com/android/platform_packages_apps_calculator.git
        cloneit platform/packages/apps/soundrecorder https://github.com/android/platform_packages_apps_soundrecorder.git
        cloneit platform/external/yaffs2 https://github.com/android/platform_external_yaffs2.git
        cloneit platform/external/tinyxml https://github.com/android/platform_external_tinyxml.git
        cloneit platform/external/tcpdump https://github.com/android/platform_external_tcpdump.git
        cloneit platform/external/tagsoup https://github.com/android/platform_external_tagsoup.git
        cloneit platform/external/strace https://github.com/android/platform_external_strace.git
        cloneit platform/external/freetype https://github.com/android/platform_external_freetype.git
        cloneit platform/external/dropbear https://github.com/android/platform_external_dropbear.git
        cloneit platform/external/esd https://github.com/android/platform_external_esd.git
        cloneit platform/external/fdlibm https://github.com/android/platform_external_fdlibm.git
        cloneit platform/external/libffi https://github.com/android/platform_external_libffi.git
        cloneit platform/external/jdiff https://github.com/android/platform_external_jdiff.git
        cloneit platform/external/giflib https://github.com/android/platform_external_giflib.git
        cloneit platform/external/apache-http https://github.com/android/platform_external_apache-http.git
        cloneit kernel/common https://github.com/android/kernel_common.git
        cloneit kernel/msm https://github.com/android/kernel_msm.git
        cloneit platform/prebuilt https://github.com/android/platform_prebuilt.git
        cloneit android.github.io https://github.com/android/android.github.io.git
        cloneit tools/repo https://github.com/android/tools_repo.git
        cloneit platform/external/wpa/supplicant https://github.com/android/platform_external_wpa_supplicant.git
        cloneit platform/packages/apps/googlesearch https://github.com/android/platform_packages_apps_googlesearch.git
        cloneit platform/system/wlan/ti https://github.com/android/platform_system_wlan_ti.git
        cloneit platform/packages/providers/googlecontactsprovider https://github.com/android/platform_packages_providers_googlecontactsprovider.git
        cloneit platform/packages/apps/im https://github.com/android/platform_packages_apps_im.git
        cloneit platform/packages/providers/improvider https://github.com/android/platform_packages_providers_improvider.git
        cloneit platform/external/tremor https://github.com/android/platform_external_tremor.git
        cloneit platform/packages/apps/sync https://github.com/android/platform_packages_apps_sync.git
        cloneit platform/packages/apps/alarmclock https://github.com/android/platform_packages_apps_alarmclock.git
        cloneit platform/external/aes https://github.com/android/platform_external_aes.git
        cloneit platform/external/clearsilver https://github.com/android/platform_external_clearsilver.git
        cloneit platform/external/googleclient https://github.com/android/platform_external_googleclient.git
        cloneit platform/packages/apps/launcher https://github.com/android/platform_packages_apps_launcher.git
        cloneit platform/external/bluez https://github.com/android/platform_external_bluez.git 
        cloneit platform/external/gdata https://github.com/android/platform_external_gdata.git
        cloneit platform/frameworks/opt/com.google.android https://github.com/android/platform_frameworks_opt_com.google.android.git
        cloneit platform/external/elfcopy https://github.com/android/platform_external_elfcopy.git
        cloneit platform/frameworks/policies/base https://github.com/android/platform_frameworks_policies_base.git
        cloneit platform/packages/apps/updater https://github.com/android/platform_packages_apps_updater.git
        cloneit platform/external/opencore https://github.com/android/platform_external_opencore.git
}

LOGDIR=log
if [ ! -d "${LOGDIR}" ]
then
    mkdir ${LOGDIR}
fi
LOGFILE=${LOGDIR}/`date +%m%d%H%M%S`.log
cloneall | tee -a ${LOGFILE}


这里注明一下,如果你的网速够快,建议将上面的--depth 1 参数去掉。另外,上面下载到的Android代码本人并没有成功编译过,仅仅是为了研习代码。
该脚本最新版本可以通过以下命令获取:
svn cat http://source-about-android.googlecode.com/svn/trunk/gitandroid.sh>gitandroid.sh


上面脚本为本人所编写,如果有问题,还请指出。

另外,附上本人已经下载的代码打包地址,因为可能有些人网络不好,下载容易断,本人在下载中发现git检出代码如果断了将需要重新下载,所以在这里提供代码下载以便大家研习。正好赶上最近互联网几大巨头拼网盘,就传上360网盘上了。
目前代码还在上传,先贴上部分已经传上来的代码的地址:
gitandroid.sh:http://yunpan.cn/QXCPxwYPLc7ZY
android.github.io.zip:http://yunpan.cn/QXCPStjQQJ7rH
tools.zip:http://yunpan.cn/QXCP6KHGbdU8b
kernel.zip:http://yunpan.cn/QXCPknWqNW9bJ
platform-bonic:http://yunpan.cn/QGdmAPamArsIN
platform-build:http://yunpan.cn/QGdmKBNzwVLgJ
platform-dalvik:http://yunpan.cn/QGdmdJnX77eII
platform-development:http://yunpan.cn/QGdmm5e62YFhB
platform-external:http://yunpan.cn/QGdm3q6tymhwd
platform-framework:http://yunpan.cn/QGdmrQzws7SNk
platform-hardware:http://yunpan.cn/QGdmYWTX8LAnG
platform-manifest:http://yunpan.cn/QGdmqNk99rDJe
platform-packkages:http://yunpan.cn/QGdmSdHYGIpqz
platform-prebuilt:http://yunpan.cn/QGdmRtJEMJrCU
platform-system:http://yunpan.cn/QGdm6QyYfhELd