From: ebiederm@xmission.com (Eric W. Biederman)
To: Florian Fainelli <florian@openwrt.org>
Cc: Simon Horman <horms@verge.net.au>, kexec@lists.infradead.org
Subject: Re: [PATCH] add support for loading lzma compressed kernels
Date: Wed, 18 Nov 2009 16:03:27 -0800 [thread overview]
Message-ID: <m1y6m3754g.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <200911190017.23744.florian@openwrt.org> (Florian Fainelli's message of "Thu\, 19 Nov 2009 00\:17\:22 +0100")
Florian Fainelli <florian@openwrt.org> writes:
> Please find below a version which should address your comments.
> Thanks for reviewing the patch.
> --
> From: Florian Fainelli <florian@openwrt.org>
> Subject: [PATCH] add support for loading lzma compressed kernels
>
> This patch allows one to load a lzma compressed kernel using kexec -l.
> As I wanted the lzma code to be very similar to the existing
> zlib slurp_decompress I took lzread and associated routines
> from the cpio lzma support. Tested on my x86 laptop using the
> following commands:
>
> lzma e bzImage bzImage.lzma
> kexec -l bzImage.lzma
>
> Having lzma support is particularly useful on some embedded
> systems on which we have the kernel already lzma compressed
> and available on a mtd partition.
Yes. I don't think it is particularly useful on x86 (as we have
a decompressor built into the kernel) but on other arches
it makes a lot of sense.
A few minor comments inline.
> diff -urN kexec-tools-2.0.1/kexec/kexec-lzma.h kexec-tools-2.0.1.lzma/kexec/kexec-lzma.h
> --- kexec-tools-2.0.1/kexec/kexec-lzma.h 1970-01-01 01:00:00.000000000 +0100
> +++ kexec-tools-2.0.1.lzma/kexec/kexec-lzma.h 2009-11-19 00:06:24.000000000 +0100
> @@ -0,0 +1,29 @@
> +#ifndef __KEXEC_LZMA_H
> +#define __KEXEC_LZMA_H
> +
> +#include <stdio.h>
> +#include <sys/types.h>
> +#include <unistd.h>
> +#include <inttypes.h>
> +#include <lzma.h>
> +
> +#include "config.h"
> +
> +#ifdef HAVE_LIBLZMA
> +#define kBufferSize (1 << 15)
> +
> +typedef struct lzfile {
> + uint8_t buf[kBufferSize];
> + lzma_stream strm;
> + FILE *file;
> + int encoding;
> + int eof;
> +} LZFILE;
> +
> +LZFILE *lzopen(const char *path, const char *mode);
> +int lzclose(LZFILE *lzfile);
> +ssize_t lzread(LZFILE *lzfile, void *buf, size_t len);
I don't think we need any of these definitions in the header file.
> +#endif /* HAVE_LIBLZMA */
> +
> +char *lzma_decompress_file(const char *filename, off_t *r_size);
Ideally the lzma_decompress_file stub would live here and would not
even compile kexec/lzma.c if we don't have lzma.
> +#endif /* __KEXEC_LZMA_H */
Eric
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2009-11-19 0:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-15 23:53 [PATCH] add support for loading lzma compressed kernels Florian Fainelli
2009-11-16 13:37 ` wilbur.chan
2009-11-17 3:04 ` Simon Horman
2009-11-17 14:08 ` Florian Fainelli
2009-11-17 14:23 ` Florian Fainelli
2009-11-18 3:55 ` Simon Horman
2009-11-18 23:17 ` Florian Fainelli
2009-11-19 0:03 ` Eric W. Biederman [this message]
2009-11-30 5:51 ` Simon Horman
2009-11-30 10:08 ` Florian Fainelli
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=m1y6m3754g.fsf@fess.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=florian@openwrt.org \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.