debuggers.hg

view xen/common/decompress.c @ 21663:d8333666361d

x86: allow LZO compressed bzImage to be used as Dom0 kernel

... since recently Linux added this as another kernel compression
method, and we already have LZO compression in the tree (from tmem),
so that only glue logic is needed.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 15 13:19:33 2010 +0100 (2010-06-15)
parents c4630f8f69cc
children
line source
1 #include <xen/config.h>
2 #include <xen/init.h>
3 #include <xen/lib.h>
4 #include <xen/string.h>
5 #include <xen/decompress.h>
7 static void __init error(const char *msg)
8 {
9 printk("%s\n", msg);
10 }
12 int __init decompress(void *inbuf, unsigned int len, void *outbuf)
13 {
14 #if 0 /* Not needed here yet. */
15 if ( len >= 2 &&
16 (!memcmp(inbuf, "\037\213", 2) || !memcmp(inbuf, "\037\236", 2)) )
17 return gunzip(inbuf, len, NULL, NULL, outbuf, NULL, error);
18 #endif
20 if ( len >= 3 && !memcmp(inbuf, "\x42\x5a\x68", 3) )
21 return bunzip2(inbuf, len, NULL, NULL, outbuf, NULL, error);
23 if ( len >= 2 && !memcmp(inbuf, "\135\000", 2) )
24 return unlzma(inbuf, len, NULL, NULL, outbuf, NULL, error);
26 if ( len >= 5 && !memcmp(inbuf, "\x89LZO", 5) )
27 return unlzo(inbuf, len, NULL, NULL, outbuf, NULL, error);
29 return 1;
30 }