how to reduce both vmlinuz size and modules?

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Sat Dec 26 14:16:14 EST 2015


On Sat, 26 Dec 2015 10:39:04 -0500, "Robert P. J. Day" said:

>   if i start with the latest git kernel repo, it *looks* like i can
> use the /boot/config-4.2.8-200.fc22.x86_64 config file as a starting
> point, copy it in as .config, then:
>
>  $ make allmodconfig
>  $ make localmodconfig

How much simpler could you make it? :)

The place you're most likely to screw it up is to forget to plug in all
your USB and other widgets at least once before the 'make localmodconfig'
to make sure they get modprobed.

As a practical matter, if 'make allmodconfig' had slightly different semantics,
we could do better.  'allmod' has semantics of 'turn on every possible =m'.
If there were a semantic of 'convert as many existing =y into =m, but *don't*
convert =n into =m', we could do this and it would almost certainly be
faster.

boot distro kernel
(plug in widgets)
make localmodconfig
boot into that kernel
make mostlymodconfig
boot
plug in widgets
make localmodconfig  *again*

The reason it would be faster - a Fedora Rawhide kernel has 2,793 =m, a
'allmodconfig' has 5,162 - but doing a 'localmodconfig' gets it down to
33 on my laptop (though admittedly I've made a lot of device drivers =y
so they're part of vmlinux - but /sys/module tells me there's a max of
133 or so of those).  So after the first 'localmodconfig', you've gotten
rid of probably 75% to 90% of the modules to build, and thus build time.
It's probably faster to do 3 builds like this than an allmod/mostlymod
pair.

Note that if you're *really* concerned about vmlinux size (like embedded
devices), you'll want to make a second pass through all the =y, and see
how many are system features you don't need, but which can't be modular.
Things like SYSV shared memory and IPC, BSD process accounting, and so on...

I wonder if adding a 'mostlymodconfig' to Kconfig would be worthwhile.
Comments?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151226/28a399b0/attachment.bin 


More information about the Kernelnewbies mailing list