ºìÁªLinuxÃÅ»§
Linux°ïÖú

Ubuntu 8.04ϱàÒëAndroidÔ´ÂëÈ«¹ý³Ì£¨×ª£©

·¢²¼Ê±¼ä:2010-01-07 17:52:12À´Ô´:ºìÁª×÷Õß:hongyu315
Ò»¡¢»ñÈ¡AndroidÔ´´úÂë
GitÊÇLinux Torvalds£¨LinuxÖ®¸¸£©ÎªÁË°ïÖú¹ÜÀíLinuxÄں˿ª·¢¶ø¿ª·¢µÄÒ»¸ö¿ª·ÅÔ´ÂëµÄ·Ö²¼Ê½°æ±¾¿ØÖÆÈí¼þ£¬Ëü²»Í¬ÓÚSubversion¡¢CVSÕâÑùµÄ¼¯ÖÐʽ°æ±¾¿ØÖÆϵͳ¡£ÔÚ¼¯ÖÐʽ°æ±¾¿ØÖÆϵͳÖÐÖ»ÓÐÒ»¸ö²Ö¿â£¨Repository£©£¬Ðí¶à¸ö¹¤×÷Ŀ¼£¨Working Copy£©£¬¶øÔÚGitÕâÑùµÄ·Ö²¼Ê½°æ±¾¿ØÖÆϵͳÖУ¨ÆäËûÖ÷ÒªµÄ·Ö²¼Ê½°æ±¾¿ØÖÆϵͳ»¹ÓÐBitKeeper¡¢Mercurial¡¢GNU Arch¡¢Bazaar¡¢Darcs¡¢SVK¡¢MonotoneµÈ£©£¬Ã¿Ò»¸ö¹¤×÷Ŀ¼¶¼°üº¬Ò»¸öÍêÕû²Ö¿â£¬ËüÃÇÖ§³ÖÀëÏß¹¤×÷£¬±¾µØÌá½»¿ÉÒÔÉÔºóÌá½»µ½·þÎñÆ÷ÉÏ¡£

ÒòΪAndroidÊÇÓÉKernel¡¢Dalvik¡¢Bionic¡¢Prebuilt¡¢buildµÈ¶à¸öÏîÄ¿×é³É£¬Èç¹ûÎÒÃÇ·Ö±ðʹÓÃGitÀ´Öð¸ö»ñÈ¡ÏԵúÜÂé·³£¬ËùÒÔAndroidÏîÄ¿±àдÁËÒ»¸öÃûΪRepoµÄPythonµÄ½Å±¾À´Í³Ò»¹ÜÀíÕâЩÏîÄ¿µÄ²Ö¿â£¬Ê¹µÃÏîÄ¿µÄ»ñÈ¡¸ü¼Ó¼òµ¥¡£

ÔÚUbuntu 8.04ÉÏ°²×°GitÖ»ÐèÒªÉ趨ÕýÈ·µÄ¸üÐÂÔ´£¬È»ºóʹÓÃapt-get¾Í¿ÉÒÔÁË£¬apt-getÊÇÒ»ÌõLinuxÃüÁÖ÷ÒªÓÃÓÚ×Ô¶¯´Ó»¥ÁªÍøµÄÈí¼þ²Ö¿âÖÐËÑË÷¡¢°²×°¡¢Éý¼¶¡¢Ð¶ÔØÈí¼þ»ò²Ù×÷ϵͳ¡£
apt-getÃüÁîÒ»°ãÐèÒªrootȨÏÞÖ´ÐУ¬ËùÒÔÒ»°ã¸ú×ÅsudoÃüÁî¡£

sudo apt-get install git-core curl

ÕâÌõÃüÁî»á´Ó»¥ÁªÍøµÄÈí¼þ²Ö¿âÖа²×°git-coreºÍcurl¡£

ÆäÖÐcurlÊÇÒ»¸öÀûÓÃURLÓï·¨ÔÚÃüÁîÐз½Ê½Ï¹¤×÷µÄÎļþ´«Ê乤¾ß£¬ËüÖ§³ÖºÜ¶àЭÒ飬°üÀ¨FTP¡¢FTPS¡¢HTTP¡¢HTTPS¡¢TELENTµÈ£¬ÎÒÃÇÐèÒª°²×°Ëü´ÓÍøÂçÉÏ»ñÈ¡Repo½Å±¾Îļþ¡£

curl
http://android.git.kernel.org/repo
>~/bin/repo

Õâ¾äÃüÁî»áÏÂÔØrepo½Å±¾Îļþµ½µ±Ç°Ö÷Ŀ¼µÄ/binĿ¼Ï£¬²¢±£´æÔÚÎļþrepoÖС£

×îºóÎÒÃÇÐèÒª¸ørepoÎļþ¿ÉÖ´ÐÐȨÏÞ

chmod a+x ~/bin/repo

½ÓÏÂÀ´ÎÒÃǾͿÉÒÔÀûÓÃrepo½Å±¾ºÍGit¡¢curlÈí¼þ»ñÈ¡AndroidµÄÔ´´úÂëÁË£º£©

Ê×ÏȽ¨Ò»¸öĿ¼£¬±ÈÈç~/android¡£
È»ºóʹÓÃÏÂÃæÃüÁî»ñÈ¡Ô´Â룺

repo init -u git://android.git.kernel.org/platform/manifest.git

Õâ¸ö¹ý³Ì»á³ÖÐøºÜ³¤µÄʱ¼ä£¨±ÊÕßÏÂÔØÁËÒ»Ì죩£¬ÏÂÔØÍê±Ïºó»á¿´µ½repo initialized in /androidÕâÑùµÄÌáʾ£¬ËµÃ÷±¾µØµÄ°æ±¾¿âÒѾ­³õʼ»¯Íê±Ï£¬²¢ÇÒ°üº¬Á˵±Ç°×îеÄsourcecode¡£

Èç¹ûÎÒÃÇÏëÄÃij¸ö·ÖÖ§°æ±¾µÄ´úÂ룬¶ø²»ÊÇÖ÷Ïß´úÂ룬ÐèҪʹÓÃ-b²ÎÊýÖ¸¶¨branchµÄÃû×Ö£¬±ÈÈ磺

repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake

Èç¹ûÎÒÃÇÖ»ÊÇÏë»ñȡijһ¸öprojectµÄ´úÂ룬±ÈÈçkernel/common£¬¾Í²»ÐèÒªrepo½Å±¾ÁË£¬Ö±½ÓʹÓÃGit¹¤¾ß¼´¿É£¬Èç¹û×ÐϸÑо¿repo½Å±¾»á·¢ÏÖ£¬repo½Å±¾Æäʵ¾ÍÊÇ×éÖ¯Git¹¤¾ßÈ¥»ñÈ¡¸÷¸öProject²¢°ÑËüÃÇ×éÖ¯µ½Í¬Ò»¸öÏîÄ¿AndroidÄÚ¡£

git clone git://android.git.kernel.org/kernel/common.git

ÎÒÃÇÉÏÃæʹÓÃrepo½Å±¾»ñÈ¡Á˸÷¸öÏîÄ¿£¬ÄÇô½ÓÏÂÀ´¾ÍÐèÒª°ÑÕû¸öAndroid´úÂëÊ÷ͬ²½µ½±¾µØ£¬ÈçÏ£º

repo sync project1 project2 ¡­

±ÊÕßʹÓÃrepo syncÃüÁîÖ±½Óͬ²½È«²¿ÏîÄ¿µ½±¾µØ¡£

¶þ¡¢Ô´Âë±àÒë

È«²¿Í¬²½Íê±Ïºó£¬½øÈëµ½AndroidĿ¼Ï£¬Ê¹ÓÃmakeÃüÁî±àÒ룬Äã»á·¢ÏÖ³öÏÖÈçÏ´íÎóÌáʾ£º

host C: libneo_cgi

Õâ¸ö´íÎóÊÇÒòΪÎÒÃÇȱÉÙzlib1g-dev£¬ÐèҪʹÓÃapt-getÃüÁî´ÓÈí¼þ²Ö¿âÖа²×°£¬ÈçÏ£º

sudo apt-get install zlib1g-dev

ͬÀí£¬ÎÒÃÇ»¹ÐèÒªÒÀ´Î°²×°ÈçÏÂÈí¼þ

sudo apt-get install flex
sudo apt-get install bison
sudo apt-get install gperf
sudo apt-get install libsdl-dev
sudo apt-get install libesd0-dev
sudo apt-get install libncurses5-dev
sudo apt-get install libx11-dev

ÒÔÉÏÈí¼þÈ«²¿°²×°Íê±Ïºó£¬ÔËÐÐmakeÃüÁîÔٴαàÒëAndroidÔ´Âë¡£

Õâ¸öʱºòÄã»á·¢ÏÖ³öÏֺܶàjavaÎļþÎÞ·¨±àÒëµÄ´íÎ󣬴ò¿ªAndroidµÄÔ´ÂëÎÒÃÇ¿ÉÒÔ¿´µ½ÔÚandroid/dalvik/libcore/dom/src/test/java/org/w3c/domtsÏÂÓкܶàjavaÔ´Îļþ£¬ÕâÒâζ×űàÒëAndroid֮ǰÐèÒªÏÈ°²×°JDK¡£
Ê×ÏÈ´Ósun¹Ù·½ÍøÕ¾ÏÂÔØjdk-6u16-linux-i586.binÎļþ²¢°²×°Ëü¡£

ÔÚUbuntu 8.04ÖУ¬/etc/profileÎļþÊÇÈ«¾ÖµÄ»·¾³±äÁ¿ÅäÖÃÎļþ£¬ËüÊÊÓÃÓÚËùÓеÄshell¡£ÔÚÎÒÃǵǽLinuxϵͳʱ£¬Ê×ÏÈÆô¶¯/etc/profileÎļþ£¬È»ºóÔÙÆô¶¯Óû§Ä¿Â¼ÏµÄ~/.bash_profile¡¢~/.bash_login»ò~/.profileÎļþÖеÄÆäÖÐÒ»¸ö£¬Ö´ÐеÄ˳ÐòºÍÉÏÃæµÄÅÅÐòÒ»Ñù¡£Èç¹û~/.bash_profileÎļþ´æÔڵĻ°£¬Ò»°ã»¹»áÖ´ÐÐ~/.bashrcÎļþ¡£
ËùÒÔÎÒÃÇÖ»ÐèÒª°ÑJDKµÄĿ¼·Åµ½/etc/profileÀï¼´¿É£¬ÈçÏ£º

JAVA_HOME=/usr/local/src/jdk1.6.0_16
PATH=$PATH:$JAVA_HOME/bin:/usr/local/src/android-sdk-linux_x86-1.1_r1/tools:~/bin

È»ºóÖØÐÂÆô¶¯Ò»Ï»úÆ÷£¬ÊäÈëjava -versionÃüÁÌáʾÈçÏÂÐÅÏ¢´ú±íÅäÖóɹ¦£º

java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

ÔÚ±àÒëÍêÕû¸öÏîÄ¿ºó£¬Öն˻á³öÏÖÈçÏÂÌáʾ£º
Target system fs image: out/target/product/generic/obj/PACKAGING/systemimage_unopt_intermediates/system.img
Install system fs image: out/target/product/generic/system.img
Target ram disk: out/target/product/generic/ramdisk.img
Target userdata fs image: out/target/product/generic/userdata.img
Installed file list: out/target/product/generic/installed-files.txt
[email=root@dfsun2009-desktop:/bin/android]root@dfsun2009-desktop:/bin/android[/email]
#
Èý¡¢Ô´ÂëÔËÐÐ

ÔÚ±àÒëÍêÕû¸öÏîÄ¿ºó£¬Èç¹ûÎÒÃÇÐèÒª¹Û¿´±àÒëºóµÄÔËÐÐЧ¹û£¬ÄÇô¾ÍÐèÒªÔÚϵͳÖа²×°Ä£ÄâÆ÷android-sdk-linux_x86-1.1_r1£¬Õâ¸öSDKµÄÏÂÔصØַΪ£º

linux:
http://dl.google.com/android/android-sdk-linux_x86-1.1_r1.zip

mac:
http://dl.google.com/android/android-sdk-mac_x86-1.1_r1.zip

windows:
http://dl.google.com/android/android-sdk-windows-1.1_r1.zip

½âѹºóÐèÒª°Ñ/usr/local/src/android-sdk-linux_x86-1.1_r1/toolsĿ¼¼ÓÈ뵽ϵͳ»·¾³±äÁ¿/etc/profileÖС£

È»ºóÕÒµ½±àÒëºóandroidµÄĿ¼Îļþout£¬ÎÒÃÇ·¢ÏÖÔÚandroid/out/host/linux-x86/bin϶àÁ˺ܶàÓ¦ÓóÌÐò£¬ÕâЩӦÓóÌÐò¾ÍÊÇandroidµÃÒÔÔËÐеĻù´¡£¬ËùÒÔÎÒÃÇÐèÒª°ÑÕâ¸öĿ¼ҲÌí¼Óµ½ÏµÍ³PATHÏ£¬ÔÚ$HOME/.profileÎļþÖмÓÈëÈçÏÂÄÚÈÝ£º

PATH=¡±$PATH:$HOME/android/out/host/linux-x86/bin¡±

½ÓÏÂÀ´ÎÒÃÇÐèÒª°ÑandroidµÄ¾µÏñÎļþ¼ÓÔص½emulatorÖУ¬Ê¹µÃemulator¿ÉÒÔ¿´µ½androidÔËÐеÄʵ¼ÊЧ¹û£¬ÔÚ$HOME/.profileÎļþÖмÓÈëÈçÏÂÄÚÈÝ£º

ANDROID_PRODUCT_OUT=$HOME/android/out/target/product/generic
export ANDROID_PRODUCT_OUT

È»ºóÖØÐÂÆô¶¯»úÆ÷¡£

ÏÂÃæ¾Í¿ÉÒÔ½øÈ뵽ģÄâÆ÷Ŀ¼Öв¢Æô¶¯Ä£ÄâÆ÷

cd $HOME/android/out/target/product/generic
emulator -image system.img -data userdata.img -ramdisk ramdisk.img


×ܽáһϰ²×°¹ý³ÌÖеĹؼüµã£º
1£ºJDK°æ±¾±ØÐë°²×°
2£ºÀûÓÃÏÂÃæµÄÃüÁîÈ·±£ËùÐèÈí¼þ¶¼±»ÕýÈ·°²×°
sudo apt-get install flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential python valgrind curl git
3:ÄÚ´æ¼°ÐéÄâÄÚ´æ±£Ö¤ÔÚ2GBÒÔÉÏ£¬¿ÉÒÔ²ÉÓÃÃüÁîÐÐfree -m²é¿´ÄÚ´æÊÇ·ñ×ã¹»£¬Èç¹ûÄÚ´æ²»¹»ÖÕ¶ËÍ£ÖÍ
http://blog.csdn.net/dongfengsun/archive/2009/10/16/4679902.aspx


±¾ÎÄÀ´×ÔChinaUnix²©¿Í£¬Èç¹û²é¿´Ô­ÎÄÇëµã£ºhttp://blog.chinaunix.net/u2/88379/showart_2112527.html
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ