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

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

问题描述

有没有人成功编译安卓内核并在安卓模拟器中测试过,如果有,有什么特别需要做的吗?

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 内核添加到您的存储库清单或通过运行手动获取 Android 内核:
    git clone https://android.googlesource.com/kernel/goldfish.git
  • 查看使用模拟器的正确分支,即金鱼:
    git checkout -t origin/android-goldfish-2.6.29 -b goldfish
  • 生成模拟器配置(qemu模拟器运行arm代码,即arm配置):
    制作 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 构建系统的一部分,因此将其分开是有意义的.内核的公共分支是模拟器使用的分支.还有experimental、msm(Qualcomm 平台)和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天全站免登陆