Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何为program.c创建makefile,以及如何在实时应用程序界面中编译和执行_C_Makefile_Linux Kernel_Real Time_Rtai - Fatal编程技术网

如何为program.c创建makefile,以及如何在实时应用程序界面中编译和执行

如何为program.c创建makefile,以及如何在实时应用程序界面中编译和执行,c,makefile,linux-kernel,real-time,rtai,C,Makefile,Linux Kernel,Real Time,Rtai,我有一个hollowworld.c: /* hello.c */ #include <linux/kernel.h> #include <linux/module.h> MODULE_LICENSE("GPL"); int init_module(void) { printk("Hello world!\n"); /* printk = kernel printf, to the console */ return 0; } void cleanup_mod

我有一个
hollowworld.c

/* hello.c */
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");

int init_module(void)
{
  printk("Hello world!\n"); /* printk = kernel printf, to the console */

  return 0;
}

void cleanup_module(void)
{
  printk("Goodbye world!\n");

  return;
}
/*hello.c*/
#包括
#包括
模块许可证(“GPL”);
int init_模块(void)
{
printk(“Hello world!\n”);/*printk=kernel printf,到控制台*/
返回0;
}
空洞清理_模块(空洞)
{
printk(“再见,世界!\n”);
返回;
}

如何为program.c创建makefile,以及如何在实时应用程序接口中编译和执行

要编译内核模块,请参阅内核源代码树中的其他驱动程序。在您的示例中,您会发现Makefile非常简单:

obj-M += hollowworld.o

这是一个内核模块,你所说的“实时应用程序”是什么意思?实时应用程序界面,好的,但这与你发布的内核模块代码有什么关系?