diff --git a/README.md b/README.md index 8b6e0636b6993fed29735cece5ceb2dcf73cf951..91724630da952585d14a556fdeefa0f259fa462c 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,31 @@ $ cd /path/to/zipr $ scons ``` -The `$PSZ` script uses IDA pro by default if it is setup properly. You'll see the `meds-static` step replace the `rida` step. +The `$PSZ` script uses IDA Pro by default if it is setup properly. You'll see the `meds-static` step replace the `rida` step. +If this step fails, make sure that IDA Pro is installed properly, and that you have started IDA Pro's GUI to accept the license agreement. +The cookbook and other tools may use `pszr` to invoke zipr. This command means "invoke Zipr with Rida" as the front end, or `$PSZ -c rida`. If you've using `pszr` and wish to change +to IDA, just switch to `$PSZ`. +# Zipr and non-X86 Architectures. + +Zipr's origins are in the X86 world, and thus most of the scripts, examples, etc. implicitly assume X86 code. +However, Zipr has at least some support for ARM32/64, MIPS32/64 and X86 32/64. +Zipr _can_ run on ARM box, but has never been tested/built on a MIPS box. + + +To make Zipr work on non-x86 binaries, you'll need to have completed these steps: + +* Built Zipr with IDA Pro support (ensure IDAROOT and IDASDK are set when running zipr). +* Install core-utils and gcc for cross compilation. For arm32 and arm64, you can use `sudo apt install binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu` +* Set the environment variables to specify that Zipr should use the cross-compilation tools. In particular, set `PS_OBJDUMP`, `PS_READELF`, `PS_GCC`, `PS_OBJCOPY`, `PS_NM`, `PS_STRIP`. +For example, to use Zipr for the ARM architecture (32 or 64-bit) set `export PS_GCC=aarch64-linux-gnu-gcc` (and the other environment variables). +This can be simplified with the `set-cross.sh` script by invoking it like so: `source set-cross.sh arm32` (or, substitute arm64, mips32,or mips64.) + + + +## Windows +Zipr (running on x86-64/linux) can possibly transform PE/PE+ files for Windows. Support is _very_ preliminary. Your mileage may vary. + +Zipr has never been built to run on a Windows machine. diff --git a/set-cross.sh b/set-cross.sh new file mode 100644 index 0000000000000000000000000000000000000000..da426e76f8625c1e31eda0617854d2dd39ee8a6a --- /dev/null +++ b/set-cross.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +main() +{ + + local prefix="" + if [[ $1 == "arm64" ]]; then + prefix=aarch64-linux-gnu + elif [[ $1 == "arm32" ]]; then + prefix=arm-linux-gnueabi + else + echo "Cannot find architecture $1" + echo "use source '$0 <arch>' after running set_env_vars" + fi + export PS_OBJDUMP=$(which -- $prefix-objdump) + export PS_READELF=$(which -- $prefix-readelf) + export PS_GCC=$(which -- $prefix-gcc) + export PS_OBJCOPY=$(which -- $prefix-objcopy) + export PS_NM=$(which -- $prefix-nm) + export PS_STRIP=$(which -- $prefix-strip) + +} + +main "$@" +