:: Re: [DNG] How to build a kernel mod…
Etusivu
Poista viesti
Vastaa
Lähettäjä: Arnt Karlsen
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [DNG] How to build a kernel module?
On Mon, 4 Mar 2019 11:59:45 +0100, Dr. wrote in message
<201903041159.45367.dr.klepp@???>:

> Hi Aitor!
>
> Anno domini 2019 Mon, 4 Mar 10:21:09 +0100
> aitor_czr scripsit:
> > Hi Nik,
> >
> > On 4/3/19 9:52, Dr. Nikolaus Klepp <dr.klepp@???> wrote:
> > > Hi!
> > >
> > > I am trying to build a patched thinkpad_acpi module for 4.19
> > > kernel (the patch removes the spaming error message from the
> > > battery charge/discharge levels BCTG/BCSG on thinkpads
> > > T60/T61/X61). I can build the module, but the creaded module
> > > won't load.
> > >
> > > This is what I did to compile the modules:
> > >
> > > # aptitude install linux-source-4.19
> > > # cd /usr/src
> > > # tar xJf linux-source-4.19.tar.xz
> > > # cd linux-source-4.19/
> > > # cp /boot/config-4.19.0-2-amd64 .config
> > > # make modules_prepare
> > > # make modules
> > >
> > > This succeeds, but the created modules won't load:
> > >
> > > root@t61:/usr/src/linux-source-4.19#
> > > insmod ./drivers/platform/x86/thinkpad_acpi.ko insmod: ERROR:
> > > could not insert module ./drivers/platform/x86/thinkpad_acpi.ko:
> > > Invalid module format root@t61:/usr/src/linux-source-4.19#
> > > file ./drivers/platform/x86/thinkpad_acpi.ko ./drivers/platform/x86/thinkpad_acpi.ko:
> > > ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV),
> > > BuildID[sha1]=571675351aecfb803c56549d218d85d53f60b8d7, with
> > > debug_info, not stripped
> > >
> > > Any idea what I missed?
> > >
> > > Nik
> >
> > Where can we find the sources of this patched module? Did you give
> > a try to module assistant?
>
> It's just a patch for my laptop, nothing special.
>
> How should I use module-assistant? I thought it was just for
> already-pprepared module packages, not arbitrary kernel modules?
>
>
> Anyway, I finaly manged to build the patched module:
>
> # mkdir /usr/src/thinkpad_acpi
> # cd /usr/src/thinkpad_acpi
> # echo 'obj-$(CONFIG_THINKPAD_ACPI)     += thinkpad_acpi.o' > Makefile
> # cp ../thinkpad_acpi.c .
> # make -C /usr/src/linux-headers-$(uname -r ) M=/usr/src/thinkpad_acpi
> # insmod thinkpad_acpi.ko
> #

>
> And it works, no more error spam im dmesg :-)


..you _could_ try provoke it with e.g.
"modprobe -vr thinkpad_acpi.ko " and
"modprobe -v thinkpad_acpi.ko " etc,
insmod et al is not all that verbose.

>
> Nik
>
> >
> > Aitor.
>
>
>
>



--
..med vennlig hilsen = with Kind Regards from Arnt Karlsen
...with a number of polar bear hunters in his ancestry...
Scenarios always come in sets of three:
best case, worst case, and just in case.