Quantcast
Channel: module makefile fails for armv7l when modules are compressed - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 2

module makefile fails for armv7l when modules are compressed

$
0
0

I have written a network hook using netfilter. This modules compiles successfully on my ubuntu 16.04.

Now I want to compile it in my embedded board which uses a customized Linux using same version of kernel in my laptop. The only problem is that all the modules in my embedded board are in .ko.xz format and my makefile fails and I don't know how to solve the problem.

My original makefile is:

obj-m += sysfirewall.o
all:
    make -C  /lib/modules/$(shell uname -r)/build -I/usr/Include/ M=$(PWD) modules
clean:
    make -C /lib/modules/$(shell uname -r)/build -I/usr/Include/ M=$(PWD) clean

But this failed because I couldn't find any build folder in my embedded Linux. Instead of build folder there was a kernel folder which I replace it with kernel.

Now my makefile is:

obj-m += sysfirewall.o
all:
    make -C  /lib/modules/$(shell uname -r)/kernel -I/usr/Include/ M=$(PWD) modules
clean:
    make -C /lib/modules/$(shell uname -r)/kernel -I/usr/Include/ M=$(PWD) clean

But when I run make in the current directory it gives the following error:

$ make -C  /lib/modules/4.14.49-ti-r54/kernel -I/usr/Include/ M=/home/parsa/firewall/ modules
make[1]: Entering directory '/lib/modules/4.14.49-ti-r54/kernel'
make[1]: *** No rule to make target 'modules'.  Stop.
make[1]: Leaving directory '/lib/modules/4.14.49-ti-r54/kernel'9-ti-r54/uname -i 
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 2

How can I solve this problem? Should I uncompress all the modules in my kernel? Does it really a matter of compressed Linux kernel modules or the error shows something else?

P.S: I don't want to cross-compile the module in my laptop.

Edited: I noticed there should be a Makefile in the "/lib/modules/$(shell uname -r)/kernel" folder which is not in my embedded board. I traced the Make file in "/lib/modules/$(shell uname -r)/build" folder in my laptop and realized it is a soft link to /usr/src/linux-headers-4.4.0-128/Makefile. but I don't have anything in my /usr/src in my embedded board. so I think I have to find a make file in order to compile this module and I don't know how !


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images