cilynx / rtl88x2bu

rtl88x2bu driver updated for current kernels.

Home Page:http://www.wolfteck.com/2018/02/22/wsky_1200mbps_wireless_usb_wifi_adapter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to configure a minimal yet compatible Kernel

MaxG87 opened this issue · comments

When I try to find the reason the rtl88x2bu driver cannot compile for a given Linux kernel, I usually find the breaking commit by a git bisect. I have a helpful script for that, but it still requires me to compile the Kernel repeatedly.

Right now I have to use my default Kernel configuration in order to get a Kernel that allows to build the Wifi driver against it. This is annoying because it means the script has to run hours instead of minutes because it has to compile so much irrelevant stuff.

I would like to configure the Kernel such that only whats strictly necessary is compiled. Maybe, less good but still a huge improvement, I would disable all sections that are obviously irrelevant, like graphics, sound, bluetooth, file systems, etc. Unfortunately, I am unable to find good documentation on that and was unable to figure out how to do so on my own.

Does anyone know how to configure a kernel appropriately? In the best case I can imagine I could run make allnoconfig and enable specific settings using scripts/config afterwards.

I don't understand your use case.

Why you need to compile the full kernel in a out of tree driver?

Just get the kernel headers from the distribution that you need to test, see https://github.com/cilynx/rtl88x2bu/blob/5.8.7.1_35809.20191129_COEX20191120-7777/.github/workflows/build.yml

First, I didn't know about the possibility to use kernel headers. Thank you for mentioning that.

Second, I fear it won't help here. There are is no distribution that provides headers for Linux 5.16rc1 and even if there was, I probably couldn't use that to bisect to a breaking commit.

EDIT: I tried to use make headers_install followed by make KBASE=/path/to/linux-src/ but to no avail. The error message is

make ARCH=x86_64 CROSS_COMPILE= -C /path/to/linux/ M=/path/to/rtl88x2bu  modules
make[1]: Verzeichnis „/path/to/linux“ wird betreten
WARNING: Symbol version dump "Module.symvers" is missing.
         Modules may not have dependencies or modversions.
         You may get many unresolved symbol warnings.
  MODPOST /path/to/rtl88x2bu/Module.symvers
/bin/sh: 1: scripts/mod/modpost: not found
make[2]: *** [scripts/Makefile.modpost:134: /path/to/rtl88x2bu/Module.symvers] Fehler 127
make[1]: *** [Makefile:1765: modules] Fehler 2
make[1]: Verzeichnis „/path/to/linux“ wird verlassen
make: *** [Makefile:2390: modules] Fehler 2

Maybe that would be a suitable way, though.

Assuming 5.16rc1 mean you compile your kernel personally? Then you should be know that to properly build and install kernel, also /path/to/linux/ usually /usr/src/linux bla bla doesn't mean literally /path/to/linux or just use distribution kernel and kernel headers.

I am sorry, but I don't understand your answer.
Yes, I am compiling my kernels personally, so I can test whether the rtl88x2bu compiles for them. Please note that I do not have to boot the compiled kernel, I just need to have it compiled. That might be wasteful, but it works.

Now I am looking for something that is less wasteful, e.g. only creating the headers.

Why are you pointing me to /usr/src/linux bla bla and what should I do then?

First, I didn't know about the possibility to use kernel headers. Thank you for mentioning that.

Second, I fear it won't help here. There are is no distribution that provides headers for Linux 5.16rc1 and even if there was, I probably couldn't use that to bisect to a breaking commit.

Look again at the proposed script, it fetch the .deb files from https://kernel.ubuntu.com/~kernel-ppa/mainline/

https://github.com/cilynx/rtl88x2bu/blob/5.8.7.1_35809.20191129_COEX20191120-7777/.github/workflows/build.yml#L39

You can get 5.16rc1 because not exist (yet) but any other rc is available for testing.

Yo can see a build over 5.15.rc6 there:
https://github.com/cilynx/rtl88x2bu/runs/3943553556?check_suite_focus=true

About the build...

make ARCH=x86_64 CROSS_COMPILE= -C /path/to/linux/ M=/path/to/rtl88x2bu modules

If you use header files use the KVER option, it will calculate the correct paths instead of use -C
https://github.com/cilynx/rtl88x2bu/blob/5.8.7.1_35809.20191129_COEX20191120-7777/.github/workflows/build.yml#L516

For example using 5.15.rc6 (5.15.0-051500rc6-generic)

make KVER=$KVER
It generates

make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/5.15.0-051500rc6-generic/build M=/home/runner/work/rtl88x2bu/rtl88x2bu modules

And the /lib/modules/bla3/build will redirect to /usr/src/linux-headers-bla3 If installed via DEB usualy the source will be there, if it manually compiled then the -C options will redirec to your custom linux kernel src path.

The right command
make KVER=4.19.216-dms-lab KSRC=/lib/modules/4.19.216-dms-lab/build M=/home/dedyms/Documents/88x2bu-20210702

make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/4.19.216-dms-lab/build M=/home/dedyms/Documents/88x2bu-20210702  modules
make[1]: Entering directory '/home/dedyms/Documents/linux-4.19.216'
  CC [M]  /home/dedyms/Documents/88x2bu-20210702/core/rtw_cmd.o
  CC [M]  /home/dedyms/Documents/88x2bu-20210702/core/rtw_security.o
  CC [M]  /home/dedyms/Documents/88x2bu-20210702/core/rtw_debug.o
  CC [M]  /home/dedyms/Documents/88x2bu-20210702/core/rtw_io.o
.....

I stumbled across the solution rather by chance. One has to run make prepare on a configured Kernel source.

make oldconfig
make prepare

This does the trick for me.