WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Kernel modules in multiple initrd files  (Read 6336 times)

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Kernel modules in multiple initrd files
« on: July 16, 2014, 01:37:51 AM »
I'm trying to master an additional initrd (beyond core.gz) that has kernel modules in it.

eg: initrd=/tce/boot/core.gz,/tce/boot/scsi_drivers.gz

Is this possible, or do I need to remaster the "first" initrd (core.gz above) to include my new modules?  This is what I have been doing so far, but isolating the initrd would be nice.

My confusion is on how to merge the dep data in the additional initrd with the original one.  How is the initial dep data even loaded for kernel modules in the initrd?  I gather that for tcz/extensions it is done dynamically via insmod, but... ??

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815
Re: Kernel modules in multiple initrd files
« Reply #1 on: July 16, 2014, 02:26:39 AM »
You'd perhaps be better to start with rootfs.gz and modules.gz rather than core.gz

i.e. replace:
Code: [Select]
initrd=/tce/boot/core.gz
..with:
Code: [Select]
initrd=/tce/boot/rootfs.gz, /tce/boot/modules.gz
..then you'd only have to mess with the modules part of things

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Kernel modules in multiple initrd files
« Reply #2 on: July 16, 2014, 02:28:23 AM »
Dep data is in files modules.dep, modules.symbols, and modules.alias in  /lib/modules/3.8.13-tinycore/
You would have to include these  updated files in the second initrd.

Another option is to use the pretce boot option "pretce=RAM".
Add to your second initrd the executible file /tmp/onpre.sh that contains the following command.

depmod -a

This will cause tc-config to run the file before drives are mounted to access the tce directory.

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: Kernel modules in multiple initrd files
« Reply #3 on: July 16, 2014, 03:24:52 AM »
Juanito:
Thanks for the advice on dealing with rootfs.gz and modules.gz separately.  I am definitely doing this.

gerald_clark:
If the modules.* files are included in the second initrd, won't they overwrite the ones from the first one?  I don't understand how this would work.

The pretce option is a cool one. I did not know about that!  However, I was curious how long that would take on every boot:

Code: [Select]
$ time sudo depmod -a
real    0m 1.53s
user    0m 0.46s
sys     0m 0.35s

Not enormous, but more than I want to pay if inclusion in the (re)master avoids it. :)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Kernel modules in multiple initrd files
« Reply #4 on: July 16, 2014, 05:58:53 AM »
Quote
If the modules.* files are included in the second initrd, won't they overwrite the ones from the first one?  I don't understand how this would work.

Yes, so they should be the complete dep files (for modules in all initrds). But the easiest way with no duplication is to remaster modules.gz with your added modules, and update the .dep there.
The only barriers that can stop you are the ones you create yourself.

Offline hiro

  • Hero Member
  • *****
  • Posts: 1229
Re: Kernel modules in multiple initrd files
« Reply #5 on: December 21, 2022, 04:29:16 PM »
i have been googling for a long time and i barely see this referenced anywhere, had to figure it out by trial&error in the end.
it's also not clear where the docs should be, in my case i suppose this is an ipxe feature, so the syntax is slightly different, but i'm not even sure about that :D

in any way here's what i figured out. with modern tc you can boot with pxe even when using the separate modules and rootfs for initrd.
this worked for me from the ipxe console:

Code: [Select]

kernel http://tinycorelinux.net/13.x/x86_64/release/distribution_files/vmlinuz64 loglevel=3 initrd=modules64.gz initrd=rootfs64.gz
module http://tinycorelinux.net/13.x/x86_64/release/distribution_files/modules64.gz
initrd http://tinycorelinux.net/13.x/x86_64/release/distribution_files/rootfs64.gz
boot

somehow this thread is the only thing that mentions tinycorelinux and that "initrd=" option.
it's needed, somehow without this, the kernel doesn't know where root comes from. (errors like "VFS: Cannot open root device "(null)" or unknown-block"...).

initrd=file1,file2 doesn't work in this case, instead you just have to supply initrd= twice.

if anybody knows how this can be documented in a central place, that would be very nice for new users now that i found out how :)
i was expecting to find information about how modules64.gz and rootfs64.gz goes together (and are the same as corepure64.gz alone) on the main site, as that's important enough.

horrible modern EFI based system, and this problem kept me from enjoying TC for a while now. maybe this means i can afford some more time with tc again.

Offline gadget42

  • Hero Member
  • *****
  • Posts: 789
Re: Kernel modules in multiple initrd files
« Reply #6 on: December 22, 2022, 04:59:46 AM »
it would be good to modify parts of the above post so that...if used by the greater interwebz...it wouldn't cause some 'serious'(?) server abuse...sigh...
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580

Offline hiro

  • Hero Member
  • *****
  • Posts: 1229
Re: Kernel modules in multiple initrd files
« Reply #7 on: December 22, 2022, 07:52:16 PM »
I'm happy if even one person finds value in this. It's not abuse as the files are very small (smaller than the full iso).

I don't understand your definition of server abuse,.

I also noticed that this *was* documented somewhere else, too. Not in the docs, but by example:
http://boot.ipxe.org/tinycore.ipxe

Curiously they even picked our distro as the example! :D

I also found out more details about this issue. The OP in this thread was using the syslinux syntax to supply multiple initrd (just separated by commas). in ipxe this doesn't work and you have to adjust like shown above with multiple initrd= strings on the kernel line.

it's a common feature for multiboot-compatible bootloaders, even if syntax has to be adjusted every time slightly.
« Last Edit: December 22, 2022, 07:56:10 PM by hiro »

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: Kernel modules in multiple initrd files
« Reply #8 on: December 22, 2022, 09:36:53 PM »
The syslinux multiple initrd syntax does work in pxelinux though.

Offline hiro

  • Hero Member
  • *****
  • Posts: 1229
Re: Kernel modules in multiple initrd files
« Reply #9 on: December 23, 2022, 12:20:55 AM »
indeed.
syslinux: initrd=1,2,3
grub: initrd 1 2 3
ipxe: initrd=1 initrd=2 initrd=3