Compiling Emulat Android AVD kernel source code (Linux Kernel) on Ubuntu

Source: Internet
Author: User
Tags config git clone

Because I do not have a real machine environment, so I need to simulate in the simulator, so I want to download the source code version of the support simulator, and the goldfish version is specifically provided for the simulator environment.

The Goldfish project contains the kernel sources for the emulated platforms.

One, first, to

git clone https://android.googlesource.com/kernel/goldfish.git downloads Linux kernel for Android emulator source code.

1, use Git tool to download, execute the following command:

user-name@machine-name:~/$ git clone https://android.googlesource.com/kernel/goldfish.git

Also after a long wait, in the home directory has a goldfish directory, the Linux kernel code is here.

2, download completed, you can view the download of the kernel code version:

user-name@machine-name:~$ CD Goldfish

user-name@machine-name:~/goldfish$ ls-a

.  .. . git

3. Git include kernel source code, now we need to apply to the simulator for the kernel, so we need checkout goldfish version:

user-name@machine-name:~/goldfish$ git branch-a

* Master

Remotes/origin/head-> Origin/master

remotes/origin/android-goldfish-2.6.29

remotes/origin/android-goldfish-3.4

Remotes/origin/linux-goldfish-3.0-wip

Remotes/origin/master

Select remotes/origin/android-goldfish-3.4:

user-name@machine-name:~/my_android/kernel/goldfish$ git checkout remotes/origin/android-goldfish-3.4

Second, compile the kernel code.

1, export the cross-compilation tool directory to the $PATH environment variable:

user-name@machine-name:~/my_android/kernel/goldfish$

Export Arch=arm

Export Subarch=arm

Export path= $PATH:/home/v0idp0int/tools/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86 /bin

Export cross_compile=arm-linux-androideabi-

2, now is the time to get the android kernel compiler parameters of the configuration file, the file needs from the installed Android simulator

To get the only line. So it's also necessary to install the Android SDK,

Start the Android emulator first, and then get the kernel configuration file from the emulator from the ADB:

User-name@machine-name:emulator &

USER-NAME@MACHINE-NAME:ADB pull/proc/config.gz.

The ADB tool then connects the simulator and downloads a file called config.gz from it to your current directory.

Copy it to your Kernel/goldfish directory:

USER-NAME@MACHINE-NAME:CD ~/my_android/kernel/goldfish

USER-NAME@MACHINE-NAME:CP ~/config.gz

Unzip the file and rename it to. config, which allows you to skip the kernel parameter settings such as Make Menuconfig

The action.

User-name@machine-name:gunzip config.gz

USER-NAME@MACHINE-NAME:MV config. config

If you recompile a kernel version of the emulator, use the command make goldfish_defconfig or the. config produced by the goldfish_armv7_defconfig to compile the kernel.

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.