Ask / Submit

Build kernel module

asked 2019-04-06 21:41:05 +0300

tourdetour gravatar image

updated 2019-04-06 21:42:10 +0300

Hello, I'm trying to build the r8152 module on Sailfish OS version kernel 4.4.172 on Xperia XA2, to use my usb C to ethernet adapter on Sailfish.

I tried to install make, and to then build the module on the device with those instructions :

However, I have the following errors when I run #make -j2 :

find: /lib/modules/4.4.172/kernel/drivers/net/usb: No such file or directory
make -C /lib/modules/4.4.172/build SUBDIRS=/home/nemo/Documents/Ethernet/realtek-r8152-linux-2.11 modules
make: *** /lib/modules/4.4.172/build: No such file or directory.  Stop. 
make: *** [modules] Error 2

Creating the directory /lib/modules/4.4.172/build leads to the following error:

make[1]: Entering directory `/lib/modules/4.4.172/build'
make[1]: *** No rule to make target `modules'.  Stop.
make[1]: Leaving directory `/lib/modules/4.4.172/build'
make: *** [modules] Error 2

Also, #lsmod returns no modules loaded, which is weird because some modules are needed for the OS to function right?

How do I proceed to build a kernel module in Sailfish OS?

Btw, I got the module from here :

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted

answered 2019-04-06 22:52:18 +0300

tortoisedoc gravatar image

you need the right kernel headers. you can find the kernel from sonys aosp website iirc. godspeed

edit flag offensive delete publish link more


Thanks for the answer. I didn't find the kernel headers on sony's aosp website.There is something called Open source Archive but I don't really know what to do with it and there doesn't seem to be anything even remotely related to kernel headers in it.

However there is a package called kernel-headers available through pkcon so I installed it, but the module still fails to compile with the same error.

tourdetour ( 2019-04-06 23:17:50 +0300 )edit

You need the arch-specific headers. And these you can only get from Sony

tortoisedoc ( 2019-04-07 08:05:02 +0300 )edit

Also, Iam not sure if kernel is compiled with loadable module supported. You will probably need to build all SFOS yourself , or at least new kernel which supports loadable modules.

Nieldk ( 2019-04-07 08:35:13 +0300 )edit

@tortoisedoc That makes sense. So I should try to download the headers on sony's website and just put them in the common place for linux-headers?

@Nieldk Maybe, it would explain why lsmod doesn't show anything. I didn't know you could even compile Linux without loadable module support. I don't really know how to replace the kernel once compiled, on a typical linux distro I would just replace vmlinuz in /boot and run mkinitcpio...

tourdetour ( 2019-04-07 16:41:29 +0300 )edit

theres plenty of guides out there gooooogle it

tortoisedoc ( 2019-04-09 00:07:35 +0300 )edit
Login/Signup to Answer

Question tools



Asked: 2019-04-06 21:41:05 +0300

Seen: 195 times

Last updated: Apr 06