Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android system source code and compile the kernel source code     - CentOS 5.5 install ntop (Linux)

- Graphical development environment to build Android under Ubuntu 11.04 (Linux)

- Java8 Lambda expressions and flow operations (Programming)

- nginx.conf Optimization (Server)

- RMAN parameters of ARCHIVELOG DELETION (Database)

- Cacti Linux-based system monitoring and alarm (Linux)

- How to configure MariaDB replication in CentOS Linux (Database)

- Protobuf compiled and used on the Ubuntu 14.04 (Programming)

- Linux Operating System Security Management Experience (Linux)

- LAN Deployment Docker-- from scratch to create your own private warehouse Docker (Linux)

- Ubuntu install the camera driver (Linux)

- VMware 8 installation configuration Win7, CentOS-7 Wizard (Linux)

- Oracle11g build physical standby database (Database)

- Cygwin install Python MySQLdb (Linux)

- Difference between TCP and UDP protocols (Linux)

- Axel install plug under CentOS 5/6 acceleration yum downloads (Linux)

- Oracle Standby Redo Log experiment (Database)

- CentOS7 virtual machine starts appear Permission denied (Linux)

- The FreeBSD zfs: failed with error 6 Error Resolution (Linux)

- VirtualBox virtual machine to install Linux (Linux)

 
         
  Android system source code and compile the kernel source code
     
  Add Date : 2018-11-21      
         
         
         
  Before me during the compilation of the kernel source Android system source code and recording it, because the process is really benefit, value is not the result, primarily process, in this process, I feel the greatest achievement is to learn patience and perseverance because in this process, the problem is like the rain like a spank on your face, although now there are many online article describes how to operate, but I tell the truth, which can only provide a reference, because you work after all, the environment, and he does not like so and so, when you follow the steps to his operation will continue to face many problems, of course, I write this article is not to say my approach is certainly possible, I can only say I was successful so I just want to record it, then you can scroll through the view, the main thing is to see their perseverance and the ability to solve problems, well not much to say, get to the point ~

First we look at the source code to compile Android system

First: We know Android system is based on Linux development, so we want to compile Android system source code, then it must have a Linux system, and here I use Ubuntu 64-bit systems, this Download image file is: link: http : //pan.baidu.com/s/1dEq7SiP password: fach

One problem: As for why I want to use 64-bit system, because later I will encounter a problem, is the first time I installed a 32-bit system, the result is a problem encountered in the compilation process:

ERROR: prebuilts / tools / gcc-sdk /../../ gcc / linux-x86 / host / x86_64-linux-glibc2.7-4.6 / bin / x86_64-linux-ar only run on 64-bit linux

But it is tragic: I have followed this method of operating, did not succeed, then how to do it? I finally chose to reinstall a 64-bit system, but this time there is no virtual machine, and installed directly to your computer.

Second problem: I have to uninstall the installation of the system in the installation several times, mainly because the first compilation no experience, the beginning of the allocated space for the 20G, the results of the translation of silly, totally inadequate, so I will be straightforward 200G space allocated out of the computer


Then after installing the system completely, there is a problem, when I went to use the same way to download the Android source code when the connection is not always found on a feeling Google pull out of China, it is difficult to source down to the middle only about a month's time, will not be able to download a good fake, tried various methods, I also bought a VPN, the result was not, then how to do it? Before there is a source, but in a virtual machine, this time you need to copy the virtual machine source code out, then how to copy files from a virtual machine do? This is very simple, I use the VM, and he was able to set up shared folders (specific methods can search), but there is a problem here, then download in a virtual machine is Android4.4 source, about 18G, I try to copy, and found a copy of the best computer crashed, mainly because of too many small files, and there are about 600 000, the computer configuration is not good, so try a few times is crashed, then copy it out How to do it?

Through the above article, the compressed copy and found that the effect is very good, but the compression is also very fast, next to a copy of the smooth

So far we have solved the problem and the system source code problem

Note: The problem is not mentioned here refers to the source of the problem download the source code, I will talk about how the final surface is now able to give the corresponding Android source code, anyway, up from google download I do not believe it. So I offer I've downloaded and good compression connector labeled packet, android-4.0.3_r1-20121115.tar.bz2

Prelude above are ready, the following operations to compile

The first step: Before this also need to install some auxiliary tools to prevent an error in the installation, of course, we can not install now, wait until the installation prompts corresponding error, when I just need to install targeted, but that in the translation process will be very unhappy, so I'd better work done

When JDK is installed, the following will need to install the library at compile:

sudo apt-get install gnupg flex bison gperf libsdl1.2-dev libesd0-dev
sudo apt-get install libwxgtk2.6-dev squashfs-tools build-essential
sudo apt-get install zlib1g-dev pngcrush schedtool ia32-libs libncurses5-dev

Of course, these must be installed, but not necessarily at compile time, there is no problem, so we encountered any problems at compile time when we go to resolve


Today in Ubuntu 11.04 (64-bit) compiler Android2.3 source, the encounter various problems. Not a lack of this is that less. Now these problems and solutions listed here for your reference

Common error:
1. Error:
/usr/include/gnu/stubs.h:7:27: error: gnu / stubs-32.h: No such file or directory
make: *** [out / host / linux-x86 / obj / EXECUTABLES / acp_intermediates / acp.o] Error 1
solve:
sudo apt-get install libc6-dev-i386

2. Error:
make: *** [out / host / linux-x86 / obj / EXECUTABLES / acp_intermediates / acp] error 1
solve:
sudo apt-get install g ++ - multilib

3. Error:
external / clearsilver / cgi / cgi.c: 22: fatal error: zlib.h: No such file or directory
compilation terminated.
make: *** [out / host / linux-x86 / obj / SHARED_LIBRARIES / libneo_cgi_intermediates / cgi.o] Error 1
solve:
sudo apt-get install zlib1g-dev

4. Error:
/ Usr / bin / ld: can not find -lz
collect2: ld returned 1 exit status
make: *** [out / host / linux-x86 / obj / EXECUTABLES / aapt_intermediates / aapt] Error 1
solve:
sudo apt-get install lib32z1-dev

5. Error:
bison -d -o out / host / linux-x86 / obj / EXECUTABLES / aidl_intermediates / aidl_language_y.cpp frameworks / base / tools / aidl / aidl_language_y.y
/ Bin / bash: bison: command not found
make: *** [out / host / linux-x86 / obj / EXECUTABLES / aidl_intermediates / aidl_language_y.cpp] Error 127
solve:
sudo apt-get install bison

6. Error:
Lex: aidl <= frameworks / base / tools / aidl / aidl_language_l.l
/ Bin / bash: flex: command not found
make: *** [out / host / linux-x86 / obj / EXECUTABLES / aidl_intermediates / aidl_language_l.cpp] Error 127
solve:
sudo apt-get install flex

7. Error:
/ Usr / bin / ld: can not find -lncurses
collect2: ld returned 1 exit status
make: *** [out / host / linux-x86 / obj / EXECUTABLES / adb_intermediates / adb] Error 1
solve:
sudo apt-get install lib32ncurses5-dev

8. ERROR:
prebuilt / linux-x86 / sdl / include / SDL / SDL_syswm.h: 55: fatal error: X11 / Xlib.h: No such file or directory
compilation terminated.
make: *** [out / host / linux-x86 / obj / EXECUTABLES / emulator_intermediates / android / main-common.o] Error 1
solve:
sudo apt-get install libx11-dev

9. Error:
sh: gperf: not found
calling gperf failed: 32512 at ./makeprop.pl line 96.
make: *** [out / target / product / generic / obj / STATIC_LIBRARIES / libwebcore_intermediates / WebCore / css / CSSPropertyNames.h] Error 25
make: *** Deleting file out / target / product / generic / obj / STATIC_LIBRARIES / libwebcore_intermediates / WebCore / css / CSSPropertyNames.h '
solve:
sudo apt-get install gperf

Fatal error: bits / predefs.h: No such file or directory compilation terminated

Solution:
sudo apt-get install gcc-multilib

There is another reason:

Ubuntu gcc version is 4.6.1 above 11.10 version is too high an error when compiling android, to make gcc version 4.4.3

sudo apt-get install gcc-4.4
sudo apt-get install g ++ - 4.4

Error summary:

1. Error

host Executable: aapt (out / host / linux-x86 / obj / EXECUTABLES / aapt_intermediates / aapt)
/ Usr / bin / ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libz.so when searching for -lz
/ Usr / bin / ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libz.a when searching for -lz
/ Usr / bin / ld: skipping incompatible //usr/lib/libz.so when searching for -lz
/ Usr / bin / ld: skipping incompatible //usr/lib/libz.a when searching for -lz
/ Usr / bin / ld: can not find -lz
collect2: ld returned 1 exit status
make: *** [out / host / linux-x86 / obj / EXECUTABLES / aapt_intermediates / aapt] Error 1

Solution:

Missing lib32z1-dev, install it: apt-get install lib32z1-dev

2. Error
fatal error:: gnu / stubs-32.h: No such file or directory error message appears when compiling /usr/include/gnu/stubs.h:7
/usr/include/gnu/stubs.h:7: fatal error: gnu / stubs-32.h: No such file or directory
compilation terminated.
make: *** [out / host / linux-x86 / obj / EXECUTABLES / acp_intermediates / acp.o] Error 1
Solution:

Missing libc development kit can be installed: apt-get install libc6-dev-i386

3. Error
Android compilation error is encountered / usr / bin / ld: can not find -lstdc ++ solution
Solution:

Missing g ++ - multilib libraries can be installed: apt-get install g ++ - multilib

Finally I found a mistake:

libwebcore.so error make android when

Workaround: Increase the swap file

Well, in it's work is done, and bug resolved, the compiler also completed, I was compiled in the evening, the next day Well, when you see the results when really happy:

Target system fs image: out / target / product / generic / obj / PACKAGING / systemimage_intermediates / system.img
Install system fs image: out / target / product / generic / system.img
Target ram disk: out / target / product / generic / ramdisk.img
Target userdata fs image: out / target / product / generic / userdata.img
Installed file list: out / target / product / generic / installed-files.txt

Then the following results compiled at run it:

1. Set the environment variables:
USER-NAME @ MACHINE-NAME: ~ / Android $ export PATH = $ PATH: ~ / Android / out / host / linux-x86 / bin
USER-NAME @ MACHINE-NAME: ~ / Android $ export ANDROID_PRODUCT_OUT = ~ / Android / out / target / product / generic
Wherein, ~ / Android / out / host / linux-x86 / bin emulator has ordered us to perform, while ~ / Android / out / target / product / generic Android is mirrored storage directory, execute the following command will be used when the emulator.
2. Run the simulator.
USER-NAME @ MACHINE-NAME: ~ / Android $ emulator
Simulator files needed for the operation, namely Android and Linux Kernel zImage mirror image file system.img, userdata.img and ramdisk.img. Executing emulator command without any parameters, then the Linux Kernel image default ~ / Android / prebuilt / android-arm / kernel-qemu kernel file directory, and the default Android image file system.img use ANDROID_PRODUCT_OUT directory , userdata.img and ramdisk.img, is what we have just compiled mirror problem.

Of course, we can also specify the image file to run the emulator, when that is running emulator, namely:
USER-NAME @ MACHINE-NAME: ~ / Android $ emulator -kernel ./prebuilt/android-arm/kernel/kernel-qemu -sysdir ./out/target/product/generic -system system.img -data userdata.img - ramdisk ramdisk.img

But again an error:

emulator: ERROR: You did not specify a virtual device name, and the system
directory could not be found.
If you are an Android SDK user, please use '@ ' or '-avd '
to start a given virtual device (see -help-avd for details).
Otherwise, follow the instructions in -help-disk-images to start the emulator

Solution:

Into the Android source directory execute:

source build / envsetup.sh

lunch sdk-eng

Then execute:

emulator

You can start the emulator

Run again, well there are the results:

After compile Android source code, have to look at how to write Android kernel source code compiler, why should compile the Android kernel source it? This is the follow-up work to do to prepare, we will discuss later, in fact, we compiled above his source Android kernel source code Google has been compiled, and stored in: Source directory / prebuilt / android-arm / kernel / kernel-qemu;

Here we look at how to compile the kernel source code it, the same is true, to compile the kernel source code, we need the kernel source, but also a pain thing, there are many online resources are said to use version of the goldfish, and then went : git clone http://android.googlesource.com/kernel/goldfish.git
Anyway, I download fails, causes and download the source code is the same, google server connection fails, how to do it?
At that time I was no way, and went to a variety of search results it was said goldfish are not connected, and someone will put the kernel source on github the following address:
https://github.com/android/kernel_common

If the download fails, I have downloaded OK, you can go to download the following connections: Links: http://pan.baidu.com/s/1dEq7SiP Password: fach

I went to download, and a few hundred M bar, after downloaded, you compile it before compiling we need to change something:

Modify folder Makefile file compilation environment

will

ARCH? = (SUBARCH)
CROSS_COMPILE? =

Modified
ARCH? = Arm
CROSS_COMPILE? = Arm-eabi-

Using the arm architecture, using a cross compiler arm-eabi-XXX tool, this value is just a prefix

Here we have to compile it, into a folder compiled results show that it can not find the specified arm-eabi-gcc tool (This error occurs when I compile Android4.4 version, since this version of the source code to find not specified prebuilt / linux-x86 / toolchain / arm-eabi-4.4.3 / bin directory, but the final version of the compiler Android2.3.7 then there, so specific to version 4.4 if not, how do we do it?

After the download is generally stored in / usr / lib directory, and then modify environment variables, which can refer to previously configured JDK environment variable method

We first need to: make goldfish_defconfig

But I can not find the specified file, find the file in the goldfish release, and we downloaded only kernel_common, this time we can:

make menuconfig

Then select the corresponding configuration, but the problem again, what options are mandatory and which are not required for the election, anyway, finally compiling always fails, get hurt, so I'd have to go goldfish version (the above me so I introduced the process operation kernel_common version of the record is about, although the last failed), but good luck, and finally I found to be really specific address I remember very clearly, but I put network disk, and there are appropriate instructions, goldfish Download:

Links: http://pan.baidu.com/s/1dEq7SiP Password: fach

After the download, you can compile,

make goldfish_defconfig

then

make

This compilation process quickly, less than an hour it

OBJCOPY arch / arm / boot / zImage
Kernel: arch / arm / boot / zImage is ready

This compilation is successful, then I use this kernel image to start the emulator it:

1. Before starting the simulator, first set up the simulator directory to $ PATH environment variable to go:
USER-NAME @ MACHINE-NAME: ~ / Android $ export PATH = $ PATH: ~ / Android / out / host / linux-x86 / bin
2. Set ANDROID_PRODUCT_OUT environment variables:
USER-NAME @ MACHINE-NAME: ~ / Android $ export ANDROID_PRODUCT_OUT = ~ / Android / out / target / product / generic
3. Specify the kernel file in the background, start the emulator:
USER-NAME @ MACHINE-NAME: ~ / Android $ emulator -kernel ./kernel/common/arch/arm/boot/zImage &

Unfortunately, the simulator is able to start, but is always black, and is also connected with adb shell is not on the device, which may be how to do, almost successful, then go online again searching for answers and found: The reason is my source version 4.4, version 2.3 is the future of architecture is armv7, and so it is not:

make goldfish_defconfig

But

make goldfish_armv7_defconfig

Compile again, success is to start again with the image file simulator, grass, dumbfounded, the result was a failure too boring, then search various reasons above answer, but I have modified, or not (this problem entangled two weeks, I almost gave up), and finally think it is not the source of the problem can only think, so went looking for source 2.3.7 evening, not to mention the day, it really pays off, really I was found, and find a lot of versions, all in a compact package, where I really want to thank the people, know how to share resources,

Then I am very excited to recompile Android2.3.7 version of the source (in fact, I was a bit worried because I am now the system is 64-bit, do not know is how many bits of the source, but in the end successful compilation, and this version is 64-bit, there is no need to re-change system), because the compilation process had before, a lot of issues are resolved in advance, the compilation process is very smooth, and it is also compiled the results in the evening a success, this time we in the above manner by recompiling the kernel, and then start the emulator

Successful, this is really successful, so touched, so excited ah, two setbacks twice excited ~

Summary: In fact, we can recall the above process, the individual feels no technology at all, the biggest problem I encountered is the problem of access to resources can not, so I'll use the resources given to the download link, at the same time feeling encountered a problem can not be timid, be brave face ~

PS: The above procedure is successful after my feelings and operating, if parents who follow me in this way are not successful, please leave a message and I will help look ~ ~ ~ ~

Note: This article is actually no content, but there are many resources download link, this is really great value ~
     
         
         
         
  More:      
 
- The principle Httpclient4.4 (execution request) (Programming)
- Linux cd command Detailed (Linux)
- gzip, bzip2, xz, tar, zip compression, archive Detailed (Linux)
- Implement binary search algorithm in C language (Programming)
- Linux set to select the appropriate level of security of the network according to deployment (Linux)
- How the program is executed (Programming)
- Traffic monitor Linux Python Version (Programming)
- HttpClient4 usage upgrade from HttpClient3 (Programming)
- You really do need to know a variety of programming languages (Programming)
- Linux System Getting Started Learning: Disable HTTP forwarding wget in (Linux)
- Function Getting the Linux shell (Programming)
- Teach you how to ensure password security under the Linux operating system (Linux)
- Linux vi command list (Linux)
- Memcached installation, configuration and monitoring (Server)
- JavaScript cross-browser event object library (Programming)
- Oracle Migration partition table (Database)
- Upgrading to MySQL 5.7.9 MySQL 5.6.23 (Database)
- [SHELL] MySQL primary recovery solution from + Keepalived online (Server)
- TeamCity continuous integration in the Linux installation (Linux)
- MySQL replication master and slave structure built (Database)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.