We have moved to a new Sailfish OS Forum. Please start new discussions there.
5

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 2.0.2.8 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 : https://www.pcsuggest.com/install-rtl8153-driver-linux/

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 : https://github.com/wget/realtek-r8152-linux/archive/v2.11.tar.gz

edit retag flag offensive close delete

3 Answers

Sort by » oldest newest most voted
2

answered 2019-12-03 11:07:21 +0300

miau gravatar image

You can do a zcat /proc/zconfig.gz | greb 'CONFIG_MODULES' to see if module support is enabled on the installed kernel.

Kernel sources are available here: https://github.com/sonyxperiadev/kernel

Defconfig file is /arch/arm64/configs/aosp_nile_pioneer_defconfig

And a guide can be found on Sonys website here: https://developer.sony.com/develop/open-devices/guides/kernel-compilation-guides

edit flag offensive delete publish link more

Comments

2

you want to use the forked sony kernel though, with the appropriate branch for the device

https://github.com/mer-hybris/android_kernel_sony_msm

r0kk3rz ( 2019-12-04 01:22:50 +0300 )edit
1

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

Comments

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
1

answered 2019-10-21 14:08:12 +0300

Michael1 gravatar image

updated 2019-10-22 13:32:34 +0300

When I needed to use the fuse kernel module, I had to re-compile the entire kernel, which took a whole day. Two years later, I upgraded to a newer 4.4.138 kernel, built by community member kaplan2539. The UPSers kernel comes with more modules including fuse, which is a better situation than the original kernel.

edit flag offensive delete publish link more

Comments

Is that really the correct link? This sounds neat to have. I think it would be reasonable to petition Jolla for a Kernel that accepts loading modules... I read your post as that being impossible...? How do I observe that?

attah ( 2019-10-29 21:31:17 +0300 )edit

The old 3.10 kernel used on Xperia X has modules disabled. Recompiling the whole kernel is the only way to get something new.

The new 4.4 kernel used on Xperia XA2 has modules enabled. The module is the only thing needed, but getting the exact correct version of everything (compiler, etc) for the kernel to accept to load the module is tricky and I eventually gave up my past attempts after multiple rejections.

(At my day job, I develop userland not kernel, I'm not that skilled).

DrYak ( 2019-12-04 14:22:30 +0300 )edit
Login/Signup to Answer

Question tools

Follow
7 followers

Stats

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

Seen: 1,154 times

Last updated: Dec 04 '19