diff options
Diffstat (limited to 'lib/decompress_unlzma.c')
| -rw-r--r-- | lib/decompress_unlzma.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c index 32123a1340e6..0b954e04bd30 100644 --- a/lib/decompress_unlzma.c +++ b/lib/decompress_unlzma.c | |||
| @@ -29,12 +29,14 @@ | |||
| 29 | *Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 29 | *Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | #ifndef STATIC | 32 | #ifdef STATIC |
| 33 | #define PREBOOT | ||
| 34 | #else | ||
| 33 | #include <linux/decompress/unlzma.h> | 35 | #include <linux/decompress/unlzma.h> |
| 36 | #include <linux/slab.h> | ||
| 34 | #endif /* STATIC */ | 37 | #endif /* STATIC */ |
| 35 | 38 | ||
| 36 | #include <linux/decompress/mm.h> | 39 | #include <linux/decompress/mm.h> |
| 37 | #include <linux/slab.h> | ||
| 38 | 40 | ||
| 39 | #define MIN(a, b) (((a) < (b)) ? (a) : (b)) | 41 | #define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
| 40 | 42 | ||
| @@ -543,9 +545,7 @@ STATIC inline int INIT unlzma(unsigned char *buf, int in_len, | |||
| 543 | int ret = -1; | 545 | int ret = -1; |
| 544 | 546 | ||
| 545 | set_error_fn(error_fn); | 547 | set_error_fn(error_fn); |
| 546 | if (!flush) | 548 | |
| 547 | in_len -= 4; /* Uncompressed size hack active in pre-boot | ||
| 548 | environment */ | ||
| 549 | if (buf) | 549 | if (buf) |
| 550 | inbuf = buf; | 550 | inbuf = buf; |
| 551 | else | 551 | else |
| @@ -645,4 +645,15 @@ exit_0: | |||
| 645 | return ret; | 645 | return ret; |
| 646 | } | 646 | } |
| 647 | 647 | ||
| 648 | #define decompress unlzma | 648 | #ifdef PREBOOT |
| 649 | STATIC int INIT decompress(unsigned char *buf, int in_len, | ||
| 650 | int(*fill)(void*, unsigned int), | ||
| 651 | int(*flush)(void*, unsigned int), | ||
| 652 | unsigned char *output, | ||
| 653 | int *posp, | ||
| 654 | void(*error_fn)(char *x) | ||
| 655 | ) | ||
| 656 | { | ||
| 657 | return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn); | ||
| 658 | } | ||
| 659 | #endif | ||
