WinX Blog

The blog of AriX

iPhoneLinux on the Mac

December 11, 2008 iPhone

INFO: This post is now slightly irrelevant and does not work very well, so I wouldn’t recommend using it.

DISCLAIMER: This is recommended for advanced users only. It is probably a bad idea to follow this tutorial if you’ve never opened Terminal before. That being said, this should be relatively easy for most power users.

DISCLAIMER²: Neither I nor the iPhoneLinux team are responsible for any damage to your iPhone through the use of this tutorial. The tutorial does, however, contain a guide on how to back up your NOR just in case something does go horribly wrong (which is extremely unlikely).

The iPhoneLinux team has recently come up with an impressive demo of Linux on the iPhone. Unfortunately, the binaries and instructions included are Linux only. When it came out, I was able to modify the client slightly to allow OpeniBoot to be installed and used from a Mac, and as a bonus I removed the root requirement. Anyway, I just compiled the most recent client build and I’d like to share it with you! I have not yet been able to build OpeniBoot myself, which means we’re stuck with a slightly old build (no file system writing) UPDATE: I was just able to build OpeniBoot myself, but the client cannot seem to connect to it… we’ll have to stick to this for now.

Soon-To-Be Frequently Asked Questions:

- What will this work on?

The original 2G (1G) iPhone, the new iPhone 3G, and the original iPod touch first generation. This will NOT work on the second generation iPod touch (with speakers and volume control) If you need help finding out which iPod touch you have, visit Apple’s support site.

- I hate using a boot menu on startup and Linux sucks. How can I get rid of this?

Launch the OpeniBoot client in Terminal and on the iPhone and run the ‘uninstall’ command. Once it reports that is is done, run ‘reboot’, and you should boot right to the Apple OS.

- Who made this awesomeness??

The awesome iPhoneLinux dev team, lead by planetbeing and other dev team members (but not directly affiliated with the iPhone dev team).

- What is this going to change about my phone/iPod?

It will add a boot menu whenever you turn on, and add the capability to boot Linux kernels on your iPhone via the console.

- What can I do in Linux? Does it support Wi-Fi? How many games can I play?

Linux is currently at a demo-only stage, once it’s booted, all you can really do is use a terminal from your computer. You can’t yet use the multitouch screen to interact in any way, and you can’t yet use WiFi. However, it’s pretty cool to any geek, and the team is working hard on new and exciting features in the form of drivers.

- Help! My iPhone won’t boot!

If your iPhone won’t boot after installing OpeniBoot, it’s likely you need to launch the console again and run “setenv auto-boot true” and then “saveenv”. If it still boots to recovery, you may need to uninstall OpeniBoot as above and then restore your phone.

- What else can I do in the OpeniBoot console?

Not much, but there’s some cool stuff. Type ‘help’ for all of the commands. You can mess around with most of it, just avoid things that seem like they’d change something like anything having to do with “write”, especially the NOR. I don’t know what a lot of the stuff does, but basically anything UNDER nor_erase is fair game (and pretty self explanatory), plus the stuff at the top. If you need to know the syntax of a command, just type the command with no arguments. Examples: Change the display color with “bgcolor 0 200 0″, list the files in your root with “fs_ls 0 /”, or find your battery voltage with “pmu_voltage”.

- Does my iPhone need to be jailbroken to use this?

No, this is much lower level than a jailbreak and you can try out OpeniBoot with no jailbreak.

EDIT: As Will (ChronicProductions) points out in the comments below, you do need to have used PwnageTool or QuickPwn to be able to do this. No wonder I was having so much trouble on my virgin iPod touch ;) You can find PwnageTool and QuickPwn from the iPhone Dev Team’s blog.

- Will this break my phone?

Probably not, it is highly unlikely something bad will happen. However, to stay on the safe side, don’t touch any OpeniBoot commands if you don’t know what they’ll do (especially ones that have to do with the nor), and back up your NOR as described below in the installation process.

- ?????????

If you have another question, feel free to ask in the comments!

Without further ado, you can download the necessary files here.

OpeniBoot set-up:

1. Open Terminal and navigate to the iphonelinux-mac directory by typing “cd ” (note the space after cd) and then dragging the iphonelinux-mac folder to the Terminal window and pressing return.

PLEASE NOTE: While you no longer have to be root to use these utilities, you DO need to be in an Administrator account. If you know the password of an administrative password but do not want to switch users, type “su THENAME” where THENAME is replaced with the administrative user account. You will be prompted for your password. Although you do not see dots or asterisks appearing as you type, it IS recognizing your password. Do not be alarmed if nothing happens while you are typing.

2. Put your iPhone/iPod into recovery mode. If you need help with this, visit http://www.iclarified.com/entry/index.php?enid=367

3. In your terminal window, enter “killall iTunes; killall iTunesHelper” and press return. This will avoid iTunes messing with your phone. If you want iTunes’ autosync feature back, simply restart your computer (or log out and back in) You will need to have the USB libraries before you can use loadibec, so copy them by running “sudo cp libusb.dylib /usr/local/lib/libusb-0.1.4.dylib”. Once again, you will be prompted for your password. Nothing will appear while you are typing it, but it IS registering. Press return when it is complete.

4. Load OpeniBoot onto your phone by typing “./loadibec openiboot-” followed by 2g.img3 if you’re on a first generation iPhone, 3g.img3 if you’re on an iPhone 3G, or ipod.img3 if you’re on an iPod touch (first generation only!). Hit return. If this returns nothing, try restarting your iPhone and trying again.

5. Sit back and admire poorlad’s pretty interface on your iPhone. This will be your new boot menu.

6. In your Terminal window, type “./oibc” but do NOT hit return yet. Press the power button so that OpeniBoot console is selected, and press the home button to enter it. While the text is still scrolling, press the return button to enter the OpeniBoot client. This may take several tries, you can’t press return too early or too late or it won’t work. I have to do it several times to get it going.

7. We will now take a backup of your iPhone’s NOR memory to avoid disaster. In the OpeniBoot client, type “help” just to make sure everything is working. You should see a long list of commands. Now type “nor_read 0×09000000 0×0 1048576″ to read it into memory, and press return. Wait for it to return “Done.”. Then type “~norbackup.dump:1048576″ to send the file to your computer. You might want to keep this file safe, just in case.

8. Install OpeniBoot! Type “install” and wait for the install complete message. Once it’s done, enter “reboot”.

9. Now we’re going to upgrade to the latest version of OpeniBoot I have. We can’t install this directly, as it appears to be some sort of upgrade-only version. Enter the OpeniBoot console just as you did before (although the timing is much easier now), and send the updated OpeniBoot with the command “!openiboot-THEDEVICE.bin” where THEDEVICE is replaced with 2g, 3g, or ipod. Run “go 0×09000000″ to launch it.

10. Once again, type ./oibc into Terminal and launch the console from the iPhone and quickly hit return in the Terminal to connect.

11. Type “install” to upgrade, and wait for the done message. To make the Apple OS boot properly, type “setenv auto-boot true” and hit return. (This is case sensitive, as I learned the hard way. My phone wouldn’t boot without a manual fsboot for a day until I realized I was typing TRUE instead of true) Then use “saveenv” and wait until you see “Environment saved”. Then “reboot” and you’re in a newer version of OpeniBoot! To boot into the iPhone OS, just press the home button.

Linux time!

It’s finally time to run Linux! Follow the steps below.

1. Once again, enter the console. I’m sure this is becoming second nature to you by now.

2. Now we’re going to send over the files required for Linux to boot, the kernel and userland. To send over the kernel, run “!zImage”. Then place it in memory with “kernel”. Send the userland with “!rootfs.arm.ext2.gz” and place it in memory with “ramdisk 3588″.

3. Time to boot! Run ‘boot “console=tty console=ttyUSB root=/dev/ram0 rw”‘ Linux is now booting!

4. Your oibc session will close. Run ./linux to communicate with Linux. You can log in with either the username ‘root’ or ‘default’.

5. If you’d like to see what you’re typing on your iPhone’s screen, run “sh 2>&1 > /dev/tty0″.

Mess with Linux! To reboot, run ‘reboot’.

FINAL NOTE: If you have any questions, read the full FAQ before asking. This tutorial was derived from planetbeing’s original tutorial from ORIGINALREADME in the archive you downloaded. The README file was distributed with the upgrade package, which added the uninstall feature.

Popularity: 7% [?]

13 Comments

  1. chronic on December 12, 2008 3:56 pm

    yo dude,

    just to note, you say it is lower level than jailbreak, which is is in the term ‘jailbreak’, but you still need to be Pwned. without your phone being Pwned, it won’t run unsigned code, and that is what OpeniBoot is :P

    Here is a little guide to utilize the Pwnage 2.0 stack overflow to run OpeniBoot:
    1. Get a patched iBSS and iBEC from a Pwned ipsw
    2. Use xpwntool to unpack the iBSS, but not the iBEC
    4. Kill iTunes Helper and iTunes
    5. Plug in your device in DFU Mode
    6. Go to System Profiler and USB, then make sure under “Apple Mobile Device (DFU Mode)” has the device ID of 0×1222, NOT 0×1227. If it is 0×1227 then you probably did not kill iTunes and / or iTunes Helper
    7. Get geohotz ‘iRan’ tool. It’s for windows, but with a mac libusb you can get it to build and work
    8. Use ‘iRan’ to upload the patched iBSS
    9. Since the ‘iRan’ tool exploited the stack overflow in the bootrom to get it to run the patched iBSS, we can now use iRecovery from http://chronicdev.googlecode.com/svn/trunk/iRecovery/ to send the patched iBEC with no problems, since signature checks are patched out :)
    10. use “./iRecovery -f Patched-iBEC.bin” to send the patched iBEC
    11. spawn a shell with iBoot using “./iRecovery -s”
    12. send it the “go” command
    13. type “/exit”
    14. send openiboot.img now with “./iRecovery -f openiboot.img3″
    15. type “./iRecovery -s” to spawn a shell again
    16. type “go”
    17. type “/exit”
    18. now, type “./oibc”
    19. openiboot client should now be running. select “console” on your device screen
    20. great job! :)

    Now, in a more practical sense, it would be MUCH easier just to use QuickPwn for this, especially because if you are not Pwned then you need to do all of these steps every time you want to load OpeniBoot, so if you ever plan to reboot you might as well just Pwn your device :)

  2. Thomas Ring on December 28, 2008 7:04 am

    What I discovered is that if you run ./oibc before opening the console, that works too

  3. Simon Brix on December 29, 2008 8:26 am

    Thanks alot for the tutorial. There is just one thing I don’t know how to do.

    “To send over the kernel, run “!zImage”. Then place it in memory with “kernel”.” How do i place it in the kernel ?

  4. Andy on July 9, 2009 3:07 am

    I got a bricked iPhone from my friend for a few bucks and wonderd if there is a way to get it working again.
    The process was caused by him trying to use redsn0w wo upgrade it.
    I get an ipwne flash screen that changes to the iphonelinux.org flash and stays there.
    I’m using mac because it actually finds the phone, but can’t restore from itunes.
    Any tips?
    Oh, I’m not scared of cli and am platform agnostic.
    Thanks

  5. shaqeezy on August 15, 2009 11:41 am

    i tried to install openiboot on my iphone but a message in the terminal says ‘cannot exercute binary file’ please HELP!!!

  6. How to: Install Android OS on iPhone 2G on May 11, 2011 11:01 pm

    [...] Step 4: Getting Android Working! Well done on getting this far! This is where the fun beings (credits to WinX Blog for these instructions –link) [...]

  7. HOW TO: Install Android On An iPhone 2G | Android Addicted on August 12, 2011 2:15 am

    [...] Well done on getting this far! This is where the fun beings (credits to WinX Blog for these instructions – link) [...]

  8. HOW TO Install Android On An iPhone 2G | The Smart Gadget on September 8, 2011 10:17 pm

    [...] Well done on getting this far! This is where the fun beings (credits to WinX Blog for these instructions – link) [...]

  9. Cara Instal android ke sebuah iPhone 2G | Tarikkabel.Com on September 8, 2011 10:36 pm

    [...] Dilakukan dengan baik untuk mendapatkan sejauh ini! Ini adalah tempat makhluk-makhluk menyenangkan (kredit ke Blog Winx untuk petunjuk ini – link) [...]

  10. Angus on September 15, 2011 1:23 pm

    It is actually a nice handy bit of details. Therefore i’m glad that you just shared this valuable details with us. You should keep informed like that. Thank you for sharing.

  11. HOW TO: Install Android On An iPhone 2G | DroidZeus on December 2, 2011 6:32 pm

    [...] Well done on getting this far! This is where the fun beings (credits to WinX Blog for these instructions – link) [...]

  12. soccer jerseys for kids on May 22, 2013 6:18 am

    WinX Blog :: iPhone
    :: iPhoneLinux on the Mac

  13. wholesale 2013 new nhl jerseys cheap for sale on May 22, 2013 7:04 am

    WinX Blog :: iPhone
    :: iPhoneLinux on the Mac

Write a Comment