From: Alexander Clouter <alex@digriz.org.uk>
To: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
manuel.lauss@googlemail.com
Subject: Re: [PATCH -v1] MIPS: add support for gzip/bzip2/lzma compressed kernel images
Date: Mon, 28 Sep 2009 21:17:03 +0100 [thread overview]
Message-ID: <20090928201703.GX6085@chipmunk> (raw)
In-Reply-To: <1249894154-10982-1-git-send-email-wuzhangjin@gmail.com>
Hi,
* Wu Zhangjin <wuzhangjin@gmail.com> [2009-08-10 16:49:14+0800]:
>
> This patch will help to generate smaller kernel images for linux-MIPS,
>
> [snipped]
>
> NOTE: this should work for the other MIPS-based machines, but I have
> used the command bc in the Makefile to calculate the load address of the
> compressed kernel. I'm not sure this is suitable. perhaps I need to
> rewrite this part in C program or somebody help to simplify the current
> implementation.
>
Remembered you wanted a nicer way to work out the load address so this
is my best attempt so far....I think it's fine to leave it as shell code
personally; but I'm not a maintainer :)
> + [snipped]
>
> +# The load address of the compressed kernel, VMLINUZ_LOAD_ADDRESS > VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE
> +VMLINUX_SIZE := $(shell wc -c $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | cut -d' ' -f1)
> +VMLINUX_SIZE := $(shell echo "obase=16;ibase=10;(($(VMLINUX_SIZE)/65536 + 1) * 65536)" | bc | cut -d'.' -f1)
> +VMLINUX_LOAD_ADDRESS = $(shell echo $(LOADADDR) | sed -e "s/0xffffffff//g")
> +VMLINUZ_LOAD_ADDRESS := $(shell echo "obase=16; ibase=16; ($(VMLINUX_LOAD_ADDRESS) + $(VMLINUX_SIZE))" | bc)
> +VMLINUZ_LOAD_ADDRESS := 0x$(if $(CONFIG_64BIT),ffffffff,)$(VMLINUZ_LOAD_ADDRESS)
> +LOADADDR := 0x$(if $(CONFIG_64BIT),ffffffff,)$(VMLINUX_LOAD_ADDRESS)
> +
Slightly prettier is to get rid of the 'bc' dependency, a divide and a
'cut' here and there.
Cheers
--
Alexander Clouter
.sigmonster says: Nice guys finish last.
-- Leo Durocher
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index f9ccd97..e531b28 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -12,11 +12,11 @@
# Author: Wu Zhangjin <wuzj@lemote.com>
#
-# The load address of the compressed kernel, VMLINUZ_LOAD_ADDRESS > VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE
-VMLINUX_SIZE := $(shell wc -c $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | cut -d' ' -f1)
-VMLINUX_SIZE := $(shell echo "obase=16;ibase=10;(($(VMLINUX_SIZE)/65536 + 1) * 65536)" | bc | cut -d'.' -f1)
-VMLINUX_LOAD_ADDRESS = $(shell echo $(LOADADDR) | sed -e "s/0xffffffff//g")
-VMLINUZ_LOAD_ADDRESS := $(shell echo "obase=16; ibase=16; ($(VMLINUX_LOAD_ADDRESS) + $(VMLINUX_SIZE))" | bc)
+# compressed kernel load addr: VMLINUZ_LOAD_ADDRESS > VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE
+VMLINUX_SIZE := $(shell wc -c $(objtree)/$(KBUILD_IMAGE) | cut -d' ' -f1)
+VMLINUX_SIZE := $(shell echo $$(($(VMLINUX_SIZE) + (65536 - $(VMLINUX_SIZE) % 65536))))
+VMLINUX_LOAD_ADDRESS = $(shell echo $(LOADADDR) | sed -e 's/0xffffffff//')
+VMLINUZ_LOAD_ADDRESS := $(shell printf %x $$((0x$(VMLINUX_LOAD_ADDRESS) + $(VMLINUX_SIZE))))
VMLINUZ_LOAD_ADDRESS := 0x$(if $(CONFIG_64BIT),ffffffff,)$(VMLINUZ_LOAD_ADDRESS)
LOADADDR := 0x$(if $(CONFIG_64BIT),ffffffff,)$(VMLINUX_LOAD_ADDRESS)
next prev parent reply other threads:[~2009-09-28 20:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-10 8:49 [PATCH -v1] MIPS: add support for gzip/bzip2/lzma compressed kernel images Wu Zhangjin
[not found] ` <20090810101205.GW19816@chipmunk>
[not found] ` <200908102342.30031.florian@openwrt.org>
2009-08-11 21:19 ` AR7 runtime identification [was:- Re: [PATCH -v1] MIPS: add support for gzip/bzip2/lzma compressed kernel images] Florian Fainelli
2009-08-12 8:37 ` Alexander Clouter
2009-08-12 9:19 ` Florian Fainelli
2009-09-26 12:33 ` [PATCH -v1] MIPS: add support for gzip/bzip2/lzma compressed kernel images Alexander Clouter
2009-09-28 14:08 ` Manuel Lauss
2009-09-28 14:08 ` Manuel Lauss
2009-09-28 20:17 ` Alexander Clouter [this message]
2009-10-12 2:34 ` Ralf Baechle
2009-10-12 3:31 ` Wu Zhangjin
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=20090928201703.GX6085@chipmunk \
--to=alex@digriz.org.uk \
--cc=linux-mips@linux-mips.org \
--cc=manuel.lauss@googlemail.com \
--cc=ralf@linux-mips.org \
--cc=wuzhangjin@gmail.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;
as well as URLs for NNTP newsgroup(s).