QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 940|回复: 3

怎么编译2.6.1内核的模块???

[复制链接]
发表于 2004-1-29 17:25:20 | 显示全部楼层 |阅读模式
刚刚编译了新内核2.6.1和新的insmod等工具

将2.6.1内核include下的asm asm-general linux 复制到/usr/include下

有如下程序hello.c:

    #include <linux/init.h>
    #include <linux/module.h>
    #include <linux/kernel.h>

    static int hello_init(void)
    {
        printk(KERN_ALERT "Hello, world\n");
        return 0;
    }

    static void hello_exit(void)
    {
        printk(KERN_ALERT "Goodbye, cruel world\n");
    }

    module_init(hello_init);
    module_exit(hello_exit);


使用命令 gcc -c hello.c编译出现了下面一堆错误(下面的只是一部分)!


/usr/include/linux/module.h: In function `try_module_get':
/usr/include/linux/module.h:307: error: invalid type argument of `->'
/usr/include/linux/module.h:312: error: invalid type argument of `->'
/usr/include/linux/module.h:312: error: `TIF_NEED_RESCHED' undeclared (first use in this function)
/usr/include/linux/module.h: In function `module_put':
/usr/include/linux/module.h:320: error: invalid type argument of `->'
/usr/include/linux/module.h:325: error: invalid type argument of `->'
/usr/include/linux/module.h:325: error: `TIF_NEED_RESCHED' undeclared (first use in this function)
/usr/include/linux/module.h: In function `MOD_INC_USE_COUNT':
/usr/include/linux/module.h:483: error: `KERN_WARNING' undeclared (first use in
this function)
/usr/include/linux/module.h:483: error: parse error before string constant
/usr/include/linux/module.h:486: error: invalid type argument of `->'
/usr/include/linux/module.h:487: error: invalid type argument of `->'
/usr/include/linux/module.h:487: error: `TIF_NEED_RESCHED' undeclared (first use in this function)

请问我是那个地方出错了???该如何解决????多谢了!!!!
发表于 2004-1-30 00:11:23 | 显示全部楼层
why did this? "将2.6.1内核include下的asm asm-general linux 复制到/usr/include下 "

check this. http://crab.ele.uri.edu/tmp/chdev_kstat.tgz i wrote this for iometer, pretty simple to understand.

read INSTALL first.
  
回复

使用道具 举报

 楼主| 发表于 2004-1-30 12:10:09 | 显示全部楼层
多谢斑竹 受益非浅阿!!!
回复

使用道具 举报

发表于 2004-2-1 10:58:26 | 显示全部楼层
welcome.
    
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-10-6 12:34 , Processed in 0.037171 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表