Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 209387 - [patch] sys-kernel/genkernel - add --strip option
Summary: [patch] sys-kernel/genkernel - add --strip option
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard: Cross compilation concerns need to be...
Keywords: Inclusion, PATCH
Depends on:
Blocks: 245389
  Show dependency tree
 
Reported: 2008-02-08 20:03 UTC by Brent Baude (RETIRED)
Modified: 2017-06-27 13:46 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
First pass at a --strip command (cmd_strip.patch,2.86 KB, patch)
2009-02-27 05:51 UTC, Robert Trace
Details | Diff
Add --strip command (cmd_strip_v2.patch,3.40 KB, patch)
2009-09-12 05:10 UTC, Robert Trace
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Baude (RETIRED) gentoo-dev 2008-02-08 20:03:48 UTC
This is a feature request to add a --strip option to genkernel which would strip the resulting vmlinux.

Reproducible: Always
Comment 1 Andrew Gaffney (RETIRED) gentoo-dev 2008-07-29 12:01:43 UTC
What exactly needs to be done for this? Is there a 'make strip'? Can the resulting kernel binary on all arches always be run through `strip`? Does this need some per-arch logic?
Comment 2 Brent Baude (RETIRED) gentoo-dev 2008-07-29 14:50:59 UTC
I think the simplest solution is to take the resulting kernel (vmlinux in our case) and run strip against it.
Comment 3 Chris Gianelloni 2008-11-03 12:43:22 UTC
Well, we could add support for it, since it won't be a default option, and ask people to help us test it on their systems.
Comment 4 Robert Trace 2009-02-27 05:51:39 UTC
Created attachment 183336 [details, diff]
First pass at a --strip command

Add the commands --no-strip and --strip=(all|kernel|modules).

I'm actually more interested in stripping the modules (I build modular kernels) and having >=100M of modules cluttering up my initramfs is distasteful.  Unstripped modules are also unecessary in /lib too.  Unstripped kernel and modules can (and should :-) stay in the build tree.

Because of the above sentiments, I made --strip=all the default (strip both the kernel and modules).

Feedback is welcome.
Comment 5 Robert Trace 2009-02-27 05:53:54 UTC
(In reply to comment #4)
> First pass at a --strip command

gah... I should add that this patch is against genkernel-3.4.10.
Comment 6 Robert Trace 2009-09-12 05:10:19 UTC
Created attachment 203849 [details, diff]
Add --strip command

Updated version of previous patch.  Assuming development is still originating at git://git.wolf31o2.org/projs/genkernel.git, then this should apply cleanly to 588ef8 (current HEAD as of this date).

Changes:
 - Updated to latest git HEAD
 - Added missing documentation in genkernel.8
 - Added --strip=none as alias for --no-strip
Comment 7 Andrew Gaffney (RETIRED) gentoo-dev 2009-09-12 05:30:58 UTC
Instead of calling the host 'strip', wouldn't we want to use the cross-strip in the case of cross-compiling a kernel?
Comment 8 Robert Trace 2009-09-12 05:47:16 UTC
(In reply to comment #7)
> Instead of calling the host 'strip', wouldn't we want to use the cross-strip in
> the case of cross-compiling a kernel?

Yes, I agree.  I didn't dig through the cross compile paths too much yet, so I wasn't certain exactly certain what form it should take.  Is UTILS_CROSS_COMPILE the correct prefix?

BTW, other initramfs tools (busybox, lvm) call the host's strip after they build.  I'm guessing this is probably not correct either, but I didn't really look into it yet.
Comment 9 Sebastian Pipping gentoo-dev 2011-01-05 22:40:54 UTC
PS: Adding keyword "Inclusion" and "[patch] " prefix to better show this bugs nature in searches...
Comment 10 Richard Yao (RETIRED) gentoo-dev 2013-06-06 07:30:43 UTC
(In reply to Brent Baude from comment #0)
> This is a feature request to add a --strip option to genkernel which would
> strip the resulting vmlinux.
> 
> Reproducible: Always

INSTALL_MOD_STRIP does not appear to actually be used by anything.

(In reply to Andrew Gaffney from comment #7)
> Instead of calling the host 'strip', wouldn't we want to use the cross-strip
> in the case of cross-compiling a kernel?

This is true.

(In reply to Robert Trace from comment #8)
> (In reply to comment #7)
> > Instead of calling the host 'strip', wouldn't we want to use the cross-strip in
> > the case of cross-compiling a kernel?
> 
> Yes, I agree.  I didn't dig through the cross compile paths too much yet, so
> I wasn't certain exactly certain what form it should take.  Is
> UTILS_CROSS_COMPILE the correct prefix?
> 
> BTW, other initramfs tools (busybox, lvm) call the host's strip after they
> build.  I'm guessing this is probably not correct either, but I didn't
> really look into it yet.

This will require improving genkernel's code to be better suited to cross compilation. At the moment, it works, but it works only because so many hooks have been put in place to make what is there work. Adding new features that need to interact with cross compilation in a sane way is somewhat painful.
Comment 11 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2017-01-03 05:16:29 UTC
[master c2525c6] Strip kernel & modules
 Author: Robert Trace <bugzilla-gentoo@farcaster.org>
 5 files changed, 36 insertions(+)
Comment 12 Anna Tikhomirova 2017-06-27 13:42:08 UTC
This patch does something wrong. After this commit (https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c2525c65b9f3d5849963bab6beb40817d7720218) genkernel "strips" bzImage effectively breaking it.

# file /usr/src/linux/arch/x86/boot/bzImage 
/usr/src/linux/arch/x86/boot/bzImage: Linux kernel x86 boot executable bzImage, version 4.11.7-gentoo (root@localhost) #1 SMP Tue Jun 27 15:46:22 MSK 2017, RO-rootFS, swap_dev 0x3, Normal VGA
# file /boot/kernel-genkernel-x86_64-4.11.7-gentoo 
/boot/kernel-genkernel-x86_64-4.11.7-gentoo: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows+

See bug #622716