LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-29-2019, 06:00 AM   #1
plisken
Member
 
Registered: Dec 2001
Location: Scotland
Distribution: Slackware 9.1-15 RH 6.2/7, RHEL 6.5 SuSE 8.2/11.1, Debian 10.5
Posts: 518

Rep: Reputation: 32
Build and insert modules into running kernel (Slackware 8.1 - 2.4.20 kernel with RTAI patch)


I’m running Slackware 8.1 (don’t ask) with 2.4.20 kernel that has been patched with some Real Time Application Interface stuff that I really know very little about, but the system works.

I’ve been trying to get usb keyboard and mouse to work and succeeded in this by recompiling the kernel with this support, basic stuff, so at this point all good.

But I have a problem, when booting with my new kernel, the main application for which this system exists no longer works, due to there being modules compiled for a different kernel version and adding -f to any insmod commands just makes my eyes bleed, so to get around this, I made my custom kernel to have the same EXTRAVERSION as the previous one, all looked good, but there is still a problem.

When some of these custom RTAI modules are being loaded, there are numerous warnings about missing dependencies and unresolved symbols. This is becoming a nightmare so I have taken a step back and asking a different question that I think may accomplish my needs.





TLDR;

In the /usr/src/2.4.20/drivers/usb folder, there are many .c and .h files and I’m assuming these are what are used to build the modules depending on the options in my .config file after running make menuconfig for example, so I’m now wondering is it possible (I cant see why not), that I cant build the modules I’m needing and then use insmod to insert them into the running kernel as opposed to my original method of building a new custom kernel?

How would this be accomplished?


All thoughts are greatly appreciated…
 
Old 06-29-2019, 12:56 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, RPi OS under protest!
Posts: 18,364

Rep: Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813
2.4.20 is quite old - older than some guys posting here.

The rule is: you can keep running it as long as you don't mind getting hacked if you go online, and you don't use any modern software. I gather you have used modern software, thus bringing the Compatibility Curse upon yourself.

Everything's changed since those days. In the software versions x.y.z,
x = break in compatibility
y = feature(s) addition
z = bug fix / security enhancement.

The kernel is now at 4.x.x; gcc is now 8.x.x. The linux headers now live in a different place. Everything is different. Meltdown & Spectre are alive, well, & you are unpatched. Please get real and update. Endure whatever down-time that involves. You can probably bring another server up, start it accepting new connections, & stop yours.
 
Old 06-29-2019, 03:40 PM   #3
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by business_kid View Post
2.4.20 is quite old - older than some guys posting here.
To be exact, the ChangeLog was released on 28-Nov-2002. There have been newer updates in the 2.4 series, though, the last one was 2.4.31 released on 1-Jun-2005. That one fixes at least some problems with that kernel.
And Slackware 8.1 itself is from 19-Jun-2002, so even older still. It has received updates until juy 2012, more then 10 years!

Quote:
The kernel is now at 4.x.x; gcc is now 8.x.x.
5.1.15 is the latest stable kernel, although Slackware keeps to the longterm 4.19.x ones.
The gcc compiler suite already is at 9.x (9.1 in -current, with glibc 2.29).
 
Old 06-29-2019, 05:35 PM   #4
plisken
Member
 
Registered: Dec 2001
Location: Scotland
Distribution: Slackware 9.1-15 RH 6.2/7, RHEL 6.5 SuSE 8.2/11.1, Debian 10.5
Posts: 518

Original Poster
Rep: Reputation: 32
I'm not being funny and certainly don't wish to seem ungrateful for the replies thus far, but did you guys even read my post?

I am more than aware how old and outdated this system is, not mentioning the security flaws that it has. This system can not be updated to a current kernel or distribution and running in a VM is also not an option. The system is isolated and will never be exposed to software other than what is running currently.

What I'm asking is how to compile kernel modules for the 2.4.20 kernel (that list in /usr/src/linux-2.4.20/drivers) that I can then insert into the running kernel without reconfiguring and compiling the kernel to support the additional features as would be done with make menuconfig or similar, such as usb keyboard support. I've already tried recompiling the kernel and this of course works and in part achieves my goal but in turn breaks the system, as mentioned in my post.

I'd really appreciate some direction here.
 
Old 06-29-2019, 05:43 PM   #5
plisken
Member
 
Registered: Dec 2001
Location: Scotland
Distribution: Slackware 9.1-15 RH 6.2/7, RHEL 6.5 SuSE 8.2/11.1, Debian 10.5
Posts: 518

Original Poster
Rep: Reputation: 32
Would running make menuconfig in the current tree which is /usr/src/linux-2.4.20 and choosing the options I need, as modules. Then instead of recompiling the kennel by running make bzImage, I choose to only run make modules and make modules_install?

I'm assuming I can then insert the modules using mod probe or insmod?


Would there be any risk in doing this?
 
Old 06-29-2019, 08:44 PM   #6
glorsplitz
Senior Member
 
Registered: Dec 2002
Distribution: slackware!
Posts: 1,398

Rep: Reputation: 413Reputation: 413Reputation: 413Reputation: 413Reputation: 413
maybe check this "How to Compile Just One Kernel Module", build/rebuild your module(s), then depmod/reboot?

you'd need to get appropriate kernel and more or less hack through first link steps

Last edited by glorsplitz; 06-29-2019 at 08:54 PM.
 
Old 06-30-2019, 04:31 AM   #7
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by plisken View Post
What I'm asking is how to compile kernel modules for the 2.4.20 kernel (that list in /usr/src/linux-2.4.20/drivers) that I can then insert into the running kernel without reconfiguring and compiling the kernel to support the additional features as would be done with make menuconfig or similar, such as usb keyboard support. I've already tried recompiling the kernel and this of course works and in part achieves my goal but in turn breaks the system, as mentioned in my post.

I'd really appreciate some direction here.
The problem is here that that kernel is so old that almost all of us have long forgotten HOW to do that. People can give you generic hints, but nothing specific to that kernel.
Even the source tree has long changed a lot, so that without access to a 2.4.20 one something like /usr/src/linux-2.4.20/drivers doesn't say a lot.
To change "built-in" drivers to modules you will have to go through a complete kernel rebuild, though, just changing the option(s) to module won't work as the built kernel will still have that code internally so will never load the module as its already there.
 
Old 06-30-2019, 04:45 AM   #8
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by plisken View Post
I'm assuming I can then insert the modules using mod probe or insmod?
Only if the kernel has the "hook" for the module but its code wasn't built-in.
So you can (re)build separately a module which is already configured AS being a module in the kernel, but not when the kernel has NO support for that module AS a module yet.
Most kernel options have one of three states:
Code:
yes    this code will be built-into the kernel
module the code can be built as a module and dynamically loaded
       (you need a separate "make modules" or such to build it)
no     the kernel doesn't have support for that option/module at all
To take just a simple example
Code:
CONFIG_SCSI=y         generic SCSI support is built-in
CONFIG_SCSI_MOD=y     and there's support for extension through modules
but
CONFIG_SCSI_AIC7XXX=m the Adaptec adaptor SCSI code I need is a loadable module
CONFIG_SCSI_SCAN_ASYNC is not set    and I do not need async scanning
(all from one of the last kernels I did compile/tune completely for my system)

Last edited by ehartman; 06-30-2019 at 04:46 AM.
 
1 members found this post helpful.
Old 06-30-2019, 05:04 PM   #9
plisken
Member
 
Registered: Dec 2001
Location: Scotland
Distribution: Slackware 9.1-15 RH 6.2/7, RHEL 6.5 SuSE 8.2/11.1, Debian 10.5
Posts: 518

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by ehartman View Post
Only if the kernel has the "hook" for the module but its code wasn't built-in.
So you can (re)build separately a module which is already configured AS being a module in the kernel, but not when the kernel has NO support for that module AS a module yet.
This was my worry.

I'll have an opportunity again tomorrow to be hands on with the machine so will update progress, if for nothing else than interest sakes.

If only I knew something more about these RTAI modules
 
Old 07-01-2019, 04:52 AM   #10
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, RPi OS under protest!
Posts: 18,364

Rep: Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813Reputation: 2813
Seems a very standard thing. Plenty online about RTAI in kernel docs, e.g.https://www.kernel.org/doc/ols/2001/rtai.pdf
 
Old 09-17-2020, 03:07 AM   #11
plisken
Member
 
Registered: Dec 2001
Location: Scotland
Distribution: Slackware 9.1-15 RH 6.2/7, RHEL 6.5 SuSE 8.2/11.1, Debian 10.5
Posts: 518

Original Poster
Rep: Reputation: 32
Was passing through and thought I'd bring closure to this as, especially as I've since moved on from the company but did find it particularly interesting.

I wrote a brief blog post to document the process, albeit mostly how to install the kernel and not the actual process involved in getting to that stage, but regardless, it can be found here:
https://blog.david14.com/2020/06/scs...mouse-and.html.

I think essentially I just used the same source and didn't change the EXTRAVERSION in Makefile so that once built, the modules would have no issues being inserted into the new kernel (I believe thinking it was the same?).

I used the same .config file and then;

make menuconfig
make dep
make bzimage

copy bzimage to /boot
copy System.map to /boot
update lilo.conf

I added any additional support needed, specifically the usb stuff into the kernel as opposed to modules, hence not needing to build any new modules and rebuild any existing modules.

In the end, I think I was overthinking things and over complicating things but it was nice to use some old Slackware again. Unfortunately, my new company (old company as I've returned after some 23 years or so) use Debian servers (several versions old) so I'm on the learning curve again.

No comments needed, this was just for closure...
 
Old 09-17-2020, 03:23 AM   #12
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,542

Rep: Reputation: Disabled
Quote:
Originally Posted by plisken View Post
No comments needed, this was just for closure...
Then please mark this thread as [Solved]
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to create an RTAI patch to ARM9 processor bskumar7080 Linux - Software 0 03-23-2010 12:25 AM
insert lines into a file after calculating where to insert xonar Programming 13 12-24-2009 04:37 AM
My RT.APP on RTAI + PC104 Geode Vs RTAI + m-ITX VIA C7 - PUZZLE :-( sanitynotvanity Linux - Hardware 1 09-15-2008 01:56 AM
How to uninstall a RTAI patch satish427 Linux - Newbie 1 09-28-2004 11:01 PM
can't insert modules into 2.6 Kernel maxi Debian 5 02-11-2004 06:07 AM

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

All times are GMT -5. The time now is 04:57 PM.

Contact Us - Advertising Info - Rules - Privacy - Donations - Contributing Member - LQ Sitemap - "Weather apps tell you it'll rain. Wyndo tells you when to go."
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