zoukankan      html  css  js  c++  java
  • linux驱动编程入门实例

    编辑

    /*****hello.c*******/

    #include <linux/init.h>

    #include <linux/module.h>

    #include <linux/kernel.h>

    MODULE_LICENSE("Dual BSD/GPL");

    static int hello_init() {

      printk("<1>hello ");

      return 0;

    }

    static void hello_exit() {

      printk("<1>bye ");

    }

    module_init(hello_init);

    module_exit(hello_exit);

    makefile

      obj-m := hello.o

    编译

    make -C /usr/src/kernel-source M=`pwd` modules

    运行

    安装驱动:insmod hello.ko

    查看驱动:lsmod

    卸载驱动:rmmod hello

  • 相关阅读:
    Vue
    linux-----docker
    linux基础
    Flask基础
    websocket
    css
    Mysql数据库基础
    IO多路复用
    线程和协程
    sh_02_del关键字
  • 原文地址:https://www.cnblogs.com/feilv/p/4065509.html
Copyright © 2011-2022 走看看