[LEDE-DEV] [PATCH] include/kernel: Do not strip kernel's Elf
Felix Fietkau
nbd at nbd.name
Wed May 18 07:03:01 PDT 2016
On 2016-05-18 15:59, Alexey Brodkin wrote:
> Hi Felix,
>
> On Wed, 2016-05-18 at 15:49 +0200, Felix Fietkau wrote:
>> On 2016-05-18 15:06, Alexey Brodkin wrote:
>> >
>> > Hi Felix,
>> >
>> > On Wed, 2016-05-18 at 14:57 +0200, Felix Fietkau wrote:
>> > >
>> > > On 2016-05-16 16:42, Alexey Brodkin wrote:
>> > > >
>> > > >
>> > > > If an image gets built as an Elf there's a chance
>> > > > it will be used by developers for debugging purposes.
>> > > > In that case it's very helpful to keep debugging info
>> > > > in that image.
>> > > >
>> > > > I would think that most OWRT-powered devices in production
>> > > > will use some form of binary image for booting so Elf
>> > > > flavours could be left a bit bulkier with more debug info
>> > > > inside.
>> > > >
>> > > > Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
>> > > You can get the bulky one directly from the kernel source directory, and
>> > > there is definitely some value in having stripped ELF binaries as well
>> > > for devices that can load them.
>> > Well indeed in kernel's source directory we have an unstripped elf.
>> > But what happens at least in case of ARC we build only one kernel's elf
>> > and then as a post-built step we patch in .dtb for all boards we build OWRT.
>> >
>> > In other words in "bin/arc770-uClibc" folder I have:
>> > 1) openwrt-arc770-generic-axs101-initramfs.elf
>> > 2) openwrt-arc770-generic-nsim_700-initramfs.elf
>> >
>> > Both are stripped but work as they are on the corresponding boards.
>> >
>> > In "build_dir/target-arc_arc700_uClibc-1.0.9/linux-arc770_generic/linux-4.4.7/"
>> > I have perfectly unstripped vmlinux but it won't work on either board because of
>> > missing device tree blob.
>> >
>> > That means if one wants to get image for a board X with debug symbols he or she
>> > will need to do manual patching in of .dtb. Which is not the most convenient thing ever.
>> It's a lot simpler than that: You can boot the stripped and patched elf
>> image from bin/ and use the vmlinux from the kernel source for the
>> debugger afterwards. They are fully compatible.
>
> Good point. So indeed if we do want stuff in "bin/" folder to be stripped
> that seems to be the simplest approach.
>
> But what if we with addition of another config option:
> a) toggle kernel's CONFIG_DEBUG_INFO
There's a config option for that already, and it's enabled by default.
> b) use "--strip-unneeded" instead of currently used "-S" (which is an alias to "--strip-all").
Why?
- Felix
More information about the Lede-dev
mailing list