public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	hbabu@us.ibm.com, ebiederm@xmission.com, ying.huang@intel.com,
	mingo@elte.hu, "H. Peter Anvin" <hpa@linux.intel.com>,
	tglx@linutronix.de, vgoyal@redhat.com
Subject: Re: [PATCH 05/14] kbuild: allow compressors (gzip, bzip2, lzma) to take multiple inputs
Date: Fri, 8 May 2009 23:33:58 +0200	[thread overview]
Message-ID: <20090508213358.GA18712@uranus.ravnborg.org> (raw)
In-Reply-To: <4A049AF5.7090300@zytor.com>

On Fri, May 08, 2009 at 01:49:57PM -0700, H. Peter Anvin wrote:
> Sam Ravnborg wrote:
> >
> >I did a quick attempt to integrate it in the Makefile - not pretty.
> >So I dropped that idea.
> >
> >It is mainly that we should not fill up scripts/ with small
> >undocumented scripts.
> >
> >Could you add something like this in the top of the file:
> >
> ># Find the sum of the size of all files specified and
> ># output the size as an escaped hex string.
> >#
> ># Sample:
> ># $ ls -l foo
> ># $ -rw-rw-r-- 1 xxx xxx 146 May  8 22:28 foo
> ># $ bin_size foo
> ># $ \\x92\\x00\\x00\\x00
> ># 146 equals 92 hex
> >
> 
> OK, I see your point (especially since that's not what it does.)
> 
> To be honest, how ugly would it be to get a C program in here?  Doing 
> this in shell is horrid, and people tend to whine about Perl (which is 
> perfect for this kind of job.)

Lets just include it in the Makefile and be done with it.
I took our patch and ended up with this - untested - patch.

If you are OK with this you can add my:
Acked-by: Sam Ravnborg <sam@ravnborg.org>


I forgot to delete bin_size - it is no longer needed...

	Sam


diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index cba61ca..827ebf6 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -188,20 +188,34 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
 # ---------------------------------------------------------------------------
 
 quiet_cmd_gzip = GZIP    $@
-cmd_gzip = gzip -f -9 < $< > $@
+cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \
+	(rm -f $@ ; false)
 
 
 # Bzip2
 # ---------------------------------------------------------------------------
 
 # Bzip2 does not include size in file... so we have to fake that
-size_append=$(CONFIG_SHELL) $(srctree)/scripts/bin_size
+size_append = $(shell                                             \
+dec_size=0;                                                       \
+for F in $1; do                                                   \
+	fsize=$$(stat -c "%s" $$F);                               \
+	dec_size=$$(expr $$dec_size + $$fsize);                   \
+done;                                                             \
+hex=$$(printf "%08x" $$dec_size |                                 \
+sed 's/\(..\)\(..\)\(..\)\(..\)/\\\\x\4\\\\x\3\\\\x\2\\\\x\1/g'); \
+echo -ne $$hex                                                    \
+)
 
 quiet_cmd_bzip2 = BZIP2    $@
-cmd_bzip2 = (bzip2 -9 < $< && $(size_append) $<) > $@ || (rm -f $@ ; false)
+cmd_bzip2 = (cat $(filter-out FORCE,$^) | \
+	bzip2 -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
+	(rm -f $@ ; false)
 
 # Lzma
 # ---------------------------------------------------------------------------
 
 quiet_cmd_lzma = LZMA    $@
-cmd_lzma = (lzma -9 -c $< && $(size_append) $<) >$@ || (rm -f $@ ; false)
+cmd_lzma = (cat $(filter-out FORCE,$^) | \
+	lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
+	(rm -f $@ ; false)

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2009-05-08 21:31 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07 22:26 [PATCH 00/14] RFC: x86: relocatable kernel changes H. Peter Anvin
2009-05-07 22:26 ` [PATCH 01/14] x86, boot: align the .bss section in the decompressor H. Peter Anvin
2009-05-08  7:17   ` Sam Ravnborg
2009-05-08  8:18     ` Eric Dumazet
2009-05-08 16:54     ` H. Peter Anvin
2009-05-08  7:53   ` Cyrill Gorcunov
2009-05-08 17:03     ` H. Peter Anvin
2009-05-08 17:15       ` Cyrill Gorcunov
2009-05-08 17:21         ` H. Peter Anvin
2009-05-07 22:26 ` [PATCH 02/14] x86, boot: honor CONFIG_PHYSICAL_START when relocatable H. Peter Anvin
2009-05-08  7:34   ` Sam Ravnborg
2009-05-08 16:58     ` H. Peter Anvin
2009-05-07 22:26 ` [PATCH 03/14] x86, config: change defaults PHYSICAL_START and PHYSICAL_ALIGN H. Peter Anvin
2009-05-08  7:36   ` Sam Ravnborg
2009-05-08  9:47     ` Ingo Molnar
2009-05-08 17:01     ` H. Peter Anvin
2009-05-07 22:26 ` [PATCH 04/14] x86, boot: unify use LOAD_PHYSICAL_ADDR and LOAD_PHYSICAL_ALIGN H. Peter Anvin
2009-05-07 22:26 ` [PATCH 05/14] kbuild: allow compressors (gzip, bzip2, lzma) to take multiple inputs H. Peter Anvin
2009-05-08  7:42   ` Sam Ravnborg
2009-05-08 20:18     ` H. Peter Anvin
2009-05-08 20:47       ` Sam Ravnborg
2009-05-08 20:49         ` H. Peter Anvin
2009-05-08 21:33           ` Sam Ravnborg [this message]
2009-05-07 22:26 ` [PATCH 06/14] x86: add a Kconfig symbol for when relocations are needed H. Peter Anvin
2009-05-07 22:26 ` [PATCH 07/14] x86, boot: simplify arch/x86/boot/compressed/Makefile H. Peter Anvin
2009-05-08  7:45   ` Sam Ravnborg
2009-05-07 22:26 ` [PATCH 08/14] x86, boot: use BP_scratch in arch/x86/boot/compressed/head_*.S H. Peter Anvin
2009-05-07 22:26 ` [PATCH 09/14] x86, boot: add new runtime_address and runtime_size bzImage fields H. Peter Anvin
2009-05-08  7:55   ` Sam Ravnborg
2009-05-08 21:09     ` H. Peter Anvin
2009-05-08 21:35       ` Sam Ravnborg
2009-05-07 22:26 ` [PATCH 10/14] x86, doc: document the runtime_start " H. Peter Anvin
2009-05-07 22:26 ` [PATCH 11/14] x86, boot: use rep movsq to move kernel on 64 bits H. Peter Anvin
2009-05-07 22:27 ` [PATCH 12/14] x86, boot: zero EFLAGS on 32 bits H. Peter Anvin
2009-05-07 22:27 ` [PATCH 13/14] x86: make CONFIG_RELOCATABLE the default H. Peter Anvin
2009-05-07 22:27 ` [PATCH 14/14] x86, defconfig: update defconfigs to relocatable H. Peter Anvin
2009-05-08  1:23 ` [PATCH 00/14] RFC: x86: relocatable kernel changes Eric W. Biederman
2009-05-08  5:31   ` H. Peter Anvin
2009-05-08  6:54     ` Eric W. Biederman
2009-05-08 18:04       ` H. Peter Anvin
2009-05-08 18:47       ` H. Peter Anvin
2009-05-11  5:18         ` RFC: x86: relocatable kernel changes (revised spec) H. Peter Anvin
2009-05-11 11:54           ` Eric W. Biederman
2009-05-11 16:03             ` H. Peter Anvin
2009-05-11 17:56             ` RFC: x86: relocatable kernel changes (revised spec v2) H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090508213358.GA18712@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=ebiederm@xmission.com \
    --cc=hbabu@us.ibm.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=vgoyal@redhat.com \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox