ubuntu 10.04(64位)下搭建android4.3開(kāi)發(fā)環(huán)境
http://releases.ubuntu.com/lucid/
http://ubuntu.mirrors.tds.net/pub/releases/10.04/
http://mirror.tju.edu.cn/ubuntu-releases/releases/releases/jigit/lucid/?sort=size&order=desc
選擇的是64位的鏡像:
ubuntu-10.04.4-desktop-amd64.iso
http://releases.ubuntu.com/lucid/ubuntu-10.04.4-desktop-amd64.iso
或者
http://ubuntu.mirrors.tds.net/pub/releases/10.04/ubuntu-10.04.4-desktop-amd64.iso
第二步:
下載之后在VMware上安裝ubuntu。安裝完成后,用update manager更新最新的pach。創(chuàng)建用戶zhenwx和samba用戶zhenwx和密碼
在64位WIN7系統(tǒng)安裝64位UBUNTU10.04
1,安裝vmware8.0.2
安裝完成vmware8.0.2后,打開(kāi)vmware8.0.2,在Edit菜單打開(kāi)Virtual Network Editor子菜單,在下面的Vmnet8子項(xiàng)點(diǎn)擊,對(duì)話框下面的subnet IP 為192.168.128.0,subnet mask為255.255.255.0. 如果不是就改為這個(gè)配置。點(diǎn)擊DHCP settings按鈕進(jìn)入IP設(shè)置,在Start IP address 對(duì)話框填入192.168.128.128,在End IP address 對(duì)話框填入192.168.128.129,點(diǎn)擊ok保存,這樣IP地址就固定到192.168.128.128,方便后面和windows互相訪問(wèn)。
內(nèi)存配置一般為物理內(nèi)存的1半,比如8G內(nèi)存,那么這里選4G大小,選擇太大會(huì)影響windows的性能。
處理器的配置,如果是I5 2500S的處理器選擇4 processor,1 core per processor。
如果是T7500的處理器選擇2 processor,1 core per processor。
這里配置不對(duì)會(huì)影響到性能,處理器沒(méi)有充分發(fā)揮到最好的性能。
內(nèi)存選1半,比如內(nèi)存一共20G,這里設(shè)置10G
內(nèi)存設(shè)置的位置為,vmware的菜單VM----》settings---》memory 設(shè)置為10G
cpu為I5-2500S,
CPU設(shè)置的位置為,vmware的菜單VM----》settings---》processors--》number of processors 選4
--》number of core per processors 選 1
2,安裝ubuntu
下載 ubuntu-10.04.4-desktop-amd64.iso
file-->new virtual machine
菜單VM--》setting-->hardware--》CD/DVD-->use ISO image file選擇ubuntu-10.04.4-desktop-amd64.iso
一步一步安裝,安裝過(guò)程要輸入主機(jī)名字zhenwx和登錄用戶名zhenwx和登錄密碼,大概兩個(gè)小時(shí)安裝完成。
3, applications --->ubuntu software center---》 update manager---->install下載安裝更新
下載120M的更新包和安裝,慢慢等待。
4,安裝samba
sudo apt-get install samba samba-common
菜單applications --->ubuntu software center-》get software, 地址欄輸入samba,在菜單選擇samba,點(diǎn)擊install進(jìn)入安裝samba,
安裝好后,在菜單system----》administration---》samba--》add a samba share (+號(hào))--》 create samba share
basic--》directory browser --》file system --》home --》zhenwx /home/zhenwx文件夾共享給zhenwx用戶,設(shè)置為可以讀寫(xiě)(writable visable 打勾)
access--》only allow access specific user 前面打勾--》 在zhenwx前面打勾
sudo smbpasswd -a zhenwx
為samba用戶設(shè)置密碼,否則win7不能夠訪問(wèn)
5,ifconfig 看看ip地址192.168.241.135
6,在windos 的地址欄\\192.168.241.135 可以看到zhenwx目錄,彈出widows安全對(duì)話框,輸入samba用戶名和密碼
7,安裝ssh
sudo apt-get install openssh-server openssh-client
在WIN7端連接
secureCRT => Quick Connect, 連接ubuntu, 輸入ubuntu的id和pwd
hostname 192.168.241.135
username zhenwx
連接后
Linux zhenwx-desktop 2.6.32-41-generic #88-Ubuntu SMP Thu Mar 29 13:10:32 UTC 2012 x86_64 GNU/Linux
Ubuntu 10.04.4 LTS
Welcome to Ubuntu!
* Documentation: https://help.ubuntu.com/
0 packages can be updated.
0 updates are security updates.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
zhenwx@zhenwx-desktop:~$
說(shuō)明secureCRT就可以登錄上ubuntu了
注意:
如果沒(méi)有安裝ssh,在secureCRT會(huì)提示
The remote system refused the connection.
secureCRT支持中文的設(shè)置:
在options---》session options--》appearance---character encoding 選擇UTF-8就可以
鼠標(biāo)右鍵功能的設(shè)置:
secureCRT的鼠標(biāo)右鍵功能默認(rèn)是粘貼的功能,用起來(lái)和windows系統(tǒng)的風(fēng)格不一致,如果要改為右鍵為彈出文 本 操作菜單功能,方便對(duì)選擇的內(nèi)容做拷貝編輯操作,可以在
options菜單----》global options------》terminal-------》mouse子菜單
對(duì) paste on right button的選項(xiàng)不要打勾就可以
8,安裝SVN
sudo apt-get install subversion
9,安裝jdk
在windows將jdk下載,通過(guò)samba傳給ubuntu
cd /usr
sudo mkdir java
cd java
sudo cp ../../home/zhenwx/jdk-6u27-linux-x64.bin .
sudo chmod 777 jdk-6u27-linux-x64.bin
執(zhí)行jdk的安裝.
sudo ./jdk-6u27-linux-x64.bin
配置環(huán)境變量
cd /etc
sudo cp profiel profile-bak
sudo chmod 777 profile
vi etc/profile
在前面添加
export JAVA_HOME=/usr/java/jdk1.6.0_27
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH:$JRE_HOME/bin
查看jdk是否安裝成功
zhenwx@zhenwx-desktop:/etc$ source ./profile
zhenwx@zhenwx-desktop:/etc$ java -version
java version '1.6.0_27'
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
zhenwx@zhenwx-desktop:/etc$
如果顯示上面信息說(shuō)明安裝成功
10,安裝編譯Android需要的工具包,這個(gè)步驟是關(guān)鍵,必須安裝,否則編譯會(huì)報(bào)莫名其妙的錯(cuò)誤?。。。。。。。。。。。。。。。?br> sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev gcc-multilib g++-multilib
注意:
a.64位系統(tǒng)要安裝gcc-multilib g++-multilib,32位系統(tǒng)不需要裝.
b.Ubuntu 10.04需要添加額外的源才能安裝Java5
deb http://cn.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://cn.archive.ubuntu.com/ubu..
如果沒(méi)有安裝 bison會(huì)編譯報(bào)錯(cuò)
sudo sudo apt-get install bison
( /bin/bash: bison: command not found )
(/bin/bash: prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: No such file or directory)
Ubuntu 中的 root 賬號(hào)默認(rèn)是被禁用了的。在這種情況之下,如果你想要使用 root 的權(quán)限來(lái)干些事情,就需要 sudo 命令。如果你需要激活 Ubuntu 中的 root 賬號(hào),在 Ubuntu 中激活 root 賬號(hào)的過(guò)程如下:
A. 在終端執(zhí)行 sudo passwd root指令后,系統(tǒng)將會(huì)提示你設(shè)置一個(gè)新的 root 賬號(hào)密碼。
B. 點(diǎn)擊 System -> Preferences -> Login Window 菜單,并切換到 Security 選項(xiàng)頁(yè),然后選中其下的“Allow local system administrator login”選項(xiàng)。
執(zhí)行上述兩步后,你便可以使用 root 賬號(hào)登錄 Ubuntu 系統(tǒng)了。通過(guò)su命令就可以切換到root用戶。
如果要再次禁用 root 賬號(hào),那么可以執(zhí)行 sudo passwd -l root鎖住 root 賬號(hào)
11,UBUNTU10.0.4基本android4.3開(kāi)發(fā)環(huán)境安裝成功了
如果你覺(jué)得主機(jī)名不合適,也可以改配置文件修改。比如將主機(jī)名zhenwx改為android
要修改兩個(gè)文件
1、修改 /etc/hostname 下的主機(jī)名;將zhenwx字符串改為android
2、修改 /etc/hosts 文件,替換原主機(jī)名,我替換的是 127.0.1.1 后的主機(jī)名,
將zhenwx字符串改為android
3、使用 hostname 進(jìn)行測(cè)試
第三步:
在自己工作目錄下或某個(gè)文件夾下建立bin目錄,我的是在/home/zhenwx/確保你已經(jīng)安裝了git jdk python等.
1.創(chuàng)建bin目錄,并加入到PATH
$ mkdir ~/bin
$ PATH=~/bin:$PATH2.下載repo到剛剛創(chuàng)建的bin目錄,并設(shè)置權(quán)限為可執(zhí)行。
repo 原理:repo腳本其實(shí)就是組織Ubuntu Git工具去獲取各個(gè)Project并把它們組織到同一個(gè)項(xiàng)目Android內(nèi)。
$ chmod a+x ~/bin/repo
3.創(chuàng)建Android源代碼存放目錄并進(jìn)入到該目錄
$ mkdir android-4.3_r2.1
$ cd android-4.3_r2.1
4.初始化Android4.3的Git庫(kù)
$ repo init -u git://codeaurora.org/platform/manifest.git
$ repo init -u https://android.googlesource.com/platform/manifest
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.3_r2.1
這里需要一個(gè)google賬號(hào) 輸入你的用戶名和 郵箱地址
如果報(bào)錯(cuò)
在 android-4.3_r2.1 目錄產(chǎn)生./repo 子目錄
在.repo目錄下的manifest.xml找到fetch屬性
改成
fetch='git://Android.git.linaro.org/' 也就是
fetch='git://Android.git.linaro.org/' />
或者
在終端ping android.googlesource.com
ping
編輯/etc/hosts文件
$ vi /etc/hosts
增加下面內(nèi)容,wq! 保存:
74.125.31.82 www.googlesource.com
74.125.31.82 android.googlesource.com
203.208.46.172 cache.pack.google.com
59.24.3.173 cache.pack.google.com
5.最后執(zhí)行開(kāi)始同步下載
$ repo sync
sync過(guò)程如果有下面錯(cuò)誤
zhenwx@zhenwx-desktop:~/android_code$ repo sync
error: The requested URL returned error: 406 while accessing https://android.googlesource.com/platform/manifest/info/refs
fatal: HTTP request failed
Fetching projects: 2% (8/373)
解決方法
1. 瀏覽器登錄https://android.googlesource.com/new-password,并用gmail賬號(hào)登錄;
2. 點(diǎn)擊網(wǎng)頁(yè)上的“允許訪問(wèn)”,得到類似
machine android.googlesource.com login git-zhenwenxiancn.gmail.com password 1/I3Bx6A6qMtr85T3QvuaasW8DMYMCZKZYYwe0U_aOJkg
machine android-review.googlesource.com login git-zhenwenxiancn.gmail.com password 1/I3Bx6A6qMtr85T3QvuaasW8DMYMCZKZYYwe0U_aOJkg
3. 把上面那段信息追加到~/.netrc文件結(jié)尾(如果不存在此文件則自己新建一個(gè));
最后,編譯。
第一步:
在存放代碼的那個(gè)文件夾下(android-4.3_r2.1),執(zhí)行:
$ source build/envsetup.sh
其中,build是源碼目錄中一個(gè)文件夾。
第二步:
執(zhí)行:
$ lunch full-eng
第三步:
$make -j4
等著編譯完成就行了。
聯(lián)系客服