All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: grub: Allow to control objcopy '-B' argument from foo.rmk files.
@ 2009-04-11  8:08 David Miller
  2009-04-11 10:23 ` Yoshinori K. Okuji
  2009-04-13 14:29 ` Robert Millan
  0 siblings, 2 replies; 6+ messages in thread
From: David Miller @ 2009-04-11  8:08 UTC (permalink / raw)
  To: grub-devel


This patch allows a platform to specify the image file output
format, it also adds the --strip-unneeded option to the objcopy
invocation as well.

I've left the i386-pc.mk portion of this patch out of the posting,
but rest assured I will check that part in once this gets an ACK :-)

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

	* genmk.rb: Add more flexible image type specification, also
	pass --strip-unneeded to objcopy.
	* conf/i386-pc.rmk: Use *_IMG_FMT.
	* conf/i386-pc.mk: Rebuilt.
---
 conf/i386-pc.mk  |   18 ++++++++++++------
 conf/i386-pc.rmk |    6 ++++++
 genmk.rb         |    2 +-
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk
index 7dfb854..b4f1353 100644
--- a/conf/i386-pc.rmk
+++ b/conf/i386-pc.rmk
@@ -17,26 +17,31 @@ pkglib_IMAGES = boot.img diskboot.img kernel.img pxeboot.img lnxboot.img \
 boot_img_SOURCES = boot/i386/pc/boot.S
 boot_img_ASFLAGS = $(COMMON_ASFLAGS)
 boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,7C00
+boot_img_IMG_FMT = binary
 
 # For pxeboot.img
 pxeboot_img_SOURCES = boot/i386/pc/pxeboot.S
 pxeboot_img_ASFLAGS = $(COMMON_ASFLAGS)
 pxeboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,7C00
+pxeboot_img_IMG_FMT = binary
 
 # For diskboot.img.
 diskboot_img_SOURCES = boot/i386/pc/diskboot.S
 diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
 diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,8000
+diskboot_img_IMG_FMT = binary
 
 # For lnxboot.img.
 lnxboot_img_SOURCES = boot/i386/pc/lnxboot.S
 lnxboot_img_ASFLAGS = $(COMMON_ASFLAGS)
 lnxboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,6000
+lnxboot_img_IMG_FMT = binary
 
 # For cdboot.img.
 cdboot_img_SOURCES = boot/i386/pc/cdboot.S
 cdboot_img_ASFLAGS = $(COMMON_ASFLAGS)
 cdboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,7C00
+cdboot_img_IMG_FMT = binary
 
 # For kernel.img.
 kernel_img_SOURCES = kern/i386/pc/startup.S kern/main.c kern/device.c \
@@ -60,6 +65,7 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
 kernel_img_CFLAGS = $(COMMON_CFLAGS)
 kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
 kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,$(GRUB_MEMORY_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
+kernel_img_IMG_FMT = binary
 
 MOSTLYCLEANFILES += symlist.c kernel_syms.lst
 DEFSYMFILES += kernel_syms.lst
diff --git a/genmk.rb b/genmk.rb
index 62e5066..c7264db 100644
--- a/genmk.rb
+++ b/genmk.rb
@@ -57,7 +57,7 @@ class Image
 MOSTLYCLEANFILES += #{deps_str}
 
 #{@name}: #{exe}
-	$(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
+	$(OBJCOPY) -O $(#{prefix}_IMG_FMT) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $< $@
 
 #{exe}: #{objs_str}
 	$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
-- 
1.6.2.2




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

* Re: [PATCH]: grub: Allow to control objcopy '-B' argument from foo.rmk files.
  2009-04-11  8:08 [PATCH]: grub: Allow to control objcopy '-B' argument from foo.rmk files David Miller
@ 2009-04-11 10:23 ` Yoshinori K. Okuji
  2009-04-11 11:46   ` David Miller
  2009-04-13 14:29 ` Robert Millan
  1 sibling, 1 reply; 6+ messages in thread
From: Yoshinori K. Okuji @ 2009-04-11 10:23 UTC (permalink / raw)
  To: The development of GRUB 2

On Saturday 11 April 2009 17:08:31 David Miller wrote:
> This patch allows a platform to specify the image file output
> format, it also adds the --strip-unneeded option to the objcopy
> invocation as well.

IIRC, --strip-unneeded was dangerous.

> I've left the i386-pc.mk portion of this patch out of the posting,
> but rest assured I will check that part in once this gets an ACK :-)

I don't like "IMG_FMT". How about "FORMAT"? If too ambiguous, "IMAGE_FORMAT". 
I prefer not to use uncommon abbrevs.

Regards,
Okuji



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

* Re: [PATCH]: grub: Allow to control objcopy '-B' argument from foo.rmk files.
  2009-04-11 10:23 ` Yoshinori K. Okuji
@ 2009-04-11 11:46   ` David Miller
  2009-04-13  6:38     ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2009-04-11 11:46 UTC (permalink / raw)
  To: grub-devel, okuji

From: "Yoshinori K. Okuji" <okuji@enbug.org>
Date: Sat, 11 Apr 2009 19:23:23 +0900

> On Saturday 11 April 2009 17:08:31 David Miller wrote:
>> This patch allows a platform to specify the image file output
>> format, it also adds the --strip-unneeded option to the objcopy
>> invocation as well.
> 
> IIRC, --strip-unneeded was dangerous.

I would like to have information about this :-)

We do want to retain symbols (and potentially even debugging
information) in the foo.exec files.  But the final images are pure
binary blobs and there is no real use for any of the symbol
information.

In fact, the the way i386 uses this, it outputs "binary" format
images.  I can't even think of where it would place any symbol
tables :-)

On sparc64 this will actually matter, because we need to use
a.out format images for the boot blocks.  If I leave the symbols
in there, this brings the boot block over it's required 512-byte
size.

>> I've left the i386-pc.mk portion of this patch out of the posting,
>> but rest assured I will check that part in once this gets an ACK :-)
> 
> I don't like "IMG_FMT". How about "FORMAT"? If too ambiguous, "IMAGE_FORMAT". 
> I prefer not to use uncommon abbrevs.

That's fine with me, I'll update the patch once the strip issue
is resolved.



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

* Re: [PATCH]: grub: Allow to control objcopy '-B' argument from foo.rmk files.
  2009-04-11 11:46   ` David Miller
@ 2009-04-13  6:38     ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2009-04-13  6:38 UTC (permalink / raw)
  To: grub-devel, okuji

From: David Miller <davem@davemloft.net>
Date: Sat, 11 Apr 2009 04:46:44 -0700 (PDT)

> From: "Yoshinori K. Okuji" <okuji@enbug.org>
> Date: Sat, 11 Apr 2009 19:23:23 +0900
> 
>> On Saturday 11 April 2009 17:08:31 David Miller wrote:
>>> This patch allows a platform to specify the image file output
>>> format, it also adds the --strip-unneeded option to the objcopy
>>> invocation as well.
>> 
>> IIRC, --strip-unneeded was dangerous.
> 
> I would like to have information about this :-)
 ...
>>> I've left the i386-pc.mk portion of this patch out of the posting,
>>> but rest assured I will check that part in once this gets an ACK :-)
>> 
>> I don't like "IMG_FMT". How about "FORMAT"? If too ambiguous, "IMAGE_FORMAT". 
>> I prefer not to use uncommon abbrevs.
> 
> That's fine with me, I'll update the patch once the strip issue
> is resolved.

In the name of progress I've commited these changes, with the
recommended use of *_FORMAT instead of *_IMG_FMT.

If this stripping of the resulting image is found to cause a
real problem, we can revert that part of the change and work
out a solution.

Thanks.



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

* Re: [PATCH]: grub: Allow to control objcopy '-B' argument from foo.rmk files.
  2009-04-11  8:08 [PATCH]: grub: Allow to control objcopy '-B' argument from foo.rmk files David Miller
  2009-04-11 10:23 ` Yoshinori K. Okuji
@ 2009-04-13 14:29 ` Robert Millan
  2009-04-13 20:33   ` David Miller
  1 sibling, 1 reply; 6+ messages in thread
From: Robert Millan @ 2009-04-13 14:29 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Apr 11, 2009 at 01:08:31AM -0700, David Miller wrote:
> index 7dfb854..b4f1353 100644
> --- a/conf/i386-pc.rmk
> +++ b/conf/i386-pc.rmk
> @@ -17,26 +17,31 @@ pkglib_IMAGES = boot.img diskboot.img kernel.img pxeboot.img lnxboot.img \
>  boot_img_SOURCES = boot/i386/pc/boot.S
>  boot_img_ASFLAGS = $(COMMON_ASFLAGS)
>  boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,7C00
> +boot_img_IMG_FMT = binary

Wait, isn't raw format implicit in the _img_ part of the variable name?

If it was ELF, we'd have boot_elf_..., right?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



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

* Re: [PATCH]: grub: Allow to control objcopy '-B' argument from foo.rmk files.
  2009-04-13 14:29 ` Robert Millan
@ 2009-04-13 20:33   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2009-04-13 20:33 UTC (permalink / raw)
  To: grub-devel, rmh

From: Robert Millan <rmh@aybabtu.com>
Date: Mon, 13 Apr 2009 16:29:10 +0200

> On Sat, Apr 11, 2009 at 01:08:31AM -0700, David Miller wrote:
>> index 7dfb854..b4f1353 100644
>> --- a/conf/i386-pc.rmk
>> +++ b/conf/i386-pc.rmk
>> @@ -17,26 +17,31 @@ pkglib_IMAGES = boot.img diskboot.img kernel.img pxeboot.img lnxboot.img \
>>  boot_img_SOURCES = boot/i386/pc/boot.S
>>  boot_img_ASFLAGS = $(COMMON_ASFLAGS)
>>  boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,7C00
>> +boot_img_IMG_FMT = binary
> 
> Wait, isn't raw format implicit in the _img_ part of the variable name?
> 
> If it was ELF, we'd have boot_elf_..., right?

We have "images" which match the foo_img_* pattern, modules,
scripts, and "everything else" which we call programs and
the foo_elf_* rules match.

Feel free to double-check my attempted interpretation of the
code in genmk.rb

Really, I am pretty sure this is the best way to handle this.



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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-11  8:08 [PATCH]: grub: Allow to control objcopy '-B' argument from foo.rmk files David Miller
2009-04-11 10:23 ` Yoshinori K. Okuji
2009-04-11 11:46   ` David Miller
2009-04-13  6:38     ` David Miller
2009-04-13 14:29 ` Robert Millan
2009-04-13 20:33   ` David Miller

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.