在x86的机器上编译使用Andorid
2013-12-19 20:39
375 查看
在x86的机器上编译使用Andorid
转自:http://www.cnbeta.com/articles/118504.htm
在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来编译的
注:对于下载的时间,个人认为凌晨12点以后到中午12点之间速度较快。
三、开始编译,一般机器采用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键
================================================
补充:
1. 下载的过程比较痛苦,因为下载速度很慢,而且容易断网。后来发现凌晨到上午这段时间比较快。虽然断网现象仍在,但速度快了很多。
2. 上面的变异并没有遇到错误,可能是改正过来了吧。
3. 在本机上实验generic_x86
Choose a target
You need to choose a target for the x86 device you want to
use/test. We provides several targets for different branches:
donut-x86
eeepc: for ASUS EeePC family
q1u: for Samsung Q1U
s5: for Viliv S5
eclair-x86
generic_x86: for generic x86 PC/notebook
eeepc: for ASUS EeePC family only
q1u: for Samsung Q1U
s5: for Viliv S5
froyo-x86
generic_x86: for generic x86 PC/notebook
eeepc: for ASUS EeePC family only
vm: for virtual machine (virtual box, qemu, vmware)
Actually, for historical reason, you have to use eeepc for a
generic x86 PC, notebook or netbook before (includes) donut-x86
branch. Since eclair-x86 branch, eeepc is changed to serve ASUS
EeePC family only. Do not use it if you are not using an
EeePC.
In short, if you don't know how to choose, use eeepc for donut-x86
branch, and use generic_x86 for eclair-x86 or later branches.
If the computer you build on has more then one processor or
core, you can take advantage of multiprocessing (or make jobs) by
adding -jX to the beginning of your make command:
$ make -jX usb_img TARGET_PRODUCT=eeepc
Replace X by the number of processors you have. For example, if
you have a quad core CPU, replace X with 4:
$ make -j4 usb_img TARGET_PRODUCT=eeepc
根据上面的提示,eclair-x86以后版本都可以使用generic_x86作为TARGET_PRODUCT,但是从哪个网站上看见说这个iso只能用于虚拟机,没有验证过,所以不知道真假。
make iso_img TARGET_PRODUCT=generic_x86
遇见错误及解决:
target StaticLib: libwebcore
(out/target/product/sapphire-open/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a)
make: execvp: /bin/bash: Argument list too long
(中文的错误信息是"参数列项目过长")
make: ***
[out/target/product/sapphire-open/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a]
解决:
cd external/webkit
git cherry-pick 18342a41ab72e2c21931afaaab6f1b9bdbedb9fa
信息提示:
root@ubuntu:~/work/android-x86-21/external/webkit#
git cherry-pick 18342a41ab72e2c21931afaaab6f1b9bdbedb9fa
Finished one cherry-pick.
[detached HEAD f0d0424] Fix spurious build breaks.
Author: Patrick Scott <phanna@android.com>
Committer: root <root@ubuntu.(none)>
Your name and email address were configured automatically
based
on your username and hostname. Please check that they are
accurate.
You can suppress this message by setting them explicitly:
git
config --global user.name "Your Name"
git config
--global user.email you@example.com
If the identity used for this commit is wrong, you can fix it
with:
git
commit --amend --author='Your Name
<you@example.com>'
2 files changed, 28 insertions(+), 14 deletions(-)
继续编译,没再遇到问题,最后信息:
Total translation table size: 4495
Total rockridge attributes bytes: 1372
Total directory bytes: 3158
Path table size(bytes): 26
Done with: The
File(s)
Block(s)
254033
Writing: Ending
Padblock
Start Block 254067
Done with: Ending
Padblock
Block(s)
150
Max brk space used 0
254217 extents written (496 MB)
在out/target/product/generic_x86/目录下生成genetic_x86.iso,及initrd.img/install.img/ramdisk.img/system.img等镜像文件。
转自:http://www.cnbeta.com/articles/118504.htm
在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来编译的
注:对于下载的时间,个人认为凌晨12点以后到中午12点之间速度较快。
三、开始编译,一般机器采用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键
================================================
补充:
1. 下载的过程比较痛苦,因为下载速度很慢,而且容易断网。后来发现凌晨到上午这段时间比较快。虽然断网现象仍在,但速度快了很多。
2. 上面的变异并没有遇到错误,可能是改正过来了吧。
3. 在本机上实验generic_x86
Choose a target
You need to choose a target for the x86 device you want to
use/test. We provides several targets for different branches:
donut-x86
eeepc: for ASUS EeePC family
q1u: for Samsung Q1U
s5: for Viliv S5
eclair-x86
generic_x86: for generic x86 PC/notebook
eeepc: for ASUS EeePC family only
q1u: for Samsung Q1U
s5: for Viliv S5
froyo-x86
generic_x86: for generic x86 PC/notebook
eeepc: for ASUS EeePC family only
vm: for virtual machine (virtual box, qemu, vmware)
Actually, for historical reason, you have to use eeepc for a
generic x86 PC, notebook or netbook before (includes) donut-x86
branch. Since eclair-x86 branch, eeepc is changed to serve ASUS
EeePC family only. Do not use it if you are not using an
EeePC.
In short, if you don't know how to choose, use eeepc for donut-x86
branch, and use generic_x86 for eclair-x86 or later branches.
If the computer you build on has more then one processor or
core, you can take advantage of multiprocessing (or make jobs) by
adding -jX to the beginning of your make command:
$ make -jX usb_img TARGET_PRODUCT=eeepc
Replace X by the number of processors you have. For example, if
you have a quad core CPU, replace X with 4:
$ make -j4 usb_img TARGET_PRODUCT=eeepc
根据上面的提示,eclair-x86以后版本都可以使用generic_x86作为TARGET_PRODUCT,但是从哪个网站上看见说这个iso只能用于虚拟机,没有验证过,所以不知道真假。
make iso_img TARGET_PRODUCT=generic_x86
遇见错误及解决:
target StaticLib: libwebcore
(out/target/product/sapphire-open/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a)
make: execvp: /bin/bash: Argument list too long
(中文的错误信息是"参数列项目过长")
make: ***
[out/target/product/sapphire-open/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a]
解决:
cd external/webkit
git cherry-pick 18342a41ab72e2c21931afaaab6f1b9bdbedb9fa
信息提示:
root@ubuntu:~/work/android-x86-21/external/webkit#
git cherry-pick 18342a41ab72e2c21931afaaab6f1b9bdbedb9fa
Finished one cherry-pick.
[detached HEAD f0d0424] Fix spurious build breaks.
Author: Patrick Scott <phanna@android.com>
Committer: root <root@ubuntu.(none)>
Your name and email address were configured automatically
based
on your username and hostname. Please check that they are
accurate.
You can suppress this message by setting them explicitly:
git
config --global user.name "Your Name"
git config
--global user.email you@example.com
If the identity used for this commit is wrong, you can fix it
with:
git
commit --amend --author='Your Name
<you@example.com>'
2 files changed, 28 insertions(+), 14 deletions(-)
继续编译,没再遇到问题,最后信息:
Total translation table size: 4495
Total rockridge attributes bytes: 1372
Total directory bytes: 3158
Path table size(bytes): 26
Done with: The
File(s)
Block(s)
254033
Writing: Ending
Padblock
Start Block 254067
Done with: Ending
Padblock
Block(s)
150
Max brk space used 0
254217 extents written (496 MB)
在out/target/product/generic_x86/目录下生成genetic_x86.iso,及initrd.img/install.img/ramdisk.img/system.img等镜像文件。
相关文章推荐
- 在x86的机器上编译使用Andorid
- 在64位机器上使用反射要注意下编译的dll是否是X86的
- 关于使用VS2015编译项目时出现LNK1112 module machine type 'x64' conflicts with target machine type 'X86'
- C#使用_如何在没有装VS(Visual Studio)的机器上编译运行C#程序
- 有如下CAT_s结构体定义,回答: 1) 在一台64位的机器上,使用32位编译,Garfield变量占用多少内存空间?64位编译又是如何?
- 关于MYSQL编程使用VS2015编译报“LNK4272库计算机类型“X86”与目标计算机类型“x64”冲突”的解决办法
- cocos2d-x 使用ndk编译 x86 出现 in function Curl_resolv_timeout: undefined reference to 'sigsetjmp' 错误
- 使用ltp编译出来的cws_cmdline,cp到其他机器上执行报错:/lib64/libc.so.6: version `GLIBC_2.14′ not found
- 在64位机器上使用LIBSVM编译时提示错误
- windows下编译ffmpeg2.5——使用VS2013,ARMLINUX,ANDORID编译ffmpeg
- 【FFMEPG】windows下编译ffmpeg2.5——使用VS2013,ARMLINUX,ANDORID编译ffmpeg
- mac上使用g++编译出错“Undefined symbols for architecture x86_64:” 错误解决办法
- 使用ubuntu x86_64位元编译Android代码遇到的library问题(solved)
- ffmpeg的编译(for x86,for arm)安装及使用(网络资料整理)
- 使用OpenCV-2.4.0.exe文件编译x86或x64平台Visual Studio 2005/2008/2010目标文件
- X86_64机器编译32位程序
- X86 32位机器程序运行中多字节数据内存使用
- ffmpeg的编译、安装及使用(for x86,for arm)
- FindProcDLL::FindProc 和 KillProcDLL::KillProc,必须使用WPF x86编译出来的程序