"Turn" Ubuntu 11.10 (32-bit system) compiled Android source code

Source: Internet
Author: User

Original URL: http://www.cnblogs.com/dwayne/archive/2011/11/16/2251734.html

This article describes the Ubuntu 11.10 System compiled under the Android 2.3.3 source code, before compiling please determine the previous two articles (http://www.cnblogs.com/dwayne/archive/2011/11/16/2250732. The required preparations in HTML and http://www.cnblogs.com/dwayne/archive/2011/11/11/2245383.html have been completed successfully. The build completes the system image file and runs in the emulator.

After the preparation is complete, start compiling the work. Download down the source has more than 5G, if according to my previous write to get the source code, source directory for ~/android/source

First, environment settings


including device/htc/passion/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh
[Email protected]:~/android/source$ lunch Full-eng

When lunch, if prompt permission denied permission is not enough, need to execute under the source root directory, give directory all file permission

[Email protected]:~/android/source$ sudo chmod-r 777 *

This time the lunch instruction will print out the following paragraph:

============================================
Platform_version_codename=rel
platform_version=2.3.3
Target_product=full
Target_build_variant=eng
Target_simulator=false
Target_build_type=release
target_build_apps=
Target_arch=arm
Host_arch=x86
Host_os=linux
Host_build_type=release
Build_id=gri40
============================================

First, start compiling

The compilation process can be aborted with many errors, and Wayne will post all the problems encountered and resolution one by one for future reference.

1.Q:

[Email protected]:~/android/source$ make-j2
============================================
Platform_version_codename=rel
platform_version=2.3.3
Target_product=full
Target_build_variant=eng
Target_simulator=false
Target_build_type=release
target_build_apps=
Target_arch=arm
Host_arch=x86
Host_os=linux
Host_build_type=release
Build_id=gri40
============================================
Checking Build Tools Versions ...
build/core/main.mk:76: ************************************************************
Build/core/main.mk:77:you is attempting to build on a 32-bit system.
Build/core/main.mk:78:only 64-bit Build environments is supported beyond froyo/2.2.
build/core/main.mk:79: ************************************************************
BUILD/CORE/MAIN.MK:80: * * * stop. Stop it.

Workaround: CD to source root directory, execute:

$ gedit Build/core/main.mk

Found it

Ifneq (64,$ (findstring 64,$ (build_arch)))

The revision was changed to

Ifneq (i686,$ (findstring i686,$ (build_arch)))

Then modify the following four make files in turn:

External/clearsilver/cgi/android.mk
External/clearsilver/java-jni/android.mk
External/clearsilver/util/android.mk
External/clearsilver/cs/android.mk

Put one of the

Local_cflags + =-m64
Local_ldflags + =-m64

Revision changed to

Local_cflags + =-m32
Local_ldflags + =-m32

2.Q:

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]
Make: * * * [OUT/HOST/LINUX-X86/OBJ/STATIC_LIBRARIES/LIBUTILS_INTERMEDIATES/REFBASE.O] Error 1

Workaround:

$ gedit Frameworks/base/libs/utils/android.mk

Modify the following statement

Local_cflags + =-dlibutils_native=1 $ (tool_cflags)

For

Local_cflags + =-dlibutils_native=1 $ (tool_cflags) –fpermissive

3.Q:

Arm-eabi-gcc:error trying to exec ' cc1 ': execvp:no such file or directory
Make: * * * [OUT/TARGET/PRODUCT/GENERIC/OBJ/LIB/CRTBEGIN_DYNAMIC.O] Error 1

If the previous dependencies have been successfully installed, this should be an issue with cross-compilation tool permissions. This problem should not be encountered as long as the permission command is executed at the beginning of the article lunch.

4.Q:

<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

The compilation error here is due to Ubuntu 11.10 using GCC4.6.1.

Workaround:

Modify the source directory under the/build/core/combo/host_linux-x86.mk file:

The following statement

Host_global_cflags + =-d_fortify_source=0

Revision changed to

Host_global_cflags + =-u_fortify_source-d_fortify_source=0

There may be similar errors at compile time, according to the error prompt keywords such as g++ error, JRE error, etc., are some of the details, better solve.

After two hours of waiting, finally successfully completed. After the compilation is successful, the image files such as system.img are generated, and the following is the compile completion prompt:

Target System FS Image:out/target/product/generic/obj/packaging/systemimage_intermediates/system.img
Install System FS Image:out/target/product/generic/system.img
Installed file List:out/target/product/generic/installed-files.txt

Third, start the compiled system

After compiling, the system.img ramdisk.img userdata.img three image files will be generated in the Out/target/product/generic directory.

Before starting the emulator, you need to set environment variables for the emulator system, execute Gedit ~/.BASHRC, and add the following environment variables:

Export Android_product_out=~/android/source/out/target/product/generic
Android_product_out_bin=~/android/source/out/host/linux-x86/bin
Export Path=${path}:${android_product_out_bin}:${android_product_out};

Finally, synchronize these changes and start the emulator:

$ source ~/.BASHRC
$ CD ~/android/source/out/target/product/generic
$ emulator-system system.img-data Userdata.img-ramdisk ramdisk.img

"Go" Ubuntu 11.10 (32-bit system) compiled Android source code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.