#include <linux/module.h>
#include <linux/init.h>
#include <linux/moduleparam.h>
#include <linux/stat.h>
#define SIZE 10
static int a[SIZE], n;
module_param_array(a, int, &n, S_IRUGO);
static int __init test_init(void)
{
int i;
for (i = 0; i < n; ++i)
printk(KERN_ALERT "%d\n", a[i]);
return 0;
}
static void __exit test_exit(void)
{
return;
}
MODULE_LICENSE("GPL");
module_init(test_init);
module_exit(test_exit);
ubuntu5.4.135平台
# SPDX-License-Identifier: GPL-2.0
obj-m := vis.o
vis-objs := \
test.o
all:
make -C /usr/src/linux-headers-$(shell uname -r) M=$(shell pwd) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean