Ubuntu12.04 the whole process of compiling android4.0.1 source code -- with wubi installed Ubuntu to compile Android source code, the hard disk space is insufficient to solve the problem.

Source: Internet
Author: User
Tags wubi

After compiling the source code last night, make reported the following error after a while:

# A fatal error has been detected by the Java Runtime Environment:##  SIGSEGV (0xb) at pc=0x40362d33, pid=12195, tid=2835454784## JRE version: 6.0_45-b06# Java VM: Java HotSpot(TM) Server VM (20.45-b01 mixed mode linux-x86 )# Problematic frame:# V  [libjvm.so+0x158d33][error occurred during error reporting (printing problematic frame), id 0xb]

After research, the hard disk space is insufficient. It's no wonder that I used ubuntu12.04 installed with wubi and divided it into a single hard disk of 30 GB. I thought the space was sufficient. I had 6 GB space after I downloaded the source code. No wonder. See click open link http://www.eoeandroid.com/forum.php? MoD = viewthread & tid = 245968 the memory is 1 GB, and the hard disk space is better than 40 GB.

To solve this problem, I uninstalled Ubuntu and allocated a hard disk of 70 GB to Ubuntu in xp. However, during wubi installation, I can only select 30 GB. What does this mean. Why can't it be bigger. Later, we can see that there is a lvpm that can modify the Ubuntu size, but according to the Information, lvpm can only support earlier versions of ubuntu, as if it was 10.04, it will not be in the middle. Later I found Ubuntu has a tool link: https://help.ubuntu.com/community/ResizeandDuplicateWubiDisk named wubi-resize-1.7.tar.gz is to modify the size of the hard disk space, the principle is the same as lvpm. If you want to allocate 60 GB space, the maximum parameter is 32 GB! It seems that wubi installation has many disadvantages, fortunately find http://www.eoeandroid.com/forum.php? MoD = viewthread & tid = 192736 & page = 1 # pid1738873 you can put the android source code on another disk in XP and compile it on/Media /.......... directory.

Therefore, write down the compilation steps from the beginning:

1. Because the original Android development environment of Ubuntu has been re-constructed, the first step is to install JDK. It must be in version 1.6, But 1.7 is not in progress. Download link: http://www.oracle.com/technetwork/java/javase/archive-139210.html reference Nandu cloth articles, choose 1.6.0 _ 29 version. Create the/usr/local/Android directory to prepare for later Android installation. Decompress JDK here. Add the following content to the/etc/profile file:

Export java_home =/usr/local/Android/jdk1.6.0 _ 29
Export Path = $ path: $ java_home/bin

Click source/etc/profile. Enter Java-version to check whether Java is installed successfully. Generally, if 1.6.0 _ 29 is displayed, the operation is successful. But the document also says to install javac and jar. I guess the reason may be that, even though Java is installed, when executing Update-alternatives -- config Java, there will be no Java options, so Update-alternatives -- install and then install.

Root @ Ubuntu:/usr/local/Android # Update-alternatives -- install/usr/bin/Java/usr/local/Android/jdk1.6.0 _ 29/bin/Java 300

The following message is displayed: Update-Alternatives:/usr/local/Android/jdk1.6.0 _ 29/bin/Java is used to provide/usr/bin/Java (Java) in automatic mode.

Perform the same processing on javac and jar. The command is:

Update-alternatives -- install/usr/bin/javac/usr/local/Android/jdk1.6.0 _ 29/bin/javac 300

Update-alternatives -- install/usr/bin/Jar/usr/local/Android/jdk1.6.0 _ 29/bin/jar 300

In this case, update-alternatives -- config Java will display the version information. When multiple JDK versions are available at the same time, this setting is very important.

2. download the required package: I mainly refer to this:

sudo apt-get install git-core gnupg flex bison gperf build-essential \  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \  libgl1-mesa-dev g++-multilib mingw32 tofrodos \  python-markdown libxml2-utils xsltproc zlib1g-dev:i386

However, it is strange that nothing can be installed if I paste the entire line into the pipeline. If one line is pasted in the past, it can still be installed. This should be noted.

3. Download the android source code. refer to the previous article. I have downloaded it. The size is 1.9gb after compression and has time to upload to the online storage. The size after decompression is 4.7g. Now put it under the/Media/entertainment/drive letter. This is the F disk under XP, with a size of 50 GB.

4. Change the default GCC g ++ version to 4.6.3. steps:

Sudo apt-Get install gcc-4.4
Sudo apt-Get install g ++-4.4
Ls-l GCC *
Sudo mv gcc. Bak
Sudo ln-s gcc-4.4 gcc
Ls-l g ++ *
Sudo MV g ++. Bak
Sudo ln-s g ++-4.4g ++
G ++-V

5. The Python version is 2.5-2.7. The default value is 2.7. Is JDK 1.6 a problem.

6. Click http://www.59a.cn/1182.htmlto set the ccacheaccelerator speed. The default ccache is in ~ /. Under the ccache folder. The default size is 1 GB. Create a cache folder in the/home/Yan/directory for caching. Gedit ~ /. The added content in bashrc is:

Export use_ccache = 1
Export ccache_dir =/home/Yan/Cache

Then, set the cache size. In the androidsource folder, that is, the local terminal to make under the project folder, enter the command: prebuilts/MISC/linux-x86/ccache-M 5g officially recommended is 50-100g, But I wubi installed Ubuntu a total of 30g, the remaining space is 24g, therefore, it is set to 5 GB. I think we can also set the ccache directory on an XP disk. [Note] In this step, I forgot to run the last command to set the ccache size. At the time of compilation, the content in the/home/Yan/cache folder is about 1 GB, I guess the default cache size is 1 GB. Setting this should increase the compilation speed]

For more information about how to use ccache to increase Compilation speed, see the following two articles:

1, http://blog.csdn.net/liucheng2009/article/details/7874331

Http://blog.csdn.net/qq295445028/article/details/7776299 2

7, refer to here http://www.eoeandroid.com/forum.php? MoD = viewthread & tid = 192736 & page = 1 # install two software:

Sudo apt-Get install ntfs-3g // This 12.04 already has.
Sudo apt-Get install NTFS-config // This is a graphical NTFS permission configuration program.

Then enter sudo NTFS-config, oh shit! Failed! Skip this step. Later, I uninstalled NTFS-config because it always reports an error. Apt-Get remove NTFS-config. In fact, the system comes with a ntfs-3g, you can read and write the disk under XP. Therefore, this step can be omitted.

8. According to the official prompts, In the androidsource path, the terminal will execute the following commands in sequence:
Source build/envsetup. Sh
Lunch full-Eng
It is strongly recommended that the last command in the original article use make showcommands to display the compilation command so that the screen does not contain
Don't feel bored when you get out. But in my test, I just used make showcommands to compile it for 10 hours. Therefore, it is best to use the make-J4 command for compilation. This 4 is equal to the number of CPU cores * 2. if it is a 2-core write-J4, if it is a 4-core write-j8. this can greatly improve the compilation speed.

Then there was a long wait. I had compiled it for more than 10 hours and it was only finished at five o'clock P.M. in the middle of the night. The compilation started at on the first day. I think it was because of two mistakes:

1. Set ccache, but forget to set the size. The default value is 1 GB.

2. the final compilation uses the make showcommands command and does not use make-J4.

The final output of the terminal after compilation is:

echo "board=" > out/target/product/generic/android-info.txtInstalled file list: out/target/product/generic/installed-files.txtbuild/tools/fileslist.py out/target/product/generic/system > out/target/product/generic/installed-files.txtTarget system fs image: out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.imgout/host/linux-x86/bin/mkyaffs2image -f  out/target/product/generic/system out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.imgInstall system fs image: out/target/product/generic/system.imgout/host/linux-x86/bin/acp -fp out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/generic/system.imgtrueout/host/linux-x86/bin/mkbootfs out/target/product/generic/root | out/host/linux-x86/bin/minigzip > out/target/product/generic/ramdisk.imgout/host/linux-x86/bin/mkyaffs2image -f  out/target/product/generic/data out/target/product/generic/userdata.imgtrue

After compilation, there are three image files in the out/target/product/generic Folder: ramdisk. IMG system. IMG userdata. IMG, as shown below:

The size of related folders before and after compilation is recorded here. The size of the source code folder before compilation is 4.7 GB, And the size after compression is 2 GB. after compilation is complete, the size of the out folder is 12.3 GB, and the size of the entire source code folder is 16.7g. it really consumes space! No wonder http://www.eoeandroid.com/forum.php? MoD = viewthread & tid = 245968 here, the memory is greater than 1 GB, and the hard disk is greater than 40 GB.

It seems that Ubuntu installed in wubi can only be compiled on the mounted XP disk without actually expanding the installation space. Run DF-H on the terminal to view disk usage:

The mounting has been completed automatically, where/dev/sda1 is my C drive, and sda5 sda6 sda7 is d e f drive, sda8 is my last disk and Ubuntu disk. I put the source code to the entertainment (drive F) for compilation. I was also worried about whether the folder contains Chinese characters or not.

Switch the terminal to the root, and you can Unmount and mount it using the following command:

Root @ Ubuntu :~ # Umount/dev/sda7/Media/Entertainment
Umount:/Media/entertainment not mounted
Root @ Ubuntu :~ # Mount/dev/sda7/mnt/
Root @ Ubuntu :~ # Cd/mnt/
Root @ Ubuntu:/mnt # ls
Androidsource androidsource_4_0_1.tar.gz recycler system volume information
In this way, the disks under xp are compiled in the same way as the folders under Linux!

There is no problem in the compilation process, but the solution appendix is as follows:

1. Download and compile the android source code (4.0.3) kernel (ubuntu11.04)

2. ubuntu11.10 (32-bit) Android compilation common errors (30 common errors)

3, android4.0 source code compilation debugging error/bin/Bash: prebuilt/linux-x86/toolchain/arm...

4, south all cloth -- [Android] ubuntu12.04 under the compilation and download android4.0.3 source code: http://wenku.baidu.com/view/626d4a2258fb770bf78a552f.html

5, UBUNTU 12.04 compiled Android 4.2 source code-http://www.59a.cn/1182.html

According to link 2 above, the image is generated under out/target/product/generic: Android source code is compiled to obtain the system. IMG, ramdisk. IMG, userdata. IMG image files. Ramdisk. IMG is the file system of emulator. IMG includes the main packages, libraries, and other files, userdata. IMG includes some user data. After the emulator loads these three image files, it loads system and userdata to the system and userdata directories in the ramdisk file system respectively.

Download the kernel code according to link 1. The next step is to download the kernel code and install the compiled image on the simulator!

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.