LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 08-29-2022, 06:48 AM   #1
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,341
Blog Entries: 3

Rep: Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733
Loading a custom driver automatically at boot time


I have a hardware driver which I must build by hand from the vendor's Git repository. That part works fine, though I would prefer an official, generic APT package. The module loads manually no problem, but what do I change and where in order to have the module loaded at boot time?

Code:
$ sudo insmod /usr/lib/modules/5.18.0-4-amd64/kernel/drivers/vendor/vendor.ko

$ uname -a
Linux laptop 5.18.0-4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.16-1 (2022-08-10) x86_64 GNU/Linux

$ lsb_release -rd
Description:	Devuan GNU/Linux 5 (daedalus/ceres)
Release:	5
And does it matter that the following don't match up?

Code:
$ uname -r -v
5.18.0-4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.16-1 (2022-08-10)
PS. Some of the above is blocked by clownflare, specifically the utility which starts with "u".
 
Old 08-29-2022, 01:00 PM   #2
Arnulf
Member
 
Registered: Jan 2022
Location: Hanover, Germany
Distribution: Slackware
Posts: 270

Rep: Reputation: 89
If you won't call a spade a spade it will be nearly impossible to help you.
 
Old 08-29-2022, 01:30 PM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,423

Rep: Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339
why not build it into the initrd or specify it's loading in grub? It saves you farting about with insmod.
 
Old 08-29-2022, 01:33 PM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,341

Original Poster
Blog Entries: 3

Rep: Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733
Quote:
Originally Posted by business_kid View Post
... or specify it's loading in grub?
Because I find GRUB2 terribly confusing, difficult, risky, and overly complex. I can see the GRUB2 route working if I can figure it out after a lot of experimental reboots. But I'd like to postpone that approach if possible.

I was hoping that there would simply be a file somewhere in /etc/ where I could list the module, perhaps with full path if necessary, and it would be loaded upon boot.
 
Old 08-30-2022, 04:21 AM   #5
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,423

Rep: Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339
Then the initrd is the way to go. Just rebuild the initrd, or add your module to /boot-initrd-tree and rebuild it without clearing the tree. Being honest, with uefi I use elilo.

What I found was that on the EFI partition, in the EFI directory, there's a directory for each boot option like this
Code:
tree /boot/efi
/boot/efi
└── EFI
    ├── Boot
    │** └── bootx64.efi
    ├── Microsoft
[SNIP VAST REAMS OF PURE M$ WASTE OF SPACE]    
    └── Slackware
        ├── elilo.conf
        ├── elilo.efi
        ├── initrd-5.15.27.gz
        └── vmlinuz-generic-5.15.27
The efi is the executable, the kernel & initrd are there, & elilo.conf. There'll be something similar for all the other boot options

EDIT: You don't appear to have boot options in elilo.

Last edited by business_kid; 08-30-2022 at 04:28 AM.
 
Old 08-30-2022, 04:47 AM   #6
petelq
Member
 
Registered: Aug 2008
Location: Yorkshire
Distribution: openSUSE(Leap and Tumbleweed) and a (not so) regularly changing third and fourth
Posts: 629

Rep: Reputation: Disabled
Put the module in /etc/modules-load.d.
 
Old 08-30-2022, 07:26 AM   #7
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,341

Original Poster
Blog Entries: 3

Rep: Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733
Quote:
Originally Posted by petelq View Post
Put the module in /etc/modules-load.d.
Thanks. I tried putting the name in a .conf file there, both just the module.ko and the full path. Neither caused the module to load on boot. So I am missing something in the process.

I'll look at GRUB2 next when I can plan some reboots.
 
Old 08-30-2022, 08:10 AM   #8
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,665
Blog Entries: 19

Rep: Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490
There used to be a modprobe file or a modprobe.d directory to put that kind of thing in. But I'm pretty sure it didn't use the .ko suffix in module names.

Last edited by hazel; 08-30-2022 at 08:15 AM.
 
Old 08-30-2022, 10:23 AM   #9
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,423

Rep: Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339
Yeah, etc/modprobe.d/ is it, but / isn't even mounted ro yet.

The initrd is the place - if he has one.
 
  


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
Custom Kernel Module: How may I access my ADC (mcp3208) via SPI within my custom driver? d3adwood Programming 0 03-22-2018 09:45 PM
[SOLVED] The system time switches the time zone automatically but doesn't change the time RandomTroll Linux - Software 9 03-15-2013 12:28 PM
Finding Module Dependencies...(Still loading...still loading..still loading..HANG!!!) Aeudian Linux - General 3 08-11-2003 03:31 PM
Finding Module Dependencies.....(still loading....Still loading....still loading) Aeudian Linux - Newbie 1 07-28-2003 02:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:41 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