Building OpeniBoot

From iDroid Project

(Redirected from Building OpenIBoot)
Jump to: navigation, search

It is advised that you check planetbeing's Official Instructions for any updates to this procedure (particularly if something goes wrong).

Contents

Open-Source Licenses

The iDroid Project is an Open-Source Project. OpeniBoot is licensed under GPLv2. As such, changes to the source code must be made public.

If you plan to compile OpeniBoot with your own changes to the source code, please make your changes public. What you have changed may be helpful for the iDroid Project and for helping in troubleshooting.

If you don't have a git repo to put you changes, that's ok. You can always create a pastie of the diffs you've created, especially if only 1 line was changed.

Requirements

  • Ubuntu Linux computer (recommended), or a Windows machine running Ubuntu in a Virtual Machine such as VirtualBox.
  • Mac OS X Users, please refer to the OS X Guide below.

Setting up Linux

  1. Get the packages needed to build OpeniBoot:
    sudo apt-get install cmake git-core build-essential texinfo libreadline-dev libssl-dev libusb-1.0-0-dev libpng12-dev libusb-dev autoconf automake libnewlib-dev
  2. Fetch OpeniBoot sources using git:
    git clone http://github.com/iDroid-Project/openiBoot.git
    Or if you already have cloned it previouly and want to update:
    cd openiBoot && git pull
    Note: If cloning the iphonelinux.git tree fails, you can always download the tar/zip file of the master repository. Please do bear in mind that if there is a failure in the tree, downloading a tar ball or zip file will not remedy the situation, as the archived file will be generated from the same source tree. You can get it here: http://github.com/iDroid-Project/openiBoot/tarball/master
  3. Make sure to remove the symlink /usr/local/bin/arm-elf-cc. If you forget to do this you will get an error stating that it was unable to create a symlink. And if compilation of the toolchain fails, you have to redo this. You can also just remove the file.

Building an ARM Toolchain

This only needs to be done once.

  1. Enter this command into terminal (make sure you are in the openiboot directory). Enter your password if prompted.
    sudo toolchain/build-toolchain.sh make
    Note: if the Newlib fails to compile, try installing textinfo or makeinfo packages on your system.
  2. Wait, for a long time, as the toolchain is compiled.

Compiling OpeniBoot

  1. To run OpeniBoot from Recovery Mode (a.k.a iboot), you’ll need to create an img3 image.
  2. You should have a copy of libcommon.a as a result of the xpwn compilation or downloaded precompiled.
  3. Run this command in terminal to find the location of libcommon.a if you compiled it yourself:
    sudo updatedb && locate libcommon.a
  4. Copy it to the openiboot/mk8900image directory if it isn't there already.
    Note: If compiling on 64-bit linux, you may need libc6-dev-i386 and type export ARCH=x86_64 before you proceed with the next steps.
  5. Go to the OpeniBoot directory:
    cd openiBoot/openiboot
  6. Depending on the target iDevice:
    1. For iPhone 2G, enter:
      PLATFORM=IPHONE make openiboot.img3
    2. For iPhone 3G, enter:
      PLATFORM=3G make openiboot.img3
    3. For iPod Touch 1G (1st Generation), enter:
      PLATFORM=IPOD make openiboot.img3
      NOTE: If you wish to enable the full set of openiBoot console commands then add the following flag to the command:
      ENABLE_EXTRA=YES
  7. Compile all in client/:
    cd client && make all && cd ..
  8. Done! Refer to Installing OpeniBoot to install your new boot loader.

Building on Mac OS X

These instructions work on Mac OS X 10.6, but 10.5 might well work too, YMMV.

  1. Install Homebrew
    ruby -e "$(curl -fsS https://gist.github.com/raw/323731/install_homebrew.rb)"
  2. Install dependancies
    sudo brew install cmake git libelf libpng libusb texinfo wget
  3. Checkout the source
    git clone git://github.com/iDroid-Project/openiBoot.git --recursive
  4. Build the toolchain
    cd openiBoot/toolchain
    sudo ./build-toolchain.sh make
    This will take a while, so go make a cup of tea and grab a scone.
  5. Build OpeniBoot
    The correct command for this depends on which device you'd like to build for:
    1. For iPhone 2G, enter:
      PLATFORM=IPHONE make
    2. For iPhone 3G, enter:
      PLATFORM=3G make
    3. For iPod Touch 1G (1st Generation), enter:
      PLATFORM=IPOD make
    4. For iPhone 4, enter:
      PLATFORM=IPHONE_4 make
    5. For iPad, enter:
      PLATFORM=IPAD make
  6. Running OpeniBoot
    To quickly test your build, you can use the make install command. This again, depends on what device you have:
    1. For iPhone 2G, enter:
      PLATFORM=IPHONE make install
    2. For iPhone 3G, enter:
      PLATFORM=3G make install
    3. For iPod Touch 1G (1st Generation), enter:
      PLATFORM=IPOD make install
    4. For iPhone 4, enter:
      PLATFORM=IPHONE_4 make install
    5. For iPad, enter:
      PLATFORM=IPAD make install
  7. Follow the instructions that appear on screen. You'll need to put your device into DFU mode, so make sure you know how to do that (hold power+home for 10 seconds then release power and keep holding home).