zoukankan      html  css  js  c++  java
  • ARM&Linux 下驱动开发第一节(小试牛刀)

    #include<linux/init.h>
    #include<linux/module.h>
    
    static int __init hello_init(void)
    {
        printk("Hello init
    ");
        return 0;
    }
    static int __exit hello_exit(void)
    {
        printk("Hello exit
    ");
    }
    module_init(hello_init);
    module_exit(hello_exit);

    交叉编译 Makefile文件(ARM):

    ifneq ($(KERNELRELEASE),)
    obj-m := hello.o
    else
    KDIR := /usr/src/linux2.6.28
    all:
        make -C $(KDIR) M=$(PWD) modules ARCH=arm CROSS_COMPILE=arm-linux-
    clean:
        rm -f *.ko *.o *.mod.o *.mod.c *.symvers  modul*
    endif

    X86:

    ## Makefile template.
    
     
    obj-m := hello.o
    UNAME := $(shell uname -r)
    PWD := $(shell pwd)
    ADVMOD := hello
     
    defualt:
        @make -C /lib/modules/$(UNAME)/build SUBDIRS=$(PWD) modules
     
    clean:    
        @rm -f *.o    
        @rm -f *.ko
        @rm -f *.mod.c
        @rm -f .*.cmd
        @rm -rf .tmp_versions
    #endif

    Linux下:

    OBJ = qudong
    ifneq ($(KERNELRELEASE),)
    obj-m := $(OBJ).o
    else
    KDIR := /usr/src/linux-headers-3.2.0-20-generic-pae
    all:
        rmmod $(OBJ)
        make -C $(KDIR) M=$(PWD) modules
        insmod $(OBJ).ko
    clean:
        rm -f *.ko *.o *.mod.o *.mod.c *.symvers  modul*
    endif
  • 相关阅读:
    02.jwt单点登录
    04.RBAC
    COM interop
    C++、c#互调用之VC6 调用 VC6 COM
    Type Library Importer (Tlbimp.exe)
    C++、C#互调用之C++ 调用C# dll
    VS tools
    Type Library to Assembly 转换摘要
    7个顶级心理预言
    c++、C#互调用之c# 调用 vc6 COM
  • 原文地址:https://www.cnblogs.com/linkong1081/p/3583294.html
Copyright © 2011-2022 走看看