This document is currently under construction.
An iPhone 4 Bitcoins and Androids
This post will be edited and the steps expanded upon. Currently this list is a bit non-linear but this will change as I make progress:
Section 1: Setting up the MinGW/MSYS environment.
Section 2: Setting up the ARM Toolchain.
Section 3: Building the openiboot Android boot loader.
Section 4: USB Communications with the iPhone 4.
Section 5: Installing OpeniBoot and Android.
Section 6: Installing X11R6.3 windowing system + VNC. (I will also test the viability of a java xserver as I've only run X over VNC in the past. I also intend to compile X11 without a pre-built Linux disto such as Ubuntu but this may or may not happen without the pre-built distro.
Section 7: Installing Bitcoin-Core and P2Pool.
Section 8: Installing Namecoin DNS redundancy.
Section 9: Replacing the Li-Ion Battery with a Laser-Printed Graphene Supercapacitor. (untested)
Section 1: Setting up the MinGW/MSYS environment.
1. Download and install MinGW and MSYS. http://www.mingw.org/
Make sure your username doesn't have a space in it! (Install libs and apps to c:\mingw\msys\1.0\ if your username has a space in it.)
$ mount c:/ /c
2. Download and install GitHub installer for windows. https://windows.github.com/ "Use Unix style line endings"
Copy 'git.exe' from 'C:\Program Files (x86)\Git\bin' to 'C:\MinGW\msys\1.0\bin'.
3. Install perl. [will add install info later]
4. Install python. [will add install info later]
5. Install pthread. [will add install info later]
6. Install wget, win32 binary found here. http://users.ugent.be/~bpuype/wget/wget.exe
The file goes in ../MinGW/msys/1.0/bin/
7a. Install pexports.
7b. Install texinfo.
8. Install autoconf.
9. Install automake.
10. Install scons, win32 install package at http://sourceforge.net/projects/scons/files/scons/2.3.4/scons-2.3.4-setup.exe/download
Create the file 'scons' containing the following code and place it in the 'C:\MinGW\msys\1.0\bin' directory.
exec /c/Python27/python.exe /c/Python27/Scripts/scons.py "$@"
11. Download and install the readline for windows complete package, except sources at http://gnuwin32.sourceforge.net/downlinks/readline.php
readline-5.0-1-setup.exe
12. Download and install cmake, win32 install package found at http://www.cmake.org/files/v3.1/cmake-3.1.0-win32-x86.exe
Change the "Destination Folder" to c:\mingw
Download https://raw.githubusercontent.com/Kitware/CMake/master/Modules/FindOpenSSL.cmake and replace C:\MinGW\share\cmake-3.1\Modules\FindOpenSSL.cmake
13. Install libssl
$ tar -xvzf openssl-1.0.2.tar.gz
$ cd openssl-1.0.2
$ ./Configure --prefix=/c/OpenSSL no-shared no-asm mingw
$ make depend
$ make
$ make install
14a. Install libpng
$ tar -xvzf libpng-1.6.16.tar.gz
$ cd libpng-1.6.16
$ ./configure –prefix=/mingw
$ make
$ make install
14b. Install libelf
$ tar -xvzf libelf-0.8.9.tar.gz
$ cd libelf-0.8.9
$ ./configure –prefix=/mingw
$ make
$ make install
Copy the directory 'C:\MinGW\msys\1.0\local\include\libelf' to 'C:\MinGW\include'.
14c. Clone the 'libdl', source at https://github.com/dlfcn-win32/dlfcn-win32
$ make
$ make install
Copy dlfcn.h to 'c:\mingw\include' and libdl.a to 'c:\mingw\lib'.
14d. Clone, build and install curl (7.41.0) from https://github.com/bagder/curl
Create the file ../curl-7.41.0/CMakeCache.txt with the following code:
CMAKE_C_COMPILER:FILEPATH=gcc.exe
CMAKE_MAKE_PROGRAM:STRING=mingw32-make.exe
CMAKE_GENERATOR:INTERNAL=MinGW Makefiles
CMAKE_INSTALL_PREFIX:PATH=c:/mingw
Run the following command in the root directory:
Edit the file ../curl-7.41.0/include/curl/curlbuild.h and change lines #117-124:
Change:
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include
# include
# include
#endif
Change to:
#include
#include
Replace the contents of file ../curl-7.41.0/src/tool_hugehelp.c with the following code:
#include "tool_hugehelp.h"
void hugehelp(void) {}
Build and install libcurl:
14e. Clone, build and install 'libusb-1.0' from https://github.com/libusb/libusb
$ ./configure --prefix=/mingw
$ make
$ make install
Section 1B: iPhone 4 specific applications and libraries
14f. Clone the 'xpwn' source https://github.com/planetbeing/xpwn
14g. Clone the 'OiBC' source from https://github.com/iDroid-Project/OiBC
14h. Clone the 'syringe' source from https://github.com/Chronic-Dev/syringe
14i. Clone the 'openiboot' source from https://github.com/iDroid-Project/openiBoot
Section 2: Setting up the ARM Toolchain.
[will clean up this section later]
15. Install the ARM toolchain.
Mostly copy & pasted from: http://www.microbuilder.eu/Tutorials/SoftwareDevelopment/BuildingGCCToolchain.aspx
15(a). Build GMP (GNU Multiple Precision Arithmetic Library)
$ tar -xvzf gmp-5.0.1.tar.gz
$ cd gmp-5.0.1
$ ./configure --prefix=/mingw
$ make
$ make install
15(b). Build MPFR (Multi-Precision Floating Point Library)
$ tar -xvzf mpfr-2.4.2.tar.gz
$ cd mpfr-2.4.2
$ ./configure --prefix=/mingw
$ make
$ make install
15(c). Build MPC (Multi-Precision Complex Arithmetic Library)
$ tar -xvzf mpc-0.8.1.tar.gz
$ cd mpc-0.8.1
$ ./configure --prefix=/mingw
$ make
$ make install
15(d).
Last, you need to download a simple script file that will handle the compilation of the
GNU GCC ARM Toolchain (GCC 4.5.0, Newlib 1.18.0, GDB 7.1 and Binutils 2.20.1).
Download the following file, and unzip it in the "
http://www.microbuilder.eu/Files/Tutorials/summon-arm-toolchain.zip
Build GNU GCC
$ sh summon-arm-toolchain.sh ~ arm-none-eabi
Windows "Path" Environment Variables
c:\MinGW\msys\1.0\home\
Tested: Failed, the space in my username screwed up the script. - working on a fix...
Current solution:
created /arm-toolchain directory
I found two options in the script comments, arm-none-eabi and arm-elf. The author of the copy & pasted comments chose the newer revision.
Tested: Failed:
Current solution: Edited summon-arm-toolchain.sh to add a valid file url.
changed:
changed to:
Added C:\MinGW\msys\1.0\arm-toolchain\arm-none-eabi\bin; to windows PATH
Renamed all the binaries from 'arm-none-eabi-' to 'arm-elf-' for openiboot.
Section 3: Building the openiboot Android boot loader.
[Build attempt #2 with just the github repo]
15(e). Start the build:
e1. Bug fix:
Found this on my first build attempt in ../openiboot/plat-a4/aes.c
{
aes_encrypt(data, size, AESCustom, Key835, AES128, iv);
}
Changed (line #53):
Changed to:
e2. Flags.
../openiboot/SConscript
Changed (line #28):
Changed to:
e3. Run scons.
e4.
Error:
thumb-interwork -fPIC -nostdlib -Wall -std=gnu99 -fgnu89-inline -fno-strict-alia
sing -marm -O2 -Ttext=0x0 -DOPENIBOOT_VERSION=0.3 -DOPENIBOOT_VERSION_BUILD=7aeb
344 -DCONFIG_ARM -DARM_A8 -DCONFIG_A4 -DMALLOC_NO_WDT -DBIG_FONT -DCONFIG_VFL_VF
L -DCONFIG_VFL_VSVFL -DCONFIG_FTL_YAFTL "-DOPENIBOOT_VERSION_CONFIG=\" for iPhon
e 4\"" -DMACH_ID=3563 -DCONFIG_IPHONE_4 -Iincludes -Iarch-arm\includes -Iplat-a4
\includes -Iacm\includes -Iusb-synopsys\includes -Ivfl-vfl\includes -Ivfl-vsvfl\
includes -Iftl-yaftl\includes -Iradio-xgold618\includes plat-a4\h2fmi.c
plat-a4\h2fmi.c:2096:6: error: conflicting types for 'h2fmi_set_key'
plat-a4\includes/h2fmi.h:162:6: note: previous declaration of 'h2fmi_set_key' wa
s here
scons: *** [plat-a4\iPhone4_h2fmi.obj] Error 1
scons: building terminated because of errors.
Solution:
In header ../openiboot/plat-a4/includes/h2fmi.h
Added the aes.h header:
Changed (line #162):
Changed to:
e5.
Error:
mk8900image\mk8900image.c:9:23: fatal error: linux/elf.h: No such file or direct
ory
#include
^
compilation terminated.
scons: *** [mk8900image\mk8900image.o] Error 1
scons: building terminated because of errors.
Solution:
In source file ../openiboot/mk8900image/mk8900image.c
Changed lines #6-10):
#include
#else
#include
#endif
Changed to:
#include
#elif __APPLE__
#include
#else
#include
#endif
e6.
Error:
m -ldl -lpng -lcrypto -lz
mk8900image\mk8900image.o:mk8900image.c:(.text+0x16c): undefined reference to `i
nit_libxpwn'
mk8900image\mk8900image.o:mk8900image.c:(.text+0x1bf): undefined reference to `c
reateAbstractFileFromFile'
mk8900image\mk8900image.o:mk8900image.c:(.text+0x22a): undefined reference to `c
reateAbstractFileFromFile'
mk8900image\mk8900image.o:mk8900image.c:(.text+0x287): undefined reference to `c
reateAbstractFileFromFile'
mk8900image\mk8900image.o:mk8900image.c:(.text+0x28f): undefined reference to `o
penAbstractFile'
mk8900image\mk8900image.o:mk8900image.c:(.text+0x2ec): undefined reference to `c
reateAbstractFileFromFile'
mk8900image\mk8900image.o:mk8900image.c:(.text+0x367): undefined reference to `d
uplicateAbstractFile2'
mk8900image\mk8900image.o:mk8900image.c:(.text+0x381): undefined reference to `d
uplicateAbstractFile'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: mk8900imag
e\mk8900image.o: bad reloc address 0x20 in section `.eh_frame'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link
failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
scons: *** [mk8900image\mk8900image.exe] Error 1
scons: building terminated because of errors.
Solution:
In file ../openiboot/mk8900image/SConscript
Changed LIBPATH='/usr/X11/lib' to LIBPATH='/MinGW/lib' in line #15.
Inserted the following code after line #14:
libs += ["win-x86/libxpwn.a", "win-x86/libcommon.a"]
e7.
Error:
' not found, needed by target `mk8900image\mk8900image.exe'.
scons: building terminated because of errors.
Solution:
Change to the ../xpwn directory.
Create the file ../xpwn/CMakeCache.txt with the following code:
CMAKE_C_COMPILER:FILEPATH=gcc.exe
CMAKE_MAKE_PROGRAM:STRING=mingw32-make.exe
CMAKE_GENERATOR:INTERNAL=MinGW Makefiles
Run cmake:
Build 'libxpwn.a' and 'libcommon.a':
Create the directory ../openiboot/mk8900image/win-x86 and copy the following files into it:
C:\MinGW\msys\1.0\xpwn\ipsw-patch\libxpwn.a
C:\MinGW\msys\1.0\xpwn\common\libcommon.a
e8.
Error:
\libxpwn.a mk8900image\win-x86\libcommon.a -LC:\MinGW\lib -lm -ldl -lpng -lcrypt
o -lz
mk8900image\win-x86\libxpwn.a(libXPwn.o):libxpwn.c:(.text+0x4368): multiple defi
nition of `TestByteOrder'
mk8900image\win-x86\libxpwn.a(libxpwn.c.obj):libxpwn.c:(.text+0x0): first define
d here
mk8900image\win-x86\libxpwn.a(libXPwn.o):libxpwn.c:(.text+0x438c): multiple defi
nition of `defaultCallback'
mk8900image\win-x86\libxpwn.a(libxpwn.c.obj):libxpwn.c:(.text+0x24): first defin
ed here
mk8900image\win-x86\libxpwn.a(libXPwn.o):libxpwn.c:(.text+0x43a7): multiple defi
nition of `init_libxpwn'
mk8900image\win-x86\libxpwn.a(libxpwn.c.obj):libxpwn.c:(.text+0x3f): first defin
ed here
mk8900image\win-x86\libxpwn.a(libXPwn.o):libxpwn.c:(.text+0x43c5): multiple defi
nition of `libxpwn_log'
mk8900image\win-x86\libxpwn.a(libxpwn.c.obj):libxpwn.c:(.text+0x5d): first defin
ed here
mk8900image\win-x86\libxpwn.a(libXPwn.o):libxpwn.c:(.text+0x43d2): multiple defi
nition of `libxpwn_loglevel'
mk8900image\win-x86\libxpwn.a(libxpwn.c.obj):libxpwn.c:(.text+0x6a): first defin
ed here
mk8900image\win-x86\libxpwn.a(libXPwn.o):libxpwn.c:(.text+0x43df): multiple defi
nition of `Log'
mk8900image\win-x86\libxpwn.a(libxpwn.c.obj):libxpwn.c:(.text+0x77): first defin
ed here
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: mk8900imag
e\win-x86\libxpwn.a(libxpwn.c.obj): bad reloc address 0x20 in section `.eh_frame
'
collect2.exe: error: ld returned 1 exit status
scons: *** [mk8900image\mk8900image.exe] Error 1
scons: building terminated because of errors.
Solution:
Removed '--whole-archive' from line #74 of the cmake file ../xpwn/ipsw-patch/CMakeLists.txt
e9. openiboot build complete:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o mk8900image\mk8900image.exe mk8900image\mk8900image.o mk8900image\win-x86
\libxpwn.a mk8900image\win-x86\libcommon.a -LC:\MinGW\lib -lm -ldl -lpng -lcrypt
o -lz
mk8900image\mk8900image.exe iphone_4_openiboot iphone_4_openiboot.bin
scons: done building targets.
Not Batman@NotBatman-PC /openiboot
$
Section 3B: Build the tools 'oibc' and 'syringe'.
e10. Build 'oibc':
Change to the ../OiBC directory and run the following commands:
e11. Build 'syringe':
Edit the lines in the following files:
../syringe/syringe/Makefile
Change:
LDFLAGS = -L/opt/local/lib
Change to:
LDFLAGS = -L/mingw/lib
../syringe/utilities/utilities.mk
Change:
LDFLAGS = -L../syringe -L/opt/local/lib
Change to:
LDFLAGS = -L../syringe -L/mingw/lib
Build syringe:
Section 4: USB Communications with the iPhone 4.
f3. Download and install iTunes if it's not already installed at http://www.apple.com/ca/itunes/download/
f4. Find your iPhone USB cable and plug it into your iPhone 4.
f5. Enter the device firmware upgrade (DFU) mode:
Hold down the power and home buttons together...
After 10 seconds you should hear the windows USB "plug/unplug" sound alerting you to the USB disconnect action. Release the power button but keep holding the home button.
After another 10 seconds you should hear the "plug/unplug" sound again and see the iTunes pop-up alerting you to the re-connect in DFU mode. The phone is now in DFU mode with a black/blank screen.
Note: To exit DFU mode hold down the power and home buttons until the Apple logo appears.
Section 5: Installing OpeniBoot and Android.
g1. Create an iPhone4 directory:
C:\MinGW\msys\1.0\iPhone4\
With the following files:
iphone_4_openiboot.bin
injectpois0n.exe
loadibec.exe
oibc.exe
tetheredboot.exe
Upload the .bin with loadibec:
Output:
Loadibec 2.00.
Connecting to iDevice...
linera1n compatible device detected, injecting limera1n.
Initializing libpois0n
Checking if device is compatible with this jailbreak
Checking the device type
Identified device as iPhone3,1
Preparing to upload limera1n exploit
Resetting device counters
Sending chunk headers
Sending exploit payload
Sending fake data
Exploit sent
Reconnecting to device
Waiting 2 seconds for the device to pop up...
limera1ned, reconnecting...
Waiting 10 seconds for the device to pop up...
uploading ibss...
Checking if iBSS.n90ap already exists
Preparing to fetch DFU image from Apple's servers
Fetching Firmware/dfu/iBSS.n90ap.RELEASE.dfu...
Issue:
Program exits after trying to fetch the image.
Testing Solution:
Downloaded the 'n90ap' restore image from Apple (it's a .zip file): http://appldnld.apple.com/iPhone4/061-7939.20100908.Lcyg3/iPhone3,1_4.1_8B117_Restore.ipsw
Extracted 'iBSS.n90ap.RELEASE.dfu' and 'kernelcache.release.n90'
Ran tetheredboot:
Initializing libpois0n
ERROR: The process "iTunes.exe" not found.
ERROR: The process "iTunesHelper.exe" not found.
Waiting for device to enter DFU mode
Found device in DFU mode
Checking if device is compatible with this jailbreak
Checking the device type
Identified device as iPhone3,1
Preparing to upload limera1n exploit
Resetting device counters
Sending chunk headers
Sending exploit payload
Sending fake data
Exploit sent
Reconnecting to device
Waiting 2 seconds for the device to pop up...
Uploading iBSS.n90ap.RELEASE.dfu to device
[==================================================] 100.0%
Waiting 10 seconds for the device to pop up...
Uploading kernelcache.release.n90 to device
[==================================================] 100.0%
Exiting libpois0n
iPhone screen goes white...
Ran loadibec:
Loadibec 2.00.
Connecting to iDevice...
Starting transfer of 'iphone_4_openiboot.bin'.
[==================================================] 100.0%
Uploaded Successfully.
Rebooted, still showing Apple logo.
hmm...
...
CURRENT PROGRESS LINE]=============================================================================
==============================================================================================
[misc stuff here for now]
f1. Download and install the libusb pre-compiled win32 binaries package http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.1.0/libusb-win32-bin-1.2.1.0.zip/download
I found this info in the pinguino man.
Then you need to know what is the processor in your computer.
If your computer is a X86 32 bits system:
• go to the libusb-win32-bin-1.2.1.0\bin\x86 folder,
• rename the file libusb0_x86.dll to libusb0.dll,
• copy this new file in the c:\Windows\system32\ folder,
• copy the file libusb0.sys to the c:\Windows\system32\drivers\ folder,
If your computer is a X86 64 bits system:
• go to the libusb-win32-bin-1.2.1.0\bin\x86 folder,
• rename the file libusb0_x86.dll to libusb0.dll,
• copy this new file in the c:\Windows\syswow64\ folder,
• copy the file libusb0.sys to the c:\Windows\system32\drivers\ folder,
If your computer is an AMD 64 bits system:
• go to the libusb-win32-bin-1.2.1.0\bin\amd64 folder,
• copy this new file in the c:\Windows\system32\ folder,
• copy the file libusb0.sys to the c:\Windows\system32\drivers\ folder,
If your computer is an intel IA64 bits system:
• go to the libusb-win32-bin-1.2.1.0\bin\ia64 folder,
• copy the file libusb0.dll in the c:\Windows\system32\ folder,
• copy the file libusb0.sys to the c:\Windows\system32\drivers\ folder,
I have an AMD64 so i put ../bin/amd64/libusb0.dll into ../windows/system32/ and ../bin/amd64/libusb0.sys into ../windows/system32/drivers/
f2. Download and install libusb-1.0-0-dev, the pre-compiled win32 binaries are at http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.1.0/libusb-win32-devel-filter-1.2.1.0.zip/download
I found this on the libusb-win32 wiki (http://sourceforge.net/p/libusb-win32/wiki/Home/):
Please use the latest release version.
Versions up until 0.1.12.2 have serious bugs related to the filter drivers
under Vista and Windows 7 and some XP nstallations. Please use later versions
(1.1.14.0 or newer). For 64bit Windows Vista/7/2008/2008R2, the version should
be 1.2.0.0 or later. We always recommend users to use the latest release
version available.
The filters driver is installed by a user friendly GUI installer which makes the
install and uninstall process easier and more secure. Starting with 1.2.2.0, a GUI
for installing the filter driver (Filter Wizard) is the preferred way to use the
filter. It only tries to attach the filter driver to a particular USB device.
You can still use the command line install-filter.exe application to install class
filter. But it is not recommended.
Log in as a user with administrator privileges. Download
(https://sourceforge.net/projects/libusb-win32/files/) the latest filter driver
installer (libusb-win32-devel-filter-x.x.x.x.zip and then unzip, or
libusb-win32-devel-filter-x.x.x.x.exe ). Close all applications which use USB
devices before installing. Run the installer, and follow its instructions. Do not
run the installer from an USB storage device, this is especially important for
versions prior to 1.2.2.0. Run the test program (testlibusb-win.exe) from the
system's start menu. This program will verify the correct installation and print
the descriptors of the USB devices accessible by the library. A reboot may not be
necessary but is recommended.
check box: Enable libusb-win32 filter service? This allows access to USB devices without an .INF file.
This can be loaded/unloaded anytime from the libusb-win32 start menu.
check this box.
X. Download openiboot.zip https://app.box.com/s/nef7ucwrumbh7t7j58vs
X(a). Download utils.zip https://app.box.com/s/d08zx65ceybsbnmh58m4
X(b). From Hackin2OS & Google Translate:
At Terminal,
cd openiboot
scons iOSDeviceName
I will continue to enter the.
iOSDeviceName will vary depending on the model of your iOS device.
iOSDeviceName = iPhone3GS, iPhone4, iPad1G, iPodTouch3G, aTV2G
Example: For iPhone4
scons iPhone4
Once scons is finished,
cd ../utils/syringe && make && cd ../../
cd utils / oibc && make && cd ../../openiboot
I enter the.
Then, 51-Android.Rules (https://app.box.com/s/jb9pbspihs3ifvj8ks7k) Download, and then placed on the desktop,
sudo cp / home / /Desktop/51-android.rules /etc/udev/rules.d/
I implantation and.
This completes the environment construction of Ubuntu is.
X. Download 51-Android.Rules https://app.box.com/s/jb9pbspihs3ifvj8ks7k
Section 5:
Section 6:
Section 7:
Section 8:
Section 9: Replacing the Li-Ion Battery with a Laser-Printed Graphene Supercapacitor.
*** This section is untested ***
a1. Required materials:
Laser Printer,
8.5x11" Transparency,
RE-Stickable Spray Adhesive,
A LightScribe Compatible CDR Disk,
A LightScribe Compatible CD Burner.
a2. Create a graphene supercapacitor Virtual Digital Photomask by creating a bitmap with windows paintbrush. Set the image properties to inches and use the rulers checkbox. Refer to a disk for the dimensions of the available working space. The output of the bitmap should contain eight (8
a3. Tapeout the VDP by saving your bitmap.
a4. Print the VDP onto both sides of the transparency.
The laser light in effect shines through the VDP to create an image on the transparency as an electrical displacement. The printer toner is a polymer-carbon mix that gets fused to the polarized sections of the transparency by the hot fuser roller after the laser action. This creates a carbon substrate for the graphene-oxide layer that will form the plates of the capacitor.
a5. Trim the transparency to fit onto the disk label area making sure the LighScribe bar-code at the center is not obscured.
a6. Apply re-stickable spray adhesive to the label side of the disk.
a7. Apply the trimmed transparency to the disk and "LightScribe" it until the laser action on the carbon black turns it graphene-oxide brown. Flip the transparency and repeat.
a8. Separate the eight (8
a9. Add the capacitor cells in series to match the iPhone 4's Li-Ion voltage then stack them in parallel to add more capacity.
a10. Install the capacitor in the iPhone 4.
A full charge should take under thirty (30) seconds while holding twelve (12x) times the juice of a Li-Ion battery. (untested)