1
votes
  1. built Goldfish kernel successfully.
  2. built Android custom ROM with pre-built Goldfish kernel successfully.
  3. Added module source code (Hello-Proc for example) and Makefile to one folder in the custom ROM. I could manually build Hello-Proc.ko successfully by issuing "make" in the folder.

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?

Note: Goldfish kernel code is not in the Android custom ROM, and Android custom ROM will not build Goldfish kernel neither. 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
2

2 Answers

0
votes

.ko is the kernel module. It must be built and loaded in the Linux kernel (Goldfish in your case). You have put it in AOSP which is not correct. AOSP defines the user space and above of Android stack .

0
votes

In fact, the AOSP build recipe does not including building the kernel. 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).

To build a loadable kernel module, add your code to the kernel source (find the repo in the link above).