WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Help with trimming modules.gz to minimum size?  (Read 3581 times)

Offline flyingfishfinger

  • Jr. Member
  • **
  • Posts: 74
Help with trimming modules.gz to minimum size?
« on: January 16, 2020, 06:06:59 PM »
Hi,
I'm looking for a bit of assistance with trimming modules.gz. I've read the remastering guide and I should just be able to remove stuff I don't need and repack it, correct?

To that end, the "drivers/net" folder is the largest and under "ethernet" alone I find 3.5MB of stuff. I've got a Realtek chipset, so would I be correct in saying I can delete every folder in that directory except the Realtek one, to start with?

Is there a good method to take this further, like looking at what things DO get loaded when I boot Core on my machine and then delete everything that doesn't?

Cheers,
R


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11704
Re: Help with trimming modules.gz to minimum size?
« Reply #1 on: January 16, 2020, 10:01:44 PM »
Hi flyingfishfinger
Hi,
I'm looking for a bit of assistance with trimming modules.gz. I've read the remastering guide and I should just be able to remove stuff I don't need and repack it, correct? ...
Yes.

Quote
To that end, the "drivers/net" folder is the largest and under "ethernet" alone I find 3.5MB of stuff. I've got a Realtek chipset, so would I be correct in saying I can delete every folder in that directory except the Realtek one, to start with?
Modules can have dependencies, and they might be in other folders.

Quote
Is there a good method to take this further, like looking at what things DO get loaded when I boot Core on my machine and then delete everything that doesn't?
I suppose you could use the output of:
Code: [Select]
lsmodto decide which modules to keep. First make sure you've run all your installed programs in case any of them rely on any of the
modules included in the base. Here's a brief summary on unpacking/repacking the  modules.gz  file:
Code: [Select]
# Unpack  modules.gz  which is in the current directory
tc@E310:~$ mkdir -p tmp/extract
tc@E310:~$ cd tmp/extract/
tc@E310:~/tmp/extract$ zcat ../../modules64.gz | cpio -i -H newc -d
43955 blocks
# Make your changes, then repack modules.gz
tc@E310:~/tmp/extract$ depmod -a -b . 4.19.10-tinycore64
depmod: ./kernel.tclocal: No such file or directory
tc@E310:~/tmp/extract$ find lib usr | cpio -o -H newc | gzip -9 > ../modules64.gz
# The new  modules.gz  is in  tc@E310:~/tmp/
Replace  4.19.10-tinycore64  with the version you are running.