Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Adding a kernel module to installation iso image
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
arackhaen
n00b
n00b


Joined: 04 Jan 2013
Posts: 29
Location: Turku, Finland

PostPosted: Fri Dec 14, 2018 7:12 am    Post subject: Adding a kernel module to installation iso image Reply with quote

Hi,

This is mostly for learning purposes, so no acute problem for me.

I am installing a new installation to a HPE G10 server, that requires SMARTPQI driver. I haven't had this situation before with Gentoo, that Gentoo wouldn't have the necessary driver for this hardware already built in or as a module, so I was wondering how to add this module.
I mean, like if I would put the same kernel source to USB stick's data partition and then compile it as a module with the help of DKMS.

I will next check if SystemRescueCd's kernel has included the necessary driver (https://cateee.net/lkddb/web-lkddb/SCSI_SMARTPQI.html), so I could do the installation through that and that is why I said that this question is mostly for learning purposes. I have already checked discussions about catalyst and how to make your own livedvd, but it's not a best way for me at the moment. That I could do when I have time and it probably would be interesting.

This might not be the right place to say this, but of course I would appreciate, if smartpqi driver will be added to to default installation disk ISO in some point.
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5866

PostPosted: Fri Dec 14, 2018 12:17 pm    Post subject: Reply with quote

it's not fun, but can be done... catalyst is needed for making the iso, and the config you'll want to edit is https://github.com/gentoo/releng/blob/master/releases/weekly/kconfig/amd64/installcd-4.14.52.config

once you have then whole thing set up you run

Code:
# catalyst -v -f releng/releases/weekly/specs/amd64/installcd-stage1.spec
# catalyst -v -f releng/releases/weekly/specs/amd64/installcd-stage2-minimal.spec


and after a couple hours you have a new iso with your kernel config. 8)
_________________
Neddyseagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.

banned from #gentoo since sept 2017
Back to top
View user's profile Send private message
arackhaen
n00b
n00b


Joined: 04 Jan 2013
Posts: 29
Location: Turku, Finland

PostPosted: Sun Dec 16, 2018 12:41 pm    Post subject: Reply with quote

bunder wrote:
it's not fun, but can be done... catalyst is needed for making the iso, and the config you'll want to edit is https://github.com/gentoo/releng/blob/master/releases/weekly/kconfig/amd64/installcd-4.14.52.config

once you have then whole thing set up you run

Code:
# catalyst -v -f releng/releases/weekly/specs/amd64/installcd-stage1.spec
# catalyst -v -f releng/releases/weekly/specs/amd64/installcd-stage2-minimal.spec


and after a couple hours you have a new iso with your kernel config. 8)


I might give the catalyst a try. I had a vision of a situation, where I could just compile the module on USB stick's data partition and then modprobing it in. But this is good too. Acute need was passed already with SystemRescueCd, as they had that smartpqi driver in kernel, so I was able to install Gentoo through that.

Thanks a lot!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43562
Location: 56N 3W

PostPosted: Sun Dec 16, 2018 12:48 pm    Post subject: Reply with quote

arackhaen,

You can make the module externally, as you suggest but ...
It depends on every symbol in the existing kernel that your new module needs either to be available already, or can be provided by other things that can be made modules.
That's often but not always OK.

You must use the same version of gcc that the kernel was made with.

For the .ko to be in a random location, you use insmod, not modprobe.
It the case that you need several modules, load order is your problem. insmod won't work out the load order.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
arackhaen
n00b
n00b


Joined: 04 Jan 2013
Posts: 29
Location: Turku, Finland

PostPosted: Sun Dec 16, 2018 9:51 pm    Post subject: Reply with quote

Thanks a lot for your reply!

GCC version to be required to match with the kernel's building version was new information. That is not easy thing, because I don't know where I could read that. LiveDVD probably contains GCC and if that could be trusted to be the same version of GCC as the one used to build that LiveDVD's kernel, then it could be safe in LiveDVD case.

Insmod is not a friend, but this could be tried out. Load order might not be a problem in this example case.
I don't know how modprobe works, but got me wondering if creating an overlay fs on top of lib-modules directory would allow me to virtually copy the module file into the lib-modules directory of that kernel and modprobe would then work for loading it.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43562
Location: 56N 3W

PostPosted: Sun Dec 16, 2018 10:11 pm    Post subject: Reply with quote

arackhaen,

The liveDVD is built with catalyst. Its just different spec files to the liveCD. Its a self coherent whole.
The top line of dmesg will say something like
Code:
[    0.000000] Linux version 4.19.0-gentoo (root@NeddySeagoon_Static) (gcc version 8.2.0 (Gentoo 8.2.0-r3 p1.3)) #1 SMP PREEMPT Thu Oct 25 19:29:44 BST 2018

So gcc is easy to spot. That's 8.2.0-r3

The DVD already uses an overlay fs to make root appear writeable. It even has a persistent mode, so you could add the module to /lib/modules/'uname -r'/...
You would need to run modeps (thats probably wrong) to recalculate all the module interdependencies.
That's how modprobe knows what to load in what order, when you
Code:
modprobe random_module

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ali3nx
l33t
l33t


Joined: 21 Sep 2003
Posts: 612
Location: Vancouver, Canada

PostPosted: Mon Dec 17, 2018 12:00 am    Post subject: Reply with quote

bunder wrote:
it's not fun, but can be done... catalyst is needed for making the iso, and the config you'll want to edit is https://github.com/gentoo/releng/blob/master/releases/weekly/kconfig/amd64/installcd-4.14.52.config

once you have then whole thing set up you run

Code:
# catalyst -v -f releng/releases/weekly/specs/amd64/installcd-stage1.spec
# catalyst -v -f releng/releases/weekly/specs/amd64/installcd-stage2-minimal.spec


and after a couple hours you have a new iso with your kernel config. 8)


I've run into a similar issue related to the topic when testing the new efistub boot gentoo minimal and admin cd's with a bay trail intel SoC tablet.

I'm absolutely thrilled new livecd's added the kernel config options to boot from 32 bit efi firmware but the kernel provided by those livecd's has entirely omitted CONFIG_MTD.

I have a functional livecd to use to tinker with trying to get a minimal gentoo install working on that tablet but it's a fedora net install livecd that while it works it's systemd based and the sshd_config file was not included in the livecd meaning every time the cd is booted a zero byte sshd_config file needs to be created then sshd restarted. This also locks out the root user login by default on that livecd unless you add an ssh key. A minor annoyance that while i'm pleased to resolve just using gentoo install media would resolve entirely.

It would be great if gentoo livecd had the kernel features to support x86_64 hardware devices that only utilize memory technology block device based storage.

For many years there has been a large void of support for tablet influenced intel SoC based hardware that will only boot from efi32 firmware and finding a console only livecd with an ssh server that will also accommodate those devices has been a massive pita for many people. so much that someone made a bash script that repacks ubuntu iso images but those ubuntu install images don't work on all of the devices due to the graphical installer.

https://linuxiumcomau.blogspot.com/2017/06/customizing-ubuntu-isos-documentation.html

If there was a way to suggest the releng team officially consider adding kernel features to the minimal and admin cd's what would be the best avenue to suggest such a thing?

In the interm i've started setting up catalyst on my 20 core xeon server to try building a custom livecd as well as finally learn to use catalyst after fifteen years but i've run into a little use flag snag with busybox that i'm not certain how to resolve. i'm aware busybox should be static but my rudimentary attempt to resolve the conflict by omitting pam from the spec file had zero effect.


Code:
Calculating dependencies |

!!! Problem resolving dependencies for sys-apps/busybox                                                                                                                                                                                    ... done!

!!! The ebuild selected to satisfy "sys-apps/busybox" has unmet requirements.
- sys-apps/busybox-1.29.3::gentoo USE="ipv6 livecd pam static -debug -make-symlinks -math -mdev -savedconfig (-selinux) -sep-usr -syslog -systemd" ABI_X86="(64)"

  The following REQUIRED_USE flag constraints are unsatisfied:
    pam? ( !static )


Here's the slightly modified (not using a no-multilib stage 3) releng catalyst spec file i'm using. i changed to the base profile set because all this livecd will need to do is run sshd and display a local terminal as well as support usb ethernet connectivity as well as adding config_mtd device support.

Code:
# cat specs/installcd-stage1.spec
subarch: amd64
version_stamp: latest
target: livecd-stage1
rel_type: default
profile: default/linux/amd64/17.0
snapshot: latest
source_subpath: default/stage3-amd64-latest
compression_mode: pixz_x
portage_confdir: /var/tmp/catalyst/releases/

livecd/use:
        fbcon
        ipv6
        livecd
        lvm1
        modules
        ncurses
        nls
        nptl
        pam
        readline
        socks5
        ssl
        static-libs
        unicode
        xml

livecd/packages:
        app-accessibility/brltty
        app-admin/hddtemp
        app-admin/passook
        app-admin/pwgen
        app-admin/syslog-ng
        app-arch/unzip
        app-crypt/gnupg
        app-editors/mg
        app-editors/nano
        app-misc/screen
        app-portage/mirrorselect
        app-text/wgetpaste
        media-gfx/fbgrab
        net-analyzer/traceroute
        net-dialup/mingetty
        net-dialup/pptpclient
        net-dialup/rp-pppoe
        net-fs/cifs-utils
        net-fs/nfs-utils
        net-irc/irssi
        net-misc/dhcpcd
        net-misc/iputils
        net-misc/ndisc6
        net-misc/ntp
        net-misc/openssh
        net-misc/rdate
        net-misc/rsync
        net-misc/vconfig
        net-proxy/dante
        net-proxy/tsocks
        net-wireless/b43-fwcutter
### Masked (~keywords)
#       net-wireless/bcm43xx-fwcutter
        net-wireless/iw
        net-wireless/wireless-tools
        net-wireless/wpa_supplicant
        sys-apps/busybox
        sys-apps/dmidecode
        sys-apps/ethtool
        sys-apps/fxload
        sys-apps/gptfdisk
        sys-apps/hdparm
        sys-apps/hwsetup
        sys-apps/iproute2
        sys-apps/memtester
        sys-apps/netplug
        sys-apps/pciutils
        sys-apps/sdparm
        sys-apps/usbutils
        sys-block/parted
        sys-block/partimage
        sys-firmware/ipw2100-firmware
        sys-firmware/ipw2200-firmware
        sys-fs/btrfs-progs
        sys-fs/cryptsetup
        sys-fs/dmraid
        sys-fs/dosfstools
        sys-fs/e2fsprogs
        sys-fs/f2fs-tools
        sys-fs/jfsutils
        sys-fs/lsscsi
        sys-fs/lvm2
        sys-fs/mac-fdisk
        sys-fs/mdadm
        sys-fs/multipath-tools
        sys-fs/ntfs3g
        sys-fs/reiserfsprogs
        sys-fs/xfsprogs
        #force rebuild for USE="(-multilib*)"
        sys-libs/glibc
        sys-libs/gpm
        sys-power/acpid
        www-client/links


Suggestions regarding how to resolve this busybox use flag conflict within the catalyst environment would be appreciated.
_________________
Compiling Gentoo since version 1.4
Thousands of Gentoo Installs Completed
Emerged on every continent but Antarctica
Compile long and Prosper!
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5866

PostPosted: Tue Dec 25, 2018 4:40 am    Post subject: Reply with quote

ali3nx wrote:
If there was a way to suggest the releng team officially consider adding kernel features to the minimal and admin cd's what would be the best avenue to suggest such a thing?


Sorry for the delay, I must have missed this post... I would contact them directly. https://wiki.gentoo.org/wiki/Project:RelEng
_________________
Neddyseagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.

banned from #gentoo since sept 2017
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43562
Location: 56N 3W

PostPosted: Tue Dec 25, 2018 9:52 am    Post subject: Reply with quote

ali3nx,

Code:
  The following REQUIRED_USE flag constraints are unsatisfied:
    pam? ( !static )


If USE=pam then USE=static must be off.

Pick one, pam, static or neither but not both.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum