原文地址:
http://blog.chinaunix.net/uid-26009923-id-4035398.html
1. 编译工具链
解压 tools 下的
arm-linux-gcc-4.3.2.tgz
arm-none-linux-gnueabi-arm-2008q3-72-for-linux.tar.bz2
到/opt/6410/android目录下
-
cong@ubuntu:/opt/6410/android$ ls
-
4.3.2 arm-none-linux-gnueabi
2. 编uboot (板子是256M的nand)
用的编译器是在arm-linux-gcc-4.3.2中的
-
cong@ubuntu:/work/an6410/uboot$ vi Makefile
-
161 CROSS_COMPILE =/opt/6410/android/4.3.2/bin/arm-none-linux-gnueabi-
-
162 export CROSS_COMPILE
-
cong@ubuntu:/work/an6410/uboot$ make smdk6410_config
-
Configuring for smdk6410 board...
-
cong@ubuntu:/work/an6410/uboot$ make
生成 u-boot.bin
3.编译kernel
修改Makefile
-
cong@ubuntu:/work/an6410/kernel$ vi Makefile
-
192 ARCH ?= arm
-
193 CROSS_COMPILE ?= /opt/6410/android/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
-
make -j4
4. 编译android
机子是 ubuntu 12.04LTS 64位,所以需要修改这几个Android.mk
4.1 按手册修改Android.mk
-
./external/clearsilver/cgi/Android.mk
-
./external/clearsilver/java-jni/Android.mk
-
./external/clearsilver/util/Android.mk
-
./external/clearsilver/cs/Android.mk
-
找到
-
LOCAL_CFLAGS += -m32
-
LOCAL_LDFLAGS += -m32
-
替换为
-
LOCAL_CFLAGS += -m64
-
LOCAL_LDFLAGS += -m64
-
记得保存文件。
-
第二步:
-
修改文件 ./build/core/main.mk
-
找到
-
ifneq (i686,$(findstring i686,$(build_arch)))
-
替换为
-
ifneq (64,$(findstring 64,$(build_arch)))
4.2 出错处理
a. 添加 -fpermissive
-
frameworks/base/libs/utils/RefBase.cpp: In member function ‘void android::RefBase::weakref_type::trackMe(bool, bool)’:
-
frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]
解决方法:
frameworks/base/libs/utils/Android.mk
60 LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive
b. 这个需要改javadoc
-
Could not load 'clearsilver-jni'
-
java.library.path = out/host/linux-x86/lib
-
make: *** [out/target/common/docs/doc-comment-check-timestamp] Error 45
解决方法: 先是将默认工具链中的javadoc替换成jdk1.5的这个地方是可以编过去的.
但是在接下来的编译中还会出现错误
c. 终极大招
默认的工具链jdk1.6.0_23好像是32位的,所以需要替换为64位的,
下载jdk-6u35-linux-x64.bin,然后解压到android源码目录下
修改build-android
-
6 #export PATH=$PWD/jdk1.6.0_23/bin:$PATH
-
7 export PATH=$PWD/jdk1.6.0_35/bin:$PATH
d. 接下来就是一些小问题了
-
prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:55:22: fatal error: X11/Xlib.h: No such file or directory
-
compilation terminated.
-
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/android/main.o] Error 1
解决方法:
sudo apt-get install libx11-dev
e. 将 -Werror去掉
-
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
-
<built-in>:0:0: note: this is the location of the previous definition
-
cc1plus: all warnings being treated as errors
-
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1
cong@ubuntu:/work/an6410/2.3.4$ vi frameworks/base/tools/obbtool/Android.mk
16 LOCAL_CFLAGS := -Wall
在frameworks/base/tools/obbtool/Android.mk文件中还有一处-Werror也要去掉
最后就编过去了.
-
Generated: (out/target/product/OK6410/android-info.txt)
-
Target system fs image: out/target/product/OK6410/obj/PACKAGING/systemimage_intermediates/system.img
-
Install system fs image: out/target/product/OK6410/system.img
-
Target ram disk: out/target/product/OK6410/ramdisk.img
-
Target userdata fs image: out/target/product/OK6410/userdata.img
-
Installed file list: out/target/product/OK6410/installed-files.txt
生成文件系统:
./make_rootfs
5. 系统启动
5.1 卡在untracked pid exited
-
request_suspend_state: wakeup (3->0) at 92374521625 (2011-08-22 04:17:52.176252436 UTC)
-
init: untracked pid 59 exited
-
init: untracked pid 63 exited
-
request_suspend_state: wakeup (0->0) at 107827143745 (2011-08-22 04:18:07.628874511 UTC)
解决方法: 将gralloc.default.so push到 /system/lib/hw目录下
cong@ubuntu:/work/an6410$ adb push ./2.3.4/out/target/product/OK6410/obj/SHARED_LIBRARIES/gralloc.default_intermediates/LINKED/gralloc.default.so /system/lib/hw
6. NFS启动
a. make menuconfig
去掉initramfs的支持,要不系统会用initramfs文件系统
-
General setup --->
-
[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
默认编译出来的内核己经支持nfs文件系统,如果没有支持还需要添加
b. 设置uboot
-
setenv bootargs "root=/dev/nfs nfsroot=192.168.6.220:/work/an6410/2.3.4/rootfs init=/init ip=192.168.6.221:192.168.6.220:192.168.6.1:255.255.255.0:cong:eth0:off console=ttySAC0,115200"
阅读(986) | 评论(0) | 转发(0) |