Vim3+ubuntu,驱动模块编译问题。

板子是vim3,系统是ubuntu20.04,请问可以直接在板子上编译驱动模块么,我写了一个很简单的驱动,编译时提示 "ccl:sorry,unimplemented:code model ‘large’ with ‘-fPIC’。

没有人试过在板子上编译驱动模块么,驱动必须要交叉编译么?

怎么不能编译呢?你的编译方式有问题把?我这边测试是没问题的。

root@Khadas:~/helloworld# cat helloworld.c 
#include <linux/init.h>
#include <linux/module.h>
 
static int __init hello_init(void) {
    printk(KERN_ALERT "Hello, world\n");
    return 0;
}
 
static void __exit hello_exit(void) {
    printk(KERN_ALERT "Goodbye!!!\n");
}
 
MODULE_LICENSE("Dual BSD/GPL");
 
module_init(hello_init);
module_exit(hello_exit);

Makefile:

root@Khadas:~/helloworld# cat Makefile 
obj-m := helloworld.o
KDIR = /usr/src/linux-headers-4.9.241

all:  
	$(MAKE) -C $(KDIR) M=$(PWD)  

.PHONY:clean
clean:  
	rm -f *.mod.c *.mod.o *.ko *.o *.tmp_versions *.symvers *.order