Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I regularly create packages for Slackware Linux and part of the process is stripping binaries so that they take up less space. I find that if I strip --strip-all (or strip with no options) kernel modules, they often fail to insert:

FATAL: Error inserting cloop (/lib/modules/2.6.38.7-smp/kernel/fs/cloop/cloop.ko): Invalid module format

What level of stripping is recommended for kernel modules? If I use --strip-debug, will I remove debugging symbols that will negatively affect system performance and/or error logging?

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

Stripping all symbols removes the names of the symbols that the module calls. It's not going to work.

Stripping debugging symbols with strip --strip-debug *.ko (= strip -g *.ko) is safe. The kernel makefile does it for you if you run make INSTALL_MOD_STRIP=1 modules_install.

You can prevent debugging symbols being inserted in the first place by configuring your kernel with CONFIG_DEBUG_INFO not defined.

See also How do I strip local symbols from linux kernel module without breaking it?

share|improve this answer
add comment

I believe the safest approach is strip --strip-unneeded.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.