[Android General] dreccon:
DBoot Recovery Tools

Here are the scripts I promised.

Initial Setup

1. In order to use the scripts, you need to have partitioned your SD card the way I described in the previous post.

2. Download the zip from the link at the end of this post, unzip it and copy the DualBoot folder to the root of your SD card.

3. Install Script Manager from Play Store

4. Install (or update) Busybox

Inside the Dual Boot folder you will find two scripts and some more folders. Please do not change anything there. Just use ScriptManager to run the scripts. Their usage is explained below.

DBootRecovery.sh

Purpose: Manage your secondary ROM.

This tool is designed to run on the primary ROM, but some major functions are also available on the secondary.

1st run

Open ScriptManager, browse to the DualBoot folder and tap on DBootRecovery.sh. At the top of the screen that follows, select the first two icons (Fav and SU). I also prefer to enable the Wklock icon (it has to be enabled in settings first). Then you can hit Run.

When you run the script for the first time, it will try to read the /proc/emmc file (if it exists on your system) in order to determine your normal partitions. If the file exists, it will present you the data, so you can accept or reject them. If it doesn't exist, it will ask you to enter your partition numbers manually. In both cases, the data will be exported to a new file (part.ini) in the DualBoot folder and you will not be asked again.

The main screen

The top two lines are important. After a selection you made completes and returns to the main screen, the first two lines will inform you of its success or if any errors occurred.

Main menu

1. Backup ROM2

This option will create a backup of your secondary ROM. It will actually create images of your secondary system (mmcblk1p2) and data (mmcblk1p3) partitions. Those two will be saved in the backup folder inside DualBoot. Be careful, a new backup will overwrite the old one. If you want to keep an old backup, make sure you move or rename it.

2. Restore ROM2

This option will flash the images you took with option 1 back to their respective secondary partitions. It will only be available while you are on your primary ROM (you don't really expect to flash a partition while it's being used).

3. Convert ZIPs

This tool wil automatically do all the edits described in the 1st post to all ZIPs it can find in the OriginalZIPs folder. It is based on [MENTION=5537766]Modding.MyMind[/MENTION]'s binaries [point (i) in 1st post]. If they don't work for you, you will see an error message. The original ZIPs will be kept intact and the edited ones will be created in the DBootZIPs folder. It is not certain that it will function equally well on all devices/ROMs, so before you flash your edited ZIPs, please check that they were edited correctly. This tool will NOT flash ZIPs. It will only convert them, so they can be flashed as secondary ROMs using your regular custom recovery. The tool will also put boot2.img in the img folder for use with the Switch ROM function. If you are on your primary ROM, it will also backup your current boot partition into a boot1.img in the img folder.

4. Advanced options

After selecting this, you will be taken to another menu where you can find more options. Most of them are not available while on your secondary ROM.

9. Switch ROM

This does the same as the individual SwitchROM.sh script. Read below.

0. Exit

I have decided not to explain this option.

Advanced menu

1. Wipe System2

2. Wipe Data2

3. Wipe Cache2

4. Wipe Dalvik2

These options just do to the secondary ROM what their name implies. They will only be available while on your primary ROM. If you want to factory-reset your secondary ROM, just wipe your Data2 and Cache2. When you flash new addons, it is advised to wipe Cache2 and Dalvik2. You can also wipe everything if you want to clean-install a completely new ROM.

5. Update binaries

Whenever Modding.MyMind updates his binaries, download and put them in your DualBoot/bin folder. Then, use this option to update existing binaries in your /system/bin folder.

0. Main Menu

Returns to the previous menu

SwitchROM.sh

The name is self-explanatory. This tool can only function if it finds the files boot1.img and boot2.img inside the DualBoot/img folder. These files will be automatically generated when you convert a ROM zip (using option 3). Alternatively, if you know what you are doing, you can create and put them there yourself.

Tap it in Script Manager and again select the first two icons (Fav and SU) and Run. It will automatically detect the current ROM, flash the boot image of the other one and prompt you to reboot. Use your Power-Menu and reboot your device. Your device will now boot to the other ROM.

In previous versions of this script for the LG Optimus 3D, I had included a reboot command. The reason why I am not using it any more is that the device would turn off abruptly and not "shutdown" the way it does when selecting it from the Power-Menu.

DOWNLOAD:

Get the latest version from here.

TROUBLESHOOTING:

If, while converting a zip, the script gives you an error that yourboot.img is incompatible, then either you have an encrypted header, or you have a truly incompatible boot.img! In any case, visit [Without PC] Unpack, Edit, Repack boot.img to read how to deal with encrypted headers, or to download the latest boot_manipulation.zip

Changelog:

13.03.2014 Initial upload of ZipEditor and SwitchROM.

17.03.2014 Updated ZipEditor to support the conversion of HTC-OneSV ROMs (AOSP and Stock based). Thanks to Modding.MyMind for assisting.

23.03.2014 First upload of DBootRecovery. The ZipEditor is now contained in it. If you are wondering about the v3.0, previous versions were device specific (only for the LG-P920). This is the first one for use on any Android.

21.06.2014 Version 3.1: Added support for the new LG P920 KitKat ROM. Fixed a bug where Dalvik2 cache would not be properly wiped. Changed a few minor details for better script operation.