Addition to Tomas M of Slax "initramfs_create" function

Moderator: Forum moderators

Post Reply
User avatar
wiak
Posts: 3659
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 1019 times
Contact:

Addition to Tomas M of Slax "initramfs_create" function

Post by wiak »

As I indicated I also used Tomas M initramfs_create function (in separate dependency script) to create the initrd.img I use with KLA.

There was an extra reason/advantage to doing that for Arch Linux case:

A year or two ago upstream Arch Linux moved to using zst compression of its kernel modules, which it turned out broke my earlier WDL_Arch64 new builds. I discovered back then that that was because busybox (still) doesn't support zst compression (and it is a big piece of code to patch into busybox as it happens) so busybox modprobe couldn't load zst compressed modules. Since that time, for WDL_Arch use, I have therefore been making an alternative skeleton initrd that included kmod plus lib dependencies into the original FR initrd I used for booting WDL_Arch64. Problem with that has been that I needed to maintain that special kmod skeleton initrd as well as the one used by KLV-Airedale, and also it is swelled in size because of the kmod stuff..

However... using Tomas M initramfs_create function allowed me to easily first uncompress the Arch zst modules at build time and only include any required ones in the resulting initrd.img. In fact it is advantageous to use uncompressed modules since both the initrd and the main root filesystem get compressed anyway and you end up with better overall compression if you compress the whole set of modules at last step rather than compress already compressed modules, if you see what I mean...

However, Tomas M initramfs_create function as provided at https://github.com/Tomas-M/linux-live/b ... mfs_create only uses xz (per its line 151):

Code: Select all

find . -print | cpio -o -H newc 2>/dev/null | xz -T0 -f --extreme --check=crc32 >$INITRAMFS.img 

So I change that very slightly to allow for distros that use other module compression types such as gz and zst, via:

Code: Select all

case $2 in  #wiak: providing extra compression choices than xz
  gz) find . -print | cpio -o -H newc 2>/dev/null | gzip >../$INITRAMFS.img
  ;;
  xz) find . -print | cpio -o -H newc 2>/dev/null | xz -T0 -f --extreme --check=crc32 >../$INITRAMFS.img
  ;;
  zst) find . -print | cpio -o -H newc 2>/dev/null | zstd -6 >../$INITRAMFS.img  # wiak - should investigate alternative compression factors
  ;;
esac

where script arg $2 is used to pass compression type.

Net result, for example, is that KLA_OT2 is no longer based on alternative kmod-including initrd, but just built directly starting with the same skeleton initrd as KLV uses since the modules added into it via Tomas M function are auto-uncompressed so busybox modprobe has no issue with them. That's a big plus since it was a real pain having to maintain that alternative kmod initrd variant... This will also apply to new version of firstribit (i.e. old weedogit) when it comes to the FR initrd for upstream Arch-based distros. Not sure when I'll get round to that next firstribit though - did make one at one point a couple of months back (a quick hack...), but then worked on something else and forgot about it and can't remember where I left off...

At the moment I'm busy re-installing Zorin for business use, though now that printing is working fine on my KLV install I'm tempted to use that instead actually, but my partner will want to keep with Ubuntu-based distro, for various app-related reasons, so Zorin continues to fit the bill and my keeping familiar with its maintenance is very important so I better stick with that too... As one of many items on my own experiment todo list I'm hoping to have another look at using SG2D; crazy really since I don't really use it, but I want to see if it is still able to boot KL distros and I have a slight boot improvement in mind for the initrd that may or may not be easy to implement. I suppose I should take another quick look at Ventoy again at the same time, but I really didn't like it or understand what info it was expecting); SG2D is easy enough, but Ventoy docs failed to cross my brain barrier - of course my 'not liking it' is more about my not taking time to understand it; I'm pretty sure Ventoy is a great product - I'm just a bit overloaded and more than a bit lazy at reading technical details required sometimes. I am somewhat biased in that I find traditional frugal installs pretty easy to make anyway and without needing some specially installed support system like SG2D or Ventory to use them, and it is easy enough to get grub2 to boot from an iso anyway, which could simply be scripted (well, to some extent I suppose that is what SG2D is, albeit a somewhat complicated under the hood one - you do need a working grub installation either way).

Last edited by Wiz57 on Sun Dec 11, 2022 10:47 am, edited 1 time in total.
Reason: corrected spelling of Tomas M

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
Wiz57
Moderator
Posts: 494
Joined: Fri Dec 13, 2019 3:54 pm
Location: Chickasha, OK USA
Has thanked: 74 times
Been thanked: 78 times

Re: Addition to Tomas M of Slax "initramfs_create" function

Post by Wiz57 »

It's been so long since I played with the Linux Live scripts from Tomas M, I may not be remembering correctly but at the time of Tomas'
releasing them only xz compression was in much use. Slax was a neat little distro, still have a USB thumb drive somewhere with it
installed (both version 6.1.2 and 7.0.5). That was my introduction to modular small Linux distros and the convenience they offer
to be able to take your system with you via thumb drive.
Wiz

Signature available upon request

User avatar
wiak
Posts: 3659
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 1019 times
Contact:

Re: Addition to Tomas M of Slax "initramfs_create" function

Post by wiak »

Wiz57 wrote: Sun Dec 11, 2022 10:53 am

It's been so long since I played with the Linux Live scripts from Tomas M, I may not be remembering correctly but at the time of Tomas'
releasing them only xz compression was in much use. Slax was a neat little distro, still have a USB thumb drive somewhere with it
installed (both version 6.1.2 and 7.0.5). That was my introduction to modular small Linux distros and the convenience they offer
to be able to take your system with you via thumb drive.
Wiz

Yes, from recently reading more about it, Slax seems to be a nice system with a long history in this small distro oriented field. I actually can't remember if I've ever tried it, though I should have done really. As for Linux Live - for some daft reason I used to confuse that with Debian Live (which of course it isn't)... and thinking anything Debian build system a bit complex, avoided ever looking into it further since I was looking for first principles simplicity, not sophisticated all nuts and bolts included. However, fredx181 has been using that Tomas M method for slimming down DebianDog initrd for a long while now (such 'media modules' slimming being useful because the DebianDogs do not use huge kernels by default so need to include any possibly required disk media driver/modules in the initrd to allow booting). I first became aware of the method (though didn't get round to reading the code extract at the time) from some posts forum member gumanzoy sent to fredx181 advocating the method such that fred tried it again (Fred having rejected it previously).
viewtopic.php?p=24488#p24488
However I never got round to properly experimenting with it myself till now/recently because it wasn't essential for my project needs, but certainly nice and useful. I'm not myself using Linux Live otherwise, but find that little slim function a useful extra utility that I can optionally call from my build scripts.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

Post Reply

Return to “KL-Dev_Work”