From c9d6dab4010c50d112ac2c2fb2ec323795acd120 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Mon, 19 Dec 2016 23:14:08 +0100 Subject: [PATCH] Remove unused p_elks.cpp. --- src/p_elks.cpp | 174 ----------------------------------------------- src/p_vmlinz.h | 28 -------- src/packmast.cpp | 5 -- 3 files changed, 207 deletions(-) delete mode 100644 src/p_elks.cpp diff --git a/src/p_elks.cpp b/src/p_elks.cpp deleted file mode 100644 index 65d5ccc2..00000000 --- a/src/p_elks.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* p_elks.cpp -- - - This file is part of the UPX executable compressor. - - Copyright (C) 1996-2016 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996-2016 Laszlo Molnar - All Rights Reserved. - - UPX and the UCL library are free software; you can redistribute them - and/or modify them under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - Markus F.X.J. Oberhumer Laszlo Molnar - - */ - - -#include "conf.h" - -#if 0 - -#include "file.h" -#include "filter.h" -#include "packer.h" -#include "p_vmlinz.h" - -// FIXME -static const -#include "stub/l_vmlinz.h" - -// from elks-0.0.83/Documentation/boot.txt -static const unsigned kernel_entry = 0x100000; -static const unsigned stack_during_uncompression = 0x90000; -static const unsigned zimage_offset = 0x1000; - - -/************************************************************************* -// -**************************************************************************/ - -const int *PackElks8086::getCompressionMethods(int method, int level) const -{ - return Packer::getDefaultCompressionMethods_8(method, level); -} - - -const int *PackElks8086::getFilters() const -{ - return NULL; -} - - -/************************************************************************* -// common util routines -**************************************************************************/ - -int PackElks8086::decompressKernel() -{ - // not used - return 0; -} - - -void PackElks8086::readKernel() -{ - int klen = file_size - setup_size; - fi->seek(0, SEEK_SET); - - setup_buf.alloc(setup_size); - fi->readx(setup_buf, setup_size); - - ibuf.alloc(klen); - fi->readx(ibuf, klen); - - obuf.allocForCompression(klen); - - ph.u_len = klen; - ph.filter = 0; -} - - -/************************************************************************* -// -**************************************************************************/ - -void PackElks8086::buildLoader(const Filter *ft) -{ - // prepare loader - initLoader(nrv_loader, sizeof(nrv_loader)); - // FIXME - UNUSED(ft); -} - - -void PackElks8086::pack(OutputFile *fo) -{ - readKernel(); - - // prepare filter - Filter ft(ph.level); - ft.buf_len = ph.u_len; - ft.addvalue = kernel_entry; - // compress - compressWithFilters(&ft, overlap_range, NULL_cconf); - - const unsigned lsize = getLoaderSize(); - MemBuffer loader(lsize); - memcpy(loader, getLoader(), lsize); - - patchPackHeader(loader, lsize); -#if 0 - // FIXME - defineFilterSymbols(&ft); - defineDecompressorSymbols(); - //patch_le32(loader, lsize, "ESI1", zimage_offset + lsize); - //patch_le32(loader, lsize, "KEIP", kernel_entry); - //patch_le32(loader, lsize, "STAK", stack_during_uncompression); -#endif - - boot_sect_t * const bs = (boot_sect_t *) ((unsigned char *) setup_buf); - bs->sys_size = ALIGN_UP(lsize + ph.c_len, 16) / 16; - - fo->write(setup_buf, setup_buf.getSize()); - fo->write(loader, lsize); - fo->write(obuf, ph.c_len); -#if 0 - printf("%-13s: setup : %8ld bytes\n", getName(), (long) setup_buf.getSize()); - printf("%-13s: loader : %8ld bytes\n", getName(), (long) lsize); - printf("%-13s: compressed : %8ld bytes\n", getName(), (long) ph.c_len); -#endif - - // finally check the compression ratio - if (!checkFinalCompressionRatio(fo)) - throwNotCompressible(); -} - - -/************************************************************************* -// unpack -**************************************************************************/ - -int PackElks8086::canUnpack() -{ - if (readFileHeader() != getFormat()) - return false; - fi->seek(setup_size, SEEK_SET); - return readPackHeader(1024) ? 1 : -1; -} - - -void PackElks8086::unpack(OutputFile *) -{ - // no uncompression support for this format yet - - // FIXME: but we could write the uncompressed "Image" image - - throwCantUnpack("build a new kernel instead :-)"); -} - - -#endif /* if 0 */ - -/* vim:set ts=4 sw=4 et: */ diff --git a/src/p_vmlinz.h b/src/p_vmlinz.h index c23c2a66..bcba20bd 100644 --- a/src/p_vmlinz.h +++ b/src/p_vmlinz.h @@ -121,34 +121,6 @@ protected: }; -/************************************************************************* -// elks/8086 (linux-8086 uncompressed kernel image) -**************************************************************************/ - -class PackElks8086 : public PackVmlinuzI386 -{ - typedef PackVmlinuzI386 super; -public: - PackElks8086(InputFile *f) : super(f) { } - virtual int getFormat() const { return UPX_F_ELKS_8086; } - virtual const char *getName() const { return "elks/i086"; } - virtual const char *getFullName(const options_t *) const { return "i086-elks ???"; } - virtual const int *getCompressionMethods(int method, int level) const; - virtual const int *getFilters() const; - - virtual void pack(OutputFile *fo); - virtual void unpack(OutputFile *fo); - - virtual int canUnpack(); - -protected: - virtual int decompressKernel(); - virtual void readKernel(); - - virtual void buildLoader(const Filter *ft); -}; - - /************************************************************************* // vmlinuz/armel (gzip compressed Linux kernel image) **************************************************************************/ diff --git a/src/packmast.cpp b/src/packmast.cpp index 9b259e0b..1df62ea2 100644 --- a/src/packmast.cpp +++ b/src/packmast.cpp @@ -219,11 +219,6 @@ Packer* PackMaster::visitAllPackers(visit_func_t func, InputFile *f, const optio if ((p = func(new PackVmlinuzARMEL(f), user)) != NULL) return p; delete p; p = NULL; -#if 0 - if ((p = func(new PackElks8086(f), user)) != NULL) - return p; - delete p; p = NULL; -#endif // // linux