如何编译Android AOSP内核并使用Android Emulator对其进行测试? [英] How to compile the Android AOSP kernel and test it with the Android Emulator?

查看:263
本文介绍了如何编译Android AOSP内核并使用Android Emulator对其进行测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人成功地编译了android内核并在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?

SDK的文档非常棒,但是我很难找到用于编译内核和在仿真器中设置自定义计算机的文档.

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.

推荐答案

自2009年8月以来,按照说明下载android开源项目的源代码时,内核不再是您所获得的标准回购清单的一部分. .在仿真器上成功下载,构建和运行特定内核所需的步骤如下:

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:

  • 通过将Android内核添加到您的回购清单中或通过运行以下命令手动获取:
    git clone https://android.googlesource.com/kernel/goldfish.git
  • 签出用于仿真器的正确分支,即金鱼:
    git checkout -t origin/android-goldfish-2.6.29 -b goldfish
  • 生成模拟器配置(qemu模拟器运行Arm代码,即Arm配置):
    make ARCH=arm goldfish_defconfig
    • 如果这不起作用,请尝试make ARCH=arm goldfish_armv7_defconfig
    • 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

      请注意,我在上面的描述中使用了默认路径,您需要将其更改为适用于您的设置的路径.自上次测试以来已经有一段时间了,但我认为它应该可以工作.

      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.

      一些额外的信息: 在标准的Android开放源代码发行版中,内核作为预构建的二进制文件分布在mydroid/prebuilt/android-arm/kernel文件夹中,并且不包含源代码.出于以下两个原因,内核源已从默认清单中删除.一个是,对于大多数人来说,平台组件使用起来会占用很多带宽和磁盘空间.另一个原因是,由于内核是使用内核构建系统构建的,而不是作为aosp构建系统的一部分,因此有必要将其分开.内核的公共分支是仿真器使用的分支.还有用于实验,msm(高通平台)和Omap(TI平台)的分支,也许还有更多分支.如果您想将Android内核与硬件一起使用,这些对您可能会更有趣.

      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 AOSP内核并使用Android Emulator对其进行测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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