如何开始Android内核编程?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3070159/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:34:51  来源:igfitidea点击:

How to start Android Kernel programming?

android

提问by Rajapandian

I have 6 months experience with Android, developing simple UI-based applications. Now I want to write applications targeting the Android core Kernel. For example, I want to develop a framework which is not present in Android. To achieve that, we have to write the code for the Kernel. I don't know where and how to start Android Kernel programming.

我有 6 个月的 Android 经验,开发基于 UI 的简单应用程序。现在我想编写针对 Android 核心内核的应用程序。例如,我想开发一个在 Android 中不存在的框架。为此,我们必须为内核编写代码。我不知道从哪里以及如何开始 Android 内核编程。

If anybody knows the way to start it please help me.

如果有人知道如何启动它,请帮助我。

采纳答案by Terrance

  • xda-developers
    A very awesome and very active place for anything smart smart phone related.
  • kernelnewbies
    Generally good resource for starting out learning linux kernel
    (Which is what the android is built off of)
  • Building Android Kernel
    Android Kernel Source
  • Linux kernel
    Online guide to driver development among many other related topics.
  • xda-developers
    一个非常棒且非常活跃的地方,用于与智能手机相关的任何事情。
  • kernelnewbies
    通常是开始学习 linux 内核的好资源
    (这是 android 的构建基础)
  • 构建 Android Kernel
    Android Kernel Source
  • Linux 内核
    驱动程序开发在线指南以及许多其他相关主题。

Update

更新

For android source code you can check out one of the following...

对于 android 源代码,您可以查看以下内容之一...

  • or this question
  • 或者这个问题
  • or source.android.com
  • 或 source.android.com
  • I personally dig this chrome pluginfor browsing android source code.

    我个人挖掘这个 chrome 插件来浏览 android 源代码。

    回答by BMB

    If you are talking about platform level programming,i.e. framework extensions, native libraries and services there are a few places to start. The first one is the new and updated official open source project page. The portions about contributing and porting provide some basic information on the platform architecture and what you need to work with the platform. The next step is to understand the build system for the platform and framework. There are some limited info available on the net if you google for it. The best way is probably to study some of the makefile templates available in the open source project in the build folder. For info on how to add your own modules using Android.mk files it is a good thing to study make files for existing projects such as the ones available in external in the open source projects.

    如果您在谈论平台级编程,即框架扩展、本机库和服务,有几个地方可以开始。第一个是新的和更新的官方开源项目页面. 关于贡献和移植的部分提供了一些关于平台架构的基本信息以及使用该平台所需的内容。下一步是了解平台和框架的构建系统。如果你用谷歌搜索,网上有一些有限的信息。最好的方法大概是研究一下 build 文件夹中开源项目中可用的一些 makefile 模板。有关如何使用 Android.mk 文件添加自己的模块的信息,最好研究现有项目的 make 文件,例如开源项目中外部可用的文件。

    Once you have gotten as far as the above. That is you know the basics of platform level development and how to build your own modules for the platform the next step is to study the framework extension example available in the open source project. Check out the vendor/sample/PlatformLibrary folder (edit, as of 2.2 the vendor stuff has moved to the device folder) in the open source project and read the readme file, study the code, build it and make sure you understand it. If you don't then JNI, shared libraries, the platform security model and the core framework are areas that could help you out.

    一旦你达到了上面的程度。也就是说,您了解了平台级开发的基础知识以及如何为平台构建自己的模块。下一步是研究开源项目中可用的框架扩展示例。查看开源项目中的 vendor/sample/PlatformLibrary 文件夹(编辑,从 2.2 开始,vendor 的东西已移至设备文件夹)并阅读自述文件,研究代码,构建它并确保您理解它。如果您不这样做,那么 JNI、共享库、平台安全模型和核心框架是可以帮助您的领域。

    I guess that since you are talking about kernel programming you are also looking for ways to hook up new hardware with the platform and expose that functionality using your framework extensions to the applications. Hardware is basically added as a standard Linux driver so getting it to work under Linux is a good first step. How to hook it into the Android framework after that depends on what type of hardware it is. You could either use a native process to control it (compare the camera service or radio daemon in the current platform) or just spawn a thread in the application that uses your framework extension. For hardware that does not require that much attention plugging it in using an Android HAL library could also be an option.

    我想,既然您在谈论内核编程,您也在寻找将新硬件与平台连接起来并使用您的框架扩展向应用程序公开该功能的方法。硬件基本上是作为标准 Linux 驱动程序添加的,因此让它在 Linux 下工作是一个很好的第一步。之后如何将其挂接到 Android 框架中取决于它是什么类型的硬件。您可以使用本机进程来控制它(比较当前平台中的相机服务或无线电守护程序),或者只是在使用您的框架扩展的应用程序中生成一个线程。对于不需要太多注意力的硬件,也可以选择使用 Android HAL 库将其插入。

    I hope that provides some initial pointers on where to look. The official mailing lists are otherwise the main source of info about platform level development. Especially Android portingand Android platform.

    我希望这提供了一些关于在哪里看的初步指示。否则,官方邮件列表是有关平台级开发信息的主要来源。尤其是Android移植Android平台

    回答by ashughes

    You should also check out http://pdk.android.com. I just found this site recently and it is extremely useful. I wish I knew about it sooner. I'm not sure how dedicated Google is to updating the site because as BMB mentioned the vendor stuff was moved to the device folder in 2.2 but there have been no changes to the PDK site to reflect that. Also, some of the links don't work but I was able to find all the pages by doing a site search in Google.

    您还应该查看http://pdk.android.com。我最近才发现这个网站,它非常有用。我希望我早点知道。我不确定 Google 对更新站点的专注程度,因为正如 BMB 提到的,供应商的内容已移至 2.2 中的设备文件夹,但 PDK 站点没有任何更改以反映这一点。此外,有些链接不起作用,但我可以通过在 Google 中进行站点搜索来找到所有页面。