[Error] Kernel configuration is invalid for out-of-tree module.


Yusuf <yusufalti1997@...>
 

I am trying to build a specific driver with an out-of-tree module. I created my own meta layer. But it did not work. Can anyone help me ?.

I declared module init module exit functions inside driver module (sample.c) and I prepared a Makefile according to yocto project Out-Of-Tree modules section. I added this folder to bblayers.conf file under build directory.

This is the file structure.

/my_meta_layer
|_ conf
    |__layer.conf
|_recipes-kernel
   |_files
       |_Makefile
       |_sample.c
       |_COPYING

and this is the error I got:
|   ERROR: Kernel configuration is invalid.
|          include/generated/autoconf.h or include/config/auto.conf are missing.
|          Run 'make oldconfig && make prepare' on kernel src to fix it.
|
| make[2]: *** [include/config/auto.conf] Error 1
| make[2]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-build-artifacts'
| make[1]: *** [sub-make] Error 2
| make[1]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-source'
| make: *** [all] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work/t1042d4rdb_64b-fsl-linux/kernel-module-sample/1.0-r0/temp/log.do_compile.1133)
ERROR: Task (/home/hwlab/Desktop/Yocto2.7/sources/meta-yusuf/recipes-kernel/sample/kernel-module-sample.bb:do_compile) failed with exit code '1'

.bb file is like this:

SUMMARY = "Example of how to build an external Linux kernel module"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e"
inherit module
PR = "r0"
SRC_URI = "file://Makefile \
file://sample.c \
file://COPYING \
"
S = "${WORKDIR}"
RPROVIDES_${PN} += "kernel-module-sample"



Andrey Zhizhikin
 

On Wed, Dec 25, 2019 at 12:03 PM Yusuf <yusufalti1997@...> wrote:

I am trying to build a specific driver with an out-of-tree module. I created my own meta layer. But it did not work. Can anyone help me ?.

I declared module init module exit functions inside driver module (sample.c) and I prepared a Makefile according to yocto project Out-Of-Tree modules section. I added this folder to bblayers.conf file under build directory.

This is the file structure.

/my_meta_layer
|_ conf
|__layer.conf
|_recipes-kernel
|_kernel-module.sample.bb
|_files
|_Makefile
|_sample.c
|_COPYING
Have a look at meta-skeleton/recipes-kernel/hello-mod - this is the
one I would use to start with OOT module dev. I just tried to take
this into may custom layer - and it builds totally fine.

Please take a note how the recipe and source files are located inside
that sample - you're doing it one level above, which is not a correct
way.


and this is the error I got:
| ERROR: Kernel configuration is invalid.
| include/generated/autoconf.h or include/config/auto.conf are missing.
| Run 'make oldconfig && make prepare' on kernel src to fix it.
|
| make[2]: *** [include/config/auto.conf] Error 1
| make[2]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-build-artifacts'
| make[1]: *** [sub-make] Error 2
| make[1]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-source'
| make: *** [all] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work/t1042d4rdb_64b-fsl-linux/kernel-module-sample/1.0-r0/temp/log.do_compile.1133)
ERROR: Task (/home/hwlab/Desktop/Yocto2.7/sources/meta-yusuf/recipes-kernel/sample/kernel-module-sample.bb:do_compile) failed with exit code '1'
There might be something wrong with you Makefile, which you didn't
disclose. Have it compared to the one provided in
meta-skeleton/recipes-kernel/hello-mod

.bb file is like this:

SUMMARY = "Example of how to build an external Linux kernel module"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e"
inherit module
PR = "r0"
SRC_URI = "file://Makefile \
file://sample.c \
file://COPYING \
"
S = "${WORKDIR}"
RPROVIDES_${PN} += "kernel-module-sample"


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#24197): https://lists.yoctoproject.org/g/meta-freescale/message/24197
Mute This Topic: https://lists.yoctoproject.org/mt/69260385/3617192
Group Owner: meta-freescale+owner@...
Unsubscribe: https://lists.yoctoproject.org/g/meta-freescale/unsub [andrey.z@...]
-=-=-=-=-=-=-=-=-=-=-=-
--
Regards,
Andrey.


Yusuf <yusufalti1997@...>
 

Andrey Zhizhikin <andrey.z@...>, 25 Ara 2019 Çar, 14:47 tarihinde şunu yazdı:
On Wed, Dec 25, 2019 at 12:03 PM Yusuf <yusufalti1997@...> wrote:
>
> I am trying to build a specific driver with an out-of-tree module. I created my own meta layer. But it did not work. Can anyone help me ?.
>
> I declared module init module exit functions inside driver module (sample.c) and I prepared a Makefile according to yocto project Out-Of-Tree modules section. I added this folder to bblayers.conf file under build directory.
>
> This is the file structure.
>
> /my_meta_layer
> |_ conf
>     |__layer.conf
> |_recipes-kernel
>    |_kernel-module.sample.bb
>    |_files
>        |_Makefile
>        |_sample.c
>        |_COPYING

Have a look at meta-skeleton/recipes-kernel/hello-mod - this is the
one I would use to start with OOT module dev. I just tried to take
this into may custom layer - and it builds totally fine.

Please take a note how the recipe and source files are located inside
that sample - you're doing it one level above, which is not a correct
way.

>
> and this is the error I got:
> |   ERROR: Kernel configuration is invalid.
> |          include/generated/autoconf.h or include/config/auto.conf are missing.
> |          Run 'make oldconfig && make prepare' on kernel src to fix it.
> |
> | make[2]: *** [include/config/auto.conf] Error 1
> | make[2]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-build-artifacts'
> | make[1]: *** [sub-make] Error 2
> | make[1]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-source'
> | make: *** [all] Error 2
> | ERROR: oe_runmake failed
> | WARNING: exit code 1 from a shell command.
> | ERROR: Function failed: do_compile (log file is located at /home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work/t1042d4rdb_64b-fsl-linux/kernel-module-sample/1.0-r0/temp/log.do_compile.1133)
> ERROR: Task (/home/hwlab/Desktop/Yocto2.7/sources/meta-yusuf/recipes-kernel/sample/kernel-module-sample.bb:do_compile) failed with exit code '1'
>

There might be something wrong with you Makefile, which you didn't
disclose. Have it compared to the one provided in
meta-skeleton/recipes-kernel/hello-mod

Hello Mr. Andrey,

I compared my module with hello-mod.They are not differ much. I worked with one level below this time. I also tried hello-mod itself. It gave me same result. include/generated/autoconf.h or include/config/auto.conf are also exists. I checked them.

This is the result of hello-mod:

|
|   ERROR: Kernel configuration is invalid.
|          include/generated/autoconf.h or include/config/auto.conf are missing.
|          Run 'make oldconfig && make prepare' on kernel src to fix it.
|
| make[2]: *** [include/config/auto.conf] Error 1
| make[2]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-build-artifacts'
| make[1]: *** [sub-make] Error 2
| make[1]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-source'
| make: *** [all] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work/t1042d4rdb_64b-fsl-linux/hello-mod/0.1-r0/temp/log.do_compile.21458)
ERROR: Task (/home/hwlab/Desktop/Yocto2.7/sources/meta-yusuf/recipes-kernel/hello-mod/hello-mod_0.1.bb:do_compile) failed with exit code '1'

Regards.


Andrey Zhizhikin
 

Hello Yusuf,

On Wed, Dec 25, 2019 at 1:57 PM Yusuf Altıparmak
<yusufalti1997@...> wrote:

Andrey Zhizhikin <andrey.z@...>, 25 Ara 2019 Çar, 14:47 tarihinde şunu yazdı:

On Wed, Dec 25, 2019 at 12:03 PM Yusuf <yusufalti1997@...> wrote:

I am trying to build a specific driver with an out-of-tree module. I created my own meta layer. But it did not work. Can anyone help me ?.

I declared module init module exit functions inside driver module (sample.c) and I prepared a Makefile according to yocto project Out-Of-Tree modules section. I added this folder to bblayers.conf file under build directory.

This is the file structure.

/my_meta_layer
|_ conf
|__layer.conf
|_recipes-kernel
|_kernel-module.sample.bb
|_files
|_Makefile
|_sample.c
|_COPYING
Have a look at meta-skeleton/recipes-kernel/hello-mod - this is the
one I would use to start with OOT module dev. I just tried to take
this into may custom layer - and it builds totally fine.

Please take a note how the recipe and source files are located inside
that sample - you're doing it one level above, which is not a correct
way.


and this is the error I got:
| ERROR: Kernel configuration is invalid.
| include/generated/autoconf.h or include/config/auto.conf are missing.
| Run 'make oldconfig && make prepare' on kernel src to fix it.
|
| make[2]: *** [include/config/auto.conf] Error 1
| make[2]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-build-artifacts'
| make[1]: *** [sub-make] Error 2
| make[1]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-source'
| make: *** [all] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work/t1042d4rdb_64b-fsl-linux/kernel-module-sample/1.0-r0/temp/log.do_compile.1133)
ERROR: Task (/home/hwlab/Desktop/Yocto2.7/sources/meta-yusuf/recipes-kernel/sample/kernel-module-sample.bb:do_compile) failed with exit code '1'
There might be something wrong with you Makefile, which you didn't
disclose. Have it compared to the one provided in
meta-skeleton/recipes-kernel/hello-mod

Hello Mr. Andrey,

I compared my module with hello-mod.They are not differ much. I worked with one level below this time. I also tried hello-mod itself. It gave me same result. include/generated/autoconf.h or include/config/auto.conf are also exists. I checked them.
Hmm, this is indeed quite strange... I've never had this issue before
with any Yocto build (including the Freescale one)...

There are few things to try and clarify further here:
1. Did you try to build the kernel recipe itself?
2. Which machine you're using in your build setup?
3. Is the kernel source populated (in your build folder under work-shared)?


This is the result of hello-mod:

|
| ERROR: Kernel configuration is invalid.
| include/generated/autoconf.h or include/config/auto.conf are missing.
| Run 'make oldconfig && make prepare' on kernel src to fix it.
|
| make[2]: *** [include/config/auto.conf] Error 1
| make[2]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-build-artifacts'
| make[1]: *** [sub-make] Error 2
| make[1]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-source'
| make: *** [all] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work/t1042d4rdb_64b-fsl-linux/hello-mod/0.1-r0/temp/log.do_compile.21458)
ERROR: Task (/home/hwlab/Desktop/Yocto2.7/sources/meta-yusuf/recipes-kernel/hello-mod/hello-mod_0.1.bb:do_compile) failed with exit code '1'

Regards.
--
Regards,
Andrey.


Yusuf <yusufalti1997@...>
 



Andrey Zhizhikin <andrey.z@...>, 25 Ara 2019 Çar, 22:58 tarihinde şunu yazdı:
Hello Yusuf,

On Wed, Dec 25, 2019 at 1:57 PM Yusuf Altıparmak
<yusufalti1997@...> wrote:
>
> Andrey Zhizhikin <andrey.z@...>, 25 Ara 2019 Çar, 14:47 tarihinde şunu yazdı:
>>
>> On Wed, Dec 25, 2019 at 12:03 PM Yusuf <yusufalti1997@...> wrote:
>> >
>> > I am trying to build a specific driver with an out-of-tree module. I created my own meta layer. But it did not work. Can anyone help me ?.
>> >
>> > I declared module init module exit functions inside driver module (sample.c) and I prepared a Makefile according to yocto project Out-Of-Tree modules section. I added this folder to bblayers.conf file under build directory.
>> >
>> > This is the file structure.
>> >
>> > /my_meta_layer
>> > |_ conf
>> >     |__layer.conf
>> > |_recipes-kernel
>> >    |_kernel-module.sample.bb
>> >    |_files
>> >        |_Makefile
>> >        |_sample.c
>> >        |_COPYING
>>
>> Have a look at meta-skeleton/recipes-kernel/hello-mod - this is the
>> one I would use to start with OOT module dev. I just tried to take
>> this into may custom layer - and it builds totally fine.
>>
>> Please take a note how the recipe and source files are located inside
>> that sample - you're doing it one level above, which is not a correct
>> way.
>>
>> >
>> > and this is the error I got:
>> > |   ERROR: Kernel configuration is invalid.
>> > |          include/generated/autoconf.h or include/config/auto.conf are missing.
>> > |          Run 'make oldconfig && make prepare' on kernel src to fix it.
>> > |
>> > | make[2]: *** [include/config/auto.conf] Error 1
>> > | make[2]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-build-artifacts'
>> > | make[1]: *** [sub-make] Error 2
>> > | make[1]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-source'
>> > | make: *** [all] Error 2
>> > | ERROR: oe_runmake failed
>> > | WARNING: exit code 1 from a shell command.
>> > | ERROR: Function failed: do_compile (log file is located at /home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work/t1042d4rdb_64b-fsl-linux/kernel-module-sample/1.0-r0/temp/log.do_compile.1133)
>> > ERROR: Task (/home/hwlab/Desktop/Yocto2.7/sources/meta-yusuf/recipes-kernel/sample/kernel-module-sample.bb:do_compile) failed with exit code '1'
>> >
>>
>> There might be something wrong with you Makefile, which you didn't
>> disclose. Have it compared to the one provided in
>> meta-skeleton/recipes-kernel/hello-mod
>
>
> Hello Mr. Andrey,
>
> I compared my module with hello-mod.They are not differ much. I worked with one level below this time. I also tried hello-mod itself. It gave me same result. include/generated/autoconf.h or include/config/auto.conf are also exists. I checked them.

Hmm, this is indeed quite strange... I've never had this issue before
with any Yocto build (including the Freescale one)...


Hello Mr. Andrey,
After testing with other yocto versions and kernels I realized that this happening when I change kernel configuration.
The kernel populated default from meta-freescale/recipes-kernel/linux-qoriq, is compiling hello-mod successfully,
When I put my own configuration file it fails with Invalid kernel conf.... .
Do you have any suggestion about this situation? Thanks.
 
There are few things to try and clarify further here:
 
1. Did you try to build the kernel recipe itself?
Yes I am trying this, bitbake fsl-image-full or fsl-image-networking is compiling succesfully. But bitbake hello-mod fails.
 
2. Which machine you're using in your build setup?
 t1042d4rdb-64b

3. Is the kernel source populated (in your build folder under work-shared)?
Yes it is. I also have  /autoconf.h or include/config/auto.conf under build directory of linux.



 
>
> This is the result of hello-mod:
>
> |
> |   ERROR: Kernel configuration is invalid.
> |          include/generated/autoconf.h or include/config/auto.conf are missing.
> |          Run 'make oldconfig && make prepare' on kernel src to fix it.
> |
> | make[2]: *** [include/config/auto.conf] Error 1
> | make[2]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-build-artifacts'
> | make[1]: *** [sub-make] Error 2
> | make[1]: Leaving directory `/home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work-shared/t1042d4rdb-64b/kernel-source'
> | make: *** [all] Error 2
> | ERROR: oe_runmake failed
> | WARNING: exit code 1 from a shell command.
> | ERROR: Function failed: do_compile (log file is located at /home/hwlab/Desktop/Yocto2.7/build_t1042d4rdb-64b/tmp/work/t1042d4rdb_64b-fsl-linux/hello-mod/0.1-r0/temp/log.do_compile.21458)
> ERROR: Task (/home/hwlab/Desktop/Yocto2.7/sources/meta-yusuf/recipes-kernel/hello-mod/hello-mod_0.1.bb:do_compile) failed with exit code '1'
>
> Regards.

--
Regards,
Andrey.


Andrey Zhizhikin
 

Hello Yusuf,

On Thu, Dec 26, 2019 at 8:12 AM Yusuf Altıparmak
<yusufalti1997@...> wrote:


Hello Mr. Andrey,
After testing with other yocto versions and kernels I realized that this happening when I change kernel configuration.
This might be the root cause of your issue here. How do you change
your configuration? Do you store the defconfig file and try to
re-apply it later? Or you re-configure the kernel and try to re-build
the module?

From what I understood now, you're trying to add a new config
parameter which suppose to configure your OOT module. If this is the
case, then you should consider not to do it, since OOT modules should
not contain any configuration parameters. If this is not the case -
then you need to elaborate more on the scenario you're trying to
implement.

The kernel populated default from meta-freescale/recipes-kernel/linux-qoriq, is compiling hello-mod successfully,
This is already a good sign! This means that upstream version has no
issues, and it all comes down to modifications you're introducing with
your "custom config".

When I put my own configuration file it fails with Invalid kernel conf.... .
Does this happens even if you're not building your OOT module? If this
is the case - then you should work your configuration here, as it
seems that what you do makes the kernel build breaks.

Do you have any suggestion about this situation? Thanks.
Just as I wrote above: try to isolate your OOT buidl failures from
mis-configured kernel build. At this point I tend to lean to the
scenario that it is not a module issue, rather a configuration issue.
--
Regards,
Andrey.


Yusuf <yusufalti1997@...>
 



Andrey Zhizhikin <andrey.z@...>, 26 Ara 2019 Per, 17:02 tarihinde şunu yazdı:
Hello Yusuf,

On Thu, Dec 26, 2019 at 8:12 AM Yusuf Altıparmak
<yusufalti1997@...> wrote:
>
>
> Hello Mr. Andrey,
> After testing with other yocto versions and kernels I realized that this happening when I change kernel configuration.

This might be the root cause of your issue here. How do you change
your configuration? Do you store the defconfig file and try to
re-apply it later? Or you re-configure the kernel and try to re-build
the module?

From what I understood now, you're trying to add a new config
parameter which suppose to configure your OOT module. If this is the
case, then you should consider not to do it, since OOT modules should
not contain any configuration parameters. If this is not the case -
then you need to elaborate more on the scenario you're trying to
implement.

> The kernel populated default from meta-freescale/recipes-kernel/linux-qoriq, is compiling hello-mod successfully,

This is already a good sign! This means that upstream version has no
issues, and it all comes down to modifications you're introducing with
your "custom config".

> When I put my own configuration file it fails with Invalid kernel conf.... .

Does this happens even if you're not building your OOT module? If this
is the case - then you should work your configuration here, as it
seems that what you do makes the kernel build breaks.

> Do you have any suggestion about this situation? Thanks.

Just as I wrote above: try to isolate your OOT buidl failures from
mis-configured kernel build. At this point I tend to lean to the
scenario that it is not a module issue, rather a configuration issue.
>

--
Regards,
Andrey.


Hello,

I solved the problem by using a clean kernel .config and enabling only the drivers I need. Think I messed up with some module loading settings in kernel.

Thank you Mr. Andrey.
Regards.