Linux/Unix 환경에서 안드로이드 소스 트리를 다운로드 하는 방법입니다.

사용자의 홈디렉토리에 bin 디렉토리를 생성합니다.

[root@yongbok ~]# mkdir ~/bin
[root@yongbok ~]# PATH=~/bin:$PATH

Repo 스크립트를 다운로드 하고 실행권한을 줍니다.

[root@yongbok ~]# curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 19731  100 19731    0     0  21288      0 –:–:– –:–:– –:–:– 24818
[root@yongbok ~]# chmod a+x ~/bin/repo

소스 트리를 다운로드할 디렉토리를 생성합니다.

[root@yongbok ~]# mkdir /android/repository ; cd /android/repository

manifest를 다운로드 합니다.

[root@yongbok /android/repository]# repo init -u https://android.googlesource.com/platform/manifest

소스 트리를 다운로드 하면 됩니다.

[root@yongbok /android/repository]# repo sync

쉘 스크립트로 만들어 관리 할수 있습니다.

[root@yongbok ~]# nano ~/android.sh
#!/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin
export PATH

LOCKFILE=”/tmp/android_lockfile”

if [ -e $LOCKFILE ]; then
echo “android – Lockfile $LOCKFILE exists” >/dev/stderr
exit 1
fi
touch $LOCKFILE

cd /android/repository ; repo sync

rm $LOCKFILE

Thanks 😀

참고
http://source.android.com/source/downloading.html