简体   繁体   English

在构建Android自定义ROM的同时构建可加载的内核模块

[英]Build loadable Kernel Module while building Android custom ROM

  1. built Goldfish kernel successfully. 成功构建了Goldfish内核。
  2. built Android custom ROM with pre-built Goldfish kernel successfully. 使用预构建的Goldfish内核成功构建了Android自定义ROM。
  3. Added module source code (Hello-Proc for example) and Makefile to one folder in the custom ROM. 在自定义ROM中的一个文件夹中添加了模块源代码(例如,Hello-Proc)和Makefile。 I could manually build Hello-Proc.ko successfully by issuing "make" in the folder. 我可以通过在文件夹中发出“ make”来成功手动构建Hello-Proc.ko

Which makefile and how need I change to trigger building this module when I build the ROM so that Hello-Proc.ko will be built automatically ? 生成ROM时将更改哪个makefile以及更改触发该模块的触发方式,以便可以自动生成Hello-Proc.ko

Note: Goldfish kernel code is not in the Android custom ROM, and Android custom ROM will not build Goldfish kernel neither. 注意:Goldfish内核代码不在Android自定义ROM中,并且Android自定义ROM也不会构建Goldfish内核。 The file tree looks like this. 文件树如下所示。

├── android_AOSP
│   ├── device
│       ├── vendor_A 
│           ├── product_A
│           │   ├── AndroidBoard.mk
│           │   ├── AndroidProducts.mk
│           │   ├── BoardConfig.mk
│           │   ├── device.mk
│           │   ├── product_a.mk
│           │   ├── system.prop
│           │   └── vendorsetup.sh
│           ├── modules
│               ├── Android.mk
│               ├── hello_proc
│                  ├── Android.mk
│                  ├── hello_proc.c
│                  ├── Kbuild
│                  ├── Makefile
├── goldfish

.ko is the kernel module. .ko是内核模块。 It must be built and loaded in the Linux kernel (Goldfish in your case). 它必须在Linux内核(您的情况下为Goldfish)中构建和加载。 You have put it in AOSP which is not correct. 您已将其放在AOSP中,这是不正确的。 AOSP defines the user space and above of Android stack . AOSP定义了Android堆栈之上的用户空间。

In fact, the AOSP build recipe does not including building the kernel. 实际上,AOSP构建配方不包括构建内核。 It has to be built separately using the provided tool chain. 必须使用提供的工具链单独构建它。 Checkout this guide if you have not ( http://source.android.com/source/building-kernels.html ). 如果您尚未查看本指南,请参阅( http://source.android.com/source/building-kernels.html )。

To build a loadable kernel module, add your code to the kernel source (find the repo in the link above). 要构建可加载的内核模块,请将您的代码添加到内核源代码中(在上面的链接中找到存储库)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM