一、安装64位ubuntu12.10系统
1,下载工具:Universal USB Installer (
http://universal-usb-installer.en.softonic.com/download
)
ubuntu-12.04-desktop-amd64
Universal-USB-Installer-1.9.3.1
安装时提示“/casper/vmlinuz.efi file not found
解决方式一:降低Universal USB Installer版本。
下载一个Universal USB Installer 1.8.9.2.rar的版本,再重新制作。
解决方式二:换iso包 (12.04.1的iso文件中casper中的文件就是vmlinuz而不是vmlinuz.efi )
下载一个ubuntu-12.04.2/3-desktop-amd64.iso包。ubuntu-12.04有三个版本:ubuntu-12.04.1 ubuntu-12.04.2 ubuntu-12.04.3
解决方式三:去这里下载最新的安装包:
http://mirrors.163.com/ubuntu-releases
2,下载ubuntu 和java sdk
http://mirrors.163.com/ubuntu-releases/12.10/
http://download.csdn.net/detail/hp_2008/6020687
3, 安装ubuntu12.10 desktop版 参考网址:
http://diybbs.zol.com.cn/1/33925_1942.html
http://blog.csdn.net/qq258711519/article/details/8722774
http://www.dedecms.com/knowledge/servers/linux-bsd/2012/0819/8387.html
二、配置android4.1编译环境
1, 更新/etc/apt/sources.list
内容如下:
deb http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted
deb http://tw.archive.ubuntu.com/ubuntu/ quantal main universe restricted multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ quantal main universe restricted multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ quantal-security universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ quantal-security universe main multiverse restricted
deb http://tw.archive.ubuntu.com/ubuntu/ quantal-updates universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ quantal-updates universe main multiverse restricted
deb http://mirror.lupaworld.com/ubuntu/archive/ quantal main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ quantal-security main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ quantal-updates main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ quantal-backports main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/ubuntu-cn/ quantal main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ quantal main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ quantal-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ quantal-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ quantal-backports main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ quantal main restricted universe multiverse
deb http://ubuntu.mirror.cambrium.nl/ubuntu/ quantal main
执行:sudo apt-get update
2, 官网源包网址:
http://packages.ubuntu.com/quantal/
3, SSH服务安装(用于远程控制)
安装openssh-server
在/etc/apt/sources.list 添加源:deb
http://ubuntu.mirror.cambrium.nl/ubuntu/
quantal main
4,samba的安装
sudo apt-get insall samba
修改现配置文件
sudo vim /etc/samba/smb.conf
在smb.conf最后添加
[share]
path = /opt/sharedfolders
available = yes
browsealbe = yes
public = yes
writable = yes
添加samba用户
sudo useradd smb
sudo smbpasswd -a smb
sudo /etc/init.d/smbd restart
sudo ps aux | grep smbd –查看samba是否启动,
5,安装套件包
sudo apt-get install bison xsltproc flex libncurses5-dev gcc-4.4 g++-4.4 libc6-dev-i386 sharutils ia32-lib* libxml2-utils xsltproc
安装后:
sudo rm /usr/bin/gcc
sudo rm /usr/bin/g++
sudo ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
sudo ln -s /usr/bin/g++-4.4 /usr/bin/g++
配置java环境
安装JDK 下载文件:
http://download.csdn.net/detail/hp_2008/6020687
sudo ./jdk-6u32-linux-x64.bin
后在当前目录下得到一个目录jdk1.6.0_32
sudo vim /etc/profile
在最后添加以下内容:
export JAVA_HOME=/usr/jdk1.6.0_32
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
vim ~/.bashrc (需重启才有效,或把下面的内容放到profile文件)
添加以下内容:
export PATH=/usr/jdk1.6.0_32/bin:/usr/jdk1.6.0_32/lib:/usr/jdk1.6.0_32:$PATH
5,下载工具链:
https://launchpad.net/linaro-toolchain-binaries/
6,交叉工具链放到/opt/mstar/gcc-linaro-arm-linux-gnueabihf-4.7_linux/
7, 配置环境:
export PATH=/opt/mstar/gcc-linaro-arm-linux-gnueabihf-4.7_linux/bin:$PATH
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
8,编 译
source build/envsetup.sh
lunch
make -j4
9,出现这样的错误
(1) make: *** No rule to make target `out/target/product/
解决方法:加到out文件夹的权限(sudo chmod 0777 out/) 和 降低gcc g++的版本或相应的文件没有找到,需要确认你的Android.mk文件中的内容是否有文件找不到。
(2)
lzoplzop: error while loading shared libraries: liblzo2.so.2: cannot open shared object file: No such file or directory
在sources.list中添加: deb
http://ubuntu.mirror.cambrium.nl/ubuntu/
lucid main
sudo apt-get update
sudo apt-get install liblzo2-2
(3)
make: *** [out/target/common/obj/APPS/android.core.tests.libcore.package.org.no-core-tests-res_intermediates/noproguard.classes-with-local.dex] Killed
make: *** Waiting for unfinished jobs….
主要原因是内存不够,因为android4.1的编译要求4GRAM或者swap,我的内存是2G,解决办法可以是增加swap的大小。
a. 创建一个swap文件
sudo dd if=/dev/zero of=/boot/swapfile bs=1024 count=4194304
b. 格式化文件,使之成为swap(交换设备)
sudo mkswap -v1 /boot/swapfile
c. 将swap加入到现有系统中
sudo swapon /boot/swapfile
free
d. 做永久性变更
sudo vi /etc/fstab
在文件末尾加上如下一行:
/boot/swapfile swap swap defaults 1 1