在ubuntu下配置 Andorid 编译环境

时间:11-12-05 栏目:技术 作者:liva 评论:6 点击: 4,093 次

在X86的机器上编译安装android,做一个简单快速的上网本.我的编译环境为VMwave+ubuntu10.04,编译时对内存占用很大,建议多分一点儿,我分了1.5G.参考网站:
android-x86官方网站:http://www.android-x86.org/
Google OS实验室:http://blog.livedoor.jp/moonlight_aska/

一、编译环境配置:

1、安装必要组件
$ sudo apt-get update
$ sudo apt-get -y install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind

 

2、安装repo
$ cd ~
$ mkdir bin
$ curl http://android.git.kernel.org/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=$PATH:~/bin

二、获取android-x86源代码
$ mkdir android2.1
$ cd android2.1
$ repo init -u git://git.android-x86.org/platform/manifest.git -b eclair-x86
$ repo sync

-b eclair-x86为制定版本,这里采用的是2.1-eclair来编译的

三、开始编译,一般机器采用eeepc的模式编译。
$ cd android2.1
$ make iso_img TARGET_PRODUCT=eeepc

iso_img为打包为ISO镜像,如果想打包为USB镜像的话可以采用:
$ cd android2.1
$ make usb_img TARGET_PRODUCT=eeepc

错误修正:在编译的过程中碰到了几处错误,修改方法如下:

错误1、错误提示:
host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt)
/usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): in function thread_store_set:system/core/libcutils/threads.c:36: error: undefined reference to 'pthread_key_create'
/usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): in function thread_store_set:system/core/libcutils/threads.c:44: error: undefined reference to 'pthread_setspecific'
/usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): in function thread_store_get:system/core/libcutils/threads.c:27: error: undefined reference to 'pthread_getspecific'
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] 错误 1

解决方法:修改./framework/base/tools/aapt/Android.mk文件
LOCAL_LDLIBS := -lz
ifeq ($(HOST_OS),linux)
-LOCAL_LDLIBS += -lrt
+LOCAL_LDLIBS += -lrt -lpthread
endif
ifeq ($(HOST_OS),windows)

错误2、错误提示:
host C++: acc <= system/core/libacc/tests/main.cpp
host C++: libacc <= system/core/libacc/acc.cpp
host SharedLib: libacc (out/host/linux-x86/obj/lib/libacc.so)
host Executable: acc (out/host/linux-x86/obj/EXECUTABLES/acc_intermediates/acc)
/usr/bin/ld: out/host/linux-x86/obj/EXECUTABLES/acc_intermediates/main.o: in function symbolLookup(void*, char const*):system/core/libacc/tests/main.cpp:41: error: undefined reference to 'dlsym'
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/acc_intermediates/acc] 错误 1

解决方法:修改./system/core/libacc/tests/Android.mk文件
LOCAL_SHARED_LIBRARIES :=
libacc
+LOCAL_LDLIBS := -ldl
#LOCAL_MODULE_TAGS := tests
LOCAL_SHARED_LIBRARIES :=
libacc
+LOCAL_LDLIBS := -ldl
LOCAL_CFLAGS := -O0 -g
LOCAL_SHARED_LIBRARIES :=
libacc
+LOCAL_LDLIBS := -ldl
LOCAL_MODULE_TAGS := tests
LOCAL_SHARED_LIBRARIES :=
libacc
+LOCAL_LDLIBS := -ldl
LOCAL_CFLAGS := -O0 -g

错误3、错误提示:
host Executable: localize (out/host/linux-x86/obj/EXECUTABLES/localize_intermediates/localize)
/usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): in function thread_store_set:system/core/libcutils/threads.c:36: error: undefined reference to 'pthread_key_create'
/usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): in function thread_store_set:system/core/libcutils/threads.c:44: error: undefined reference to 'pthread_setspecific'
/usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): in function thread_store_get:system/core/libcutils/threads.c:27: error: undefined reference to 'pthread_getspecific'
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/localize_intermediates/localize] 错误 1

解决方法:修改./framework/base/tools/localize/Android.mk文件
libcutils
ifeq ($(HOST_OS),linux)
-LOCAL_LDLIBS += -lrt
+LOCAL_LDLIBS += -lrt -lpthread
endif

编译成功后,可在out/target/product/eeepc/eeepc.iso找到ISO镜像,用虚拟机载入该镜像即可。

已知不完善的地方,gapps安装后会FC,电子市场FC

键位绑定:

鼠标左键:点击
鼠标中键:menu
鼠标右键/键盘ESC:返回
键盘Home键:home键

声明: 本文由( liva )原创编译,转载请保留链接: 在ubuntu下配置 Andorid 编译环境

在ubuntu下配置 Andorid 编译环境:目前有6 条留言

  1. 6楼
    Easy Sun Tan Localhost Unknow Browser Unknow Os :

    I have been reading a lot on this specific topic lately, nevertheless your information is good. You have composed your post in a most distinctive method.

    2014-09-25 下午 7:17 [回复]
  2. 5楼
    Self Tanner Localhost Unknow Browser Unknow Os :

    I desire I’d discovered your write-up previously, however it is still outstanding reading. I enjoyed reading your own viewpoint and I agree with most of your information. This particular is absolutely perfect material.

    2014-09-25 下午 6:15 [回复]
  3. This is some of the best material I have gone through in a long time. You have actually struck on some sound points in my opinion. I personally accept you. Don’t stop rolling out extraordinary content like this.

    2014-09-25 下午 6:13 [回复]
  4. I’ve turned into an online viewer currently and also have discovered it’s hard to find excellent material. I’m happy I was able to discover your post. I discovered this interesting and sensible content material. Thanks a ton.

    2014-09-24 下午 12:56 [回复]
  5. I’m not a college grad, nevertheless I have a fantastic education behind me and also am a big reader. My specialty is within language arts and I am pleased with the content you have composed right here.

    2014-09-23 下午 8:44 [回复]
  6. I am aware there are plenty of excellent writers around, but you truly stand above everyone else. I needed to let you know how much I appreciate the data you’ve in this material. Thanks.

    2014-09-23 下午 8:43 [回复]

发表评论


购物推荐

赞助商

© 2013 enjoydiy.com. Design by zijiao. 57 queries in 0.326 seconds, using 21.00MB memory