Difference between revisions of "Open recovery"
(TOC moved to right)
|Line 1:||Line 1:|
Developed by Skrilax_CZ.<br>
Developed by Skrilax_CZ.<br>
Credit for mankind (from alldroid) for the CustomUpdate, on which this recovery is based,<br>
Credit for mankind (from alldroid) for the CustomUpdate, on which this recovery is based,<br>
Revision as of 07:34, 25 August 2010
Developed by Skrilax_CZ.
Credit for mankind (from alldroid) for the CustomUpdate, on which this recovery is based,
credit for poseidon (also from alldroid) for ADBRecovery,
credit for koush for mtd-utils and nandroid (uses script based on it),
credit for nadlabak for keyboard layout change script.
Current version 1.37 [08/23/2010]
- on-phone console (limited) - MILESTONE ONLY!
- rooting the phone from menu (using ChainsDD su and SuperUser.apk (version 2.2.2))
- nandroid backup/restore from menu
- apply update *.zip files from menu (located in OpenRecovery/updates under the sdcard root folder, there is a sample one (just unpacks a file named "babble" to /system), no signatures are needed :)
- wipe data (factory reset)
- wipe cache
- wipe dalvik-cache
- adb in recovery, using bash shell
- run a script
- recovery options for applications
The open recovery files are located under the OpenRecovery folder under the root of the sd card. The own update *.zip files are under the "updates" folder, sample one is included. The scripts must have *.sh extension and reside under the "scripts" folder. The recovery contains an update.zip with payload, which doesn't do anything else than restarts to the open recovery. All the files for OpenRecovery are under the OpenRecovery folder under the root of the sdcard. The payload installs busybox to /sbin runs the "switch.sh" under the bin folder in open recovery. The initial menu file is in OpenRecovery/menu/init.menu under sdcard root.
Download & Installation (MILESTONE)
1) You need to have the vulnerable recovery installed.
2) Download the archive and unpack it to the root folder of the sdcard.
1) Reboot into recovery (hold 'X' button on bootloader 90.78, on others hold camera button; until you see triangle; then press camera + volume up)
2) Apply the update.zip
3) You are now in Open Recovery
Download & Installation (XT701)
1) Download the archive and unpack it.
2) Either flash the sbf file using RSD Lite (preffered, recommended version 4.6+), or flash using the flash_image the *.img file to recovery partition.
3) Unpack the "OpenRecovery" folder and "OpenRecovery.zip" to the root folder of the sdcard.
1) Reboot into recovery (hold camera button; until you see triangle; then press camera + volume up)
2) If no error occurs, you're now in Open Recovery. If error occurs you're in Open Recovery Lite.
Console (MILESTONE ONLY)
- MENU key is CTRL, pressing MENU + ALT + C forcibly quits the console
- scrolling (pressing volume keys by a row (or eight rows if ALT is pressed))
- don't forget to select correct keyboard layout (under settings menu)
- search key is tab
- Alt+A prints "|" instead of Euro, Alt+F prints "$" instead of Pound
- limited support for escape characters but allowing to use "clear" and "ls" coloured
Changing a theme
On /sdcard/OpenRecovery, the current theme is in "res" subfolder. The other two included are under "res.stock" or "res.squirtle". To change to another theme, let's say stock theme, rename the current "res" folder to "res.or" and "res.stock" to "res".
OR update.zip format
- the update.zip is extracted to "/sdcard/OpenRecovery/tmp/update"
- shell script, located in the archive in "META-INF/update-or.sh" is called; under env. variable PACKAGE is the root folder of the extraction: "/sdcard/OpenRecovery/tmp/update"
- the script can do the very same as script called from the menu (can call imenu)
- progress bar is not supported in this format
This file sets the colors for the theme. It's located right under the "res" folder.
color3.LED=#100 <- led diode color (3-bit RGB, use only 0 or 1)
color32.background=#000000A0 <- recovery background color
color32.menu=#FF3705FF <- recovery menu color
color32.selection=#FFFFFFFF <- recovery selected item color
color32.script=#FFFF00FF <- recovery script color
color24.console.header=#FFFF00 <- console header color
color24.console.background=#000000 <- console background color
color24.console.front=#E5E5E5 <- console foreground color
(The example values are used by default when the property is not found.)
Lite vs. Full version (XT701 ONLY)
- The recovery image contains Lite version, with minimal options (moreless only difference from stock recovery is the GUI and applying update.zip doesn't need any signatures.)
- When booting into recovery, the Lite version is started. It will automatically switch to full version by applying the OpenRecovery.zip).
- fixed nandroid restore not properly restoring yaffs2 partitions in old format
- fixed nandroid restore not restoring compressed backups
- fixed nandroid backup not taking md5 checksums
- console buffers up to 1000 lats printed lines (extended from 200)
- fixed nandroid when doing "Backup All" and not having apps2sd; which would fail complaining that /sddata could not be mounted
(Ticking all partitions in the menu and selecting "Backup Selected" was working properly and the backup has been done correctly.)
- fixed console cursor blinking
- squirtle theme fixed
- update.zip can be in new OR format using a shell script (described lower, there are samples of each one)
- console has now signalling implemented (menu key = CTRL)
- console has arrow keys implemented
- console has support for displaying front colors; thus it is no longer needed to disable bash colors
- console supports calling clear
- recovery binary will exit if not run by init (to prevent running it from adb or console)
- scripts in scripts folder are dos2unixed (on -FuFu- advice)
- switch files (.nobashcolors, .kdb_qwertz, etc.) are now located in /etc
- manual settings of the timezone (/etc/timezone), applied if the env. variable TZ doesn't exist
- update.zip no longer need to have the "update-binary", a default one is used if not found
- fixed unyaffs not restoring sticky bit / suid / sgid
- fixed displaying long menus (it will not be truncated, instead a scrollbar appears)
- fixed error in switch.sh for XT701
- fixed color24.console.front in the themes -> default is supposed to be #E5E5E5
- pressing MENU + ALT + C forcibly quits the console
- ui.prop contains more options
- when applying any update.zip package, there is a confirmation menu
- cursor in console blinks
- Error message when ext2 partition on sdcard doesn't exist fixed
- fixed the bug with imenu when ran more than once in one script
- Console layout for QWERTZ / AZERTY fixed
- on-phone console
- keyboard layout changer included
- new nandroid, with support of backing up and restoring ext2 partition on sdcard (Note: uses new format of the backup, new backups are located in /sdcard/nandroid/openrecovery, there is a backwards compatibility to restore the old backups)
- ability to create compressed backups (and autoreboot when done)
- better nandroid menu
- menus wrap around
- theming for the recovery (3 themes included, to apply just rename the "res.*" folder to "res"); color settings can be manipulated in the ui.prop file under the res folder)
- new commands for menu (tag, label, break)
- scripts (command "shell") are able to show menu interactively when requesting user feedback (sample included)
- switch.sh is separated (menu creation is in init_recovery.sh and called later by the recovery)
- Volume keys and Camera key can be used to navigate in Open Recovery
- wipe commands working properly
- Bash Settings menu, to enable/disable coloured output (preset to disabled), this is persistent settings, it will last through reboots
- ability to wipe dalvik-cache only (via script)
- reboot command is working properly
- the content of the sdcard is no longer changed when running, everything is being copied into the ramdisk
- minor fixes
- removed the 'init' command, instead uses 'scripted_menu'
- adbd uses bash (interactively) instead of sh
- payload installs also bash and toolbox
- different the menu system (deprecated 'init' command, used), each menu must be generated from a script (notes later)
- added init folder, scripts (with extension *.sh) are ran there on startup of the open recovery.
- the diode is blinking in blue instead of red.
- the recovery prints the output of the scripts / programs (prints their stdout)
- application menu (described later)
- new su and SuperUser.apk by ChainsDD
- if sdcard has ext2 partition, it is noted in fstab under "/sddata" (the module is inserted automatically)
- fixed a bug in payload making it dependant on the system
- there is now nothing in the /system folder when unmounted
- toolbox linked statically
- busybox now installs symlinks, instead of copying itself
- fixed a bug in adb about the shell being in /sbin/sh instead of /system/bin/sh
- cleaned up, removed unecessary libraries and binaries
- switch.sh now initializes the Open Recovery completely, no other script is used for initialization
- permissions set correctly
- added option to wipe
- menu's now have header (the menu file structure has been changed)
- added the possibility to run scripts, with .*sh extension located in scripts folder under OpenRecovery folder (shell is /sbin/sh or /sbin/bash)
- fixed root install
- initial release
The recovery contains an update.zip with payload, which doesn't do anything else than restarts to the open recovery. All the files for OpenRecovery are under the OpenRecovery folder under the root of the sdcard. The payload installs busybox to /sbin runs the "switch.sh" under the bin folder in open recovery.
The menu for the Open Recovery is created dynamically. The files must be created inside "/menu" folder by scripts, which can either be specified (if the menu is scripted_menu) or created by a *.sh script in /sdcard/OpenRecovery/init where the scripts are executed at startup. A menu creating script has to create a *.menu file inside the /menu folder. If the menu is supposed to be created on startup and not modified, place the script into /init folder, otherwise use "scripted_menu" item, where the script is ran right before the menu is created. sdcard, system and data partitions are mounted when the scripts are ran. A typical example for "scripted_menu" item is under the tutorial for application menu. For application menu see lower section. The structure of the menu file is different from the CustomUpdate by mankind:
First line is the menu name (normal string), then use the following structure:
- item name is what is seen in the menu
- type: type of the command (described later)
- argument: argument passed to the command (file, or anything else; if empty, put "*" there, otherwise the item will be discarded)
- reboot: reboots the phone
- shell: calls a file specified in arguments (default path is to /bin, if not specified)
- menu: opens another menu file (specified in argument), if the argument is "..", it returns to up one level meu
- scripted_menu: argument is in format "menu file:menu script", the menu script is called with variable MENU_FILE containing the menu name (default path for the script is to /bin, if not specified)
- update: applies an update *.zip file, specified in argument (format SDCARD:$path_to_the_file_in_sdcard)
- tag: if ticked, file "tags/.[I]argument[/I]" is created
- break: unselectable item, argument is ignored (use "*") and creates a menu item like "---- name ----"; using "*" as name will create just "--------------"
- label: unselectable item, argument is ignored (use "*") and creates normal menu item "name "
- wipe_data: factory reset
- wipe_cahce: wipe cache
The menu is refreshed (the script is called if the menu is scripted) on a menu change, applying an update or running a script. Whenever a script is ran, system, data and sdcard is mounted.
Application menu is designed for anything that is run on the startup and can malfunction under any circumstances. Here is one example - suppose you have a mount on font in the startup. You'll have something like this in your startup script:
mount -o bind /system/myfonts/segoeui.ttf /system/fonts/DroidSans.ttf mount -o bind /system/myfonts/segoeuib.ttf /system/fonts/DroidSans-Bold.ttf
Well the idea is that you add a condition to the script, to run only under some circumstances, like:
if [ ! -f /system/switch/.nocustomfont ]; then mount -o bind /system/myfonts/segoeui.ttf /system/fonts/DroidSans.ttf mount -o bind /system/myfonts/segoeuib.ttf /system/fonts/DroidSans-Bold.ttf fi
which mounts the font only when /system/switch/.nocustomfont is not existing. If you want this controlable from the recovery, you register in into the application menu this way: all *.sh scripts in /app (where /sdcard/OpenRecovery/app is copied) are called at startup. They are passed variable "APP_MENU_FILE", which is the name of the used menu file (preinitalized). The script will look like this:
#!/sbin/sh #create the menu item echo "Custom Font:scripted_menu:custfont.menu:/app/custfont/menu.sh" >> "$APP_MENU_FILE"
Since the scripts are in /app and not /bin, use absolute path. This will add an item to the applications menu, now we need a menu when it is selected, which is the "/app/custfont/menu.sh":
#!/sbin/sh if [ -f /system/switch/.nocustomfont ]; then # menu name - custom font is disabled echo "Custom Font (Disabled)" > "$MENU_FILE" # go to upper level menu echo "Go Back:menu:.." >> "$MENU_FILE" # enable it echo "Enable:shell:/app/custfont/enable.sh" >> "$MENU_FILE" else # menu name - custom font is enabled echo "Custom Font (Enabled)" > "$MENU_FILE" # go to upper level menu echo "Go Back:menu:.." >> "$MENU_FILE" # disable it echo "Disable:shell:/app/custfont/disable.sh" >> "$MENU_FILE" fi
Notice the shells are in /sbin, so use /sbin/sh (or /sbin/bash). The script checks if the switch is on or off and generates the menu accordingly. Since the menu is refreshed each time the script is run, it will always submit the correct option. The "enable.sh" simply touches the file and "disable.sh" just deletes it.