Android Kernel Debug

Source: Internet
Author: User

This document gives a way to debug Android kernel using Android emulator and ARM-LINUX-ANDROIDEABI-GDB

1. Checkout goldfish Source: Kernel used by the simulator is goldfish

git clone https://android.googlesource.com/kernel/goldfish.git gitcheckout-t origin/android-goldfish-3.4-b goldfish3.4

  

2. Set environment variables, mainly to specify the cross compiler to path path: The following sentences can be saved as a script, need to execute in the shell

Export path= $YOUR _android_src_path/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/: $PATHexport ARCH= Armexport Subarch=armexport Cross_compile=arm-eabi-make Goldfish_armv7_defconfig

3. Add kernel config option

The default Goldfish_armv7_defconfig configuration does not turn on debugging, nor does it use HIGHMEM, where we open the Goldfish/.config directory manually, opening several of the following configurations:

Config_highmem=y When this option is turned on, the emulator-memory parameter is activated when the emulator is started, or the emulator's memory is always more than 700 mconfig_debug_kernel=y when this option is turned on, vmlinux Only sign Config_kgdb=y open KGDB

  

4. Start compiling

Make Arch=arm cross_compile= $YOUR _android_src_path/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/ Arm-linux-androideabi-all

Since the 3rd step to open a few configurations, so the compile start will be prompted to choose configuration options, remember that the relevant configuration of all Y can be compiled after the goldfish/arch/arm/boot/zimage appear, this is the kernel

5. Start the simulator

Emulator-no-window-no-audio-verbose-show-kernel-kernel Goldfish/arch/arm/boot/zimage-memory 2048-qemu-s-S

  

I generally debug the kernel does not require a graphical interface, so add-no-window, No-audio. In addition, want to see the detailed output of the kernel, add-show-kernel,-verbose, and then the-kernel parameter points to just compiled Zimage,-memory set memory, the larger the memory, debugging performance better, and finally-qemu-s-s Start debugging monitoring, that is, the kernel will wait on port 1234 after boot and not always start, this time need to start gdb in another interface:

Arm-linux-androideabi-gdb Goldfish/vmlinux

  

Then perform remote debugging in the interface:

Reference:

https://gbrownmozilla.wordpress.com/2015/02/13/more-memory-for-the-android-emulator/

http://www.kgdb.info/kgdb/use_kgdb/using_kgdb_base_qemu/

Http://yabinc.blogspot.com/2015/03/build-and-run-android-linux-kernel-in.html

http://www.joenchen.com/archives/1093

Android Kernel Debug

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.