This is a feature request to add a --strip option to genkernel which would strip the resulting vmlinux. Reproducible: Always
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?
I think the simplest solution is to take the resulting kernel (vmlinux in our case) and run strip against it.
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.
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.
(In reply to comment #4) > First pass at a --strip command gah... I should add that this patch is against genkernel-3.4.10.
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
Instead of calling the host 'strip', wouldn't we want to use the cross-strip in the case of cross-compiling a kernel?
(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.
PS: Adding keyword "Inclusion" and "[patch] " prefix to better show this bugs nature in searches...
(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.
[master c2525c6] Strip kernel & modules Author: Robert Trace <bugzilla-gentoo@farcaster.org> 5 files changed, 36 insertions(+)
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