Building a kernel module from several source files which one of them has the same name as the module

后端 未结 5 1885
[愿得一人]
[愿得一人] 2020-12-02 17:24

Is it possible to build a kernel module from several source files which one of them has the same name as the module?

For example: I want to build \"mymodule.ko\" wit

5条回答
  •  星月不相逢
    2020-12-02 18:00

    You can use TARGET to name your .ko file as I did in this example:

    TARGET = can
    
    KDIR = /lib/modules/3.1.10-1.16-desktop/build
    PWD := $(shell pwd)
    
    obj-m += $(TARGET).o
    
    can-objs := can_core.o can_open.o can_select.o can_sysctl.o can_write.o \
           can_close.o can_ioctl.o can_read.o can_util.o \
           can_debug.o can_error.o \
           can_async.o can_sim.o
    
    default:
        make -C $(KDIR) M=$(PWD) modules
    

    So after the build I ended with a bunch of object files and can.ko

提交回复
热议问题