Compile the Android source code in Ubuntu

Source: Internet
Author: User
Tags gmp

It took nearly a week to download the Android source code and the source code on the corresponding Freerunner. Last week, I did not understand the repo, nor did I know the specific status of the download. I only knew that the download was going down, but when the network was interrupted, I did not know whether to continue or start again. This week, I learned about the role of manifest. xml and the download process. In this way, I downloaded the file for two days and one night. I also used my classmate's book to download it in the dormitory. The result was so slow that it would take less than half of the time for the next two days. In particular, errors often occur. However, the loop statement is still awesome and lucky. This morning, I saw that the download was successful on the desktop.

After downloading, make sure to back up the data first.

Initially I wanted to make the file system under Fedora, but the compilation environment was not installed on Fedora, especially JDK1.5. Therefore, I should install it first. Download jdk.1 _ 5_0_22-linux-i586-rpm.bin from the sun website, run./jdk.1 _ 5_0_22-linux-i586-rpm.bin, and add the environment variable in/etc/profile:

Export JAVA_HOME =/usr/java/jdk1.5.0 _ 22

Export PATH = $ PATH: $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin

Export CLASSPATH =.:/usr/java/jdk1.5.0 _ 22/lib:/usr/java/jdk1.5.0 _ 22/jre/lib: $ CLASSPATH

Then, log out and log on again. If you enter java-version, the corresponding java version is returned. Then, jdk is installed successfully. (JDK1.6 is unavailable on the Internet, so we chose jdk1.5)

After JDK is installed, install other compiling environments, such as flex, bison, gperf, python, valgrind, curl, git, build-essential, etc, install ncurses-devel libX11-devel.i686 readline-devel with yum, but libsdl-dev, libesd0-dev, libwxgtk2.6-dev cannot be found using yum, So skip.

Go to the root directory of the file system and make.

There is always an error. It may be due to a problem with the compilation environment installation and I don't know how to solve it. The installation of the Fedora compilation environment on the Internet cannot solve the problem, in addition, google officially provided the installation process in ubuntu. Fortunately, there is also a ubuntu virtual machine that directly enters the ubuntu environment for make.

 

 

After entering ubuntu, you still need to install the compiling environment. Apart from JDK, run apt-get install-y git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev directly, which is convenient. When jdk1.5 is installed, the rpm package cannot be installed in ubuntu, and the conversion of rpm to deb package fails, so you can create a java folder directly in/usr, run jdk.1 _ 5_0_22-linux-i586.bin in the java folder. /jdk.1 _ 5_0_22-linux-i586.bin. Install jdk here and add the environment variable. (Note: The difference between jdk.1 _ 5_0_22-linux-i586.bin and jdk.1 _ 5_0_22-linux-i586-rpm.bin is that when the latter is running, the software package is installed in the/usr/java folder, and the former requires its, that is, you need to create your own java folder and operate it under the java folder ).

After the compiling environment is installed, go to the root directory of the file system and make.

The following problems occur:

1. symbol lookup error:/usr/lib/libmp Fr. so.4: Undefined Symbol: _ gmp_get_memory_functions and stop compiling

Solution: the previous GMP version is 4.1.4. Directly compile and install the version 4.3.0 (Installation Process: Download gmp-4.3.0.tar.bz2, decompress it, and run it./configure; Make; make install ). I don't know if the method is correct, but it seems that the above problem has been solved.

2. lzo/lzo1x appears. h: No such file or directory and external/MTD-utils/compr_lzo.c: 29: Fatal error: lzo/lzo1x. h: No such file or directory compilation terminated problem, and stop compiling

Solution: APT-Get install liblzo2-dev, search on the Internet, there is no specific answer, after the installation of the compilation is no longer an error.

3. "mkimage" command not found and stop Compilation

Solution: From slave. And then make the file system.

At present, the file system is still being compiled. The cause of the analysis is that the compiling environment is not properly installed. This may involve some software packages not installed when ubuntu is installed, try it on your ubuntu later. I feel that the above three problems should not occur if the compiling environment is installed normally according to the tutorial.

 

References:

1, jdk1.5 installation: http://www.linuxdiyf.com/viewarticle.php? Id = 5992 http://wenson.javaeye.com/blog/65292

2, Fedora13 under the compilation android: http://kongweile.javaeye.com/blog/770377

3. ubuntu compiling environment installation: http://zhanglibin1986.javaeye.com/blog/778219

4. About mkimage: http://www.quickembeddedtips.com/resolving-mkimage-command-not-found-u-boot-images-will-not-be-built-error

 

PS: In the "make" process, the above content is mainly for reference later. If there is an error in "make", the solution will continue.

 

The first step of the long journey has gone out. Come on.

Related Article

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.