* Out-of-tree module build in a dedicated build directory.
@ 2018-03-15 12:14 Aleksei Fedotov
2018-03-15 13:00 ` Greg KH
0 siblings, 1 reply; 12+ messages in thread
From: Aleksei Fedotov @ 2018-03-15 12:14 UTC (permalink / raw)
To: kernelnewbies
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Out-of-tree module build in a dedicated build directory.
2018-03-15 12:14 Out-of-tree module build in a dedicated build directory Aleksei Fedotov
@ 2018-03-15 13:00 ` Greg KH
2018-03-15 13:33 ` Aleksei Fedotov
0 siblings, 1 reply; 12+ messages in thread
From: Greg KH @ 2018-03-15 13:00 UTC (permalink / raw)
To: kernelnewbies
On Thu, Mar 15, 2018 at 01:14:57PM +0100, Aleksei Fedotov wrote:
> 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.
It doesn't? It should, what is the result when you try to do that?
And do you have a pointer to your Makefile, perhaps you are doing
something "wrong" in it?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* Out-of-tree module build in a dedicated build directory.
2018-03-15 13:00 ` Greg KH
@ 2018-03-15 13:33 ` Aleksei Fedotov
2018-03-15 13:36 ` Denis Kirjanov
2018-03-15 14:01 ` Greg KH
0 siblings, 2 replies; 12+ messages in thread
From: Aleksei Fedotov @ 2018-03-15 13:33 UTC (permalink / raw)
To: kernelnewbies
>> It looks like passing O= or KBUILD_OUTPUT= doesn't work for out of tree modules.
> It doesn't? It should, what is the result when you try to do that?
It is trying to use path specified in O= as path to the pre-build
kernel and fails to find kernel scripts:
$ make V=1 -C $(KDIR) M=`pwd` O=`pwd`/build_x86
make: Entering directory '/home/lexa/linux'
make -C /home/lexa/module/build_x86 KBUILD_SRC=/home/lexa/linux \
-f /home/lexa/linux/Makefile
make[1]: Entering directory '/home/lexa/module/build_x86'
mkdir -p /home/lexa/module/.tmp_versions ; rm -f
/home/lexa/module/.tmp_versions/*
WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.
make -f /home/lexa/linux/scripts/Makefile.build obj=/home/lexa/module
make -f /home/lexa/linux/scripts/Makefile.build
obj=/home/lexa/module/module1 need-builtin=1
rm -f /home/lexa/module/module1/built-in.o; ar rcSTPD
/home/lexa/module/module1/built-in.o
gcc -Wp,-MD,/home/lexa/module/module1/.task1.o.d -nostdinc -isystem
/usr/lib/gcc/x86_64-linux-gnu/5/include
-I/home/lexa/linux/arch/x86/include -I./arch/x86/include/generated
-I/home/lexa/linux/include -I./include
-I/home/lexa/linux/arch/x86/include/uapi
-I./arch/x86/include/generated/uapi -I/home/lexa/linux/include/uapi
-I./include/generated/uapi -include
/home/lexa/linux/include/linux/kconfig.h -I/home/lexa/module/module1
-I/home/lexa/module/module1 -D__KERNEL__ -Wall -Wundef
-Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
-fshort-wchar -Werror-implicit-function-declaration
-Wno-format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2
-mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387
-mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup
-mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time
-DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1
-DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1
-DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1
-DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1
-pipe -Wno-sign-compare -fno-asynchronous-unwind-tables
-mindirect-branch=thunk-extern -mindirect-branch-register -DRETPOLINE
-fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0
-DCC_HAVE_ASM_GOTO -Wframe-larger-than=1024 -fstack-protector-strong
-Wno-unused-but-set-variable -fno-var-tracking-assignments -g
-gdwarf-4 -pg -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement
-Wno-pointer-sign -fno-strict-overflow -fno-stack-check
-fconserve-stack -Werror=implicit-int -Werror=strict-prototypes
-Werror=date-time -Werror=incompatible-pointer-types
-Werror=designated-init -DMODULE -DKBUILD_BASENAME='"task1"'
-DKBUILD_MODNAME='"mod1"' -c -o /home/lexa/module/module1/.tmp_task1.o
/home/lexa/module/module1/task1.c
/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[3]: *** [/home/lexa/module/module1/task1.o] Error 127
/home/lexa/linux/scripts/Makefile.build:575: recipe for target
'/home/lexa/module/module1' failed
make[2]: *** [/home/lexa/module/module1] Error 2
/home/lexa/linux/Makefile:1509: recipe for target
'_module_/home/lexa/module' failed
make[1]: *** [_module_/home/lexa/module] Error 2
make[1]: Leaving directory '/home/lexa/module/build_x86'
Makefile:146: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
make: Leaving directory '/home/lexa/linux'
> And do you have a pointer to your Makefile, perhaps you are doing
> something "wrong" in it?
I don't use Makefile in my module, I solely rely only on Kbuild files.
Is that wrong?
--
Kind Regards,
Aleksei
^ permalink raw reply [flat|nested] 12+ messages in thread
* Out-of-tree module build in a dedicated build directory.
2018-03-15 13:33 ` Aleksei Fedotov
@ 2018-03-15 13:36 ` Denis Kirjanov
2018-03-15 14:01 ` Greg KH
1 sibling, 0 replies; 12+ messages in thread
From: Denis Kirjanov @ 2018-03-15 13:36 UTC (permalink / raw)
To: kernelnewbies
On 3/15/18, Aleksei Fedotov <lexa@cfotr.com> wrote:
>>> It looks like passing O= or KBUILD_OUTPUT= doesn't work for out of tree
>>> modules.
>
>> It doesn't? It should, what is the result when you try to do that?
>
> It is trying to use path specified in O= as path to the pre-build
> kernel and fails to find kernel scripts:
>
> $ make V=1 -C $(KDIR) M=`pwd` O=`pwd`/build_x86
> make: Entering directory '/home/lexa/linux'
> make -C /home/lexa/module/build_x86 KBUILD_SRC=/home/lexa/linux \
> -f /home/lexa/linux/Makefile
> make[1]: Entering directory '/home/lexa/module/build_x86'
> mkdir -p /home/lexa/module/.tmp_versions ; rm -f
> /home/lexa/module/.tmp_versions/*
>
> WARNING: Symbol version dump ./Module.symvers
> is missing; modules will have no dependencies and modversions.
>
> make -f /home/lexa/linux/scripts/Makefile.build obj=/home/lexa/module
> make -f /home/lexa/linux/scripts/Makefile.build
> obj=/home/lexa/module/module1 need-builtin=1
> rm -f /home/lexa/module/module1/built-in.o; ar rcSTPD
> /home/lexa/module/module1/built-in.o
> gcc -Wp,-MD,/home/lexa/module/module1/.task1.o.d -nostdinc -isystem
> /usr/lib/gcc/x86_64-linux-gnu/5/include
> -I/home/lexa/linux/arch/x86/include -I./arch/x86/include/generated
> -I/home/lexa/linux/include -I./include
> -I/home/lexa/linux/arch/x86/include/uapi
> -I./arch/x86/include/generated/uapi -I/home/lexa/linux/include/uapi
> -I./include/generated/uapi -include
> /home/lexa/linux/include/linux/kconfig.h -I/home/lexa/module/module1
> -I/home/lexa/module/module1 -D__KERNEL__ -Wall -Wundef
> -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
> -fshort-wchar -Werror-implicit-function-declaration
> -Wno-format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2
> -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387
> -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup
> -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time
> -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1
> -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1
> -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1
> -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1
> -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables
> -mindirect-branch=thunk-extern -mindirect-branch-register -DRETPOLINE
> -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0
> -DCC_HAVE_ASM_GOTO -Wframe-larger-than=1024 -fstack-protector-strong
> -Wno-unused-but-set-variable -fno-var-tracking-assignments -g
> -gdwarf-4 -pg -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement
> -Wno-pointer-sign -fno-strict-overflow -fno-stack-check
> -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes
> -Werror=date-time -Werror=incompatible-pointer-types
> -Werror=designated-init -DMODULE -DKBUILD_BASENAME='"task1"'
> -DKBUILD_MODNAME='"mod1"' -c -o /home/lexa/module/module1/.tmp_task1.o
> /home/lexa/module/module1/task1.c
> /bin/sh: 1: scripts/basic/fixdep: not found
make oldconfig?
> /home/lexa/linux/scripts/Makefile.build:316: recipe for target
> '/home/lexa/module/module1/task1.o' failed
> make[3]: *** [/home/lexa/module/module1/task1.o] Error 127
> /home/lexa/linux/scripts/Makefile.build:575: recipe for target
> '/home/lexa/module/module1' failed
> make[2]: *** [/home/lexa/module/module1] Error 2
> /home/lexa/linux/Makefile:1509: recipe for target
> '_module_/home/lexa/module' failed
> make[1]: *** [_module_/home/lexa/module] Error 2
> make[1]: Leaving directory '/home/lexa/module/build_x86'
> Makefile:146: recipe for target 'sub-make' failed
> make: *** [sub-make] Error 2
> make: Leaving directory '/home/lexa/linux'
>
>
>
>> And do you have a pointer to your Makefile, perhaps you are doing
>> something "wrong" in it?
>
> I don't use Makefile in my module, I solely rely only on Kbuild files.
> Is that wrong?
>
> --
> Kind Regards,
> Aleksei
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
Regards / Mit besten Gr??en,
Denis
^ permalink raw reply [flat|nested] 12+ messages in thread
* Out-of-tree module build in a dedicated build directory.
2018-03-15 13:33 ` Aleksei Fedotov
2018-03-15 13:36 ` Denis Kirjanov
@ 2018-03-15 14:01 ` Greg KH
2018-03-15 14:36 ` Aleksei Fedotov
1 sibling, 1 reply; 12+ messages in thread
From: Greg KH @ 2018-03-15 14:01 UTC (permalink / raw)
To: kernelnewbies
On Thu, Mar 15, 2018 at 02:33:31PM +0100, Aleksei Fedotov wrote:
> >> It looks like passing O= or KBUILD_OUTPUT= doesn't work for out of tree modules.
>
> > It doesn't? It should, what is the result when you try to do that?
>
> It is trying to use path specified in O= as path to the pre-build
> kernel and fails to find kernel scripts:
>
> $ make V=1 -C $(KDIR) M=`pwd` O=`pwd`/build_x86
> make: Entering directory '/home/lexa/linux'
> make -C /home/lexa/module/build_x86 KBUILD_SRC=/home/lexa/linux \
> -f /home/lexa/linux/Makefile
> make[1]: Entering directory '/home/lexa/module/build_x86'
> mkdir -p /home/lexa/module/.tmp_versions ; rm -f
> /home/lexa/module/.tmp_versions/*
>
> WARNING: Symbol version dump ./Module.symvers
> is missing; modules will have no dependencies and modversions.
>
> make -f /home/lexa/linux/scripts/Makefile.build obj=/home/lexa/module
> make -f /home/lexa/linux/scripts/Makefile.build
> obj=/home/lexa/module/module1 need-builtin=1
> rm -f /home/lexa/module/module1/built-in.o; ar rcSTPD
> /home/lexa/module/module1/built-in.o
> gcc -Wp,-MD,/home/lexa/module/module1/.task1.o.d -nostdinc -isystem
> /usr/lib/gcc/x86_64-linux-gnu/5/include
> -I/home/lexa/linux/arch/x86/include -I./arch/x86/include/generated
> -I/home/lexa/linux/include -I./include
> -I/home/lexa/linux/arch/x86/include/uapi
> -I./arch/x86/include/generated/uapi -I/home/lexa/linux/include/uapi
> -I./include/generated/uapi -include
> /home/lexa/linux/include/linux/kconfig.h -I/home/lexa/module/module1
> -I/home/lexa/module/module1 -D__KERNEL__ -Wall -Wundef
> -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
> -fshort-wchar -Werror-implicit-function-declaration
> -Wno-format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2
> -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387
> -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup
> -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time
> -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1
> -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1
> -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1
> -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1
> -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables
> -mindirect-branch=thunk-extern -mindirect-branch-register -DRETPOLINE
> -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0
> -DCC_HAVE_ASM_GOTO -Wframe-larger-than=1024 -fstack-protector-strong
> -Wno-unused-but-set-variable -fno-var-tracking-assignments -g
> -gdwarf-4 -pg -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement
> -Wno-pointer-sign -fno-strict-overflow -fno-stack-check
> -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes
> -Werror=date-time -Werror=incompatible-pointer-types
> -Werror=designated-init -DMODULE -DKBUILD_BASENAME='"task1"'
> -DKBUILD_MODNAME='"mod1"' -c -o /home/lexa/module/module1/.tmp_task1.o
> /home/lexa/module/module1/task1.c
> /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
That's the error.
> make[3]: *** [/home/lexa/module/module1/task1.o] Error 127
> /home/lexa/linux/scripts/Makefile.build:575: recipe for target
> '/home/lexa/module/module1' failed
> make[2]: *** [/home/lexa/module/module1] Error 2
> /home/lexa/linux/Makefile:1509: recipe for target
> '_module_/home/lexa/module' failed
> make[1]: *** [_module_/home/lexa/module] Error 2
> make[1]: Leaving directory '/home/lexa/module/build_x86'
> Makefile:146: recipe for target 'sub-make' failed
> make: *** [sub-make] Error 2
> make: Leaving directory '/home/lexa/linux'
>
>
>
> > And do you have a pointer to your Makefile, perhaps you are doing
> > something "wrong" in it?
>
> 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.
good luck!
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* Out-of-tree module build in a dedicated build directory.
2018-03-15 14:01 ` Greg KH
@ 2018-03-15 14:36 ` Aleksei Fedotov
2018-03-15 14:52 ` Aruna Hewapathirane
0 siblings, 1 reply; 12+ messages in thread
From: Aleksei Fedotov @ 2018-03-15 14:36 UTC (permalink / raw)
To: kernelnewbies
>> 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Out-of-tree module build in a dedicated build directory.
2018-03-15 14:36 ` Aleksei Fedotov
@ 2018-03-15 14:52 ` Aruna Hewapathirane
2018-03-15 15:27 ` Aruna Hewapathirane
0 siblings, 1 reply; 12+ messages in thread
From: Aruna Hewapathirane @ 2018-03-15 14:52 UTC (permalink / raw)
To: kernelnewbies
<snip>
>
> 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.
>
<snip>
Please run make modules from the top level directory of your source tree
and and then module.symvers will be generated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180315/5957913d/attachment-0001.html>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Out-of-tree module build in a dedicated build directory.
2018-03-15 14:52 ` Aruna Hewapathirane
@ 2018-03-15 15:27 ` Aruna Hewapathirane
2018-03-15 16:26 ` Greg KH
0 siblings, 1 reply; 12+ messages in thread
From: Aruna Hewapathirane @ 2018-03-15 15:27 UTC (permalink / raw)
To: kernelnewbies
On Thu, Mar 15, 2018 at 10:52 AM, Aruna Hewapathirane <
aruna.hewapathirane@gmail.com> wrote:
> <snip>
>
>>
>> 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.
>>
> <snip>
>
> Please run make modules from the top level directory of your source tree
> and and then module.symvers will be generated.
>
>
If for some reason make modules did not create module.symvers then try:
cd /home/lexa/linux
make
[wait a few minutes as it builds some scripts and starts building
kernel code...]
hit <Ctrl-C>
then go back and try building your module.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180315/df533c4c/attachment.html>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Out-of-tree module build in a dedicated build directory.
2018-03-15 15:27 ` Aruna Hewapathirane
@ 2018-03-15 16:26 ` Greg KH
2018-03-15 16:39 ` Aleksei Fedotov
0 siblings, 1 reply; 12+ messages in thread
From: Greg KH @ 2018-03-15 16:26 UTC (permalink / raw)
To: kernelnewbies
On Thu, Mar 15, 2018 at 11:27:05AM -0400, Aruna Hewapathirane wrote:
> On Thu, Mar 15, 2018 at 10:52 AM, Aruna Hewapathirane <
> aruna.hewapathirane at gmail.com> wrote:
>
> > <snip>
> >
> >>
> >> 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.
> >>
> > <snip>
> >
> > Please run make modules from the top level directory of your source tree
> > and and then module.symvers will be generated.
> >
> >
> If for some reason make modules did not create module.symvers then try:
>
> cd /home/lexa/linux
> make
> [wait a few minutes as it builds some scripts and starts building
> kernel code...]
> hit <Ctrl-C>
>
> then go back and try building your module.
'make modules_prepare' should do the same thing.
'make help' shows all of this, but who ever reads documentation :)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Out-of-tree module build in a dedicated build directory.
2018-03-15 16:26 ` Greg KH
@ 2018-03-15 16:39 ` Aleksei Fedotov
2018-03-15 17:14 ` Greg KH
2018-03-15 18:58 ` Aruna Hewapathirane
0 siblings, 2 replies; 12+ messages in thread
From: Aleksei Fedotov @ 2018-03-15 16:39 UTC (permalink / raw)
To: kernelnewbies
> If for some reason make modules did not create module.symvers then try:
>
> cd /home/lexa/linux
> make
> [wait a few minutes as it builds some scripts and starts building kernel code...]
> hit <Ctrl-C>
>
> then go back and try building your module.
But i have my kernel completely build, including kernel modules.
I get the error about ./Module.symvers only if I specify
O=module_build_directory. When I build the module without O= there is
not such error, but the object files are created in the same directory
as module source, which I want to avoid.
On 3/15/18, Greg KH <greg@kroah.com> wrote:
> On Thu, Mar 15, 2018 at 11:27:05AM -0400, Aruna Hewapathirane wrote:
>> On Thu, Mar 15, 2018 at 10:52 AM, Aruna Hewapathirane <
>> aruna.hewapathirane at gmail.com> wrote:
>>
>> > <snip>
>> >
>> >>
>> >> 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.
>> >>
>> > <snip>
>> >
>> > Please run make modules from the top level directory of your source
>> > tree
>> > and and then module.symvers will be generated.
>> >
>> >
>> If for some reason make modules did not create module.symvers then try:
>>
>> cd /home/lexa/linux
>> make
>> [wait a few minutes as it builds some scripts and starts building
>> kernel code...]
>> hit <Ctrl-C>
>>
>> then go back and try building your module.
>
> 'make modules_prepare' should do the same thing.
>
> 'make help' shows all of this, but who ever reads documentation :)
>
--
Kind Regards,
Aleksei
^ permalink raw reply [flat|nested] 12+ messages in thread
* Out-of-tree module build in a dedicated build directory.
2018-03-15 16:39 ` Aleksei Fedotov
@ 2018-03-15 17:14 ` Greg KH
2018-03-15 18:58 ` Aruna Hewapathirane
1 sibling, 0 replies; 12+ messages in thread
From: Greg KH @ 2018-03-15 17:14 UTC (permalink / raw)
To: kernelnewbies
On Thu, Mar 15, 2018 at 05:39:36PM +0100, Aleksei Fedotov wrote:
> > If for some reason make modules did not create module.symvers then try:
> >
> > cd /home/lexa/linux
> > make
> > [wait a few minutes as it builds some scripts and starts building kernel code...]
> > hit <Ctrl-C>
> >
> > then go back and try building your module.
>
> But i have my kernel completely build, including kernel modules.
>
> I get the error about ./Module.symvers only if I specify
> O=module_build_directory. When I build the module without O= there is
> not such error, but the object files are created in the same directory
> as module source, which I want to avoid.
You have to do 'make module_prepare' with your 'O=' set correctly as
well, otherwise how will the build system know where to look for the
object files to link/build against?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* Out-of-tree module build in a dedicated build directory.
2018-03-15 16:39 ` Aleksei Fedotov
2018-03-15 17:14 ` Greg KH
@ 2018-03-15 18:58 ` Aruna Hewapathirane
1 sibling, 0 replies; 12+ messages in thread
From: Aruna Hewapathirane @ 2018-03-15 18:58 UTC (permalink / raw)
To: kernelnewbies
On Thu, Mar 15, 2018 at 12:39 PM, Aleksei Fedotov <lexa@cfotr.com> wrote:
> > If for some reason make modules did not create module.symvers then try:
> >
> > cd /home/lexa/linux
> > make
> > [wait a few minutes as it builds some scripts and starts
> building kernel code...]
> > hit <Ctrl-C>
> >
> > then go back and try building your module.
>
> But i have my kernel completely build, including kernel modules.
>
> I get the error about ./Module.symvers only if I specify
> O=module_build_directory. When I build the module without O= there is
> not such error, but the object files are created in the same directory
> as module source, which I want to avoid.
>
This will help:
https://www.kernel.org/doc/Documentation/kbuild/modules.txt
In section 2. of the above link on "How to Build External Modules" it
specifically mentions that:
NOTE: "modules_prepare" will not build Module.symvers even if
CONFIG_MODVERSIONS is set; therefore, a full kernel build needs to be
executed to make module versioning work.
This is the *reason* I asked you to run make to trigger a full kernel build
and press Ctrl+C because no one wants to hang around until it completes.
Especially if one is on a Pentium 3 like I used to be with my first kernel
compile which took over 6 hours.
And pay very careful attention to what is below, read ten times if u must
but 'understand' what that is saying :-) took me more than ten times before
I understood..
6.2 Symbols and External Modules
When building an external module, the build system needs access
to the symbols from the kernel to check if all external symbols
are defined. This is done in the MODPOST step. modpost obtains
the symbols by reading Module.symvers from the kernel source
tree. If a Module.symvers file is present in the directory
where the external module is being built, this file will be
read too. During the MODPOST step, a new Module.symvers file
will be written containing all exported symbols that were not
defined in the kernel.
So that is why Gregkh said run make modules_prepare ( which yet needs
a full compile )
Hope this helps - Aruna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180315/14362cbe/attachment.html>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2018-03-15 18:58 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-15 12:14 Out-of-tree module build in a dedicated build directory Aleksei Fedotov
2018-03-15 13:00 ` Greg KH
2018-03-15 13:33 ` Aleksei Fedotov
2018-03-15 13:36 ` Denis Kirjanov
2018-03-15 14:01 ` Greg KH
2018-03-15 14:36 ` Aleksei Fedotov
2018-03-15 14:52 ` Aruna Hewapathirane
2018-03-15 15:27 ` Aruna Hewapathirane
2018-03-15 16:26 ` Greg KH
2018-03-15 16:39 ` Aleksei Fedotov
2018-03-15 17:14 ` Greg KH
2018-03-15 18:58 ` Aruna Hewapathirane
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.