radare2/doc/iphone.md

118 lines
2.8 KiB
Markdown
Raw Normal View History

2014-05-17 02:27:49 +00:00
Crosscompiling from OSX:
========================
2018-02-27 09:54:54 +00:00
export PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:$PATH
export CC=`pwd`/sys/ios-sdk-gcc
# set only for arm64, otherwise it is armv7
export CPU=arm64
# select ios sdk version
export IOSVER=7.1
./configure --prefix=/usr --with-ostype=darwin --with-compiler=ios-sdk --target=arm-unknown-darwin
make -j4
make install DESTDIR=/tmp/r2ios
2014-05-17 02:27:49 +00:00
Natively compiling on iOS
=========================
SSH into your iDevice and run the following steps:
2014-01-18 02:06:22 +00:00
Setup SDK for ARMv6
2014-05-17 02:27:49 +00:00
-------------------
2018-02-27 09:54:54 +00:00
2014-01-18 02:06:22 +00:00
1) Install 'APT 0.7 Strict' and OpenSSH packages from cydia.
2018-02-27 09:54:54 +00:00
apt-get coreutils install wget inetutils rsync git expat curl
2014-01-18 02:06:22 +00:00
2) Download missing packages from lolcathost:
2018-02-27 09:54:54 +00:00
wget http://lolcathost.org/b/libgcc_4.2-20080410-1-6_iphoneos-arm.deb
wget http://lolcathost.org/b/libSystem.dylib
2014-01-18 02:06:22 +00:00
3) Install them
2018-02-27 09:54:54 +00:00
dpkg -i libgcc_4.2-20080410-1-6_iphoneos-arm.deb
apt-get install com.bigboss.20toolchain
cp libSystem.dylib /usr/lib
cd /usr/lib ; ln -sf libSystem.dylib libm.dylib
apt-get install make vim gawk git
2014-01-18 02:06:22 +00:00
4) /var/include/sys/stat.h is broken.
2018-02-27 09:54:54 +00:00
Solution: add 'int foo[3];' after 'st_rdev' at line 178
2014-01-18 02:06:22 +00:00
5) Get the varinclude tarball
2018-02-27 09:54:54 +00:00
wget lolcathost.org/b/varinclude.tar.gz
tar xzvf varinclude.tar.gz -C /
2014-01-18 02:06:22 +00:00
Compilation
2014-05-17 02:27:49 +00:00
-----------
2014-01-18 02:06:22 +00:00
export CC=gcc
export CFLAGS=-I/var/include
export CPPFLAGS=-I/var/include
./configure --prefix=/usr --with-ostype=darwin
make
make symstall
Usage
2014-05-17 02:27:49 +00:00
-----
2014-01-18 02:06:22 +00:00
export R2DIR=/private/var/radare2
export PATH=${R2DIR}/bin:$PATH
export DYLD_LIBRARY_PATH=${R2DIR}/lib
r2 ...
2014-01-18 11:17:13 +00:00
Building with the ARMv7 SDK
2014-05-17 02:27:49 +00:00
---------------------------
2014-01-18 11:17:13 +00:00
From coolstar repo we get the ios toolchain
2014-01-18 02:06:22 +00:00
apt-get coreutils install wget inetutils
apt-get install basename git make expat
apt-get install org.coolstar.iostoolchain
* Copy crt1.o and dylib1.o from your iOS SDK into /usr/lib
/Applications//Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/
* Current r2 build requires 'gcc' as native compiler to
build a standalone 'sdb' to precompile some files. This
dependency will be probably
cd /usr/bin
ln -fs clang gcc
2014-05-17 02:27:49 +00:00
Build
-----
2014-01-18 02:06:22 +00:00
export CC=clang
export CFLAGS=-I/var/include
export CPPFLAGS=-I/var/include
./configure --prefix=/usr --with-ostype=darwin
make
make symstall
Packaging
2014-05-17 02:27:49 +00:00
---------
2014-01-18 02:06:22 +00:00
Make a fake install in a temporary directory:
rm -rf /tmp/r2
make install DESTDIR=/tmp/r2
cd /tmp/r2
tar czvpf ../r2.tgz *
Clone the cydia repo from radare's github
git clone https://github.com/radare/cydia
cd cydia/radare2*
mkdir root
tar xzvf r2.tgz -C root
vim CONFIG # bump version
make
Signing
-------
In order to enable debugger capabilities to the radare2
executable you will need to sign it using the following command:
cd binr/radare2
make sign