How to make device driver with multi files

I’m seungpyo shin of ocube

how to make *.ko file with multi files?

I’m trying to make device driver

I have a source which runs linux-x86

the source is composed of 5 files

but there is no example using multi files to make device driver

please help me

best regard !

below is my environment


2.8	LTS	Ångström v2017.12	rocko	2.4

I use “~/oe-core/layers/meta-toradex-bsp-common/recipes-kernel/hello-mod” folder to make device driver

Build Configuration:

BB_VERSION           = "1.36.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-18.04"
TARGET_SYS           = "arm-angstrom-linux-gnueabi"
MACHINE              = "apalis-t30"
DISTRO               = "angstrom"
DISTRO_VERSION       = "v2017.12"
TUNE_FEATURES        = "arm armv7a vfp thumb neon callconvention-hard"
TARGET_FPU           = "hard"

(I did “Build a Reference Image with Yocto Project” )

Greetings @spshin!

I believe this depends on your module’s Makefile. I think that if multiple modules are built and installed by the Makefile, the same is going to be achieved on Yocto. The hello-mod recipe is the standard way to build out-of-tree modules so if your Makefile is somewhat “standard” it should already deploy any .ko files it builds.

my make file is below
obj-m := main.o device_file.o n6_common.o
n6_function.o n6_table.o n6_video.o
SRC := $(shell pwd)
$(info “pwd $(SRC)” )

$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install

rm -f *.o ~ core .depend ..cmd *.ko *.mod.c
rm -f Module.markers Module.symvers modules.order
rm -rf .tmp_versions Modules.symvers

how do I change this make file to one ko file?

please help me

Hi @spshin ,

As @gustavo.tx already mentioned, The hello-mod recipe is the standard way to build out-of-tree modules, if you follow correctly the example all .ko files will be deployed to your final image.

Here is another example that is based on the hello-mod recipe.

If with all these examples you can’t make the recipe work, please send us your files so we can analyze and check what may be causing this issue.

Best regards,

Daniel Morais