Message ID | 1463409763-11832-1-git-send-email-abrodkin@synopsys.com |
---|---|
State | Changes Requested |
Delegated to: | John Crispin |
Headers | show |
On Mon, May 16, 2016 at 05:42:43PM +0300, 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. Well, some of the tiniest AR7 boxes out there come with a bootloader expecting ELF binaries... I didn't have a close look, just assuming that they might be affected. May Florian knows more...? Cheers Daniel > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> > --- > include/kernel-defaults.mk | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk > index 406fd46..0166dc5 100644 > --- a/include/kernel-defaults.mk > +++ b/include/kernel-defaults.mk > @@ -142,7 +142,7 @@ endif > define Kernel/CopyImage > cmp -s $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug || { \ > $(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)$(1); \ > - $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf; \ > + $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf; \ > $(CP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug; \ > $(foreach k, \ > $(if $(KERNEL_IMAGES),$(KERNEL_IMAGES),$(filter-out dtbs,$(KERNELNAME))), \ > -- > 2.5.5 > > > _______________________________________________ > Lede-dev mailing list > Lede-dev@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/lede-dev
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@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. - Felix
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@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. -Alexey
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@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. - Felix
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@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 b) use "--strip-unneeded" instead of currently used "-S" (which is an alias to "--strip-all"). -Alexey
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@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
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index 406fd46..0166dc5 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -142,7 +142,7 @@ endif define Kernel/CopyImage cmp -s $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug || { \ $(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)$(1); \ - $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf; \ + $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf; \ $(CP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug; \ $(foreach k, \ $(if $(KERNEL_IMAGES),$(KERNEL_IMAGES),$(filter-out dtbs,$(KERNELNAME))), \
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@synopsys.com> --- include/kernel-defaults.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)