Android的内核编译和测试了Android模拟器 [英] Android kernel compile and test with Android Emulator

查看:192
本文介绍了Android的内核编译和测试了Android模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人成功编译了android内核和Android模拟器测试它,如果是的话是有需要做的事情是特别的东西吗?

文档的SDK是优秀的,但文档编译内核,并建立一个定制机的模拟器已经很难让我找到。<​​/ P>

解决方案

自2009年8月的内核是标准的回购体现的不再一部分,当您按照说明下载源$ C ​​$ C为Android,你得到开源项目。都需要成功下载,生成并运行在模拟器上的特定内核的步骤如下:

  • 获取Android内核或者通过将它添加到您的回购清单或手动运行:
    git的克隆https://android.googlesource.com/kernel/goldfish.git
  • 检查出正确的分支与模拟器,即金鱼工作:
    git的结帐-t产地/ Android的金鱼-2.6.29 -b金鱼
  • 生成模拟器配置(QEMU仿真器运行的胳膊code,即手臂配置):
    进行ARCH =手臂goldfish_defconfig
    • 如果还是不行,请尝试进行ARCH =手臂goldfish_armv7_defconfig
  • 在使用分布式的开源项目的交叉编译工具现在构建内核:
    进行ARCH =手臂CROSS_COMPILE = mydroid / prebuilt / Linux的-86 /工具链/ ARM-EABI-4.2.1 /斌/ ARM-EABI -
  • 在建内核这种方式应该结束了在弓/ ARM /启动你的内核树的文件夹(你把code从混帐克隆)
  • 要运行与你的内核仿真器有两种选择,要么将其复制到开源项目的prebuilt内核文件夹,替换标准内核。另一种选择是先从内核选项集仿真器:
    模拟器-kernel mydroid /核心/普通/弓/ ARM /开机/的zImage

请注意,我使用的默认路径在上面的描述中,您需要将它们改到什么适用于您的设置。这是一个,因为我最后一次测试,但我认为它应该工作。一段时间

一些额外的信息: 在标准Android开放源码分发内核分布如 mydroid / prebuilt /机器人臂/内核文件夹和一个pre的二进制来源$ C ​​$ C不包括在内。内核源代码被从默认的清单中删除的原因有两个,因为我需要它。其中之一是,它需要大量的带宽和磁盘空间的一个平台组件,大多数人不会有太多工作。另一个原因是,由于内核是建立与内核构建系统,而不是作为AOSP构建系统的一部分,它是有道理的,以保持它分开。常见的分支内核仿真器使用的一个。也有实验,MSM(高通平台)与OMAP(德州仪器平台),也许一些更多的分支机构。如果你想使用Android内核的硬件,这些可能更有趣的你。

Has anyone successfully compiled the android kernel and tested it in the Android emulator, and if so is there anything that special that needs to be done?

Documentation for the SDK is excellent, however documentation for compiling the kernel and setting up a custom machine in the emulator has been hard for me to find.

解决方案

Since August 2009 the kernel is no longer part of the standard repo manifest that you get when you follow the instructions to download the source code for the android open source project. The steps that are needed to successfully download, build and run a specific kernel on the emulator are as follows:

  • Get the Android kernel either by adding it to your repo manifest or manually by running:
    git clone https://android.googlesource.com/kernel/goldfish.git
  • Check out the correct branch for working with the emulator, i.e. goldfish:
    git checkout -t origin/android-goldfish-2.6.29 -b goldfish
  • Generate the emulator configuration (qemu emulator runs arm code, i.e. an arm config):
    make ARCH=arm goldfish_defconfig
    • if that doesn't work, try make ARCH=arm goldfish_armv7_defconfig
  • Now build the kernel using the cross compilation tools distributed with the open source project:
    make ARCH=arm CROSS_COMPILE=mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
  • The kernel built this way should end up in the arch/arm/boot folder of your kernel tree (where you put the code from git clone)
  • To run the emulator with your kernel there are two alternatives, either copy it to the prebuilt kernel folder of the open source project to replace the standard kernel. The other option is to start the emulator with the kernel option set:
    emulator -kernel mydroid/kernel/common/arch/arm/boot/zImage

Note that I have used the default paths in the above description, you need to change them to what applies to your setup. It has been a some time since last time I tested this but I think it should work.

Some extra information: In the standard Android open source distribution the kernel is distributed as a pre-built binary in the mydroid/prebuilt/android-arm/kernel folder and the source code is not included. The kernel source was removed from the default manifest for two reasons as I take it. One is that it takes a lot of bandwith and diskspace for a platform component that most people will not work with much. The other reason is that since the kernel is built with the kernel build system and not as part of the aosp build system it makes sense to keep it separated. The common branch for the kernel is the one used by the emulator. There are also branches for experimental, msm (Qualcomm platforms) and Omap (TI platform) and maybe some more. If you want to use the Android kernel with hardware these may be more interesting to you.

这篇关于Android的内核编译和测试了Android模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆