How to recompile the kernel (to add a new module)?

Discussion in general that pertains to Sabayon Linux - Must Pertain to Sabayon Linux

Moderator: Moderators

Post Reply
denijane
Growing Hen
Posts: 168
Joined: Tue Feb 13, 2007 19:54
Location: Sofia
Contact:

How to recompile the kernel (to add a new module)?

Post by denijane » Fri Apr 27, 2018 21:31

Since I still have no touchpad, I discovered this driver https://github.com/mishurov/linux_elan1200_touchpad that might enable it.
However, I need to recompile the kernel. Could someone please please help me do that? I found this arch instructions https://wiki.archlinux.org/index.php/Co ... nel_module but I really don't know if they work on gentoo based systems.
What I did:
I downloaded the 4.15.17 linux kernel and unzipped it.
Then:
$ make mrproper
$ cp /lib/modules/$(uname -r)/build/.config ./
$ cp /lib/modules/$(uname -r)/build/Module.symvers ./
$ make oldconfig
$ make EXTRAVERSION=-sabayon modules_prepare
$ make M=/home/user/linux_elan1200_touchpad-master/
$ xz /home/user/linux_elan1200_touchpad-master//hid-elan.ko

All fine, no errors and I have a "hid-elan.ko.xz"

What do I do afterwards?
Instructions says you need to "gzip and copy it over for your current kernel."
But they also say:
# cp -f fs/btrfs/btrfs.ko.xz /usr/lib/modules/`uname -r`/kernel/fs/btrfs/

Do I first gzip and copy the current kernel and then do the copy, or the copy should be done before gzip?

Also do I gzip with:
"gzip -r myfolder"
or with
"tar -zcvf archive.tar.gz directory/ "
Finally, where should I place the gzip?
I see initramfs-genkernel-x86_64-4.15.0-sabayon (which the info says it's gzip file)
But I also see a "kernel-genkernel-x86_64-4.15.0-sabayon" which I don't know how to generate.

P.S. I posted this question also on http://www.linuxquestions.org but so far I didn't get answers regarding the compilation. I also asked about the touchpad on stackexchange. This is getting so disappointing. Once upon the time the Linux community was actually very helpful.

gentmixer
Simple Hen
Posts: 60
Joined: Wed Jan 17, 2018 17:21

Re: How to recompile the kernel (to add a new module)?

Post by gentmixer » Thu May 03, 2018 19:24

Hi...
Probably you are not an "afficionado" of kernel compiling and you want simply to use your touchpad...
Do not touch your "initrams" or "kernel-genkernel"! These are parts of your working kernel, precompiled in Sabayon...
You have compiled your module with a proper kernel sources (the same like your working kernel)...
Copy (as root) your "hid-elan.ko", not "hid-elan.ko.xz" to the /lib64/modules/4.15.0-sabayon/kernel/drivers/hid...
and: "modprobe hid-elan" (or eventually a weaker command "insmod hid-elan"). Check if this module is loaded: "lsmod"...
Remember: the last numbers in a kernel name are unimportant (usually) so modules for "4.15.0" will be valid for "4.15.17" also (the version control will accept them). You should compile this module anew for a major versions of your kernel of course...
You should repeat this procedure ("modprobe hid-elan") manually after every reboot...
There is an automatic module loading possible with "systemd"...
Automatic module loading (on start) is configured in a separate file. The configuration files are stored in /etc/modules-load.d. Make a file "hid.conf" (for example) and write out there your module name "hid-elan" (not "hid-elan.ko").
Read and learn a bit:
https://wiki.gentoo.org/wiki/Kernel/Configuration
https://wiki.gentoo.org/wiki/Systemd#Au ... le_loading
Yes, you can recompile your all kernels but using some precompiled kernels is very convenient, seems to me.
Best wishes...

denijane
Growing Hen
Posts: 168
Joined: Tue Feb 13, 2007 19:54
Location: Sofia
Contact:

Re: How to recompile the kernel (to add a new module)?

Post by denijane » Fri May 04, 2018 11:12

Hi and thank you so much for the detailed reply.
It really helped because of course I don't want to recompile the kernel.

So I did modprobe etc and well, I still have no touchpad.

After another 2 hours of pain, I think the problem is acpi:
When I boot with acpi=force, the detection of Elan1200 appears in:

Code: Select all

$journalctl | grep ELAN1200
may 04 03:34:44 sabayon.local kernel: i2c_hid i2c-ELAN1200:00: i2c-ELAN1200:00 supply vdd not found, using dummy regulator
may 04 03:34:44 sabayon.local kernel: input: ELAN1200:00 04F3:303E Touchpad as /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-ELAN1200:00/0018:04F3:303E.0003/input/input16
май 04 03:34:44 sabayon.local kernel: hid-multitouch 0018:04F3:303E.0003: input,hidraw2: I2C HID v1.00 Mouse [ELAN1200:00 04F3:303E] on i2c-ELAN1200:00
The problem is that I get a non-responsive black screen so I can't really use it.
Whatever other boot options I use, the system doesn't load Elan1200.
For example:

Code: Select all

$ls /sys/bus/hid/drivers/hid-generic
0003:0458:0007.0001  0003:0B05:1869.0002  bind  module  new_id  uevent  unbind
$ls /sys/bus/hid/drivers/hid-elan
bind  module  new_id  uevent  unbind
And the two ids in hid-generic correspond to my keyboard and my usb mouse.

I'm not sure if the problem is bios or the kernel, because on kUbunto, the touchpad got detected (though it worked badly).

I'd be very grateful if anyone has a suggestion with regards to the acpi option, how to turn on the screen on "acpi=force" or if a new kernel would help.

The xorg.log.old from the "acpi=force" boot displays the following errors:

Code: Select all

[     8.313] (EE) [drm] Failed to open DRM device for (null): -22
[     8.313] (EE) [drm] Failed to open DRM device for (null): -22
[    10.347] intel: waited 2020 ms for i915.ko driver to load
[    10.350] (WW) Falling back to old probe method for modesetting
[    10.352] (WW) Falling back to old probe method for vesa
[    10.353] (EE) Screen 0 deleted because of no matching config section.
[    10.353] (II) UnloadModule: "modesetting"
[    10.363] (II) AIGLX: Screen 0 is not DRI2 capable
[    10.363] (EE) AIGLX: reverting to software rendering

gentmixer
Simple Hen
Posts: 60
Joined: Wed Jan 17, 2018 17:21

Re: How to recompile the kernel (to add a new module)?

Post by gentmixer » Fri May 04, 2018 13:40

You should start a new thread with "Elan1200 drivers" in a header (and a bit more informative)...
Look for some similar keywords in Google...
for example:
https://bugzilla.redhat.com/show_bug.cgi?id=1543769
Unfortunately I have no this hardware so no testing possibility and no required experience/expertise...
You can change temporarily acpi parameters in "grub.cfg"
https://askubuntu.com/questions/981183/ ... g-smoothly
and this information in the same thread:
"At first it was not recognized at all, I added the i8042.kbdreset=1 param in the grub and it is now recognized."
and read also: https://github.com/mishurov/linux_elan1 ... d/issues/2

BUT:
You should probably install drivers for your Elan1200 from Gentoo (unofficial) repositories...
There are some drivers for your touchpad in "linxon" repo...
Install "layman" and required "overlay" (linxon) in a Gentoo way.
Try learn from this link: https://blog.tankywoo.com/2013/09/18/ge ... ayman.html. There you can find another links to the Gentoo Wiki...
Sorry, I should ask before if you have checked availability of this drivers in Gentoo repos... It seems to me so natural! If these drivers will compile and work you will be happy without complicated procedures... Compiling and installing modules will be simple, but these drivers are the same drivers from GitHub so maybe there are the same issues too...
Seems to me you are not using Gentoo tools...
Install some package manager for Gentoo: for example"porthole" (you can install "rigo" also) or use "emerge" command only. "Sync tree" immediately. It will update "portage" database (and installed/configured "overlay").
Last edited by gentmixer on Mon May 14, 2018 1:10, edited 1 time in total.

denijane
Growing Hen
Posts: 168
Joined: Tue Feb 13, 2007 19:54
Location: Sofia
Contact:

Re: How to recompile the kernel (to add a new module)?

Post by denijane » Sat May 05, 2018 15:44

Hi,
thanks for the suggestion. Indeed, I haven't used Gentoo options for a very long while now. Before it used to break things and so I avoided it.

Anyway, it seems that the problem are the kernel options. I'm able to start X only with "acpi_osi=! acpi_osi="WIndows 2009"" and I saw that for other people it also turn off the Elan 1200 touchpad. So I guess it's not really a problem of the driver, but of the kernel and acpi. I mean, I guess the driver cannot do anything if the device itself is completely invisible to the system. I run some tests - if I run "acpi_osi=! acpi_osi="WIndows 2013"", X doesn't start, but from the xorg.log.old I can see it found and initialized the touchpad. With "acpi_osi=! acpi_osi="WIndows 2009"" it doesn't see it at all. So I guess, it's bad luck with this laptop. :(

Thanks for the help, really!

Post Reply