LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-08-2019, 07:57 AM   #1
burdi01
Member
 
Registered: Dec 2010
Location: The Netherlands
Distribution: Slackware Current64, PartedMagic, Xubuntu
Posts: 465

Rep: Reputation: 114Reputation: 114
[Solved] Current64: How to build an out-of-tree module


For many years I configure, build and install my own kernels from the kernel.org sources -- at the moment that is 5.3.9.
Once installed and rebooted I then have to build two out-of-kernel module-sets -- the VirtualBox one and the rtlwifi_new-extended one (the zip from https://github.com/lwfinger/rtlwifi_new/tree/extended).
Out of curiosity I installed the testing kernel-(generic,modules,source}-5.4.0-rc6 *) and rebooted: Both the VirtualBox **) and the rtlwifi module builds failed.
First after rebuilding the kernel (make in /usr/src/linux-5.4-rc6) the rtlwifi module build succeeded. This begs the question whether this is "normal" or that I missed something. The Book does not mention building out-of-tree modules and scanning LinuxQuestions gave no definitive hints either.
Any hints would be appreciated.
Regards, Dick


*) Fafaik the kernel-headers package should be the one the userland is built with, so 4.19.82 at the moment.
**) Not researched further -- see https://www.virtualbox.org/ticket/18945.

Last edited by burdi01; 11-11-2019 at 02:51 AM.
 
Old 11-08-2019, 08:45 AM   #2
garpu
Senior Member
 
Registered: Oct 2009
Distribution: Slackware
Posts: 1,536

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Are you using multilib? I"m wondering if it has to do with gcc not matching the one used to compile the kernel, since others have reported issues with modules (such as the Nvidia blob) in the Latest Kernel thread with the 5.4 kernel. (gcc-multilib and gcc-stock have never mattered to the 4.19 kernels, but I don't know if things changed for 5.4.)

Thread: https://www.linuxquestions.org/quest...3/page118.html

Failing that theory, there are others having trouble with VirtualBox, too, I believe.
 
1 members found this post helpful.
Old 11-09-2019, 04:02 AM   #3
burdi01
Member
 
Registered: Dec 2010
Location: The Netherlands
Distribution: Slackware Current64, PartedMagic, Xubuntu
Posts: 465

Original Poster
Rep: Reputation: 114Reputation: 114
@garpu: No, I am not using multilib. So I assume to use the same compiler as Pat used to create the pertinent packages. I do see your point though. With a compiler upgrade adding out-of-tree modules to an already compiled kernel may cause problems. Luckily compiler upgrades do not happen often ...

As I said, I did not elaborate on the VirtualBox problem any further. I zoomed in on the rtlwifi module build as a test case but my question is more generic:
Given the stock kernel {generic[,headers],modules,source} packages what is the procedure to build an out-of-tree module?

Regards, Dick
 
Old 11-09-2019, 07:32 PM   #4
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
did you see this at bottom of the link you provided.
Quote:
If you are using a kernel newer than 5.2,
I suggest that you use the driver built into the kernel!
edit: that is only for RTL8822BE and RTL8822CE drivers. Sorry about that, misread the link, I use the rtl8723de and it isn't included yet.

Last edited by colorpurple21859; 11-09-2019 at 08:10 PM.
 
Old 11-09-2019, 10:19 PM   #5
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@burdi01

Have a look at the "Book" that will answer your kernel (and not necessarily Slackware) related questions:
https://www.kernel.org/doc/Documenta...ld/modules.txt

I haven't tested the 5.4.0-rc6 nor have I checked in what state the source package (tree) is, therefore I cannot comment on it. The main kernels Slackware is providing have their source tree prepared, meaning it's in the state left immediately after finishing compiling the kernel, all the necessary files (config, make files, headers, Module.symvers, etc.) are already available.

If you don't have the kernel source tree in a prepared state, let's say you're downloading the source from upstream - kernel.org, you need to have two files available from your running kernel, the .config and the Module.symvers, both need to be copied in the root of the kernel source tree - /usr/src/linux-5.4-rc6 in this case. Then, you need to prepare the kernel source tree for your out-of-tree kernel module compilation by running:
Code:
make modules_prepare
Only after these steps you can move into your out-of-tree kernel module source directory and build it.
There's another thing you should care about, usually the out-of-tree kernel module make file is looking in /lib/modules/running-kernel-version after the symlink "build", which should point to the kernel source tree. If this symlink isn't there, create it.
 
1 members found this post helpful.
Old 11-10-2019, 11:33 AM   #6
burdi01
Member
 
Registered: Dec 2010
Location: The Netherlands
Distribution: Slackware Current64, PartedMagic, Xubuntu
Posts: 465

Original Poster
Rep: Reputation: 114Reputation: 114
@colorpurple21859: Indeed it is the rtl8723de driver I am after.

@abga: With "the Book" I meant the Slackware https://www.slackbook.org/ one -- I must admit that "2012" did not hint at its up-to-dateness. It never occurred to me to have a look at the kernel's "Documentation" directory. [/blush]

Assuming the Slackware testing 5.4-rc6 was in its "prepared" stage I installed (a test build supporting kernel 5.4 of) VirtualBox and succeeded. Building the rtlwifi_new-extended drivers still failed.
So I opened issue https://github.com/lwfinger/rtlwifi_new/issues/500 on their bug tracker which was closed as:
Quote:
Obviously, you did not have a proper map of the system globals available, particularly for the other modules. A full kernel make obviously did the job.
VirtualBox can be built without needing any kernel modules other than its own, although most distro versions do use some other kernel modules.
In other words: the "prepared" stage is not sufficient for building some out-of-tree kernel modules ...

Last edited by burdi01; 11-11-2019 at 02:51 AM.
 
Old 11-10-2019, 01:18 PM   #7
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by burdi01 View Post
In other words: the "prepared" stage is not sufficient for building some out-of-tree kernel modules ...
Well then, go with your false generalized statement from above to the kernel developers and ask them to amend their documentation:
https://www.kernel.org/doc/html/late...d/modules.html

But then, before wasting your time&energy, better focus on the way the rtlwifi_new external modules are built. I read lwfinger's answer at the rtlwifi_new bug tracking you mentioned and he's right, their external modules build process require some extra modules files and those should be available in /lib/modules/5.4.0-rc6 (map/order/symbols). I'm afraid those are not considered and expected to be available in the kernel source tree.
 
Old 11-10-2019, 04:13 PM   #8
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
Code:
make modules prepare
is what worked for me, but then again it isn't much different then running make
The driver wouldn't compile with
Code:
make modules_prepare

Last edited by colorpurple21859; 11-11-2019 at 10:44 AM. Reason: Clarification
 
Old 11-11-2019, 02:50 AM   #9
burdi01
Member
 
Registered: Dec 2010
Location: The Netherlands
Distribution: Slackware Current64, PartedMagic, Xubuntu
Posts: 465

Original Poster
Rep: Reputation: 114Reputation: 114
@abga:
Quote:
... your false generalized statement ...
Does this "false" apply to the statement (as in "your false and generalized statement") or to "generalized" (as in "your falsely generalized statement")? In the latter case I should rephrase my statement as "In other words: the "prepared" stage is not sufficient for building at least one out-of-tree kernel module ...".

Note that my wording is such that it does not imply who I think is to "blame": the kernel developers or the rtlwifi_new-extended developer.

Anyway, my question is answered ...

Last edited by burdi01; 11-11-2019 at 03:15 AM.
 
Old 11-11-2019, 02:39 PM   #10
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@burdi01

I'm glad you got it working and your particular experience and the details provided in this thread with the rtlwifi_new drivers are definitely beneficial for the Slackware community. My observation (hope you didn't miss the emoji at the end of it) with your generalization had two reasons, first, avoid misleading the other people who read and learn from this thread and second, to point you at the only buggers who are to be blamed for not respecting the way defined by the kernel devs.
Again, this is a particular case and the "the "prepared" stage is not sufficient for building some" is rather false.
 
Old 11-12-2019, 05:30 AM   #11
burdi01
Member
 
Registered: Dec 2010
Location: The Netherlands
Distribution: Slackware Current64, PartedMagic, Xubuntu
Posts: 465

Original Poster
Rep: Reputation: 114Reputation: 114
@abga: Thank you for your kind response.

I still think my amended (see my Yesterday 09:50 AM post) statement:
The "prepared" stage is not sufficient for building at least one out-of-tree kernel module.
is correct and neutral.

But let us agree to not agree.
Kind regards, Dick

Last edited by burdi01; 11-12-2019 at 08:04 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the difference strict binary tree nad extended binary tree . tushar_pandey Programming 1 07-18-2012 11:30 AM
How to build a individual module in the kernel tree avyadavnitw Linux - Embedded & Single-board computer 2 06-15-2009 01:21 AM
LXer: Howto: build Linux kernel module against installed kernel w/o full kernel source tree LXer Syndicated Linux News 0 09-03-2006 08:21 PM
the bible = the tree of the knowledge of good and evil () Jesus = the tree of life Michael111 General 2 04-14-2004 04:28 PM
need a P-Tree (Patricia Tree) library manaskb Programming 1 11-02-2002 06:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration