PDA

View Full Version : Recompiling an in-tree kernel module with a trivial change



blinksilver
9th November 2015, 01:57 PM
Hi all,

somewhere in the kernel's sony-laptop module is the following bit of code:
<snip>

static struct dmi_system_id __initdata sonypi_dmi_table[] = {
{
.ident = "Sony Vaio",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "PCG-"),
},
},
{
.ident = "Sony Vaio",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "VGN-"),
},
},
{ }
};

static int __init sony_laptop_init(void)
{
int result;

if (!no_spic && dmi_check_system(sonypi_dmi_table)) {
result = acpi_bus_register_driver(&sony_pic_driver);
<snip>

Basically it makes sure you have a one of two sony series laptop before registering the driver... seems harmless enough.. except sony no longer owns the vaio ip, so that check fails on newer machines like my z canvas. I can patch it with the correct DMI info from my machine, but I don't know how to recompile just this single module and not the whole kernel...

this: https://fedoraproject.org/wiki/Building_a_custom_kernel has simple guide on how to build an out of kernel module(I tried it, just for kicks it didn't work), but not one that is part of the proper kernel.

I would really appreciate the help! There is a lot of basic stuff I can't do (like set my battery limit) without it and I sorta doubt anyone is going to fix it if I don't.

I promise to toss up an upstream pull request with the patch if it works as expected!

EDIT: I'm on FC23

blinksilver
10th November 2015, 12:01 AM
Okay, so I got it built... and still no go, looks like that exact same bit of code is in sonypi... and when I use the method outlined here:

http://www.pixelbeat.org/docs/rebuild_kernel_module.html

to build the sonypi module after I make a change... it does not seem to compile? this thing is a cheeky little bugger... help ?

blinksilver
11th November 2015, 04:24 AM
I can't really make heads or tails of the build process... Sony-laptop leverages something from sonypi (its #included), I just don't know if its important to have an updated version of it in the kernel or just if its using some basic function... I can't really spend all day hunting code... Maybe just an idea where to look?

srakitnican
12th November 2015, 02:25 PM
I think you should ask in appropriate kernel mailing list (http://vger.kernel.org/vger-lists.html) for your module.

blinksilver
14th November 2015, 11:47 AM
thanks! That seems like my go to!