Out-of-tree module build in a dedicated build directory.

Aleksei Fedotov lexa at cfotr.com
Thu Mar 15 10:36:37 EDT 2018


>> I don't use Makefile in my module, I solely rely only on Kbuild files.
>> Is that wrong?
>
> Yes, you should have a simple Makefile to set all of the above up for
> you correctly.  You do not need any Kbuild files for an external module.
> Look at one of the many examples for how to do this properly, that's the
> issue here.
>

Thank you for pointing out. I've switched to using Makefile. The
Makefile in the root directory has following content:

obj-m += module1/
obj-m += module2/

all:
	$(MAKE) -C /home/lexa/linux M=$(PWD) O=$(PWD)/build_x86 modules


But the issue remain the same:
$ make
make -C /home/lexa/linux M=/home/lexa/module
O=/home/lexa/module/build_x86 modules
make[1]: Entering directory '/home/lexa/linux'
make[2]: Entering directory '/home/lexa/module/build_x86'

  WARNING: Symbol version dump ./Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /home/lexa/module/module1/task1.o
/bin/sh: 1: scripts/basic/fixdep: not found
/home/lexa/linux/scripts/Makefile.build:316: recipe for target
'/home/lexa/module/module1/task1.o' failed
make[4]: *** [/home/lexa/module/module1/task1.o] Error 127
/home/lexa/linux/scripts/Makefile.build:575: recipe for target
'/home/lexa/module/module1' failed
make[3]: *** [/home/lexa/module/module1] Error 2
/home/lexa/linux/Makefile:1509: recipe for target
'_module_/home/lexa/module' failed
make[2]: *** [_module_/home/lexa/module] Error 2
make[2]: Leaving directory '/home/lexa/module/build_x86'
Makefile:146: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '/home/lexa/linux'
Makefile:5: recipe for target 'all' failed
make: *** [all] Error 2


In case of external module build O= specifies a path to the kernel
build directory or the directory where I want the modules to be built?

-- 
Kind Regards,
Aleksei



More information about the Kernelnewbies mailing list