Tiny Core Linux

Tiny Core Base => TCB Talk => Topic started by: qopit on May 14, 2016, 06:03:15 PM

Title: How to make Tiny Core's small initrd modules file?
Post by: qopit 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 (http://wiki.tinycorelinux.net/wiki:custom_kernel) 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.
Title: Re: How to make Tiny Core's small initrd modules file?
Post by: gerald_clark on May 14, 2016, 09:03:25 PM
For a smaller initrd file read the packing section of http://wiki.tinycorelinux.net/wiki:remastering
Title: Re: How to make Tiny Core's small initrd modules file?
Post by: curaga 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.
Title: Re: How to make Tiny Core's small initrd modules file?
Post by: qopit 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?
Title: Re: How to make Tiny Core's small initrd modules file?
Post by: curaga on May 15, 2016, 07:46:14 AM
I usually do an advdef run after gzipping yeah, just not mentioned in the comment.