Showing posts with label iPhone ToolChain. Show all posts
Showing posts with label iPhone ToolChain. Show all posts

Saturday, May 24, 2008

iPhone Open Toolchain Header runs UIShowCase

The missing UIKit clasees of open toolchain headers for IPhone SDK is now partially solved. You can now build UIShowCase in your Open Toolchain Template in iPhone SDK.

Read this
http://www.hackint0sh.org/forum/showpost.php?p=297245&postcount=15

Wednesday, May 14, 2008

What is needed to be an iPhone programmer (firmware 2.0 OS)

Even if you are not a registered iPhone developer of Apple (US$99 program), you still can code and test your iPhone program in firmware 2.0

This is how:

(1) You need a machine running Mac OS X 10.5.2 with Intel CPU because you need to run iPhone SDK for the iPhone OS 2.0
there are several possibilities, e.g.
(a) you can get a Intel Mac with Mac OS X 10.5.2 (which I think is the easiest one and save a lot of troubles, thus you can put omore time in the learning of iPhone programming)
(b) Use the VMWare image (and use VMWare Workstation/Player for PC), read this, and install iPhone SDK in it. You need C2D Intel CPU and lots of RAM (2G) in your existing PC.
(c) Install OSX86 on PC (you must be a power user), read this forum on how http://www.hackint0sh.org/forum/forumdisplay.php?f=104

(2) Get the iPhone SDK from Apple which is free after registration with Apple.

(3) You need to read some books on Objective C and Foundation framework of Mac OS X, I think Oreilly has good source of books in this subject. This site also gives some tutorial exmaples on cocoa programming http://cocoadevcentral.com/

(4) Get a pwned iPhone with iPhone OS 2.0 firmware beta 3 (build 5A240d)
read this for the pwnage tools http://www.hackint0sh.org/forum/forumdisplay.php?f=146

(5) Read this Forum and use the Xcode template (open toolchain header) here to start some coding and testing on iPhone
http://www.hackint0sh.org/forum/showthread.php?t=38389

(6) get some project code (based on open toolchain) from the right menu of this blog to compile and test run on iPhone

(7) start coding your own idea in your own iPhone project.

Saturday, May 10, 2008

class-dump for iPhone SDK header file

http://iphone.freecoder.org/classdump_en.html

with this wonderful tool, you don't need to worry about header files problem any more
e.g.
put the class-dump binary (Mac OS X) in your bin and do this

class-dump -H /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit

you will get the most updated header files in your current directory from the SDK

Friday, April 18, 2008

Using the Apple SDK with low-level toolchain APIs

Update and details here

Assume you have installed iPhone SDK beta 3 and want to use the toolchain APIs to port the existing iPhone Application to Firmware 2.0 beta 3 using Apple's SDK

(1) Install iPhone SDK beta 3 from Apple

(2) Install the toolchain headers as per instructions from here
But I have modified it for the Beta 3 SDK path as below


$ sudo mkdir -p /Developer/SDKs/iPhoneOS.sdk/Versions/iPhoneOS2.0.sdk/
$ svn co http://iphone-dev.googlecode.com/svn/branches/include-1.2-sdk
$ cd include-1.2-sdk
$ ./configure --prefix=/Developer/SDKs/iPhoneOS.sdk/Versions/iPhoneOS2.0.sdk/
$ sudo sh install-headers.sh


(3) Get the following Template here, unzip it and put the "Tool Chain Build" folder under the following folder (you need to create this folder first),
/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/iPhone Tool Chain

then you can see this Template when you create new project

(4) This template supports Build to device and release only, so you have to connect your iPhone to USB cable when build and go

(5) When using SDK framework to build old iPhone App, you would discover that some symbols will be missing when linking

(6) The Template also include MakeFile to build application that can be ssh to iPhone folder /Application

Wednesday, April 2, 2008

Monday, March 24, 2008

Open Tool Chain for apple SDK available now

This allows you to build the 1.2.0 iPhone arm binary from source code using Open Tool Chain and the low level APIs.

That means you must have a 1.2.0 firmware iPhone and Apple iPhone SDK to test.

Read this
http://www.zdziarski.com/

sdk header can be obtained from here
svn co http://iphone-dev.googlecode.com/svn/branches/include-1.2-sdk

this is how to setup the build environment
http://iphone-dev.org/howto:using_sdk_with_toolchain_headers

try to build this from source
cvs -z3 -d :pserver:cvs@cvs.zdziarski.com:/usr/local/cvsroot co nesapp

Friday, March 7, 2008

My first Hello iPhone Program from SDK


Create a US iTunes account now,then you can get your iPhone Application from AppStore in June.

Monday, January 28, 2008

Decrypt iPhone filesystem Firmware using Mac OS or Linux

If you use Mac OS and want to extract the iPhone Firmware in your computer, you can follow the instructions below. If you use Windows PC, please refer to another post here

(1) get the vfdecrypt binary for Mac (Universal Binary)


If you use linux, you can get the source code from here and compile with
gcc vfdecrypt.c -o vfdecrypt -lcrypto


For this linux version, line 357 should be changed to
  while((c = getopt(argc, argv, "hvi:o:p:k:")) != -1) {


(2) Run the shell script below to download the firmware and get the decrypted dmg


#!/bin/bash
key100=28c909fc6d322fa18940f03279d70880e59a4507998347c70d5b8ca7ef090ecccc15e82d
key101=7d5962d0b582ec2557c2cade50de90f4353a1c1de07b74212513fef9cc71fb890574bfe5
key102=7d5962d0b582ec2557c2cade50de90f4353a1c1de07b74212513fef9cc71fb890574bfe5
key111=f45de7637a62b200950e550f4144696d7ff3dc5f0b19c8efdf194c88f3bc2fa808fea3b3
key112=70e11d7209602ada5b15fbecc1709ad4910d0ad010bb9a9125b78f9f50e25f3e05c595e2
key113=11070c11d93b9be5069b643204451ed95aad37df7b332d10e48fd3d23c62fca517055816
key114=d0a0c0977bd4b6350b256d6650ec9eca419b6f961f593e74b7e5b93e010b698ca6cca1fe
key120=ea14f3ec624c7fdbd52e108aa92d13b16f6b0b940c841f7bbc7792099dae45da928d13e7

ipswurl100=http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-3538.20070629.B7vXa/iPhone1,1_1.0_1A543a_Restore.ipsw
ipswurl101=http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-3614.20070731.Nt6Y7/iPhone1,1_1.0.1_1C25_Restore.ipsw
ipswurl102=http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-3823.20070821.vormd/iPhone1,1_1.0.2_1C28_Restore.ipsw
ipswurl111=http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-3883.20070927.In76t/iPhone1,1_1.1.1_3A109a_Restore.ipsw
ipswurl112=http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-4037.20071107.5Bghn/iPhone1,1_1.1.2_3B48b_Restore.ipsw
ipswurl113=http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-4061.20080115.4Fvn7/iPhone1,1_1.1.3_4A93_Restore.ipsw
ipswurl114=http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-4313.20080226.Sw39i/iPhone1,1_1.1.4_4A102_Restore.ipsw
ipswurl120=http://appldnld.apple.com.edgesuite.net/

ipswname100=iPhone1,1_1.0_1A543a_Restore.ipsw
ipswname101=iPhone1,1_1.0.1_1C25_Restore.ipsw
ipswname102=iPhone1,1_1.0.2_1C28_Restore.ipsw
ipswname111=iPhone1,1_1.1.1_3A109a_Restore.ipsw
ipswname112=iPhone1,1_1.1.2_3B48b_Restore.ipsw
ipswname113=iPhone1,1_1.1.3_4A93_Restore.ipsw
ipswname114=iPhone1,1_1.1.4_4A102_Restore.ipsw
ipswname120=iPhone1,1_2.0_5A225c_Restore.ipsw

dmgname100=694-5262-39.dmg
dmgname101=694-5281-6.dmg
dmgname102=694-5298-5.dmg
dmgname111=022-3602-17.dmg
dmgname112=022-3725-1.dmg
dmgname113=022-3743-100.dmg
dmgname114=022-3894-4.dmg
dmgname120=018-3473-4.dmg

decrypted100=decrypted100.dmg
decrypted101=decrypted101.dmg
decrypted102=decrypted102.dmg
decrypted111=decrypted111.dmg
decrypted112=decrypted112.dmg
decrypted113=decrypted113.dmg
decrypted114=decrypted114.dmg
decrypted120=decrypted120.dmg


# default is to get the latest firmware
# you can pass multiple arguments
# in command line to get more than one
if [ $# -lt 1 ]
then
getipsw=120
else
getipsw=$@
fi

for ipsw_ver in $getipsw
do
ipswname=$(eval "echo \$$(echo ipswname${ipsw_ver})")
ipswurl=$(eval "echo \$$(echo ipswurl${ipsw_ver})")
ipswpath=`pwd`/$ipswname
decryptedname=$(eval "echo \$$(echo decrypted${ipsw_ver})")
dmgname=$(eval "echo \$$(echo dmgname${ipsw_ver})")
key=$(eval "echo \$$(echo key${ipsw_ver})")
decryptpath=`pwd`/$decryptedname
if [ -f "$ipswpath" ]
then
echo Firmware $ipsw_ver "$ipswname" found
else
echo Downloading firmware $ipsw_ver $ipswname
curl "$ipswurl" > $ipswpath
fi

if [ -f "$decryptpath" ]
then
echo Firmware $ipsw_ver "$decryptedname" found
else
if [ -f "$ipswpath" ]
then
echo Extracting firmware $ipsw_ver $dmgname
unzip -o $ipswname $dmgname -d .
fi
if [ -f "$dmgname" ]
then
echo Decrypting firmware $ipsw_ver $ipswname
./vfdecrypt -i $dmgname -o $decryptedname -k $key
fi
fi
done
echo Jobs Completed!!!



(3) Mount the decrypted dmg in Mac OS by double click the filename

(4) For Firmware key for 1.0.1 you can run
strings 009-7662-6.dmg | egrep "^[0-9a-fA-F]{72}$"
and This is how you find the key.

(5) This is where you can find the Firmware download link from Apple
http://itunes.com/version


If you find this info useful, please consider to $1 by clicking the Donate button.

Friday, January 25, 2008

Decrypt iPhone filesystem Firmware

This shows how to extract the iphone filesystem software (firmware files) from Apple iphone software download using PC (source from iPhone Dev wiki)

(1) For Firmware 1.0.1
(i) get the vfdecrypt101.exe from Rapid share
(ii) get the Apple's iPhone firmware 1.0.1 and rename it with extension .zip and unzip it
(run) vfdecrypt101 main_dmg_of_101.dmg decrypted101.dmg

(2) For Firmware 1.0.2
(i) get the vfdecrypt102.exe from Rapid share
(ii) get the Apple's iPhone firmware 1.0.2 and rename it with extension .zip and unzip it
(run) vfdecrypt102.exe 694-5298-5.dmg decrypted102.dmg

(3) For Firmware 1.1.1
(i) get the vfdecrypt111.exe from Rapid share
(ii) get the Apple's iPhone firmware 1.1.1 and rename it with extension .zip and unzip it
(run) vfdecrypt111.exe 022-3602-17.dmg decrypted111.dmg

(4) For Firmware 1.1.2
(i) get the vfdecrypt112.exe from Rapid share
(ii) get the Apple's iPhone firmware 1.1.2 and rename it with extension .zip and unzip it
(run) vfdecrypt112.exe 022-3725-1.dmg decrypted112.dmg

(5) For Firmware 1.1.3
(i) get the vfdecrypt.exe from Rapid Share
(ii) get the Apple's iPhone firmware 1.1.3 and rename it with extension .zip and unzip it
(run) vfdecrypt -i 022-3743-100.dmg -o decrypted113.dmg -k 11070c11d93b9be5069b643204451ed95aad37df7b332d10e48fd3d23c62fca517055816

(6) For Firmware 1.1.4
(i) get the vfdecrypt.exe from Rapid Share
(ii) get the Apple's iPhone firmware 1.1.4 and rename it with extension .zip and unzip it
(run) vfdecrypt -i 022-3894-4.dmg -o decrypted114.dmg -k d0a0c0977bd4b6350b256d6650ec9eca419b6f961f593e74b7e5b93e010b698ca6cca1fe

(7) For Firmware 2.0 beta (Build 5A225c) (MD5 8254ccf38735bc74b38fb432ce982081) (expired 8 April 2008)
(i) Google Search iPhone1,1_2.0_5A225c_Restore.ipsw
(ii) Rename it with extension .zip and unzip it
(run) vfdecrypt -i 018-3473-4.dmg -o decrypted20b2.dmg -k ea14f3ec624c7fdbd52e108aa92d13b16f6b0b940c841f7bbc7792099dae45da928d13e7

(8) For Firmware 2.0 beta (Build 5A240d) (MD5 429142d57db7cf94d4c29ee4da7f21cc) (to be expired 15 May 2008)
(i) Google Search iPhone1_1_2.0_5A240d_Restore.ipsw
(ii) Rename it with extension .zip and unzip it
(run) vfdecrypt -i 018-3553-6.dmg -o decrypted20b3.dmg -k e24bfab40a2e5d3dc25e089291846e5615b640897ae8b424946c587bcf53b201a1041d36


(9) For Firmware 2.0 beta (Build 5A258f) (MD5 f7a2937c32615545ba339c330356d9ad) (to be expired 4 June 2008)
(i) Google Search iPhone 2.0 Beta 4 (5a258f)
(ii) Rename it with extension .zip and unzip it (unzip -o iPhone1,1_2.0_5A258f_Restore.ipsw 018-3585-6.dmg)
(run) ./vfdecrypt -i 018-3585-6.dmg -o decrypted20b4.dmg -k 198d6602ba2ad2d427adf7058045fff5f20d05846622c186cca3d423ad03b5bc3f43c61c

Read detail steps for decrypt iPhone firmware 1.1.3 here


Notice
-------
(a)To run the vfdecrypt in PC you need libeay32.dll
as well
(b)To extract the contents in the dmg image in PC you need hfsexplorer or dmg2img.exe
You need Java Runtime if you use hfsexplorer

You can also use PowerISO 4.0 in Windows to examine and extract contents of Mac OS X *.dmg file
http://www.poweriso.com/

(c)
you can mount the decrypted image directly in Mac OS or Linux. To mount DMG
dd if=694-5259-38.dmg of=ramdisk.dmg bs=512 skip=4 conv=sync
mount -o loop decrpyted112.img /mnt/decrypted112

Keys
-----

The key for the 1.01 revision is : 28c909fc6d322fa18940f03279d70880e59a4507998347c70d5b8ca7ef090ecccc15e82d


The key for the 1.02 revision is : 7d5962d0b582ec2557c2cade50de90f4353a1c1de07b74212513fef9cc71fb890574bfe5


The key for the 1.1.1 revision is : f45de7637a62b200950e550f4144696d7ff3dc5f0b19c8efdf194c88f3bc2fa808fea3b3


The key for the 1.1.2 revision is :
70e11d7209602ada5b15fbecc1709ad4910d0ad010bb9a9125b78f9f50e25f3e05c595e2


The key for the 1.1.3 revision is :
11070c11d93b9be5069b643204451ed95aad37df7b332d10e48fd3d23c62fca517055816


The key for the 1.1.4 revision is : d0a0c0977bd4b6350b256d6650ec9eca419b6f961f593e74b7e5b93e010b698ca6cca1fe


The key for the 1.2.0 beta (Build 5A147p) (md5 iPhone1,1_1.2_5A147p_Restore.ipsw = 3539f0b912812fd56ac1019d8fce4fc2 ) is: 86bec353ddfbe3fb750e9d7905801f79791e69acf65d16930d288e697644c76f16c4f16d


The key for the 2.0 beta (Build 5A225c) (md5 iPhone1,1_2.0_5A225c_Restore.ipsw = 8254ccf38735bc74b38fb432ce982081 ) is: ea14f3ec624c7fdbd52e108aa92d13b16f6b0b940c841f7bbc7792099dae45da928d13e7


The key for the 2.0 beta (Build 5A240d) (md5 iPhone1_1_2.0_5A240d_Restore.ipsw = 429142d57db7cf94d4c29ee4da7f21cc) is: e24bfab40a2e5d3dc25e089291846e5615b640897ae8b424946c587bcf53b201a1041d36



The key for the 2.0 beta (Build 5A258f) (md5 iPhone1,1_2.0_5A258f_Restore.ipsw = f7a2937c32615545ba339c330356d9ad) is: 198d6602ba2ad2d427adf7058045fff5f20d05846622c186cca3d423ad03b5bc3f43c61c


read this http://tungchingkai.blogspot.com/2008/05/iphone11205a258frestoreipsw-decrypt.html for the decrypt method


The key for the 2.0 beta (Build 5A274d) (md5 iPhone1,1_2.0_5A274d_Restore.ipsw = 1e671faa31d876602161d9bb463e15da) is: 589df25eaa4ff0a5e29e1425fb99bf50957888ff098ba2fcb72cf130f40e15e00bcf2fc7



Read this on how to find the key for firmware 1.1.1 or above

For example, firmware 1.1.4, you can find the decrypt key by running this in Mac OS X Terminal

#!/bin/bash
# first extract the ramdisk image file from the ipsw file
unzip -o iPhone1,1_1.1.4_4A102_Restore.ipsw 022-3896-4.dmg -d .

# strip off the first 0x800 bytes and the trailing certificate
dd if=022-3896-4.dmg of=022-3896-4.stripped.dmg bs=512 skip=4 count=36640 conv=sync

# use the method of GEORGE HOTZ and ignore the error
openssl enc -d -in 022-3896-4.stripped.dmg -out ramdisk-022-3896-4.dmg -aes-128-cbc -K 188458A6D15034DFE386F23B61D43774 -iv 0

# print out the ramdisk key from the image
strings ramdisk-022-3896-4.dmg | egrep "^[0-9a-fA-F]{72}$"


If you have the 8900decryptor binary, you can get the same decrypted image file and key from

#!/bin/bash
./8900decryptor 022-3896-4.dmg 022-3896-4.8900decrypted.dmg
strings 022-3896-4.8900decrypted.dmg | egrep "^[0-9a-fA-F]{72}$"


If you find this info useful, please consider to $1 by clicking the Donate button.

Thursday, January 10, 2008

Successful iPhone Toolchain build in eee pc


I have successfuly compile iPhone ToolChain in EEE PC environment.
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm-svn-42498 -r 42498
svn co http://iphone-dev.googlecode.com/svn/trunk/ iphone-dev-209 -r 209


The screen dump shows the project build of hp15c for iPhone.

Build script
#!/bin/sh
cd ~/iphone

svn co http://llvm.org/svn/llvm-project/llvm/trunk \
llvm-svn-42498 -r 42498

svn co http://iphone-dev.googlecode.com/svn/trunk/ \
iphone-dev-209 -r 209


pushd llvm-svn-42498

./configure --enable-optimized

make ENABLE_OPTIMIZED=1

sudo make install

LLVMOBJDIR=`pwd`; export LLVMOBJDIR

popd


pushd iphone-dev-209

sudo mkdir /usr/local/arm-apple-darwin

mkdir -p build/odcctools

pushd build/odcctools

../../odcctools/configure --target=arm-apple-darwin \
--disable-ld64

make

sudo make install

popd


pushd ~/iphone

tar -xzvf MacOSX10.4u.sdk.tgz

pushd /usr/local/arm-apple-darwin

sudo tar -xzvf ~/iphone/include2.tgz

sudo tar -xzvf ~/iphone/iphone-filesystem.tgz

cd iphone-filesystem

HEAVENLY=`pwd`; export HEAVENLY

popd;popd


pushd include

./configure --with-macosx-sdk=/home/user/iphone/MacOSX10.4u.sdk

sudo bash install-headers.sh

popd


mkdir -p build/csu

pushd build/csu

../../csu/configure --host=arm-apple-darwin

sudo make install

popd


mkdir -p build/llvm-gcc-4.0-iphone

pushd build/llvm-gcc-4.0-iphone

../../llvm-gcc-4.0-iphone/configure \
--enable-llvm=`llvm-config --obj-root` \
--enable-languages=c,c++,objc,obj-c++ \
--target=arm-apple-darwin \
--enable-sjlj-exceptions \
--with-heavenly=$HEAVENLY \
--with-as=/usr/local/bin/arm-apple-darwin-as \
--with-ld=/usr/local/bin/arm-apple-darwin-ld

make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn

sudo make install

popd;popd

Monday, January 7, 2008

iPhone development using windows XP/Vista

For iPhone firmware 1.1.x development
A pre-complied binary for iPhone Toolchain (for firmware 1.1.x) is available.  It is called winchain

http://code.google.com/p/winchain/wiki/HowToUse


For iPhone firmware 2.x development
Please refer to my latest article on the iPhone toolchain SDK2.0 development
on Ubuntu as a virtual machine in Virtual PC 2007 for Windows XP/Vista

http://tungchingkai.blogspot.com/2008/11/personal-installation-guide-for-ubuntu.html

Or if you use VMWare, you can try this
http://iphonesdkdev.blogspot.com/2008/11/upgrade-vmware-image-to-ubuntu-810-for.html

For iOS SDK 4.0 / 5.0
Update for iphone toolchain4 for SDK4.x+
http://github.com/javacom/toolchain4

Thursday, January 3, 2008

iPhone ToolChain build in EEE pc

My new EEE PC goes to technical support today due to internet sharing connection failed problem.

Today I download the iPhoneToolChain binary (intel) and install it in my ppc mac
(beware, it will overwrite your linker /usr/bin/ld)
and I have to reinstall the xcode in order to solve the problem as my ppc cannot run intel binary obviously.

the MakeFile should be changed to
CC=/usr/local/arm-apple-darwin/bin/gcc
CXX=/usr/local/arm-apple-darwin/bin/g++
CFLAGS=-fsigned-char
LDFLAGS=-Wl,-syslibroot,/usr/local/arm-apple-darwin/heavenly
-lobjc -ObjC
-framework CoreFoundation
-framework Foundation
-framework UIKit
-framework LayerKit
-framework CoreGraphics
-framework GraphicsServices
-framework Celestial
-framework MusicLibrary


This version of ToolChain seems to have a more complete header files than self build one

My objective is to put the binary file to my new EEE PC Linux for later iPhone development work.

If you need the iphone header file for 1.1.2, get it here
http://ericasadun.com/ftp/Misc/

For example, I modified the Makefile for iCountDown as below

APP=iCountDown

CC=arm-apple-darwin-gcc
LD=$(CC)

CFLAGS=-I/usr/local/arm-apple-darwin/include/ -fsigned-char

LDFLAGS=-lobjc \
-framework CoreFoundation \
-framework Foundation \
-framework UIKit \
-framework LayerKit \
-framework CoreGraphics \
-framework WebCore \
-framework GraphicsServices

all: ${APP}.app/${APP}

${APP}.app/${APP}: main.o iCountDown.o CDList.o SetupView.o CustomTable.o CustomTableCell.o ToggleDisplayView.o
$(LD) $(LDFLAGS) -v -o $@ $^

%.o: %.m
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

nice:
rm -f *.o

clean:
rm -f *.o ${APP}.app/${APP}