[android_linux] 01_Android源码下载

Android 4.0

Android源码下载

Android源码下载:
1、工具下载:
①​在ubuntu中安装git工具:
    $ sudo apt-get install git-core curl 
②repo工具下载
建立一个存放repo工具的目录:
    $ mkdir ~/bin
将该路径加入到环境变量$PATH路径中去:
临时更改PATH路径:
    $  export  PATH="$PATH:~/bin"
查看PATH环境变量:
    $  echo $PATH下载repo工具
    $ curl http://git-repo.googlecode.com/files/repo-1.12 > ~/bin/repo
修改repo工具权限:
    $ chmod a+x ~/bin/repo

建立
touch ~/.netrc
machine android.googlesource.com login git-zfs592645357.gmail.com password 1/iUnuoNysq3MVIjceeclUgwhhQuedQevsLbYAssKEBZE
machine android-review.googlesource.com login git-zfs592645357.gmail.com password 1/iUnuoNysq3MVIjceeclUgwhhQuedQevsLbYAssKEBZE

2、源码下载
mkdir -p ~/develop/anroid4.3
cd ~/develop/anroid4.3

repo init -u https://android.googlesource.com/a/platform/manifest (或者repo init,根据提示来做)
git config --global user.email "[email protected]"
git config --global user.name "hacket"

cp /home/hacket/bin/.repo/repo/repo /home/hacket/bin/repo(如果有提示就复制,否则不用)
repo init -u  https://android.googlesource.com/platform/manifest -b android-4.4_r1

在~/建立一个tryrepo.sh脚本(防止掉线):
#! /bin/bash
echo "=====start repo sync======" 
repo sync 
while [ $? = 1 ]; do 
echo “======sync failed, re-sync again======” 
sleep 3 
repo sync 
done  
修改tryrepo.sh权限:
chmod a+x ~/tryrepo.sh
进入目录,进行下载
cd ~/develop/anroid4.3
~/tryrepo.sh


ubunbu:
①切换到root用户
sudo passwd  root 
su root
②静默删除文件和文件夹
rm -rf xxx
③添加一个用户
sudo adduser test
问题:xiaosheng 不在 sudoers 文件中。此事将被报告。
以root身份:usermod -G sudo xiaosheng
④删除一个用户
userdel -r test 使用参数 -r 使用者目录下的档案一并移除。在其他位置上的目录也将一一找出并删除

问题1:
object 12fd10c20115046dcd2fbe468a45e566f38ffbc9
type commit
tag v1.12.7
tagger Conley Owens <[email protected]> 1381959964 -0700

repo 1.12.7

gpg: 于 2013年10月17日 星期四 05时46分04秒 CST 创建的签名,使用 RSA,钥匙号 692B382C
gpg: 无法检查签名:找不到公钥
error: 不能校验 tag 'v1.12.7'
分析:google一下,发现出错原因是曾使用repo sync从其它库sync过代码,删掉~/.repoconfig即可
解决:
rm -r  ~/.repoconfig/ 

googlehttp://source.android.com/source/downloading.html,为了防止连接数过多,每个ip都需要认证。。。
第一步:从这里 the password generatorhttps://android.googlesource.com/new-password  获取用户名和密码
第二步:将上面的页面上以machine开头的两行复制到  ~/.netrc文件中
第三步:repo init -u https://android.googlesource.com/a/platform/manifest  多了个/a
然后就可以repo sync

Login for Git:

Username: git-zfs592645357.gmail.com
Password: 1/IG2LlTvaTikV0avNiIX3-lnFC6Zq4RfcvRDID8zZJv0

Staying Authenticated - Linux and Mac OS X:

To stay authenticated by saving the password, append the following line to the ~/.netrc configuration file:
machine android.googlesource.com login git-zfs592645357.gmail.com password 1/IG2LlTvaTikV0avNiIX3-lnFC6Zq4RfcvRDID8zZJv0
machine android-review.googlesource.com login git-zfs592645357.gmail.com password 1/IG2LlTvaTikV0avNiIX3-lnFC6Zq4RfcvRDID8zZJv0
Make sure you have set the permissions on ~/.netrc so that only your user account can read the file. If your home directory is on a network filesystem, consider moving it to a local disk and making ~/.netrc a symbolic link to the local version.

Staying Authenticated - Windows:

To stay authenticated by saving the password, append the following line to the %HOME%\_netrc configuration file:
machine android.googlesource.com login git-zfs592645357.gmail.com password 1/IG2LlTvaTikV0avNiIX3-lnFC6Zq4RfcvRDID8zZJv0
machine android-review.googlesource.com login git-zfs592645357.gmail.com password 1/IG2LlTvaTikV0avNiIX3-lnFC6Zq4RfcvRDID8zZJv0
Ensure %HOME% is configured in the environment to be the same location as %USERPROFILE%. Note that by default, Windows systems will not define the environment variable %HOME%; you must explicitly add it:
Start menu -> Computer -> (right click) -> Properties -> Advanced System Settings -> Environment Variables
Make sure you have set the permissions on %HOME%\_netrc so that only your user account can read the file.