Skip to contentSkip to conversation

: Strip boot block built objects.

PATCH In review David Miller 2 participants 4 messages Mar 4, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Strip boot block built objects.

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 <[email protected]>

* 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(-)
conf/i386-pc.mk +6 -0
index 98dcbd2..dab7d40 100644
@@ -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 $@ $<
conf/sparc64-ieee1275.mk +2 -0
index 0d69eac..3d9c400 100644
@@ -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 $@ $<
genmk.rb +1 -0
index fe022cd..83ef639 100644
@@ -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]
Signature · 1 line
1.6.1.2.253.ga34a
#1 lore raw
Quoted 5 lines · David Miller

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.

#2 lore raw

From: Vesa Jääskeläinen <[email protected]>
Date: Wed, 04 Mar 2009 13:59:43 +0200

Quoted 9 lines
Quoted 5 lines · David Miller

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.

#3 lore raw
Quoted 12 lines · David Miller

From: Vesa Jääskeläinen <[email protected]>
Date: Wed, 04 Mar 2009 13:59:43 +0200

Quoted 8 lines
Quoted 5 lines · David Miller

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.

Quoted 6 lines

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.