From patchwork Sun Jul 22 13:18:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Christophe PLAGNIOL-VILLARD X-Patchwork-Id: 1224541 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id A68993FC5A for ; Sun, 22 Jul 2012 13:31:31 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Ssw9i-0006QF-Se; Sun, 22 Jul 2012 13:25:07 +0000 Received: from 13.mo1.mail-out.ovh.net ([178.33.253.128] helo=mo1.mail-out.ovh.net) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Ssw3P-0005j3-H0 for linux-arm-kernel@lists.infradead.org; Sun, 22 Jul 2012 13:18:57 +0000 Received: from mail94.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo1.mail-out.ovh.net (Postfix) with SMTP id 0A3F3FF9352 for ; Sun, 22 Jul 2012 15:24:06 +0200 (CEST) Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 22 Jul 2012 15:18:26 +0200 Received: from ns32433.ovh.net (HELO localhost) (plagnioj%jcrosoft.com@213.251.161.87) by ns0.ovh.net with SMTP; 22 Jul 2012 15:18:24 +0200 From: Jean-Christophe PLAGNIOL-VILLARD To: linux-arm-kernel@lists.infradead.org X-Ovh-Mailout: 178.32.228.1 (mo1.mail-out.ovh.net) Subject: [PATCH 3/7] compressed image: factorise compressor type Date: Sun, 22 Jul 2012 15:18:58 +0200 Message-Id: <1342963142-30339-3-git-send-email-plagnioj@jcrosoft.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1342963142-30339-1-git-send-email-plagnioj@jcrosoft.com> References: <20120722130301.GI22657@game.jcrosoft.org> <1342963142-30339-1-git-send-email-plagnioj@jcrosoft.com> X-Ovh-Tracer-Id: 18275607288764607485 X-Ovh-Remote: 213.251.161.87 (ns32433.ovh.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-OVH-SPAMSTATE: OK X-OVH-SPAMSCORE: 0 X-OVH-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeegkedrkeehucetufdoteggodetrfdofgetucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucenucfhrhhomheplfgvrghnqdevhhhrihhsthhophhhvgcurffntefipffkqffnqdggkffnnfettfffuceophhlrghgnhhiohhjsehjtghrohhsohhfthdrtghomheqnecuffhomhgrihhnpehliihordhsqdhopdhlughsrdhssgenucfjughrpefhvffufffkofgjfhestddtredtredttd X-Spam-Check: DONE|U 0.5/N X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeegkedrkeehucetufdoteggodetrfdofgetucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucenucfhrhhomheplfgvrghnqdevhhhrihhsthhophhhvgcurffntefipffkqffnqdggkffnnfettfffuceophhlrghgnhhiohhjsehjtghrohhsohhfthdrtghomheqnecuffhomhgrihhnpehliihordhsqdhopdhlughsrdhssgenucfjughrpefhvffufffkofgjfhestddtredtredttd X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [178.33.253.128 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Jean-Christophe PLAGNIOL-VILLARD X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This will simplify to support of multi compressor support such as gzip, lzma, xz. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 12 +++++++----- arch/arm/cpu/start.c | 9 ++++++--- arch/arm/lib/Makefile | 2 +- arch/arm/lib/barebox.lds.S | 2 +- common/Kconfig | 17 ++++++++++++++--- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index e0a3c07..0b3da03 100644 --- a/Makefile +++ b/Makefile @@ -715,20 +715,22 @@ barebox-uncompressed: $(barebox-lds) $(barebox-head) $(barebox-common) $(kallsym barebox-uncompressed.bin: barebox-uncompressed $(call if_changed,objcopy) +suffix_$(CONFIG_IMAGE_COMPRESSION_LZO) = lzo + barebox-uncompressed.bin.lzo: barebox-uncompressed.bin @echo " LZO " $@ $(Q)lzop -f -9 -o $@ barebox-uncompressed.bin -piggy.lzo.o: barebox-uncompressed.bin.lzo $(src)/piggy.lzo.S +piggy.$(suffix_y).o: barebox-uncompressed.bin.$(suffix_y) $(src)/piggy.$(suffix_y).S @echo " CC " $@ - $(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -c $(src)/piggy.lzo.S -o $@ + $(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -c $(src)/piggy.$(suffix_y).S -o $@ -ifdef CONFIG_IMAGE_COMPRESSION_LZO -barebox: piggy.lzo.o +ifdef CONFIG_IMAGE_COMPRESSION +barebox: piggy.$(suffix_y).o @echo " LD " $@ $(Q)$(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \ -T $(barebox-compressed-lds) \ - --start-group $(barebox-common) piggy.lzo.o --end-group + --start-group $(barebox-common) piggy.$(suffix_y).o --end-group else barebox: $(barebox-lds) $(barebox-head) $(barebox-common) $(kallsyms.o) FORCE $(call barebox-modpost) diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c index 6743804..18c5c83 100644 --- a/arch/arm/cpu/start.c +++ b/arch/arm/cpu/start.c @@ -28,7 +28,7 @@ #include #include -#ifdef CONFIG_IMAGE_COMPRESSION_LZO +#ifdef CONFIG_IMAGE_COMPRESSION void __naked __section(.text_head_entry) compressed_start(void) { barebox_arm_head(); @@ -101,7 +101,10 @@ extern void *input_data; extern void *input_data_end; #define STATIC static + +#ifdef CONFIG_IMAGE_COMPRESSION_LZO #include "../../../lib/decompress_unlzo.c" +#endif void barebox_uncompress(void *compressed_start, unsigned int len) { @@ -112,7 +115,7 @@ void barebox_uncompress(void *compressed_start, unsigned int len) else barebox = (void *)TEXT_BASE; - decompress_unlzo((void *)compressed_start, + decompress((void *)compressed_start, len, NULL, NULL, (void *)TEXT_BASE, NULL, NULL); @@ -158,7 +161,7 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void) /* flush I-cache before jumping to the copied binary */ __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); - if (IS_ENABLED(CONFIG_IMAGE_COMPRESSION_LZO)) { + if (IS_ENABLED(CONFIG_IMAGE_COMPRESSION)) { compressed_start = (uint32_t)&input_data - offset; compressed_end = (uint32_t)&input_data_end - offset; len = compressed_end - compressed_start; diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 044d3e6..1b6f7f4 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -21,4 +21,4 @@ obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS) += memset.o obj-$(CONFIG_ARM_UNWIND) += unwind.o obj-$(CONFIG_MODULES) += module.o extra-y += barebox.lds -extra-$(CONFIG_IMAGE_COMPRESSION_LZO) += barebox-compressed.lds +extra-$(CONFIG_IMAGE_COMPRESSION) += barebox-compressed.lds diff --git a/arch/arm/lib/barebox.lds.S b/arch/arm/lib/barebox.lds.S index b415830..b22cf98 100644 --- a/arch/arm/lib/barebox.lds.S +++ b/arch/arm/lib/barebox.lds.S @@ -31,7 +31,7 @@ SECTIONS { . = TEXT_BASE; -#ifndef CONFIG_IMAGE_COMPRESSION_LZO +#ifndef CONFIG_IMAGE_COMPRESSION PRE_IMAGE #endif . = ALIGN(4); diff --git a/common/Kconfig b/common/Kconfig index c6f1afa..8437e1c 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -99,9 +99,20 @@ menu "memory layout " config HAVE_IMAGE_COMPRESSION bool +config IMAGE_COMPRESSION + bool "Compressed image" + +if IMAGE_COMPRESSION + +choice + prompt "Compression" + config IMAGE_COMPRESSION_LZO - depends on HAVE_IMAGE_COMPRESSION - bool "lzo compressed image" + bool "lzo" + +endchoice + +endif config MMU bool "Enable MMU" @@ -185,7 +196,7 @@ config MALLOC_SIZE prompt "malloc area size" config HEAD_TEXT_BASE - depends on MEMORY_LAYOUT_FIXED && IMAGE_COMPRESSION_LZO + depends on MEMORY_LAYOUT_FIXED && IMAGE_COMPRESSION hex prompt "HEAD_TEXT_BASE" endmenu