简体   繁体   English

如何在Linux内核Makefile中添加规则

[英]How to add rules in Linux kernel Makefile

I want to add systemcall to Linux kernel 3.6.x . 我想将systemcall添加到Linux内核3.6.x中 I have two files myheader.h and mycode.c . 我有两个文件myheader.hmycode.c

As I have seen on some articles, I did the following: 正如我在某些文章中看到的那样,我做了以下事情:

  1. Create a folder from root directory /linux/myfolder . 从根目录/linux/myfolder创建一个文件夹。

  2. Create Makefile in myfolder with the rule: 使用以下规则在myfolder创建Makefile:

    obj-y := mycode.o

    and I put mycode.c file in this folder. 然后将mycode.c文件放在此文件夹中。

  3. I modify the main Makefile form the root directory. 我从根目录中修改了主Makefile。

    core-y := usr/ myfolder/

Where should I put myheader.h and what rules should I have to add to the makefiles ? 我应该将myheader.h放在哪里,必须将哪些规则添加到makefile中?

I tried putting it inside /linux/include but it fails to compile. 我尝试将其放在/linux/include但无法编译。

您可以在本地拥有头文件(与源文件位于同一目录中),并将其包含在简单的#include "myheader.h"

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

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