All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: Strip boot block built objects.
@ 2009-03-04  9:12 David Miller
  2009-03-04 11:59 ` Vesa Jääskeläinen
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2009-03-04  9:12 UTC (permalink / raw)
  To: grub-devel


In order for the boot block images for sparc to work properly,
we have to strip them out before doing the objcopy.

This is harmless on i386-pc and some other future grub
targets might need this too, so do it universally.

2009-03-04  David S. Miller  <davem@davemloft.net>

	* genmk.rb: Strip object files built for boot images.
	* conf/i386-pc.mk: Rebuilt.
	* conf/sparc64-ieee1275.mk: Likewise.
---
 conf/i386-pc.mk          |    6 ++++++
 conf/sparc64-ieee1275.mk |    2 ++
 genmk.rb                 |    1 +
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/conf/i386-pc.mk b/conf/i386-pc.mk
index 98dcbd2..dab7d40 100644
--- a/conf/i386-pc.mk
+++ b/conf/i386-pc.mk
@@ -25,6 +25,7 @@ boot.img: boot.exec
 
 boot.exec: boot_img-boot_i386_pc_boot.o
 	$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(boot_img_LDFLAGS)
+	$(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 boot_img-boot_i386_pc_boot.o: boot/i386/pc/boot.S $(boot/i386/pc/boot.S_DEPENDENCIES)
 	$(TARGET_CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(TARGET_CPPFLAGS) -DASM_FILE=1 $(TARGET_ASFLAGS) $(boot_img_ASFLAGS) -MD -c -o $@ $<
@@ -43,6 +44,7 @@ pxeboot.img: pxeboot.exec
 
 pxeboot.exec: pxeboot_img-boot_i386_pc_pxeboot.o
 	$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(pxeboot_img_LDFLAGS)
+	$(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 pxeboot_img-boot_i386_pc_pxeboot.o: boot/i386/pc/pxeboot.S $(boot/i386/pc/pxeboot.S_DEPENDENCIES)
 	$(TARGET_CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(TARGET_CPPFLAGS) -DASM_FILE=1 $(TARGET_ASFLAGS) $(pxeboot_img_ASFLAGS) -MD -c -o $@ $<
@@ -61,6 +63,7 @@ diskboot.img: diskboot.exec
 
 diskboot.exec: diskboot_img-boot_i386_pc_diskboot.o
 	$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(diskboot_img_LDFLAGS)
+	$(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 diskboot_img-boot_i386_pc_diskboot.o: boot/i386/pc/diskboot.S $(boot/i386/pc/diskboot.S_DEPENDENCIES)
 	$(TARGET_CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(TARGET_CPPFLAGS) -DASM_FILE=1 $(TARGET_ASFLAGS) $(diskboot_img_ASFLAGS) -MD -c -o $@ $<
@@ -79,6 +82,7 @@ lnxboot.img: lnxboot.exec
 
 lnxboot.exec: lnxboot_img-boot_i386_pc_lnxboot.o
 	$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(lnxboot_img_LDFLAGS)
+	$(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 lnxboot_img-boot_i386_pc_lnxboot.o: boot/i386/pc/lnxboot.S $(boot/i386/pc/lnxboot.S_DEPENDENCIES)
 	$(TARGET_CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(TARGET_CPPFLAGS) -DASM_FILE=1 $(TARGET_ASFLAGS) $(lnxboot_img_ASFLAGS) -MD -c -o $@ $<
@@ -97,6 +101,7 @@ cdboot.img: cdboot.exec
 
 cdboot.exec: cdboot_img-boot_i386_pc_cdboot.o
 	$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(cdboot_img_LDFLAGS)
+	$(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 cdboot_img-boot_i386_pc_cdboot.o: boot/i386/pc/cdboot.S $(boot/i386/pc/cdboot.S_DEPENDENCIES)
 	$(TARGET_CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(TARGET_CPPFLAGS) -DASM_FILE=1 $(TARGET_ASFLAGS) $(cdboot_img_ASFLAGS) -MD -c -o $@ $<
@@ -126,6 +131,7 @@ kernel.img: kernel.exec
 
 kernel.exec: kernel_img-kern_i386_pc_startup.o kernel_img-kern_main.o kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_loader.o kernel_img-kern_rescue.o kernel_img-kern_term.o kernel_img-kern_time.o kernel_img-kern_list.o kernel_img-kern_handler.o kernel_img-kern_i386_dl.o kernel_img-kern_i386_pc_init.o kernel_img-kern_i386_pc_mmap.o kernel_img-kern_parser.o kernel_img-kern_partition.o kernel_img-kern_i386_tsc.o kernel_img-kern_i386_pit.o kernel_img-kern_generic_rtc_get_time_ms.o kernel_img-kern_generic_millisleep.o kernel_img-kern_env.o kernel_img-term_i386_pc_console.o kernel_img-term_i386_vga_common.o kernel_img-symlist.o
 	$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(kernel_img_LDFLAGS)
+	$(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 kernel_img-kern_i386_pc_startup.o: kern/i386/pc/startup.S $(kern/i386/pc/startup.S_DEPENDENCIES)
 	$(TARGET_CC) -Ikern/i386/pc -I$(srcdir)/kern/i386/pc $(TARGET_CPPFLAGS) -DASM_FILE=1 $(TARGET_ASFLAGS) $(kernel_img_ASFLAGS) -MD -c -o $@ $<
diff --git a/conf/sparc64-ieee1275.mk b/conf/sparc64-ieee1275.mk
index 0d69eac..3d9c400 100644
--- a/conf/sparc64-ieee1275.mk
+++ b/conf/sparc64-ieee1275.mk
@@ -23,6 +23,7 @@ boot.img: boot.exec
 
 boot.exec: boot_img-boot_sparc_ieee1275_boot.o
 	$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(boot_img_LDFLAGS)
+	$(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 boot_img-boot_sparc_ieee1275_boot.o: boot/sparc/ieee1275/boot.S $(boot/sparc/ieee1275/boot.S_DEPENDENCIES)
 	$(TARGET_CC) -Iboot/sparc/ieee1275 -I$(srcdir)/boot/sparc/ieee1275 $(TARGET_CPPFLAGS) -DASM_FILE=1 $(TARGET_ASFLAGS) $(boot_img_ASFLAGS) -MD -c -o $@ $<
@@ -41,6 +42,7 @@ diskboot.img: diskboot.exec
 
 diskboot.exec: diskboot_img-boot_sparc_ieee1275_diskboot.o
 	$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(diskboot_img_LDFLAGS)
+	$(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 diskboot_img-boot_sparc_ieee1275_diskboot.o: boot/sparc/ieee1275/diskboot.S $(boot/sparc/ieee1275/diskboot.S_DEPENDENCIES)
 	$(TARGET_CC) -Iboot/sparc/ieee1275 -I$(srcdir)/boot/sparc/ieee1275 $(TARGET_CPPFLAGS) -DASM_FILE=1 $(TARGET_ASFLAGS) $(diskboot_img_ASFLAGS) -MD -c -o $@ $<
diff --git a/genmk.rb b/genmk.rb
index fe022cd..83ef639 100644
--- a/genmk.rb
+++ b/genmk.rb
@@ -61,6 +61,7 @@ MOSTLYCLEANFILES += #{deps_str}
 
 #{exe}: #{objs_str}
 	$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
+	$(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 " + objs.collect_with_index do |obj, i|
       src = sources[i]
-- 
1.6.1.2.253.ga34a




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH]: Strip boot block built objects.
  2009-03-04  9:12 [PATCH]: Strip boot block built objects David Miller
@ 2009-03-04 11:59 ` Vesa Jääskeläinen
  2009-03-04 12:03   ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Vesa Jääskeläinen @ 2009-03-04 11:59 UTC (permalink / raw)
  To: The development of GRUB 2

David Miller wrote:
> In order for the boot block images for sparc to work properly,
> we have to strip them out before doing the objcopy.
> 
> This is harmless on i386-pc and some other future grub
> targets might need this too, so do it universally.

Please have a look at mail from me with subject "qemu + gdb
debugging..." on 22.2.2009 17:34.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: Strip boot block built objects.
  2009-03-04 11:59 ` Vesa Jääskeläinen
@ 2009-03-04 12:03   ` David Miller
  2009-03-04 12:13     ` Vesa Jääskeläinen
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2009-03-04 12:03 UTC (permalink / raw)
  To: grub-devel, chaac

From: Vesa Jääskeläinen <chaac@nic.fi>
Date: Wed, 04 Mar 2009 13:59:43 +0200

> David Miller wrote:
> > In order for the boot block images for sparc to work properly,
> > we have to strip them out before doing the objcopy.
> > 
> > This is harmless on i386-pc and some other future grub
> > targets might need this too, so do it universally.
> 
> Please have a look at mail from me with subject "qemu + gdb
> debugging..." on 22.2.2009 17:34.

My patch only strips information for the foo.img boot block
images built in the grub tree.

Your debugging hacks are only for the rest of the grub kernel
and don't even come close to touching the areas I am interested
in and changing.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: Strip boot block built objects.
  2009-03-04 12:03   ` David Miller
@ 2009-03-04 12:13     ` Vesa Jääskeläinen
  0 siblings, 0 replies; 4+ messages in thread
From: Vesa Jääskeläinen @ 2009-03-04 12:13 UTC (permalink / raw)
  To: grub-devel

David Miller wrote:
> From: Vesa Jääskeläinen <chaac@nic.fi>
> Date: Wed, 04 Mar 2009 13:59:43 +0200
> 
>> David Miller wrote:
>>> In order for the boot block images for sparc to work properly,
>>> we have to strip them out before doing the objcopy.
>>>
>>> This is harmless on i386-pc and some other future grub
>>> targets might need this too, so do it universally.
>> Please have a look at mail from me with subject "qemu + gdb
>> debugging..." on 22.2.2009 17:34.
> 
> My patch only strips information for the foo.img boot block
> images built in the grub tree.
> 
> Your debugging hacks are only for the rest of the grub kernel
> and don't even come close to touching the areas I am interested
> in and changing.

Ok. Just wanted to inform you about that. If there is existing debug
image that matches quite nicely to boot image then it is easier to debug
as code matches quite nicely to assembly. It is much nicer to debug when
debugger can follow actual code lines.

Anyway. Idea there was that strip was not used, but objcopy was used to
generate matching image.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-04 12:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-04  9:12 [PATCH]: Strip boot block built objects David Miller
2009-03-04 11:59 ` Vesa Jääskeläinen
2009-03-04 12:03   ` David Miller
2009-03-04 12:13     ` Vesa Jääskeläinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.