[CentOS] C7 Kernel module compilation

Mon Aug 5 16:21:16 UTC 2019
Alessandro Baggi <alessandro.baggi at gmail.com>

Il 05/08/19 18:07, Akemi Yagi ha scritto:
> On Mon, Aug 5, 2019 at 9:01 AM Alessandro Baggi
> <alessandro.baggi at gmail.com> wrote:
>>
>> Il 05/08/19 17:49, Akemi Yagi ha scritto:
>>> On Mon, Aug 5, 2019 at 8:42 AM Alessandro Baggi
>>> <alessandro.baggi at gmail.com> wrote:
>>>>
>>>> Il 05/08/19 17:30, Akemi Yagi ha scritto:
>>>>> On Mon, Aug 5, 2019 at 6:46 AM Alessandro Baggi
>>>>> <alessandro.baggi at gmail.com> wrote:
>>>>>>
>>>>>> Hey there,
>>>>>> I'm trying to compile a single module following this guide:
>>>>>>
>>>>>> https://wiki.centos.org/HowTos/BuildingKernelModules#head-d2e4c05886f94c701e4ae74387d41d8c40c25d01
>>>>>>
>>>>>> and
>>>>>>
>>>>>> https://wiki.centos.org/HowTos/I_need_the_Kernel_Source
>>>>>>
>>>>>> I tried to compile a module for novuton led controller supplied by
>>>>>> thirdparty and I got several error.
>>>>>>
>>>>>> To check if this is the wrong procedure I tried to compile cifs module
>>>>>> as listed in howto but when loading with modprobe I get "Exec format
>>>>>> error", and from dmesg "cifs: no symbol version for module_layout
>>>>>> ", the same errors when compiling novuton module and I don't know why I
>>>>>> get this error.
>>>>>
>>>>> When following the instructions in BuildingKernelModules, which kernel
>>>>> version did you use? Also, after the "depmod -a" step, what is the
>>>>> output from:
>>>>>
>>>>> $ modinfo cifs | grep filename
>>>>>
>>>>>> I noticed that modules in centos are compressed in .xz but after running
>>>>>> make M=fs/cifs I got only a .ko kernel module and then I run xz to
>>>>>> compress the new module.
>>>>>
>>>>> Compressing modules is optional. Uncompressed form is functionally the
>>>>> same (of course it saves some disk space).
>>>>>
>>>>>> Can someone help me please?
>>>>>>
>>>>>> Thanks in advance.
>>>>>
>>>>> Akemi
>>>>
>>>> Hi Akemi,
>>>> thank you for your answer.
>>>>
>>>> Kernel version used is 3.10.0-957.27.2.el7.x86_64
>>>>
>>>> [root at c7-test SPECS]# modinfo cifs | grep filename
>>>> filename:       /lib/modules/3.10.0-957.27.2.el7.x86_64/extra/cifs.ko
>>>
>>> Looking good. I assume your running kernel is 3.10.0-957.27.2.el7 ?
>>>
>>> Akemi
> 
>> Reading from dmesg seems that the module is not accepted by kernel due
>> to invalid signature. I need to sign the module with a key?
> 
> Do you have secureboot enabled? Then yes, that requires a proper key.
> 
> Akemi
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
> 

Yes I have secureboot enabled. If usefull to others in list this could 
helps:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Kernel_Administration_Guide/sect-signing-kernel-modules-for-secure-boot.html

I think also that  centos's wiki must be updated because steps are valid 
for centos 5 and because key-signing is required for secure boot I think 
that a proper section must be inserted.