cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to make kernel module programming compilation error

asadullah4571
Associate III

I am trying to build kernel module programme out-of-tree module with the help of ST WIKI document. But unfortunately we are facing the compilation error where while do_installation work. It says mymodule.ko "NO such file or directory".
Note : I am using DEVTOOL. And i attached the link which i used to build our kernel module programme.
https://wiki.st.com/stm32mpu/wiki/How_to_cross-compile_with_the_Distribution_Package#Adding_an_external_out-of-tree_Linux_kernel_module


2 REPLIES 2
Pwxn
ST Employee

Hello @asadullah4571 

Can you check if your file is in the same directory you are pointing in your recipe ? 

do_install () {
	# NOTE: unable to determine what to put here - there is a Makefile but no
	# target named "install", so you will need to define this yourself
    install -d ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}
    install -m 0755 ${B}/kernel_module_example.ko ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}
}

 

Regards,

do_install () {
# NOTE: unable to determine what to put here - there is a Makefile but no
# target named "install", so you will need to define this yourself
install -d ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}
install -m 0755 ${B}/kernel_module_example.ko ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}
}


same as like wiki.

I think it will causing the error on Make file

obj-m := kernel_module_example.o
 
all:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules
 
clean:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
I used this make file and i got the .ko file on the same directory, later I make my own custom recipes and it works well