天嵌 ARM开发社区

 找回密码
 注册
查看: 2140|回复: 4

TQ3358 编写的内核模块 求助MAKEFILE !!!

[复制链接]
geriletu 发表于 2013-12-13 11:29:24 | 显示全部楼层 |阅读模式
大虾们你们好:
我自己在交叉编译环境里想编译这个模块儿 不会写makefile!帮我提供个简单的能编译生成.ko的makefile 这个.c的文件名为hello.c
我想编译生成的.ko直接insmod 一下 不想在内核里嵌入!


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

MODULE_LICENSE("GPL");

static int __init hello_init(void)
{
        printk("<1>\n        hello,guoxiao!\n");
        printk("<1>\n        this is first driver test\n\n");
        
        return 0;        
}

static void __exit hello_exit(void)
{
        printk("<1>\n        exit!\n");
        printk("<1>\n        goodbye guoxiao69!\n\n");
               
        }
        
module_init(hello_init);
module_exit(hello_exit);


还有一个问题是 u-boot下一直不能用TFTP服务器更新系统!帖子链接为:
http://www.armbbs.net/forum.php? ... id=18160&extra=

TQ-lkp 发表于 2013-12-13 12:02:39 | 显示全部楼层
手册中有教如何添加自己的驱动的,按你的意思是想编绎成模块,你可以加在配置单中然后配置成M即可。
TQ-ZQL 发表于 2013-12-13 13:24:00 | 显示全部楼层
http://www.armbbs.net/forum.php? ... &highlight=make
论坛有很多相关的帖子的找下看下吧
 楼主| geriletu 发表于 2013-12-13 13:27:25 | 显示全部楼层
大虾 我这个不能单独编译生成模块儿 然后直接装在模块儿不行吗?非得要重新编译内核模块儿吗?
 楼主| geriletu 发表于 2013-12-18 08:29:48 | 显示全部楼层
这个问题已解决!谢谢大虾们!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-4-26 17:52 , Processed in 1.046875 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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