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

查看:34
本文介绍了如何编译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 开源项目的源代码时获得的标准 repo 清单的一部分.在模拟器上成功下载、构建和运行特定内核所需的步骤如下:

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

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

    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天全站免登陆