upxmake --- upx source compilation

1. 下载upx所依赖的组件源码

2. 解压源码到指定工作目录

  • upxmake 工作目录结构
# cd /root/develop/upxmake/
# tree .
.
├── README.md
├── dist
├── document
├── package
│ ├── lzma443.tar.bz2
│ ├── upx-3.95-src.tar.gz
│ └── upx-3.95.tar.gz
├── source
└── vendor
├── install
└── source
├── ucl-1.03.tar.gz
└── zlib-1.2.11.tar.gz 7 directories, 6 files
#
  • zlib-1.2 编译命令
# cd /root/develop/upxmake/
# cd vendor/source/
# tar -zxvpf zlib-1.2.11.tar.gz
# cd zlib-1.2.11/
# ./configure --prefix=/root/develop/upxmake/vendor/install/zlib
# gmake all
# gmake install
# tree ../../install/zlib
../../install/zlib
├── include
│ ├── zconf.h
│ └── zlib.h
├── lib
│ ├── libz.a
│ ├── libz.so -> libz.so.1.2.11
│ ├── libz.so.1 -> libz.so.1.2.11
│ ├── libz.so.1.2.11
│ └── pkgconfig
│ └── zlib.pc
└── share
└── man
└── man3
└── zlib.3 6 directories, 8 files
#
  • ucl-1.03 编译命令
# cd /root/develop/upxmake/
# cd vendor/source/
# tar -zxvpf ucl-1.03.tar.gz
# cd ucl-1.03/
# ./configure --prefix=/root/develop/upxmake/vendor/install/ucl
# gmake all
# gmake install
# tree ../../install/ucl/
../../install/ucl/
├── include
│ └── ucl
│ ├── ucl.h
│ ├── ucl_asm.h
│ └── uclconf.h
└── lib
├── libucl.a
└── libucl.la 3 directories, 5 files
#
  • upx-3.95-src 编译命令
  1. 解压源码包

修改编译的src/Makefile文件, 删除CXXFLAGS-Wmissing-declarations-Wvla选项.

# cd /root/develop/upxmake/
# tar -zxvpf package/upx-3.95-src.tar.gz -C source/
# cd source/upx-3.95-src/
# vi src/Makefile
  1. 当前终端环境变量设置
# export UPX_ZLIBDIR="/root/develop/upxmake/vendor/install/zlib"
# export UPX_UCLDIR="/root/develop/upxmake/vendor/install/ucl"
# export UPX_DIR="/root/develop/upxmake/source/upx-3.95-src"
#
# export CPPFLAGS="-I${UPX_ZLIBDIR}/include -I${UPX_UCLDIR}/include ${CPPFLAGS}"
# export LIBRARY_PATH="${UPX_ZLIBDIR}/lib:${UPX_UCLDIR}/lib:${LIBRARY_PATH}"
# export LD_LIBRARY_PATH=".:${UPX_ZLIBDIR}/lib:${UPX_UCLDIR}/lib:${LD_LIBRARY_PATH}"
#
# ldconfig -m ${UPX_ZLIBDIR}/lib
# ldconfig -m ${UPX_UCLDIR}/lib
#
  1. 编译源码
# cd /root/develop/upxmake/
# cd source/upx-3.95-src/
# gmake all
# ldd src/upx.out
src/upx.out:
libucl.so.1 => /usr/local/lib/libucl.so.1 (0x80080c000)
libz.so.5 => /lib/libz.so.5 (0x800919000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x800a2e000)
libm.so.5 => /lib/libm.so.5 (0x800c3e000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x800d5e000)
libc.so.7 => /lib/libc.so.7 (0x800e6c000)
#
# cp src/upx.out ../../dist/upx_amd64.elf
# cd ../../dist/
# ./upx_amd64.elf --help
Ultimate Packer for eXecutables
Copyright (C) 1996 - 2018
UPX 3.95 Markus Oberhumer, Laszlo Molnar & John Reiser Aug 26th 2018 Usage: upx_amd64.elf [-123456789dlthVL] [-qvfk] [-o file] file.. Commands:
-1 compress faster -9 compress better
--best compress best (can be slow for big files)
-d decompress -l list compressed file
-t test compressed file -V display version number
-h give this help -L display software license Options:
-q be quiet -v be verbose
-oFILE write output to 'FILE'
-f force compression of suspicious files
--no-color, --mono, --color, --no-progress change look Compression tuning options:
--brute try all available compression methods & filters [slow]
--ultra-brute try even more compression variants [very slow] Backup options:
-k, --backup keep backup files
--no-backup no backup files [default] Overlay options:
--overlay=copy copy any extra data attached to the file [default]
--overlay=strip strip any extra data attached to the file [DANGEROUS]
--overlay=skip don't compress a file with an overlay Options for djgpp2/coff:
--coff produce COFF output [default: EXE] Options for dos/com:
--8086 make compressed com work on any 8086 Options for dos/exe:
--8086 make compressed exe work on any 8086
--no-reloc put no relocations in to the exe header Options for dos/sys:
--8086 make compressed sys work on any 8086 Options for ps1/exe:
--8-bit uses 8 bit size compression [default: 32 bit]
--8mib-ram 8 megabyte memory limit [default: 2 MiB]
--boot-only disables client/host transfer compatibility
--no-align don't align to 2048 bytes [enables: --console-run] Options for watcom/le:
--le produce LE output [default: EXE] Options for win32/pe, win64/pe, rtm32/pe & arm/pe:
--compress-exports=0 do not compress the export section
--compress-exports=1 compress the export section [default]
--compress-icons=0 do not compress any icons
--compress-icons=1 compress all but the first icon
--compress-icons=2 compress all but the first icon directory [default]
--compress-icons=3 compress all icons
--compress-resources=0 do not compress any resources at all
--keep-resource=list do not compress resources specified by list
--strip-relocs=0 do not strip relocations
--strip-relocs=1 strip relocations [default] Options for linux/elf:
--preserve-build-id copy .gnu.note.build-id to compressed output file.. executables to (de)compress This version supports:
amd64-darwin.dylib dylib/amd64
amd64-darwin.macho macho/amd64
amd64-linux.elf linux/amd64
amd64-linux.kernel.vmlinux vmlinux/amd64
amd64-win64.pe win64/pe
arm-darwin.macho macho/arm
arm-linux.elf linux/arm
arm-linux.kernel.vmlinux vmlinux/arm
arm-linux.kernel.vmlinuz vmlinuz/arm
arm-wince.pe arm/pe
arm64-darwin.macho macho/arm64
arm64-linux.elf linux/arm64
armeb-linux.elf linux/armeb
armeb-linux.kernel.vmlinux vmlinux/armeb
fat-darwin.macho macho/fat
i086-dos16.com dos/com
i086-dos16.exe dos/exe
i086-dos16.sys dos/sys
i386-bsd.elf.execve bsd.exec/i386
i386-darwin.macho macho/i386
i386-dos32.djgpp2.coff djgpp2/coff
i386-dos32.tmt.adam tmt/adam
i386-dos32.watcom.le watcom/le
i386-freebsd.elf freebsd/i386
i386-linux.elf linux/i386
i386-linux.elf.execve linux.exec/i386
i386-linux.elf.shell linux.sh/i386
i386-linux.kernel.bvmlinuz bvmlinuz/i386
i386-linux.kernel.vmlinux vmlinux/i386
i386-linux.kernel.vmlinuz vmlinuz/i386
i386-netbsd.elf netbsd/i386
i386-openbsd.elf openbsd/i386
i386-win32.pe win32/pe
m68k-atari.tos atari/tos
mips-linux.elf linux/mips
mipsel-linux.elf linux/mipsel
mipsel.r3000-ps1 ps1/exe
powerpc-darwin.macho macho/ppc32
powerpc-linux.elf linux/ppc32
powerpc-linux.kernel.vmlinux vmlinux/ppc32
powerpc64-linux.elf linux/ppc64
powerpc64le-darwin.macho macho/ppc64le
powerpc64le-linux.elf linux/ppc64le
powerpc64le-linux.kernel.vmlinux vmlinux/ppc64le UPX comes with ABSOLUTELY NO WARRANTY; for details visit https://upx.github.io
#

End ...

最新文章

  1. Nancy之基于Self Hosting的补充小Demo
  2. phpexcel引入MVC框架会导致__autoload引入类文件失败的解决办法
  3. MapReduce实例-基于内容的推荐(一)
  4. JS中的this对象详解
  5. AngularJS开发指南6:AngularJS表单详解
  6. C++学习17派生类的构造函数
  7. poj 1330 Nearest Common Ancestors LCA
  8. android多国语言文件夹
  9. 支付宝APP支付(Java后台生成签名具体步骤)
  10. 【Nutch2.3基础教程】集成Nutch/Hadoop/Hbase/Solr构建搜索引擎:安装及运行【集群环境】
  11. C#使用自定义字体(从文件获取)
  12. JavaScript Trick
  13. EntityFrameworkCore v1.1.1 问题汇总
  14. NLog基础配置
  15. [leetcode]Word Break @ Python
  16. 最小二乘法least square
  17. C语言 常用的宏定义
  18. FastJson bean序列化属性顺序问题
  19. Java 8 Date-Time API概览
  20. HDU 5336 XYZ and Drops

热门文章

  1. Flutter移动电商实战 --(33)列表页_子类和商品列表交互效果
  2. CDH构建大数据平台-Kerberos高可用部署【完结篇】
  3. Mysql 清空数据后,释放硬盘文件
  4. LC 592. Fraction Addition and Subtraction
  5. 利用socket实现聊天-Android端核心代码
  6. WPF 设置TextBox为空时,背景为文字提示。
  7. 仙剑奇侠传1系列:2.编译主程序SDLPAL及SDL
  8. 使用XCode7打包动态库(Framework)
  9. django ORM中的复选MultiSelectField的使用
  10. list列表转tree树方法