Before creating the compilation environment, download the required SDK and Firmware files: iPhone1, 2_3.1.2_7D11_Restore.ipswhttp: // response.
Before creating a compilation environment, download the required SDK and Firmware files:
IPhone1, 2_3.1.2_7D11_Restore.ipsw
Http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7265.20091008.Xsd32/iPhone1,2_3.1.2_7D11_Restore.ipsw
Iphone_sdk_3.1.2_with_xcode_3.1.4 _ leopard _ 9m2809. dmg
Http://shuqun.com/files/iphone_sdk_3.1.2_with_xcode_3.1.4__leopard__9m2809.dmg
My Linux HOST environment is Ubuntu 9.10 (Karmic Koala). Here we use iphonedevonlinux to create a toolchain.
First, configure the HOST environment required for compilation, and enter the following command in the terminal:
1 sudo apt-get install automake bison cpio flex g ++-4.3g ++-4.3-multilib gawk gcc-4.3 git-core gobjc-4.3 gzip libbz2-dev libcurl4-openssl-dev libssl-dev make mount subversion sudo tar unzip uuid-dev wget xar zlib1g-dev
Click here to get the iphonedevonlinux source code:
1 $ mkdir-p ~ /Iphone/toolchain
2 $ cd ~ /Iphone/toolchain
3 $ svn checkout http://iphonedevonlinux.googlecode.com/svn/trunk ./
Currently, the svn version of checkout out is 83.
Copy the SDK and the firmware file to the corresponding directory:
1 $ mkdir-p ~ /Iphone/toolchain/files/firmware
2 $ mv./iphone_sdk_3.1.2_with_xcode_3.1.4 _ leopard _ 9m2809. dmg ~ /Iphone/toolchain/files/
3 $ mv./iPhone1, 2_3.1.2_7D11_Restore.ipsw ~ /Iphone/toolchain/files/firmware/
Manually set the key and comment out the code for downloading the key in toolchain. sh:
1 $ gedit ~ /Iphone/toolchain. sh
01 unzip-d "$ {TMP_DIR}"-o "$ {FW_FILE}" $ {FW_RESTORE_SYSTEMDISK }"
02
03 # if [-z "$ DECRYPTION_KEY_SYSTEM"]; then
04 # echo "We need the decryption key for 'basename $ fw_restore_systemdisk '."
05 # echo "I'm going to try to fetch it from $ IPHONEWIKI_KEY_URL ...."
06 #
07 # IPHONEWIKI_KEY_URL = $ (wget -- quiet-O-$ IPHONEWIKI_KEY_URL | awk'
08 # BEGIN {IGNORECASE = 1 ;}
09 #/name = "'$ {DEVICE}'/{found_phone = 1 ;}
10 #/. * '$ {TOOLCHAIN_VERSION}'. */& found_phone {found_firmware = 1 ;}
11 #/. * href =. */& found_firmware {while (sub (/href = | "/," ", $3); print $3; exit ;}
12 #')
13
14 # DECRYPTION_KEY_SYSTEM = 'wget -- quiet-O-"http://www.theiphonewiki.com" $ IPHONEWIKI_KEY_URL | awk'
15 # BEGIN {IGNORECASE = 1 ;}
16 #/. * VFDecrypt. */{print $3 ;}
17 #''
18
19 DECRYPTION_KEY_SYSTEM = "encrypt"
20
21 if [! "$ DECRYPTION_KEY_SYSTEM"]; then
We can use
1 $ sudo./toolchain. sh all
The toolchain is automatically compiled, but many problems may occur. Here we use manual step-by-step compilation:
1 $ sudo./toolchain. sh headers
2 $ sudo./toolchain. sh firmware
3 $ sudo./toolchain. sh darwin_sources
4 $ sudo./toolchain. sh build
Generally, no problem occurs in the first three steps. (Leave a message if you have any questions)
In the last step, an error is reported in toolchain. sh build ~ /Iphone/toolchain/bld/cctools-iphone/make. log, search for "error:", and add:
1 # include <stdio. h>
2 # include <stdlib. h>
The following are my modified files:
ArchiveReader. hpp MachOReaderDylib. hpp MachOWriterExecutable. hpp OpaqueSection. hpp ld. cpp Options. cpp
Re-build. Be sure not to repeat the checkout code. Otherwise, you must repeat it again...
If "It seems like the toolchain built!" appears !", The toolchain is successfully built.
You can use the code in apps to test the toolchain. Generally, there are two problems:
1. Unable to find the compiler arm-apple-darwin9-gcc
In ~ /. Add the environment variable to bashrc.
1 $ sudo gedit ~ /. Bashrc
Add export PATH = ~ /Iphone/toolchain/pre/bin: $ PATH
2. The message "ld: library not found for-lobjc" is displayed"
Copy the following directory to the compiler Library:
1 mv ~ /Iphone/toolchain/sys/System ~ /Iphone/toolchain/sys/System2
2 mv ~ /Iphone/toolchain/sys/usr/lib ~ /Iphone/toolchain/sys/usr/lib2
3 cp ~ /Iphone/toolchain/sdks/iPhoneOS3.1.2.sdk/System ~ /Iphone/toolchain/sys/
4 cp ~ /Iphone/toolchain/sdks/iPhoneOS3.1.2.sdk/usr/lib ~ /Projects/iphone/toolchain/sys/usr/