[ltp] RE: Gen 2 (Haswell) X1 Carbon suspend to RAM hang
Nikos Alexandris
linux-thinkpad@linux-thinkpad.org
Wed, 07 May 2014 20:05:46 +0300
On 06.05.2014 16:08, Bj=C3=B8rn Mork wrote:
> dagb <dag.blakstad@gmail.com> writes:
>
>> The proces for compiling the kernel for each Linux distro may vary.=20
>> I am not
>> a experiences kernel guy, but what I did was following this=20
>> procedure
>> (loosely cut and paste from here
>> <https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel> )
>>
>> sudo apt-get build-dep linux-image-$(uname -r)
>>
>> Patch the Thinkpad driver with this patch:
>> Thinkpad Adaptive keys on Linux
>>=20
>> <https://groups.google.com/forum/#!searchin/fa.linux.kernel/x1$20carbo=
n$20adaptive$20keyboard/fa.linux.kernel/Js1kWITaNGE/laZXUid6wPIJ>
>>
>> fakeroot debian/rules clean
>> fakeroot debian/rules binary-headers binary-generic
>>
>> The name of the kernel package will vary, so amend to to your local=20
>> system
>> sudo dpkg -i linux*2.6.38-7.37*.deb
>>
>> sudo reboot
>
> Note that you don't necessarily need to rebuild the kernel to patch a
> driver, as long as that driver is somewhat standalone and built as a
> module. And of course, as long as the patch doesn't touch any other
> parts of the kernel to support the changes in the driver. This case=20
> is
> such an example.
>
>
> Something like this should work, keeping the distro kernel and not=20
> even
> needing a reboot:
>
> 1) get the kernel source, approximately the same version as your=20
> distro
> kernel. This doesn't need to be a perfect match, unless there are
> plenty of API changes affecting the driver in question. Download a=20
> copy
> from www.kernel.org or clone a repo or whatever.
>
> 2) get the kernel headers matching the distro-kernel you are running.
> This will depend on distro of course. Debian example:
>
> apt-get install linux-headers-`uname -r`
>
>
> 3) get the patch. I prefer lkml.org, because it's easier to access=20
> the
> plaintext diff:
>
> bjorn@nemi:/usr/local/src/git/linux$ wget -O /tmp/foo
> https://lkml.org/lkml/diff/2014/3/11/167/1
> --2014-05-06 14:42:58-- https://lkml.org/lkml/diff/2014/3/11/167/1
> Resolving lkml.org (lkml.org)... 2a01:7c8:c061:1303::7,=20
> 87.253.128.182
> Connecting to lkml.org (lkml.org)|2a01:7c8:c061:1303::7|:443...=20
> connected.
> HTTP request sent, awaiting response... 200 OK
> Length: 2898 (2.8K) [text/plain]
> Saving to: `/tmp/foo'
>
>
>=20
> 100%[=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>]
> 2,898 --.-K/s in 0s
>
> 2014-05-06 14:42:59 (13.2 MB/s) - `/tmp/foo' saved [2898/2898]
>
>
> 4) patch the driver - ignoring warnings, but not errors (this step=20
> and
> the next assumes that your working directory is the top level of the
> kernel source tree):
>
> bjorn@nemi:/usr/local/src/git/linux$ patch -p1 < /tmp/foo
> patching file drivers/platform/x86/thinkpad_acpi.c
> Hunk #1 succeeded at 3471 (offset 34 lines).
> Hunk #2 succeeded at 3590 (offset 34 lines).
> patch unexpectedly ends in middle of line
>
>
> 5) build *only* the patched driver using the distro headers:
>
> bjorn@nemi:/usr/local/src/git/linux$ make -C /lib/modules/`uname
> -r`/build SUBDIRS=3D`pwd`/drivers/platform/x86 thinkpad_acpi.ko
> make: Entering directory `/usr/src/linux-headers-3.2.0-4-amd64'
> CC [M] =20
> /usr/local/src/git/linux/drivers/platform/x86/thinkpad_acpi.o
> MODPOST 1 modules
> CC =20
> /usr/local/src/git/linux/drivers/platform/x86/thinkpad_acpi.mod .o
> LD [M] =20
> /usr/local/src/git/linux/drivers/platform/x86/thinkpad_acpi.ko
> make: Leaving directory `/usr/src/linux-headers-3.2.0-4-amd64'
>
>
> 6) test it:
>
> rmmod thinkpad_acpi
> insmod=20
> /usr/local/src/git/linux/drivers/platform/x86/thinkpad_acpi.ko
>
>
> 7) if it worked, then install your special driver where it will
> automatically be used instead of the distro packaged driver:
>
> mkdir /lib/modules/`uname -r`/updates
> cp /usr/local/src/git/linux/drivers/platform/x86/thinkpad_acpi.ko
> /lib/modules/`uname -r`/updates/
I don't see any "updates" (sub-)directory here. ?
> depmod -a
>
>
> That's it! OK, it is a few steps, but all of them are really
> quick. Especially if you want to repeat this to test more changes.
> And the rest of
> your kernel still comes from your distro.
Thank you!
It worked (Funtoo, running kernel: 3.12.18-KS.01, linux-headers: 3.13):=20
switching Modes, Volume (Decr., Mute, Incr.), and Brightness. The=20
latter very slow though. Does it need some setting, somewhere, to=20
increase the inbetween brightness steps?.
Waking the machine up after Sleep-ing, though, does not reactivate the=20
touchbar here. Strange it is that, instructing `rmmod thinkpad_acpi`=20
brings the touchbar back alive! Any hints?
Nikos
--=20
Nikos