• 和菜鸟一起学OK6410之最简单驱动模块hello world


         天气越来越热了,可是炎热的天气也抵挡不住我对嵌入式的激情啊,OK6410,哥哥我又来了。今天终于回学校办了最后一件事情,拿了报到证,也签了劳动合同了,接下来,安安心心的工作+努力学习,相信自己的梦想会实现的。

          好了,今天就把最简单的驱动模块hello world给实现下吧,以前实现过,所以很快的就搞定了,加上昨天那个交叉编译搞定了平台的搭建,你懂的。

         首先就是写个驱动了;

     

    #include <linux/init.h>

    #include <linux/module.h>

     

    static int hello_init(void)

    {

        printk("Hello World!\n");

        printk("I will win the World!\n");

    return 0;

    }

     

    static void hello_exit(void)

    {

        printk("Good Bye!\n");

    }

     

    module_init(hello_init);

    module_exit(hello_exit);

     

    然后就是makefile了,驱动的makefile都是比较简单的。

     

    obj-m := hello.o

     

    觉得make 什么什么的,编译那个东西太复杂了,就写了个makemod

     

    make -C /home/eastmoon/work/linux2.6.28/ M=`pwd` modules

     

    然后只要source makdmod 就编译好了,方便

     

    接着便是传到我的SD卡上去了

     

    接着把SD卡上的东西放到板子上。然后

     

     

    至于那个rmmod,根文件系统没有做好,所以效果没有。好了,收工,睡觉。。。。。

  • 相关阅读:
    Binary Tree Postorder Traversal
    Insertion Sort List
    Unique Binary Search Trees
    Gas Station
    Path Sum II
    tkinter中鼠标与键盘事件(十五)
    tkinter中树状结构的建立(十四)
    tkinter中表格的建立(十三)
    tkinter中menu菜单控件(十二)
    tkinter中spinbox递增和递减控件(十)
  • 原文地址:https://www.cnblogs.com/wuyida/p/6300093.html
Copyright © 2020-2023  润新知