WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to make Tiny Core's small initrd modules file?  (Read 2160 times)

Offline qopit

  • Jr. Member
  • **
  • Posts: 72
How to make Tiny Core's small initrd modules file?
« on: May 14, 2016, 06:03:15 PM »
I'm compiling a new kernel (4.4.10 LTS), nominally with the intent of enabling the memory subsystem for cgroups, but in reality it is mostly for the experience of doing it (first time kernel build here).

The kernel compilation itself is (as a pleasant surprise) nice and easy with the available tiny core kernel config and:
Code: [Select]
make oldconfig
make nconfig
make

However, I'm having trouble getting the modules initrd file to match the one that comes with Tiny Core.

Packing up the initrd is ok (with `find lib | cpio -H newc -o | gzip -9 > modules64.gz`), but the resulting file is a whopping 22.9 MB. As a comparison, the core modules64.gz is only 6.4 MB. The wiki makes reference to this issue, but with no specifics on how the reduction is done. It also makes reference to some of the path adjustments, and a needed symlink, that are needed in the modules initrd.

To try and make them match I'm in the process of diffing the dir trees between an unpacked core modules64.gz and the one that I have created. However, it occurs to me that this process has probably been automated by the Tiny Core team for the release process...

Is there a script available for converting the "make modules_install" output into a suitable/filtered/minimized dir structure for cpio archiving into an initrd file? Or is this usually done by hand, given the infrequency of Tiny Core kernel updates?

As another side question: Assuming I don't mistakenly drop an expected kernel feature, will the latest core rootfs64.gz be compatible with any new vmlinuz and modules64.gz files I create? My assumption is that it will be due to backwards compatibility of the ABI, but I wanted to confirm this.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: How to make Tiny Core's small initrd modules file?
« Reply #1 on: May 14, 2016, 09:03:25 PM »
For a smaller initrd file read the packing section of http://wiki.tinycorelinux.net/wiki:remastering

Online curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10273
Re: How to make Tiny Core's small initrd modules file?
« Reply #2 on: May 15, 2016, 02:16:55 AM »
http://git.tinycorelinux.net/index.cgi?url=sorter/plain/sorter.sh

This script is used to create the module extensions, and what remains goes to the initrd. Yes, rootfs will be compatible if your kernel features match.
The only barriers that can stop you are the ones you create yourself.

Offline qopit

  • Jr. Member
  • **
  • Posts: 72
Re: How to make Tiny Core's small initrd modules file?
« Reply #3 on: May 15, 2016, 05:29:06 AM »
sorter.sh is precisely what I was looking for and a LOT more. Thanks!!

No advdef usage in that script. Does this save unpacking time vs gzip -9 alone?

Online curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10273
Re: How to make Tiny Core's small initrd modules file?
« Reply #4 on: May 15, 2016, 07:46:14 AM »
I usually do an advdef run after gzipping yeah, just not mentioned in the comment.
The only barriers that can stop you are the ones you create yourself.