凌云实验室推出的ARM Linux物联网网关开发板IGKBoard(IoT Gateway Kit Board)项目源码
guowenxue
2021-12-18 9e937cc7b61f38c774df5a003048eefbf6186a51
add hello driver module and makefile
2 files added
74 ■■■■■ changed files
bsp/drivers/users/Makefile 39 ●●●●● patch | view | raw | blame | history
bsp/drivers/users/hello.c 35 ●●●●● patch | view | raw | blame | history
bsp/drivers/users/Makefile
New file
@@ -0,0 +1,39 @@
#*********************************************************************************
#      Copyright:  (C) 2021 LingYun IoT System Studio <www.weike-iot.com>
#                  All rights reserved.
#
#       Filename:  Makefile
#    Description:  This Makefile used to compile all the drivers here
#
#        Version:  1.0.0(18/12/2021~)
#                  Author:  Guo Wenxue <guowenxue@gmail.com>
#      ChangeLog:  1, Release initial version on "18/12/2021 01:29:33 PM"
#
#********************************************************************************/
CROSS_COMPILE=/opt/buildroot/cortexA7/bin/arm-linux-
LINUX_SRC = ${shell pwd}/../../kernel/linux-imx/
DRV_INSTPATH = ${shell pwd}/../../rootfs/driver/
EXTRA_INSTPATH=/tftp
PWD := $(shell pwd)
obj-m += hello.o
modules:
    @echo ${LINUX_SRC}
    @make -C $(LINUX_SRC) M=$(PWD) modules
    @make -C $(LINUX_SRC) M=$(PWD) modules_install INSTALL_MOD_PATH=${DRV_INSTPATH} INSTALL_MOD_STRIP=1
    @make clear
install:
    cp -af *.ko ${EXTRA_INSTPATH}
clear:
    @rm -f *.o *.mod* .*.cmd *.symvers *.order
clean: clear
    @rm -f  *.ko
bsp/drivers/users/hello.c
New file
@@ -0,0 +1,35 @@
/*********************************************************************************
 *      Copyright:  (C) 2021 LingYun IoT System Studio <www.weike-iot.com>
 *                  All rights reserved.
 *
 *       Filename:  hello.c
 *    Description:  This file is the linux kernel sample hello module
 *
 *        Version:  1.0.0(18/12/2021~)
 *         Author:  Guo Wenxue <guowenxue@gmail.com>
 *      ChangeLog:  1, Release initial version on "18/12/2021 10:50:26 AM"
 *
 ********************************************************************************/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
static __init int hello_init(void)
{
    printk(KERN_ALERT "Hello, LingYun IoT System Studio!\n");
    return 0;
}
static __exit void hello_exit(void)
{
    printk(KERN_ALERT "Goodbye, I have found a good job!\n");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_AUTHOR("GuoWenxue <guowenxue@gmail.com>");
MODULE_DESCRIPTION("Linux Kernel hello module");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_INFO(intree, "Y");