|
在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鍵 |
|