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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have a question regarding building of out-of-tree kernel modules in
separate build directory.

I have a source tree containing two out-of-tree kernel modules which is spread
in two directories, module1 and module2. The build produces two independent
modules: module1.ko and module2.ko.

$ tree --charset=ascii
.
|-- Kbuild
|-- module1
|   |-- Kbuild
|   `-- task1.c
`-- module2
    |-- Kbuild
    `-- task2.c

The root Kbuild points on sub-directories where the actual modules are located:

$ cat Kbuild
obj-y += module1/
obj-y += module2/

I want to use a dedicated build directory, so I could build the same set of
sources for different platforms (ARM and x86).

It looks like passing O= or KBUILD_OUTPUT= doesn't work for out of tree modules.
So, I've tried passing 'src' directory directly to the make command, but that
seems to cause a run-away recursion in the Kbuild:

make V=1 -C $(KDIR) M=`pwd`/build_x86 src=`pwd`

make: Entering directory '/home/lexa/linux_build'
make -C /home/lexa/linux O=/home/lexa/linux_build/.
make -C /home/lexa/linux_build KBUILD_SRC=/home/lexa/linux \
-f /home/lexa/linux/Makefile
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (		\
echo >&2;							\
echo >&2 "  ERROR: Kernel configuration is invalid.";		\
echo >&2 "         include/generated/autoconf.h or
include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src
to fix it.";	\
echo >&2 ;							\
/bin/false)
mkdir -p /home/lexa/module/build_arm/.tmp_versions ; rm -f
/home/lexa/module/build_arm/.tmp_versions/*
make -f /home/lexa/linux/scripts/Makefile.build obj=/home/lexa/module/build_arm
make -f /home/lexa/linux/scripts/Makefile.build
obj=/home/lexa/module/build_arm/module1
make -f /home/lexa/linux/scripts/Makefile.build
obj=/home/lexa/module/build_arm/module1/module1
make -f /home/lexa/linux/scripts/Makefile.build
obj=/home/lexa/module/build_arm/module1/module1/module1
make -f /home/lexa/linux/scripts/Makefile.build
obj=/home/lexa/module/build_arm/module1/module1/module1/module1
make -f /home/lexa/linux/scripts/Makefile.build
obj=/home/lexa/module/build_arm/module1/module1/module1/module1/module1
make -f /home/lexa/linux/scripts/Makefile.build
obj=/home/lexa/module/build_arm/module1/module1/module1/module1/module1/module1
make -f /home/lexa/linux/scripts/Makefile.build
obj=/home/lexa/module/build_arm/module1/module1/module1/module1/module1/module1/module1
make -f /home/lexa/linux/scripts/Makefile.build
obj=/home/lexa/module/build_arm/module1/module1/module1/module1/module1/module1/module1/module1
make -f /home/lexa/linux/scripts/Makefile.build
obj=/home/lexa/module/build_arm/module1/module1/module1/module1/module1/module1/module1/module1/module1
make -f /home/lexa/linux/scripts/Makefile.build
obj=/home/lexa/module/build_arm/module1/module1/module1/module1/module1/module1/module1/module1/module1/module1

... and this goes on ...

It looks like this happen because in 'src' from command line overrides the 'src'
assignment in scripts/Makefile.modbuiltin:5 and then it is not handled when
descending the source tree in scripts/Makefile.modbuiltin:53

I was wondering, what is the right way to build the module with separate build
directory?

-- 
Kind Regards,
Aleksei

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux