(1) jailbreak iPhone with pwned firmware 2.0.x
(2) Install the following packages in Cydia Installer
- GNU C Compiler
- iPhone 2.0 Toolchain
- Make
- Link Indentity Editor
- wget (... in order to download the following sample in iPhone)
- zip (... in order to unzip the following sample in iPhone)
Here is the procedure on how to copy the iPhone SDK headers from your mac to iPhone GCC to have a SDK development environment in iPhone
I have installed the sdk header files to /var/sdk of iPhone
If you use Linux / Microsoft Windows, see this on how to get the header files from the SDK
http://www.theiphonewiki.com/wiki/index.php?title=Toolchain_2.0
Use this shell script in Mac Terminal to copy the installed SDK header files to iPhone directly
and you have to change IPHONEIP for your actual iPhone IP address
- copySDKHeaders.sh : Select all
#!/bin/sh
IPHONEIP=10.0.2.2
sdkroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/Frameworks
sdkframeworks[1]=$sdkroot/AddressBook.framework/Headers/*
sdkframeworks[2]=$sdkroot/AddressBookUI.framework/Headers/*
sdkframeworks[3]=$sdkroot/AudioToolbox.framework/Headers/*
sdkframeworks[4]=$sdkroot/AudioUnit.framework/Headers/*
sdkframeworks[5]=$sdkroot/CFNetwork.framework/Headers/*
sdkframeworks[6]=$sdkroot/CoreAudio.framework/Headers/*
sdkframeworks[7]=$sdkroot/CoreFoundation.framework/Headers/*
sdkframeworks[8]=$sdkroot/CoreGraphics.framework/Headers/*
sdkframeworks[9]=$sdkroot/CoreLocation.framework/Headers/*
sdkframeworks[10]=$sdkroot/Foundation.framework/Headers/*
sdkframeworks[11]=$sdkroot/MediaPlayer.framework/Headers/*
sdkframeworks[12]=$sdkroot/OpenAL.framework/Headers/*
sdkframeworks[13]=$sdkroot/OpenGLES.framework/Headers/*
sdkframeworks[14]=$sdkroot/QuartzCore.framework/Headers/*
sdkframeworks[15]=$sdkroot/Security.framework/Headers/*
sdkframeworks[16]=$sdkroot/SystemConfiguration.framework/Headers/*
sdkframeworks[17]=$sdkroot/UIKit.framework/Headers/*
sdkframeworks[18]=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/IOKit.framework/Headers/*
iphonesdkroot=/var/sdk
iphoneframeworksroot=$iphonesdkroot/include
iphoneframeworks[1]=$iphoneframeworksroot/AddressBook/
iphoneframeworks[2]=$iphoneframeworksroot/AddressBookUI/
iphoneframeworks[3]=$iphoneframeworksroot/AudioToolbox/
iphoneframeworks[4]=$iphoneframeworksroot/AudioUnit/
iphoneframeworks[5]=$iphoneframeworksroot/CFNetwork/
iphoneframeworks[6]=$iphoneframeworksroot/CoreAudio/
iphoneframeworks[7]=$iphoneframeworksroot/CoreFoundation/
iphoneframeworks[8]=$iphoneframeworksroot/CoreGraphics/
iphoneframeworks[9]=$iphoneframeworksroot/CoreLocation/
iphoneframeworks[10]=$iphoneframeworksroot/Foundation/
iphoneframeworks[11]=$iphoneframeworksroot/MediaPlayer/
iphoneframeworks[12]=$iphoneframeworksroot/OpenAL/
iphoneframeworks[13]=$iphoneframeworksroot/OpenGLES/
iphoneframeworks[14]=$iphoneframeworksroot/QuartzCore/
iphoneframeworks[15]=$iphoneframeworksroot/Security/
iphoneframeworks[16]=$iphoneframeworksroot/SystemConfiguration/
iphoneframeworks[17]=$iphoneframeworksroot/UIKit/
iphoneframeworks[18]=$iphoneframeworksroot/IOKit/
ssh root@$IPHONEIP "mkdir -p $iphoneframeworksroot"
scp -r /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/include root@$IPHONEIP:$iphonesdkroot
scp -r /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib root@$IPHONEIP:$iphonesdkroot
for index in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
do
echo "copying ${sdkframeworks[index]} to ${iphoneframeworks[index]}"
ssh root@$IPHONEIP "mkdir -p ${iphoneframeworks[index]}"
scp -r ${sdkframeworks[index]} root@$IPHONEIP:${iphoneframeworks[index]}
done
In order to avoid typing the password using ssh, you can install the ssh public key of your Mac to your iPhone using the following method
(a) keygen in Mac terminal and type (if you haven't generated it before)
- Select all
ssh-keygen -t rsa
(b) create .ssh directory in iPhone (assume ip address of iPhone is 10.0.2.2)
- Select all
ssh root@10.0.2.2 'mkdir -p .ssh'
then enter iPhone root password (alpine)
(c) copy mac public key to iPhone, and in Mac Terminal type
- Select all
cat ~/.ssh/id_rsa.pub | ssh root@10.0.2.2 'cat >> .ssh/authorized_keys'
then enter iPhone root password (alpine)
(d) Edit the file /etc/ssh/sshd_config in iPhone
change these
- Select all
#StrictModes yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys
to
- Select all
StrictModes no
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
(e)reboot iPhone
I have successfully compiled a modified SDK sample app UICategory (non-Interface Builder verison)
Here is the project folder to test your installation.
(i) copy it (using wget) and unzip it in iPhone
- Select all
wget http://www.iphone.org.hk/attach/39773-UICatalog.zip
unzip 39773-UICatalog.zip
(ii) then run
- Select all
cd UICatalog
make
make install
to build and install the project in iPhone