LineageOS 19.1 + Magisk. Script to help automate rooting after LOS OTA. - OnePlus 6 Guides, News, & Discussion

After setting up Magisk root and MagiskHide Props, I was a bit disappointed to learn that you loose root after a LOS OTA update (which comes out every week). So, I decided to make a bash script to help me automate restoring root. This script still needs to run on your computer rather than on the phone, but it is still a major improvement to the manual process. I am sure smart people can adapt this script to be a BAT script that will work on Windows.
Prerequisites
USB Debugging enabled on your OnePlus 6.
ADB/Fastboot installed on your computer.
It is assumed that you already have root, you just temporarily lost it after an OTA update.
You will need python 3. You will also need to install at least re and requests packages using pip.
Python script for extracting boot.img from the payload.bin provided here https://wiki.lineageos.org/extracti...ing-proprietary-blobs-from-payload-based-otas
It is expected that you put it into `scripts` folder within your current working directory (from where you run the script).
Python script to download the latest LOS zip from the website created by me. Here are the contents of that downloadLOS.py script which is expected to be in your working directory.
Python:
import re
import requests
# Get HTML text of the downloads webpage
webpage = requests.get("https://download.lineageos.org/enchilada").text
# Get the firmware urls
pattern = r"(https:.*nightly.*signed\.zip)\""
matches = re.findall(pattern, webpage, flags=0)
matches.sort(reverse=True)
# Get the latest firmware URL
latestOSURL = matches[0]
# Extract firmware name
name = latestOSURL.split('/')[-1]
print("Latest firmware: " + name)
print("Download link: " + latestOSURL)
# Download the latest firmware
print("Downloading...")
with open(name, "wb") as f:
f.write(requests.get(latestOSURL).content)
print("Done!")
Magisk Root Automation Script
Before running the script, install the latest OTA update through the updater app and reboot once that is done.
The script is quite self explanatory. The steps are:
Download the latest LOS zip using downloadLOS.py script.
Extract boot.img and vbmeta.img from the zip using unzip and update-payload-extractor. These are needed for rooting.
Copy boot.img to phone's Download folder.
Here the script pauses, waiting for you to go into Magisk app to patch the boot.img that was just copied. Hit any key once you are done.
The patched boot image is copied to your computer and both boot images are removed from the phone.
The phone now reboots into bootloader. The script pauses. Hit any key once your phone is in bootloader.
Both boot_a and boot_b are flashed with patched boot image. vbmeta partition is also flashed.
The phone reboots.
Firmware files are cleaned from your folder.
flash.sh
Bash:
#!/bin/bash
echo "Launching python script to download latest firmware ..."
python3 ./downloadLOS.py
echo ""
echo "Extracting boot.img ..."
echo "----"
unzip lineage*.zip 'payload.bin'
python3 ./scripts/update-payload-extractor/extract.py payload.bin --output_dir ./ --partitions boot vbmeta
echo "----"
echo ""
echo "Copying boot.img to phone... "
echo "----"
adb push ./boot.img /storage/emulated/0/Download
echo "----"
echo ""
read -t 1 -n 1
echo "Press any key after done patching boot... "
while [ true ] ; do
read -t 3 -n 1
if [ $? = 0 ] ; then
break ;
else
continue ;
fi
done
echo "Copying patched boot.img to PC... "
echo "----"
adb shell mv /storage/emulated/0/Download/magisk_patched* /storage/emulated/0/Download/magisk_patched.img
adb pull /storage/emulated/0/Download/magisk_patched.img magisk_patched.img
echo "----"
echo ""
echo "Removing boot images from phone... "
echo "----"
adb shell rm /storage/emulated/0/Download/boot.img
adb shell rm /storage/emulated/0/Download/magisk_patched.img
echo ""
echo "Rebooting to bootloader... "
echo "----"
adb reboot bootloader
read -t 1 -n 1
echo "Press any key when in bootloader... "
while [ true ] ; do
read -t 3 -n 1
if [ $? = 0 ] ; then
break ;
else
continue ;
fi
done
echo "----"
echo "Flashing both boots... "
echo "----"
fastboot flash boot_a magisk_patched.img
fastboot flash boot_b magisk_patched.img
echo "----"
echo ""
echo "Flashing vbmeta... "
echo "----"
fastboot flash vbmeta --disable-verity --disable-verification vbmeta.img
echo "----"
echo ""
fastboot reboot
echo ""
echo "Done rooting!"
echo "Cleaning up local files ..."
rm *.img
rm *.bin
rm *.zip
echo "Complete!"
Notes
If you have slow internet and do not want to download the update twice. You could remove the whole downloadLOS.py section and use a separate script pullLOS.sh to pull the LOS update from your phone BEFORE YOU REBOOT after installing the update. After you reboot you loose root and cannot access it. For this you will need to enable rooted debugging in developer options.
Bash:
#!/bin/bash
adb root
echo "Copying update zip from the phone ..."
adb shell mv /data/lineageos_updates/lineage* /data/lineageos_updates/lineage.zip
adb pull /data/lineageos_updates/lineage.zip lineage.zip
adb shell rm /data/lineageos_updates/lineage.zip
echo "----"
echo ""
Attachment
Attachments contains:
scripts folder for your convenience containing LOS extractor scripts. Feel free to remove and re-download from source.
downloadLOS.py python script to download the latest LOS zip from the website.
flash.sh the main script
pullLOS.sh optional script for those who want to avoid re-downloading OTA update.
I hope you guys find it helpful! Let me know if you encounter any problems.

Doesn’t your device factory reset afterwards?

Will it copy your data over to your device again?

I think you are misunderstanding something. This is only if you already have LineageOS 19.1 and Magisk root.
LineageOS has over the air (OTA) updates. They release them every week. They do not touch your data. You just install through Settings -> System -> Updater, reboot and you are good to go. The same way OTAs work in OOS.
The problem is that you loose your Magisk root. In order to bring it back you need to patch and flash a boot partition again (and also vbmeta). Flashing boot partition does not do anything to your data. The script just automates what you would have to do by hand.

Isn't it the same outcome as with Magisk "Install on inactive partition after OTA" option?
I always install OTAs and select that option on Magisk and reboot.

jfromeo said:
Isn't it the same outcome as with Magisk "Install on inactive partition after OTA" option?
I always install OTAs and select that option on Magisk and reboot.
Click to expand...
Click to collapse
You could be right, but I have never seen / not been able to find this option. Maybe it is only available right after an OTA, don't know.

Related

[APP][root][HK]mb860/mb861 2.3.4 root

i just want to help thoese chinese friends:
my phone is mb861 (860+dock super pack) flashed with hk rom
now 2.3.4 is updated, so it need to be root.
super onclick root does'nt work on my phone. (operation not permitted)
but,by flashing boot.img and then root is fine with mine phone. well, hope u know what to do
my thread: (chinese)
bbs.hiapk.com viewthread.php?tid=2670677
my bat file:
Code:
@echo off
echo 1st turn off power, then press power button while holding volume button down
echo when seeing FASTBOOT on screen then press volume button up!
echo step 1/3...
pause
echo step 2/3 flashing root.img
fastboot flash preinstall root.img
ping 127.0.0.1>null
fastboot reboot
echo open usb debug mode! and then press any key to enter next step
pause
echo step 3/3 installing su, superuser
adb shell
/preinstall/su
/bin/mount /system -o remount,rw
cp /preinstall/su /system/bin/su
chmod 6755 /system/bin/su
PATH=/system/bin:$PATH pm install /preinstall/Superuser.apk
files needed:
adb.exe
AdbWinApi.dll
AdbWinUsbApi.dll
fastboot.exe
root.img
su
Superuser.apk

[HOW-TO] Fix when the phone stuck in boot splash after apply V6 Supercharger

You may have applied V6 Supercharger to your phone. And after reboot, you stuck at the boot splash. Reboot once and V6 Supercharger install script tell you that you aren't supercharged. Here is how to fix it. (If you get looped in boot animation, this is NOT your fix. Sorry!)
Depend on your rom, you may have to do one of following:
Open the (rooted) File Manager, open the directory /etc/init.d/ and open file 99SuperCharger. OR
Turn on ADB on your phone, use your computer to pull the file /etc/init.d/99Supercharger by running
Code:
adb pull /etc/init.d/99SuperCharger
Edit the file at the almost bottom of the file, change the following code:
Code:
if [ "`ps | grep -m 1 [a]ndroid`" ]; then HellzYeah;
else HellzYeah &; fi;
To look like this:
Code:
if [ "`ps | grep -m 1 [a]ndroid`" ] || [ $1 = "bypass" ]; then HellzYeah;
else
rm $bootloopcookie
$0 bypass &
fi;
Depend on what you have done on step 1, do the following:
If you use (root) file manager, save the file. Grant the superuser permission if needed. Then browse to /data and delete file !!SuperChargerBootLoopMessage.log. Don't worry if it's not exist.
If you use your computer to edit your file, run the following command:
Code:
adb root
adb remount
abd push /path/of/99SuperCharger /etc/init.d/99SuperCharger
adb shell
And inside the adb shell, run:
Code:
chmod 755 /etc/init.d/99SuperCharger
rm /data/!!SuperChargerBootLoopMessage.log
exit
Don't worry if file /data/!!SuperChargerBootLoopMessage.log doesn't exist.
And that's it! The V6 Supercharger bootscript is worked as it's designed to. Thanks to zeppelinrox to make this great script.
For one who want to know some technical info (and my assumption of the cause), wait me until tomorow and i'll explain how i found it. read on:
In order to run script in /etc/init.d at boot, the line like this is inserted in init.rc:
Code:
on boot
...
# Start the init.d service
exec /system/bin/sysinit
(In case of cm - for example)
But, what does the /system/bin/sysinit do? Just this:
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/xbin/run-parts /system/etc/init.d
And this is the real source of problem. For some reason run-parts with logwrapper doesn't move on when you run a shell script function in background. If you scroll up in file 99SuperCharger, you'll found that "HellzYeah" is actually a function. And when it's execute in a boot process, "HellzYeah" will wait for boot process to continue. But run-parts (and the whole boot process) is waiting for the script to finish. You see? A deadlock!
The workaround is to execute function in the other way. What my modification do is re-executing the script with the parameter "bypass" in the background. This way, run-parts will not wait for it anymore. Then, when the script is re-executed, it will detect that it's called with the parameter "bypass". It'll run the function "HellzYeah", wait for boot process to finish, and, when the boot process is finished, supercharge your phone!
(if anyone is reading this, please inform zeppelinrox about this problem. I'm not able to post on the development forum yet.)
(This is my first post in xda. Hopefully it's helpful)

[Q&A] Mr.Parkinsons DroidHD Utility 2.0

Q&A for Mr.Parkinsons DroidHD Utility 2.0
Some developers prefer that questions remain separate from their main development thread to help keep things organized. Placing your question within this thread will increase its chances of being answered by a member of the community or by the developer.
Before posting, please use the forum search and read through the discussion thread for Mr.Parkinsons DroidHD Utility 2.0. If you can't find an answer, post it here, being sure to give as much information as possible (firmware version, steps to reproduce, logcat if available) so that you can get help.
Thanks for understanding and for helping to keep XDA neat and tidy!
Updated Droid Utility Version 2.1 Deluxe script,back to main menu option now added
Charles Branson's Updated Droid Utility Version 2.1 Deluxe script with back to main menu option now added
BEGIN >>>
@ECHO off
::This progarm is HOMEMADE by Jeff Cimmino (Otherwise known as the lovely Mr. Parkinson).
@title Charles Branson's Updated Droid Utility Version 2.1 Deluxe
echo ................................
echo . Updated Version .
echo . Mr.Parkinson's .
echo . DROID UTILITY .
echo . Version 2.1 .
echo . DANGEROUSLY REFRESHING .
echo . Deluxe Edition .
echo . Add back to main menu option .
echo ................................
pause
cls
echo 2.1 Changelog:
echo Edited by Charles Peterkin aslo known as charles Branson
echo email [email protected]
echo Add back to main menu option
echo 2.0 Changelog:
echo -Updated the layout.
echo -Did some housecleaning.
echo -Added more stock recovery options.
echo -Added remove bootloader unlock warning.
echo -Added push Batakang ROM Test 16.
echo -Created Deluxe, Lite, and Ultra-Lite Editions.
echo -Working on GUI.
echo 1.21 Changelog:
echo -Fixed a dangerous error where the recovery image wouldn't flash when recovering.
echo -Added the "Flash TWRP 2.5 Custom Recovery" program.
echo -Added an option to not flash recovery image.
echo -Added a step by step guide to see if your bootloader is unlocked.
echo -When restoring stock ROMs, you will now have the option to delete userdata.
echo 1.1 Changelog:
echo -Removed the "Push Eclipse" option from the utility.
echo 1.01 Changelog:
echo -Fixed a typo in the main menu.
echo -Changed the wording of fastboot option.
echo -Made a change to the Eclipse/GApps program.
echo 1.0 Changelog:
echo Initial Release.
pause
cls
echo A little license I wrote:
echo This program is free for PERSONAL use only.
echo Try not to use this program for a profit.
echo Before hosting this program on your website,
echo email me at [email protected].
pause
cls
echo This utility is designed for the following Devices:
echo Motorola Droid Razr / Razr Maxx HD,
echo Motorola Droid Razr M,
echo Motorola Atrix HD.
echo And some features may work on other devices.
echo Some features of this utility will only work on
echo specific devices, you will be warned in this case.
pause
cls
echo STANDARD DISCLAIMER:
echo USE THIS UTILITY AT YOUR OWN RISK.
echo ME, OR DANIEL ROSENBERG, OR ANYONE INVOLVED
echo IN THE CREATION OF THE PROGRAMS AND EXPLOITS HEREIN ARE NOT RESPONSIBLE
echo IF YOUR PHONE BRICKS, OR ANY OTHER DAMAGE OCCURS
echo WHILE USING THIS UTILITY. FOLLOW ALL INSTRUCTIONS,
echo AND YOU *SHOULD* BE FINE.
pause
:menu
cls
echo [*] Marks Experimental Program
echo Choose a Section:
echo 1: Stock Stuff
echo 2: ROMS
echo 3: Apps
echo 4: Roots, Unlocks and Recoveries
echo 5: Exit
echo 6: menu
SET /P menu=Make your selection:
IF %menu% == 1 GOTO stockstuff
IF %menu% == 2 GOTO roms
IF %menu% == 3 GOTO apps
IF %menu% == 4 GOTO rur
IF %menu% == 5 GOTO exit
echo Please select a valid option.
pause
GOTO menu
cls
:stockstuff
cls
echo Stock Stuff
echo Select an Option:
echo -------------------------------------------------
echo 1: Complete Fastboot Restore to 4.1.2 Stock (XT925/926)
echo 2: Fastboot Restore to 4.1.2 Stock (Dont Flash Recovery) (XT925/926)
echo 3: [*]Fastboot Restore to 4.1.2 Stock (Dont Flash Modem) (XT926/926)
echo 4: Fastboot Restore Stock Recovery
echo 5: Fastboot Restore Stock Modem
echo 6: Go to Main menu
SET /P stock=Make Your Selection:
IF %stock% == 1 GOTO restore
IF %stock% == 2 GOTO restorenr
IF %stock% == 3 GOTO restorenm
IF %stock% == 4 GOTO resrecovery
IF %stock% == 5 GOTO resmodem
IF %stock% == 6 GOTO menu
echo Please select a valid option.
pause
GOTO stockstuff
:roms
cls
echo *Suggest a ROM! Add to the utility thread, PM Mr. Parkinson, or email me at [email protected]!*
echo ROMs
echo Select an Option:
echo -------------------------------------------------
echo 1: Batakang ROM Test 16 for Droid Razr/ Razr Maxx HD with Gapps
echo 2: Go to Main menu
SET /P roms=Make Your Selection:
IF %roms% == 1 GOTO batakang
IF %roms% == 2 GOTO menu
echo Please select a valid option.
pause
GOTO roms
:batakang
cls
echo This program will push the Batakang ROM and its gapps package.
echo To your sdcard/downloads folder.
echo MAKE SURE YOU HAVE 411 MB OF FREE SPACE BEFORE YOU PUSH.
echo It will NOT install it, you need to do that yourself, through a custom recovery
echo or through safestrap.
echo Press any key to begin the push...
pause
echo Pushing Gapps...
adb push roms/Gapps4BatakangROMv2 sdcard/Download/Gapps4BatakangROMv2
echo Pushing Batakang ROM...
adb push roms/BatakangROM sdcard/Download/BatakangROM
echo Push complete!
echo Press any key to return to main menu...
pause
GOTO menu
:apps
cls
echo *Suggest an app! Add to the utility thread, PM Mr. Parkinson, or email me at [email protected]!*
echo Apps
echo Select an Option:
echo -------------------------------------------------
echo 1: Install Safestrap 3.05
echo 2: Install Safestrap 3.12
echo 3: Install voodoo's OTA Rootkeeper
echo 4: Install Titanium Backup
echo 5: Go to Main Menu
SET /P apps=Make Your Selection:
IF %apps% == 1 GOTO safestrap
IF %apps% == 2 GOTO safestrap3.12
IF %apps% == 3 GOTO voodoo
IF %apps% == 4 GOTO titanium
IF %apps% == 5 Go to Main menu
echo Please select a valid option.
pause
GOTO apps
:rur
cls
echo Roots, Unlocks, and Recoveries
echo Select an Option:
echo -------------------------------------------------
echo ROOTS:
echo 1: Root Your Phone! (Motochopper Method)
echo UNLOCKS:
echo 2: Unlock Your Bootloader! (Motopocalypse Method)
echo 3: Is My Bootloader Unlocked?
echo 4: Remove Bootloader Unlock Warning
echo RECOVERIES:
echo 4: Flash TWRP Custom Recovery (UNLOCKED BOOTLOADER REQUIRED)
echo 6: Main Menu
SET /P rur=Make Your Selection:
IF %rur% == 1 GOTO root
IF %rur% == 2 GOTO unlock
IF %rur% == 3 GOTO unlock2
IF %rur% == 4 GOTO rmbuwarn
IF %rur% == 5 GOTO twrp
IF %rur% == 6 Go to Main menu
echo Please select a valid option.
pause
GOTO rur
:rmbuwarn
echo This program will remove the Bootloader Unlock Warning from your phone.
echo Press any key to remove the warning...
pause
fastboot flash logo VZW_XT926_4.1.2/logo.bin
echo Your phone is now free from that pesky bootloader unlock warning!
echo Press any key to return to the main menu.
pause
GOTO menu
:restore
cls
echo *****************
echo * 4.1.2 Restore *
echo * by *
echo * Mr. Parkinson *
echo *****************
echo This program will restore your phone to Verizon stock Android 4.1.2.
echo It will also replace your custom recovery with stock, if you have one.
echo WARNING: THIS PROGRAM IS ONLY GUARANTEED FOR XT925/926 DEVICES (Droid Razr/Razr Maxx HD)!
echo USE AT YOUR OWN RISK, EVEN BETTER, IF YOUR PHONE IS NOT AN XT925/926, DO NOT USE THIS PROGRAM AT ALL.
pause
echo This program will now install stock 4.1.2 firmware to your device.
echo Before launching the utility, put your phone into Fastboot mode!
echo Turn of the phone, then, hold the vol-up and vol-down buttons,
echo while holding the power button, until the boot menu comes up.
echo Scroll down to AP FASTBOOT, and select it.
pause
fastboot flash sbl1 VZW_XT926_4.1.2/sbl1.mbn
fastboot flash sbl2 VZW_XT926_4.1.2/sbl2.mbn
fastboot flash sbl3 VZW_XT926_4.1.2/sbl3.mbn
fastboot flash rpm VZW_XT926_4.1.2/rpm.mbn
fastboot flash tz VZW_XT926_4.1.2/tz.mbn
fastboot flash aboot VZW_XT926_4.1.2/emmc_appboot.mbn
fastboot reboot-bootloader
echo. When the screen bcomes back on, press any key to continue!
pause
fastboot flash partition VZW_XT926_4.1.2/gpt_main0.bin
fastboot flash sbl1 VZW_XT926_4.1.2/sbl1.mbn
fastboot flash sbl2 VZW_XT926_4.1.2/sbl2.mbn
fastboot flash sbl3 VZW_XT926_4.1.2/sbl3.mbn
fastboot flash rpm VZW_XT926_4.1.2/rpm.mbn
fastboot flash tz VZW_XT926_4.1.2/tz.mbn
fastboot flash aboot VZW_XT926_4.1.2/emmc_appboot.mbn
fastboot flash boot VZW_XT926_4.1.2/boot.img
fastboot flash system VZW_XT926_4.1.2/system.img
fastboot flash recovery VZW_XT926_4.1.2/recovery.img
fastboot flash modem VZW_XT926_4.1.2/NON-HLOS.bin
fastboot flash devtree VZW_XT926_4.1.2/device_tree.bin
fastboot flash logo VZW_XT926_4.1.2/logo.bin
fastboot flash cdrom VZW_XT926_4.1.2/cdrom
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg VZW_XT926_4.1.2/fsg.mbn
fastboot erase cache
fastboot erase tombstones
echo After this point, the utility will erase userdata.
echo It is recommended you do this, but not required.
set /p z=Would you like to erase userdata? (Y/N CASE SENSITIVE)
IF %z%==Y GOTO restore2
IF %z%==N GOTO restorecomplete
:restore2
fastboot erase userdata
fastboot flash modem VZW_XT926_4.1.2/NON-HLOS
fastboot erase modemst1
fastboot erase modemst2
:restorecomplete
fastboot reboot
echo You are now on stock 4.1.2 for XT925/926 devices!
echo Pressing any key will return to the main menu.
pause
goto menu
:restorenr
cls
echo *****************
echo * 4.1.2 Restore *
echo * by *
echo * Mr. Parkinson *
echo * No Recovery *
echo *****************
echo This program will restore your phone to Verizon stock Android 4.1.2.
echo This will NOT flash the stock recovery.
echo WARNING: THIS PROGRAM IS ONLY GUARANTEED FOR XT925/926 DEVICES (Droid Razr/Razr Maxx HD)!
echo USE AT YOUR OWN RISK, EVEN BETTER, IF YOUR PHONE IS NOT AN XT925/926, DO NOT USE THIS PROGRAM AT ALL.
pause
echo This program will now install stock 4.1.2 firmware to your device.
echo Before launching the utility, put your phone into Fastboot mode!
echo Turn of the phone, then, hold the vol-up and vol-down buttons,
echo while holding the power button, until the boot menu comes up.
echo Scroll down to AP FASTBOOT, and select it.
pause
fastboot flash sb11 VZW_XT926_4.1.2/sbl1.mbn
fastboot flash sb12 VZW_XT926_4.1.2/sbl2.mbn
fastboot flash sb13 VZW_XT926_4.1.2/sbl3.mbn
fastboot flash rpm VZW_XT926_4.1.2/rpm.mbn
fastboot flash tz VZW_XT926_4.1.2/tz.mbn
fastboot flash aboot VZW_XT926_4.1.2/emmc_appboot.mbn
fastboot reboot-bootloader
echo. When the screen bcomes back on, press any key to continue!
pause
fastboot flash partition VZW_XT926_4.1.2/gpt_main0.bin
fastboot flash sb11 VZW_XT926_4.1.2/sbl1.mbn
fastboot flash sb12 VZW_XT926_4.1.2/sbl2.mbn
fastboot flash sb13 VZW_XT926_4.1.2/sbl3.mbn
fastboot flash rpm VZW_XT926_4.1.2/rpm.mbn
fastboot flash tz VZW_XT926_4.1.2/tz.mbn
fastboot flash aboot VZW_XT926_4.1.2/emmc_appboot.mbn
fastboot flash boot VZW_XT926_4.1.2/boot.img
fastboot flash system VZW_XT926_4.1.2/system.img
fastboot flash modem VZW_XT926_4.1.2/NON-HLOS.bin
fastboot flash devtree VZW_XT926_4.1.2/device_tree.bin
fastboot flash logo VZW_XT926_4.1.2/logo.bin
fastboot flash cdrom VZW_XT926_4.1.2/cdrom
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg VZW_XT926_4.1.2/fsg.mbn
fastboot erase cache
fastboot erase tombstones
echo After this point, the utility will erase userdata.
echo It is recommended you do this, but not required.
set /p x=Would you like to erase userdata? (Y/N CASE SENSITIVE)
IF %x%==Y GOTO restorenr2
IF %x%==N GOTO restorenrcomplete
:restorenr2
fastboot erase userdata
fastboot flash modem VZW_XT926_4.1.2/NON-HLOS
fastboot erase modemst1
fastboot erase modemst2
:restorenrcomplete
fastboot reboot
echo You are now on stock 4.1.2 for XT925/926 devices!
echo Pressing any key will return to the main menu.
pause
goto menu
:restorenm
cls
echo *****************
echo * 4.1.2 Restore *
echo * by *
echo * Mr. Parkinson *
echo * No Modem *
echo *****************
echo This program will restore your phone to Verizon stock Android 4.1.2.
echo This will NOT flash the stock modem.
echo WARNING: THIS PROGRAM IS ONLY GUARANTEED FOR XT925/926 DEVICES (Droid Razr/Razr Maxx HD)!
echo USE AT YOUR OWN RISK, EVEN BETTER, IF YOUR PHONE IS NOT AN XT925/926, DO NOT USE THIS PROGRAM AT ALL.
pause
echo This program will now install stock 4.1.2 firmware to your device.
echo Before launching the utility, put your phone into Fastboot mode!
echo Turn of the phone, then, hold the vol-up and vol-down buttons,
echo while holding the power button, until the boot menu comes up.
echo Scroll down to AP FASTBOOT, and select it.
pause
fastboot flash sb11 VZW_XT926_4.1.2/sbl1.mbn
fastboot flash sb12 VZW_XT926_4.1.2/sbl2.mbn
fastboot flash sb13 VZW_XT926_4.1.2/sbl3.mbn
fastboot flash rpm VZW_XT926_4.1.2/rpm.mbn
fastboot flash tz VZW_XT926_4.1.2/tz.mbn
fastboot flash aboot VZW_XT926_4.1.2/emmc_appboot.mbn
fastboot reboot-bootloader
echo. When the screen bcomes back on, press any key to continue!
pause
fastboot flash partition VZW_XT926_4.1.2/gpt_main0.bin
fastboot flash sb11 VZW_XT926_4.1.2/sbl1.mbn
fastboot flash sb12 VZW_XT926_4.1.2/sbl2.mbn
fastboot flash sb13 VZW_XT926_4.1.2/sbl3.mbn
fastboot flash rpm VZW_XT926_4.1.2/rpm.mbn
fastboot flash tz VZW_XT926_4.1.2/tz.mbn
fastboot flash aboot VZW_XT926_4.1.2/emmc_appboot.mbn
fastboot flash boot VZW_XT926_4.1.2/boot.img
fastboot flash system VZW_XT926_4.1.2/system.img
fastboot flash recovery VZW_XT926_4.1.2/recovery.img
fastboot flash devtree VZW_XT926_4.1.2/device_tree.bin
fastboot flash logo VZW_XT926_4.1.2/logo.bin
fastboot flash cdrom VZW_XT926_4.1.2/cdrom
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg VZW_XT926_4.1.2/fsg.mbn
fastboot erase cache
fastboot erase tombstones
echo After this point, the utility will erase userdata.
echo It is recommended you do this, but not required.
set /p x=Would you like to erase userdata? (Y/N CASE SENSITIVE)
IF %x%==Y GOTO restorenr2
IF %x%==N GOTO restorenrcomplete
:restorenm2
fastboot erase userdata
fastboot erase modemst1
fastboot erase modemst2
:restorenmcomplete
fastboot reboot
echo You are now on stock 4.1.2 for XT925/926 devices!
echo Pressing any key will return to the main menu.
pause
goto menu
:rescovery
cls
echo This program will restore the stock 4.1.2 recovery for XT925/926 devices.
echo Press any key to start the restore.
pause
fastboot flash recovery VZW_XT926_4.1.2/recovery.img
fastboot erase cache
fastboot erase tombstones
fastboot reboot
echo You are now running the stock recovery!
echo Pressing any key will return to the main menu.
pause
goto menu
:resmodem
cls
echo This program will restore the stock 4.1.2 modem for XT925/926 devices.
echo Press any key to start the restore.
pause
fastboot flash modem VZW_XT926_4.1.2/NON-HLOS.bin
fastboot erase cache
fastboot erase tombstones
fastboot reboot
echo You are now running the stock modem!
echo Pressing any key will return to the main menu.
pauseg
goto menu
:root
cls
echo This program will give you root privelages.
echo Thank Dan Rosenberg (Djrbliss) for this root exploit!
echo Feel free to donate to him for his hard work!
echo Press any key to root your phone.
pause
adb kill-server
echo [*] Waiting for device...
adb wait-for-device
echo [*] Device found.
echo [*] Pushing exploit...
adb push root/pwn /data/local/tmp/pwn
adb shell chmod 755 /data/local/tmp/pwn
echo [*] Pushing root tools...
adb push root/su /data/local/tmp/su
adb push root/busybox /data/local/tmp/busybox
adb install apps/Superuser.apk
echo [*] Rooting phone...
adb shell /data/local/tmp/pwn
echo [*] Cleaning up...
adb shell rm /data/local/tmp/pwn
adb shell rm /data/local/tmp/su
adb shell rm /data/local/tmp/busybox
echo [*] Exploit complete. Press enter to reboot and exit.
pause
adb reboot
adb kill-server
goto menu
:safestrap
cls
echo This program will install Safestrap 3.05 to your phone.
echo Enable USB Debugging!
echo *Requires Root Privelages to work!*
pause
adb wait-for-device
adb install apps/RAZR-HD-Safestrap-3.05.17.apk
adb kill-server
echo Install complete!
echo Press any key to return to the main menu.
pause
goto menu
:safestrap3.12
cls
echo This program will install Safestrap 3.12 to your phone.
echo Enable USB Debugging!
echo *Requires Root Privelages to work!*
pause
adb wait-fordevice
adb install apps/safestrap3.12.apk
adb kill-server
echo Install complete!
echo Press any key to return to the main menu.
pause
goto menu
:twrp
cls
echo This program will now flash the TWRP Custom Recovery.
echo Before we do this, your bootloader needs to be unlocked!
set /p b=Is your bootloader unlocked? (Y/N/NotSure CASE SENSITIVE)
IF %b%==Y GOTO twrp1
IF %b%==N GOTO unlock
IF %b%==NotSure GOTO unlock2
:twrp1
echo Press any key to flash TWRP!
pause
fastboot flash recovery twrp/twrp-2.5.0.0-recovery-vanquish.img
echo Flash complete.
echo Press any key to return to the main menu.
pause
GOTO menu
:voodoo
cls
echo This program will install voodoo's OTA Rootkeeper.
echo Enable USB Debugging!
pause
adb wait-for-device
adb install apps/org.projectvoodoo.otarootkeeper-1.apk
adb kill-server
echo Install complete!
echo Press any key to return to the main menu.
pause
goto menu
:titanium
cls
echo This program will install Titanium Backup Pro.
echo Enable USB Debugging!
echo *Requires Root Privelages to work!*
pause
adb wait-for-device
adb install apps/TBackuppro.apk
adb kill-server
echo Install complete!
echo Press any key to return to the main menu.
pause
goto menu
:unlock
cls
echo This program will unlock your Motorola device bootloader.
echo Works with Razr /Razr Maxx HD, Razr M, and Atrix HD.
echo Thank Dan Rosenberg (Djrbliss) for his hard work!
echo Feel free to donate to him for this fantastic exploit!
echo *Requires Root Privelages to work!*
pause
echo WARNING! UNLOCKING YOUR BOOTLOADER WILL RESULT IN A MAJOR SECURITY HOLE IN YOUR PHONE.
echo ANY THEIF WITH ENOUGH KNOW HOW COULD STEAL ALL THE DATA ON YOUR PHONE, REGARDLESS OF A LOCK SCREEN.
echo IT IS RECOMMENDED THAT YOU ENCRYPT YOUR PHONE AFTERWARDS.
echo THIS PROGRAM ALSO PERMANANTLY UNLOCKS THE BOOTLAODER, AKA: PERMANANTLY VOIDS YOUR WARRANTY.
echo NOONE INVOLVED IN MAKING THIS PROGRAM IS RESPONSIBLE FOR ANY DAMAGE TO YOUR PHONE.
echo RUN THIS PROGRAM AT YOUR OWN RISK.
set /p q=Are you sure you want to unlock your bootloader? (Y/N CASE SENSITIVE)
IF %q%==Y GOTO unlock1
IF %q%==N GOTO menu
:unlock1
cls
echo You have chosen to unlock your bootloader.
pause
cls
adb kill-server
echo [*] Waiting for device...
adb wait-for-device
echo [*] Device found.
echo [*] Pushing unlock tool...
adb push unlock/unlock /data/local/tmp
adb shell chmod 755 /data/local/tmp/unlock
echo [*] Unlocking phone...
adb shell su -c /data/local/tmp/unlock
echo [*] Cleaning up...
adb shell rm /data/local/tmp/unlock
echo [*] Unlocking complete. Rebooting into bootloader mode.
adb reboot bootloader
echo [*] Press enter once the phone has rebooted into bootloader mode.
pause
echo [*] Displaying bootloader variables:
fastboot getvar all
echo [*] Press enter to reboot and exit.
pause
fastboot continue
adb kill-server
echo Congratulations! Your phone's bootloader is now unlocked!
pause
goto menu
:unlock2
cls
echo How to tell if your bootloader is unlocked:
echo Step 1: Power off your phone.
pause
cls
echo Step 2: Boot into AP Fastboot mode
echo (Hold the VOL-Down and VOL-Up buttons as you push the power button.
echo When the menu shows up, scroll down to AP FASTBOOT and select it.)
pause
cls
echo Step 3: Check your status,
echo If it says Status 0, then your bootloader is locked.
echo If it says Status 1, then your bootloader is unlocked!
echo Pressing any key will return to the main menu.
pause
GOTO menu
:exit
cls
echo Thank you for using the DroidHD Utility by Mr. Parkinson!
echo Contact me at [email protected]!
echo (I do websites too!)
pause
<<< END

Modifying a 2/2 XL script for the 4/4 XL

Hi all,
You may or may not already be familiar with it, but there was a very nice script created by Joseph Miller to install new factory images (with or without locking the device). What I would like to do is to see how much of the script can be migrated to work with Pixel 4/4 XL.
Based on your experience with updating your 4/4 XL, do you see anything in the deuce script for the Pixel 2 that would need to be revised for use on a Pixel 4?
I'm certainly willing to test on my own device and any feedback would be appreciated. (I am relatively new to the Pixel 4 XL but very familiar with the Pixel 2 XL.)
.sh version is below:
Code:
#!/bin/sh
echo "Welcome to Deuces Flashing Script!"
echo "v5.0-Linux"
#to create a log, run: "script -c ./deuce-flash-all-v5.0.sh logfile.log"
echo "Checking if Fastboot binary is accessible.."
if [ -f "fastboot" ];
then
echo "\033[32m fastboot binary exists in script directory.\033[0m"
fb="./fastboot"
else
echo "\033[33mfastboot binary does not exist in script directory\033[0m" >&2
command -v fastboot | ( read fb; echo "\033[33mFound $fb. Will try to use this.\033[0m" )
fb="fastboot"
fi
echo "Checking if Fastboot works correctly"
if $fb --version
then
echo "\033[32m fastboot returned a version, continuing..\033[0m"
else
echo "\033[31m fastboot not working correctly.\033[0m"
exit 1
fi
echo "Checking if device is detected via Fastboot."
if [ -z $($fb devices -l) 2> /dev/null ]
then
echo "\033[31mDevice not detected in fastboot.\033[0m"
exit 1
else
echo "\033[32m Device detected!\033[0m"
fi
echo "Insuring unzip package is installed and accessible"
if unzip 1> /dev/null
then
echo "\033[32m unzip detected!\033[0m"
else
echo "\033[31m unzip is not installed, or is not working correctly!\033[0m"
echo "\033[33mplease install via:\033[0m"
echo "\033[33msudo apt install unzip\033[0m"
echo "\033[33mor\033[0m"
echo "\033[33msudo yum install unzip\033[0m"
exit 1
fi
zipcount="$(ls *.zip 2>/dev/null | wc -l)"
if [ "${zipcount}" -eq 1 ]
then
zipname="$(ls *.zip)"
echo ""
echo "\033[32mImage to flash: ${zipname}\033[0m"
elif [ "${zipcount}" -gt 1 ]
then
echo "\033[31m More than 1 zip!\033[0m"
echo "\033[31mPlease have only 1 zip file in the script folder.\033[0m"
zipnames="$(ls *.zip)"
echo "\033[33m${zipnames}\033[0m"
exit 1
else
echo "no zip files!"
exit 1
fi
echo -n "Are you SURE you want to continue? (y/N) "
read answer1
if echo "$answer1" | grep -iq "^y" ;then
echo "\033[33mThis Tool will reformat partitions in your device!\033[0m"
echo "\033[33mIt will attempt to keep your user data!\033[0m"
echo "\033[33mData could be lost! - Use At Your Own Risk!\033[0m"
echo -n "Continue? (y/N) "
read answer2
if echo "$answer2" | grep -iq "^y" ;then
echo "Checking if bootloader is unlocked."
echo "Look at device to confirm if script is waiting..."
$fb flashing unlock
echo "There will be errors if already unlocked, ignore."
else
echo "Aborting..."
exit 1
fi
else
echo "Aborting..."
exit 1
fi
echo "extracting the main image zip..."
unzip -j -o ${zipname} -d _work/
echo "setting active partition slot to A"
$fb --set-active=a
echo "flashing bootloader & radio..."
$fb flash bootloader _work/bootloader*.img
rm -rf _work/bootloader*.img
$fb reboot-bootloader
sleep 5
$fb flash radio _work/radio*.img
rm -rf _work/radio*.img
$fb reboot-bootloader
echo "extracting secondary image zip..."
zipname2="$(ls _work/*.zip)"
unzip -j -o ${zipname2} -d _work/
mkdir _work/_ 2>/dev/null
mv _work/*_other.img _work/_/ 2>/dev/null
echo "setting active partition slot to B"
$fb --set-active=b
bimgs="$(ls _work/_/*.img)"
for bimg in $bimgs
do
part=$(ls _work/_/*_other.img | cut -d "_" -f3 | cut -d "/" -f2)
echo $part
$fb flash $part $bimg
rm -rf $bimg
done
rm -rf _work/_
echo "setting active partition slot to A"
$fb --set-active=a
aimgs=$(ls _work/*.img)
for aimg in $aimgs
do
part=$(echo $aimg | cut -d "/" -f2 | cut -d "." -f1)
echo $part
$fb flash $part $aimg
rm -rf $aimg
done
echo -n "\033[33mDo you want to format user data? (y/N) \033[0m"
read answer3
if echo "$answer3" | grep -iq "^y" ;then
echo "\033[33m!!!This will wipe all your data!!!\033[0m"
echo -n "\033[31mAre you SURE? (y/N) \033[0m"
read answer4
if echo "$answer4" | grep -iq "^y" ;then
echo "Formatting user data.."
$fb format userdata 2>/dev/null
$fb reboot-recovery 2>/dev/null
echo "\033[32mDone!\033[0m"
else
echo "\033[36mSkipped formatting userdata.\033[0m"
echo "\033[32mDone!\033[0m"
exit
fi
else
echo "\033[36mSkipped formatting userdata.\033[0m"
echo "\033[32mDone!\033[0m"
exit
fi
exit
.bat version is here.
Note: I recommend placing the latest flashboot somewhere in your $PATH and running the script from within the unzipped factory image folder (where you have also unzipped the image zip).
Edit: Updated deuce script to v5.0 (thanks quorn23!)
Just a heads up, you're using an older version of the script, see original thread https://forum.xda-developers.com/pixel-2-xl/development/tool-deuces-bootloop-recovery-flashing-t3704761
I haven't tested it yet, but the 5.0 apparently works with A10 skimming through the last few pages in the thread. Once the Kernel is updated with the new sources (dez broke face unlock) i might have a look. What i probably would do is prepatch the boot image with magisk, besides that i would assume it's pretty straight forward, as it's AOSP.
Edit: as context, i'm coming from the pixel 2xl as well, i generally been using the Deuce script to update the 2 XL, if i recall correctly the only change i made was to adapt it to flash TWRP as well, which is currently not needed as not available for the 4 XL. (Devs wife is pregnant, so he's busy with more important personal life stuff currenty)
quorn23 said:
What i probably would do is prepatch the boot image with magisk, besides that i would assume it's pretty straight forward, as it's AOSP.
Click to expand...
Click to collapse
Out of habit, I've always re-added magisk manually, but you're right, this will require some additional dance steps without twrp. What i like about the original sh script is that the core dependency (for most scenarios) is a recent fastboot.

Installing G930FXXU8EUE1_DevBase_v7.4

(I didn't get a response in the thread for this ROM, I hope I'll have more luck here.)
I'm currently running crDroid 11, but the camera is almost unusable. Thus I'm now trying to install G930FXXU8EUE1_DevBase_v7.4.zip using TWRP 3.7.0_9-0 from https://forum.xda-developers.com/t/...laxy-s7-herolte.3333770/page-83#post-87570457.
However, I get the following error:
Code:
Installing zip file '/external_sd/G930FXXU8EUE1_DevBase_v7.4.zip'
Unmounting System...
Failed! Can't unzip 7za package!
Aborting, no changes have been made
I've tried this with the rooted and unrooted boot image from crDroid installed.
How can I troubleshoot this?
I managed to install it:
Installed twrp-3.6.2_9-0-herolte.img
Installed BL_G930FXXU8EUE1.zip from https://androidfilehost.com/?w=files&flid=287434
Extract G930FXXU8EUE1_DevBase_v7.4.zip
in ./META-INF/com/google/android/update-binary, make the following change:
# Check device using bootloader prefix
getprop ro.bootloader | grep "^$BLPREFIX" >/dev/null
if [ $? -ne 0 ] ; then
ui_print "This ROM is designed for $BLPREFIX, but not aborting!"
ui_print " "
# abort
fi
cd G930FXXU8EUE1_DevBase_v7.4
zip -r -9 G930FXXU2xxxx_DevBase.zip META-INF options.prop ALEXNDR

Categories

Resources