Cupcake 编译指导
准备文件:
\ cupcake\
从服务器下载该目录下所有文件
解压 cupcake.tgz 至 ~/cupcake
tar zxf path/cupcake.tgz –C ~/
拷贝 clean_git.sh 至 ~/cupcake/ 并执行之,以清除各个子目录下的 .git 目录
cd ~/cupcake
chomd a+x clean_git.sh
./clean_git.sh
做原始版本记录
git init
git add .
git commit –m “cupcake base code”
~/cupcake 目录下新建 .gitignore 文件,输入如下内容,让 git 忽略之
out
*.patch
*~
解压 Android_PlatformRel_Linux_MHLV_2009WW21.tgz
tar zxf Android_PlatformRel_Linux_MHLV_2009WW21.tgz –C ~/
拷贝 cupcake_patch 到 cupcake 目录
cp –r ~/pxa_cupcake/src/cupcake/cupcake_patches/* ~/cupcake/
解压 vendor.tgz 到 cupcake 目录下
tar zxvf ~/pxa_cupcake/src/cupcake/vendor.tgz -C ~/cupcake
( 此步骤不执行将不会出现 littleton 选项 )
修改 apply_cupcake_patch.sh
git-am $cupcake_root_dir/$cupcake_patch
修改为
patch –p1 < $cupcake_root_dir/$cupcake_patch
打 cupcake_patch
./ apply_cupcake_patch.sh
做打 patch 后的版本记录
git add .
git commit
配置编译环境
编译 cupcake 需要 JDK1.5 , gcc-4.3 , g++-4.3 。
但 Ubuntu9.10 未安装 jdk1.5 ,默认安装 gcc-4.4 , g++-4.4 ,所以需要安装上述 2 个。
JDK:
如果之前装了 java6 sdk ,但编译 Android 需要 jdk5 ,所以先把 Java6 屏蔽掉。
lua@ubuntu:~$ ls /usr/bin/j*
/usr/bin/java /usr/bin/javaws /usr/bin/jexec /usr/bin/jockey-text
/usr/bin/java_vm /usr/bin/jcontrol /usr/bin/jockey-gtk /usr/bin/join
lua@ubuntu:~$ sudo mv /usr/bin/java /usr/bin/java.bak
lua@ubuntu:~$ sudo mv /usr/bin/javaws /usr/bin/javaws.bak
lua@ubuntu:~$ sudo mv /usr/bin/java_vm /usr/bin/java_vm.bak
lua@ubuntu:~$ ls /usr/bin/j*
/usr/bin/java.bak /usr/bin/jcontrol /usr/bin/jockey-text
/usr/bin/java_vm.bak /usr/bin/jexec /usr/bin/join
/usr/bin/javaws.bak /usr/bin/jockey-gtk
比如 jdk-1_5_0_21-linux-i586.bin 放到如下目录
/home/lua/Downloads
在 shell 窗口执行 sh jdk-1_5_0_21-linux-i586.bin
jdk5 将安装到 /home/lua/Downloads/jdk1.5.0_21
将 /home/lua/Downloads/jdk1.5.0_21/bin 添加到 PATH
lua@ubuntu:~$ echo $PATH
/home/lua/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/lua/arm-marvell-linux-gnueabi/bin:/home/lua/bin:/home/lua/work/android-sdk-linux_86/tools:/home/lua/work/eclipse:/home/lua/Downloads/jdk1.5.0_21/bin
测试 Java ,系统能找到 java 且版本正确。
lua@ubuntu:~$ which java
/home/lua/Downloads/jdk1.5.0_21/bin/java
lua@ubuntu:~$ which javac
/home/lua/Downloads/jdk1.5.0_21/bin/javac
lua@ubuntu:~$ java -version
java version "1.5.0_21"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_21-b01)
Java HotSpot(TM) Client VM (build 1.5.0_21-b01, mixed mode, sharing)
lua@ubuntu:~$ javac -version
javac 1.5.0_21
GCC-4.3
安装文件在 ubuntu-9.10-gcc-4.3 目录下,
sudo dpkg -i cpp-4.3_4.3.4-5ubuntu1_i386.deb
sudo dpkg -i gcc-4.3-base_4.3.4-5ubuntu1_i386.deb
sudo dpkg -i gcc-4.3_4.3.4-5ubuntu1_i386.deb
sudo dpkg -i g++-4.3_4.3.4-5ubuntu1_i386.deb
sudo dpkg -i libstdc++6-4.3-dev_4.3.4-5ubuntu1_i386.deb
查看旧的 gcc , g++
ll /usr/bin/gcc*
ll /usr/bin/g++*
创建 gcc , g++ 软连接
sudo rm gcc g++
sudo ln –s gcc-4.3 gcc
sudo ln –s g++-4.3 g++
修改 cupcake bug
1. 如果直接 make ,会出现 frameworks/policies/base/PolicyConfig.mk:22: ***
No module defined for the given PRODUCT_POLICY (android.policy_phone). Stop. 错
误。
解决办法:
在 build/tools/findleaves.sh 中的第 89 行,
这一句 find "${@:0:$nargs}" $findargs -type f -name "$filename" -print |
改为 find "${@:1:$nargs-1}" $findargs -type f -name "$filename" -print |
2. qemu_gnu.patch
project external/qemu/
diff --git a/Makefile.android b/Makefile.android
index 4c697fb..98d2084 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -18,7 +18,7 @@ MY_CFLAGS := $(CONFIG_INCLUDES) -O2 -g \
# this is needed to build the emulator on 64-bit Linux systems
ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
- MY_CFLAGS += -Wa,--32
+ MY_CFLAGS += -Wa,--32 -D_GNU_SOURCE
endif
ifeq ($(HOST_OS),freebsd)
编译 cupcake
Buid PXA Android by:
$ . build/envsetup.sh
$ choosecombo
Note: please chose Device-release-littleton-user
$ make –j4
After a while (30~60 minutes), the binaries will be generated under /out/target/product/littleton/.