From 38ab49203063049bcbcf7af7cdc613e242e8e6c8 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Thu, 4 Jan 2001 19:54:06 +0000 Subject: [PATCH] Added preliminary unpacking support. committer: mfx 978638046 +0000 --- src/p_vmlinz.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/p_vmlinz.cpp b/src/p_vmlinz.cpp index 740db520..32edab7a 100644 --- a/src/p_vmlinz.cpp +++ b/src/p_vmlinz.cpp @@ -411,14 +411,34 @@ int PackVmlinuzI386::canUnpack() } -void PackVmlinuzI386::unpack(OutputFile *) +void PackVmlinuzI386::unpack(OutputFile *fo) { // no uncompression support for this format, so that // it is possible to remove the original deflate code (>10KB) // FIXME: but we could write the uncompressed "vmlinux" image - throwCantUnpack("build a new kernel instead :-)"); + ibuf.alloc(ph.c_len); + obuf.allocForUncompression(ph.u_len); + + fi->seek(setup_size + ph.buf_offset + ph.getPackHeaderSize(), SEEK_SET); + fi->readx(ibuf, ph.c_len); + + // decompress + decompress(ibuf, obuf); + + // unfilter + Filter ft(ph.level); + ft.init(ph.filter, kernel_entry); + ft.cto = (unsigned char) ph.filter_cto; + ft.unfilter(obuf, ph.u_len); + + // write decompressed file + if (fo) + { + throwCantUnpack("build a new kernel instead :-)"); + //fo->write(obuf, ph.u_len); + } }