* Stripping in module
@ 2005-07-25 6:23 Budde, Marco
2005-07-25 7:29 ` Jan Engelhardt
0 siblings, 1 reply; 7+ messages in thread
From: Budde, Marco @ 2005-07-25 6:23 UTC (permalink / raw)
To: linux-kernel
Hi,
at the moment I am packaging a Linux module as an RPM archive.
Therefor I would like to remove some of the not exported/needed
symbols (like e.g. static functions or constants) from the
Linux module.
What is the best way to do this with v2.6.
I have tried e.g. to remove all symbols starting with "telos"
from the module like this (after kbuild):
strip -w -K '!telos*' -K 'telosi2c_usb_driver' telosi2c_linux.ko
When I try to load such a module, insmod dies with a segmentation
fault or the complete kernel dies (with "invalid operand: 0000").
What is the reason for this problem?
What is the correct way using kbuild to remove some symbols?
cu, Marco
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Stripping in module
2005-07-25 6:23 Stripping in module Budde, Marco
@ 2005-07-25 7:29 ` Jan Engelhardt
2005-07-25 11:26 ` Wakko Warner
0 siblings, 1 reply; 7+ messages in thread
From: Jan Engelhardt @ 2005-07-25 7:29 UTC (permalink / raw)
To: Budde, Marco; +Cc: linux-kernel
>What is the best way to do this with v2.6.
>
>I have tried e.g. to remove all symbols starting with "telos"
>from the module like this (after kbuild):
>
> strip -w -K '!telos*' -K 'telosi2c_usb_driver' telosi2c_linux.ko
Yes, I'd also be interested in what sections can actually be stripped, if any.
Userspace shared libs for example can be `strip -s`'ed and they still work as
expected, does not look like this holds for kernel modules.
Jan Engelhardt
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Stripping in module
2005-07-25 11:26 ` Wakko Warner
@ 2005-07-25 11:23 ` Michael Tokarev
2005-07-25 16:27 ` Wakko Warner
0 siblings, 1 reply; 7+ messages in thread
From: Michael Tokarev @ 2005-07-25 11:23 UTC (permalink / raw)
To: Wakko Warner; +Cc: Jan Engelhardt, linux-kernel
Wakko Warner wrote:
[]
> I would also be interested in this. For instance the AIC7xxx driver has
> every PCI id in the module I think in the .modinfo section which is not
> truely required once depmod has been run. []
The .modinfo section, for example the PCI IDs, IS required for the
module to function properly. The kernel and the module uses that
tables to determime which devices to work with, and with which paramteres.
/mjt
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Stripping in module
2005-07-25 7:29 ` Jan Engelhardt
@ 2005-07-25 11:26 ` Wakko Warner
2005-07-25 11:23 ` Michael Tokarev
0 siblings, 1 reply; 7+ messages in thread
From: Wakko Warner @ 2005-07-25 11:26 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: linux-kernel
Jan Engelhardt wrote:
> >What is the best way to do this with v2.6.
> >
> >I have tried e.g. to remove all symbols starting with "telos"
> >from the module like this (after kbuild):
> >
> > strip -w -K '!telos*' -K 'telosi2c_usb_driver' telosi2c_linux.ko
>
> Yes, I'd also be interested in what sections can actually be stripped, if any.
> Userspace shared libs for example can be `strip -s`'ed and they still work as
> expected, does not look like this holds for kernel modules.
I would also be interested in this. For instance the AIC7xxx driver has
every PCI id in the module I think in the .modinfo section which is not
truely required once depmod has been run. I wanted to strip out this
information so that modules would be smaller. I had stripped this section
out in testing a floppy boot and then most modules would not load anymore.
--
Lab tests show that use of micro$oft causes cancer in lab animals
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Stripping in module
2005-07-25 11:23 ` Michael Tokarev
@ 2005-07-25 16:27 ` Wakko Warner
0 siblings, 0 replies; 7+ messages in thread
From: Wakko Warner @ 2005-07-25 16:27 UTC (permalink / raw)
To: Michael Tokarev; +Cc: linux-kernel
Michael Tokarev wrote:
> Wakko Warner wrote:
> []
> > I would also be interested in this. For instance the AIC7xxx driver has
> > every PCI id in the module I think in the .modinfo section which is not
> > truely required once depmod has been run. []
>
> The .modinfo section, for example the PCI IDs, IS required for the
> module to function properly. The kernel and the module uses that
> tables to determime which devices to work with, and with which paramteres.
I stripped out the section that had alias= and other vars from aic7xxx and
it still worked. Not all modules worked doing that.
--
Lab tests show that use of micro$oft causes cancer in lab animals
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Stripping in module
@ 2005-07-25 17:18 Christopher Allen Wing
0 siblings, 0 replies; 7+ messages in thread
From: Christopher Allen Wing @ 2005-07-25 17:18 UTC (permalink / raw)
To: Budde, Marco; +Cc: linux-kernel
Marco:
FWIW, the Red Hat kernel RPMs effectively do the following when they
package kernel modules:
strip -g <module.ko>
This is done via the script:
/usr/lib/rpm/brp-strip
which is implicitly run on all executable files packaged in the RPM.
If you ensure that the module .ko file is executable, then RPM will strip
it for you automatically.
-Chris Wing
wingc@engin.umich.edu
---
Budde, Marco <budde_at_telos.de> wrote:
> Hi,
>
> at the moment I am packaging a Linux module as an RPM archive.
>
> Therefor I would like to remove some of the not exported/needed
> symbols (like e.g. static functions or constants) from the
> Linux module.
>
> What is the best way to do this with v2.6.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: Stripping in module
@ 2005-07-25 16:14 Aleksey Gorelov
0 siblings, 0 replies; 7+ messages in thread
From: Aleksey Gorelov @ 2005-07-25 16:14 UTC (permalink / raw)
To: Budde, Marco, linux-kernel
Well, the best you can do is
strip -R .note -R .comment --strip-unneeded.
If you go for more, module might not be loaded/initialized properlly
Aleks.
>-----Original Message-----
>From: linux-kernel-owner@vger.kernel.org
>[mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Budde, Marco
>Sent: Sunday, July 24, 2005 11:24 PM
>To: linux-kernel@vger.kernel.org
>Subject: Stripping in module
>
>Hi,
>
>at the moment I am packaging a Linux module as an RPM archive.
>
>Therefor I would like to remove some of the not exported/needed
>symbols (like e.g. static functions or constants) from the
>Linux module.
>
>What is the best way to do this with v2.6.
>
>I have tried e.g. to remove all symbols starting with "telos"
>from the module like this (after kbuild):
>
> strip -w -K '!telos*' -K 'telosi2c_usb_driver' telosi2c_linux.ko
>
>When I try to load such a module, insmod dies with a segmentation
>fault or the complete kernel dies (with "invalid operand: 0000").
>What is the reason for this problem?
>
>What is the correct way using kbuild to remove some symbols?
>
>cu, Marco
>
>-
>To unsubscribe from this list: send the line "unsubscribe
>linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-07-25 17:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-25 6:23 Stripping in module Budde, Marco
2005-07-25 7:29 ` Jan Engelhardt
2005-07-25 11:26 ` Wakko Warner
2005-07-25 11:23 ` Michael Tokarev
2005-07-25 16:27 ` Wakko Warner
2005-07-25 16:14 Aleksey Gorelov
2005-07-25 17:18 Christopher Allen Wing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®