From: Christian Ruppert <christian.ruppert@abilis.com>
To: Vineet Gupta <Vineet.Gupta1@synopsys.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Pavel Roskin <proski@gnu.org>, Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Sam Ravnborg <sam@ravnborg.org>, Noam Camus <noamc@ezchip.com>,
Joe Perches <joe@perches.com>,
Christian Ruppert <christian.ruppert@abilis.com>
Subject: [PATCH 2/2] x86: Add support for uncompressed kernel images
Date: Mon, 18 Nov 2013 10:51:51 +0100 [thread overview]
Message-ID: <1384768311-8824-2-git-send-email-christian.ruppert@abilis.com> (raw)
In-Reply-To: <20131118094807.GC31741@ab42.lan>
Signed-off-by: Christian Ruppert <christian.ruppert@abilis.com>
---
arch/x86/Kconfig | 1 +
arch/x86/boot/compressed/Makefile | 14 ++++++------
arch/x86/boot/compressed/misc.c | 4 +++
lib/decompress_copy.c | 44 +++++++++++++++++++++++++++++++++++++
4 files changed, 56 insertions(+), 7 deletions(-)
create mode 100644 lib/decompress_copy.c
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index e903c71..009349f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -62,6 +62,7 @@ config X86
select USER_STACKTRACE_SUPPORT
select HAVE_REGS_AND_STACK_ACCESS_API
select HAVE_DMA_API_DEBUG
+ select HAVE_KERNEL_UNCOMPRESSED
select HAVE_KERNEL_GZIP
select HAVE_KERNEL_BZIP2
select HAVE_KERNEL_LZMA
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index dcd90df..f65e444 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -67,16 +67,16 @@ $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
$(call if_changed,lz4)
-suffix-$(CONFIG_KERNEL_GZIP) := gz
-suffix-$(CONFIG_KERNEL_BZIP2) := bz2
-suffix-$(CONFIG_KERNEL_LZMA) := lzma
-suffix-$(CONFIG_KERNEL_XZ) := xz
-suffix-$(CONFIG_KERNEL_LZO) := lzo
-suffix-$(CONFIG_KERNEL_LZ4) := lz4
+suffix-$(CONFIG_KERNEL_GZIP) := .gz
+suffix-$(CONFIG_KERNEL_BZIP2) := .bz2
+suffix-$(CONFIG_KERNEL_LZMA) := .lzma
+suffix-$(CONFIG_KERNEL_XZ) := .xz
+suffix-$(CONFIG_KERNEL_LZO) := .lzo
+suffix-$(CONFIG_KERNEL_LZ4) := .lz4
quiet_cmd_mkpiggy = MKPIGGY $@
cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false )
targets += piggy.S
-$(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE
+$(obj)/piggy.S: $(obj)/vmlinux.bin$(suffix-y) $(obj)/mkpiggy FORCE
$(call if_changed,mkpiggy)
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 434f077..c210314 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -149,6 +149,10 @@ static int lines, cols;
#include "../../../../lib/decompress_unlz4.c"
#endif
+#ifdef CONFIG_KERNEL_UNCOMPRESSED
+#include "../../../../lib/decompress_copy.c"
+#endif
+
static void scroll(void)
{
int i;
diff --git a/lib/decompress_copy.c b/lib/decompress_copy.c
new file mode 100644
index 0000000..109ef22
--- /dev/null
+++ b/lib/decompress_copy.c
@@ -0,0 +1,44 @@
+#include <linux/decompress/mm.h>
+
+#define NOZIP_BUFSZ (16 * 1024)
+STATIC int INIT nozip(unsigned char *buf, int len,
+ int(*fill)(void*, unsigned int),
+ int(*flush)(void*, unsigned int),
+ unsigned char *outbuf,
+ int *pos,
+ void(*error)(char *x))
+{
+ char *b;
+
+ if (buf)
+ b = buf;
+ else
+ b = malloc(NOZIP_BUFSZ);
+
+ if (!b) {
+ error("Out of memory while allocating buffer");
+ return -1;
+ }
+
+ if (flush) {
+ if (!len)
+ len = fill(b, NOZIP_BUFSZ);
+
+ len = flush(b, len);
+ } else {
+ if (!len)
+ len = fill(outbuf, NOZIP_BUFSZ);
+ else
+ memcpy(outbuf, b, len);
+ }
+
+ if (pos)
+ *pos = len;
+
+ if (!buf)
+ free(b);
+
+ return 0;
+}
+
+#define decompress nozip
--
1.7.1
next prev parent reply other threads:[~2013-11-18 9:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-15 5:43 [PATCH] Revert "init/Kconfig: add option to disable kernel compression" H. Peter Anvin
2013-11-15 16:51 ` [PATCH] [FIX] init/Kconfig: fix option to disable kernel compression Christian Ruppert
2013-11-16 9:42 ` Vineet Gupta
2013-11-18 9:48 ` Christian Ruppert
2013-11-18 9:51 ` [PATCH 1/2] init/Kconfig: add " Christian Ruppert
2013-11-18 9:51 ` Christian Ruppert [this message]
2013-11-18 11:25 ` [PATCH 2/2] x86: Add support for uncompressed kernel images Borislav Petkov
2013-11-18 13:48 ` [PATCH 2/2 v2] " Christian Ruppert
2013-12-16 8:59 ` Christian Ruppert
-- strict thread matches above, loose matches on Subject: below --
2013-11-14 8:32 Uncompressed kernel doesn't build on x86_64 Christian Ruppert
2013-11-14 8:38 ` [PATCH 2/2] x86: Add support for uncompressed kernel images Christian Ruppert
2013-11-14 17:31 ` H. Peter Anvin
2013-11-15 9:31 ` Christian Ruppert
2013-11-14 17:45 ` H. Peter Anvin
2013-11-15 9:49 ` Christian Ruppert
2013-11-15 10:06 ` 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=1384768311-8824-2-git-send-email-christian.ruppert@abilis.com \
--to=christian.ruppert@abilis.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=noamc@ezchip.com \
--cc=proski@gnu.org \
--cc=sam@ravnborg.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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
all inboxes | Powered by JetHome®