You are not logged in.

#1 2024-01-11 13:16:38

raddirad
Member
Registered: 2024-01-11
Posts: 2

[SOLVED] Trying to rebuild a kernel

Hi,

my background is the following:
I am a developer at a small company developing a tool to provision operating systems and software.
The OS provisioning part uses a small Ubuntu based miniroot with a current kernel.
However the kernel config hasn't really changed from kernel 3.X and only adapts the suggested changes up to kernel 6.6 now.
We wanted to try a fresh start with a non bloated kernel that starts on a large list of clients. Sometimes we have to suggest customers to use different kernel append parameters to make their hardware boot correctly

I am having a problem to rebuild the Kernel used in Manjaro (6.6.8) and SystemRescue (6.1.69)
After installing Arch on a VM I took a look in /lib/modules/ to check the size of the directory, which was about 500MB. Same goes for SystemRescue, which uses Arch as base.

I took the kernel config from /proc/config.gz and extracted the config with the extract-ikconfig script from the booted kernel.

Whenever I build the kernel and install the modules in a chroot environment the kernel modules directory in /lib/modules/ is about 1.5GB in size

Can someone explain to me how this difference in size can happen?
What Do I need to do to reduce the size of the modules when using this kernel config?

Regards
raddirad

Last edited by raddirad (2024-01-15 06:52:09)

Offline

#2 2024-01-11 15:21:18

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,164

Re: [SOLVED] Trying to rebuild a kernel

The kernel modules are compressed with zstd. You're probably not setting that/not passing ZSTD_CLEVEL to make/not stripping debug symbols however you are building your kernel. I suggest you read/look at the PKGBUILD of how Arch builds the kernel https://gitlab.archlinux.org/archlinux/ … type=heads and https://wiki.archlinux.org/title/Kernel … ild_system

Last edited by V1del (2024-01-11 15:23:54)

Offline

#3 2024-01-12 08:25:45

raddirad
Member
Registered: 2024-01-11
Posts: 2

Re: [SOLVED] Trying to rebuild a kernel

Thanks for your advice

running the command

ZSTD_CLEVEL=19 make INSTALL_MOD_STRIP=1 modules_install

Shrinked it down to about 120MB. Amazing.

Regards
raddirad

Offline

#4 2024-01-12 11:40:56

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,164

Re: [SOLVED] Trying to rebuild a kernel

Please mark as [SOLVED] by editing the title in your first post.

Offline

Board footer

Powered by FluxBB