From iDroid Project
OpeniBoot is an open source implementation of iBoot for Apple iPhone and iPod Touch devices. It allows booting of unsigned code such as linux kernels on the device. There is also and OpeniBoot console (oibc) which can be connected to from a libusb enabled computer.
OpeniBoot is critical for the booting and usage of linux on the iPhone as it sets up and initializes many devices ready for the linux kernel to take over. Many iBoot functions are replicated here, however when booting iOS iBoot is chainloaded from the NOR to guarantee iOS will boot without problems even with OpeniBoot installed.
Latest Version: 0.2
Currently the following devices are supported by OpeniBoot:
- iPhone (iPhone1,1)
- iPhone 3G (iPhone1,2)
- iPod Touch 1st Generation (iPod1,1)
For installation see the main page Installing OpeniBoot
Once loaded on the device you will be presented with the following screen:
- Power button: Pressing the power button selects between booting the iPhone OS and the OpeniBoot console.
- Home button: Pressing the home button will select the highlighted option. Pressing and holding the home button whilst the console is highlighted will boot an untethered linux image as detailed in the Installation Guide.
- Volume buttons: On devices which have hardware volume buttons (all except the iPod Touch 1st generation) selection can be toggled with these.
- Touchscreen: Tapping on an option will now select that option on supported devices.
- iOS: This chanloads the official Apple iBoot and susbsequently loads the current installed version of iOS on the device.
- Android: Loads a predefined kernel and initrd from the devices flash storage.
- Console: Enables the openiboot console which can be connected to over USB.
See OpeniBoot Console for documentation on oibc.
OpeniBoot can be configured using NVRAM flags to allow automatic booting after a timer of any of the three options. OpeniBoot also supports quickbooting; when an NVRAM flag is set the selected OS will be booted for one time only before reverting to default option on subsequent boots.
These NVRAM flags can be configured manually from openiboot and iOS or graphically with the iOS application Bootlace.
- opib-default-os - Values are: 1 - iPhone OS, 2 - Android OS, 3 - Console.
- opib-menu-timeout - (Value is in milliseconds for compatibility). 0 Disables auto-boot.
- opib-temp-os - Values are the same as default OS.
Manually Setting Flags
Example, set timeout to 5 seconds:
Under openiboot console:
setenv <variable> <value> saveenv
Example, set timeout to 5 seconds:
setenv opib-menu-timeout 5000 saveenv
Scripting is now supported in openiboot and allows automatic booting for example. Scripts can be launched before OpeniBoot launches the shell or kernel.
To use scripting four environment variables (NVRAM values) must be set and a file in the NAND present.
- partition-script: Defines the partition in which the script is stored. openiboot format so 0 corresponds to / and 1 to /private/var under iPhone OS
- file-script: Defines the path to the script file from the root of the partition set in partition-script.
- scripting-openiboot: Allows script to be run before dropping the openiboot shell. Set to 1 to enable.
- scripting-linux: Defines whether a script is executed before launching the linux kernel in automated boot. Set to 1 to enable.
How to write the script file
Scripts are standard text files which are separated by new lines (avoid extra newlines). Should handle Windows and Linux formatting as \r is ignored and only \n interpretted.
All internal openiboot commands work. Communication with computer doesn't work (so don't try to send or receive a file). oibc need changes to receive instructions from USB.
Example of script for updating openiboot automatically.
3 files stored in /private/var:
- openiboot.bin (in binary format, not packed as img3)
The contents of these text files:
uninstall setenv file-script /update-openiboot-part2 setenv opib-hide-menu true saveenv fs_extract 1 /openiboot.bin 0x09000000 go
install setenv opib-hide-menu false setenv scripting-openiboot false setenv scripting-linux false saveenv reboot
Note: You can install your script/kernel/images (if not too big) with OpeniBoot. The command to use is fs_add:
Usage: fs_add <partition> <file> <location> <size>
First step upload the file to OpeniBoot : !myFile OpeniBoot will tell you the size of the file. The address is by default 0x09000000 unless you specifed something different. You now have the location (address) and the size of the file. The file is the path to the on the device from the root of the partition. Partition is which partition to use.
You can find further instructions on building OpeniBoot under both Linux and OS X on Building OpeniBoot