Install Stock Android 9.0.8
Using edl mode
Especially when you have errors, wrong partitions, broken gps,broken wifi, or a '''locked bootloader''', it makes sense to bring the OnePlus 6 back to a factory state with this method, be aware that it might take some time and nerves. Sometimes you need to repeat steps, but this method works. There is still a lot of stuff going on behind the scenes we dont know and cant understand.
Install following tools first:
- https://github.com/bkerler/edl/ (on arch:
yay edl-git) - https://github.com/ssut/payload-dumper-go
-
If you are not a Linux user, run bkerler`s liveCD image instead.
-
Don
t use any fancy usb cable with blinking leds and super highspeed charging capabilities.
For OnePlus6, download '''fulldowngrade_wipe_MSM_17819_181025_2315_user_MP1_release.zip''' (its here).
Unpack and decrypt payload:
payload-dumper-go payload.bin
Now is time to start the first edl command written further down. It will wait for a device, filling the terminal with dots ..... then bring your phone into edl mode:
-
Turn off phone
-
Hold volume up + volume down
-
Plugin usb cable (you should feel a vibration)
-
The edl command which wrote some dots in terminal, now starts to execute (on your computer, while the phone screen stays black and only a white led next to the earpiece is shown)
-
Write all necessary files with the edl tool:
Note: make an alias to the edl binary for simple copy pasta of:
edl w boot_a boot.img edl w boot_b boot.img edl w dtbo_a dtbo.img edl w dtbo_b dtbo.img edl w abl_a abl.img edl w abl_b abl.img edl w aop_a aop.img edl w aop_b aop.img edl w bluetooth_a bluetooth.img edl w bluetooth_b bluetooth.img edl w cmnlib_a cmnlib.img edl w cmnlib_b cmnlib.img edl w cmnlib64_a cmnlib64.img edl w cmnlib64_b cmnlib64.img edl w devcfg_a devcfg.img edl w devcfg_b devcfg.img edl w dsp_a dsp.img edl w dsp_b dsp.img edl w fw_4j1ed_a fw_4j1ed.img edl w fw_4j1ed_b fw_4j1ed.img edl w fw_4u1ea_a fw_4u1ea.img edl w fw_4u1ea_b fw_4u1ea.img edl w hyp_a hyp.img edl w hyp_b hyp.img edl w keymaster_a keymaster.img edl w keymaster_b keymaster.img edl w LOGO_a LOGO.img edl w LOGO_b LOGO.img edl w modem_a modem.img edl w modem_b modem.img edl w oem_stanvbk oem_stanvbk.img edl w qupfw_a qupfw.img edl w qupfw_b qupfw.img edl w storsec_a storsec.img edl w storsec_b storsec.img edl w system_a system.img edl w system_b system.img edl w tz_a tz.img edl w tz_b tz.img edl w vbmeta_a vbmeta.img edl w vbmeta_b vbmeta.img edl w vendor_a vendor.img edl w vendor_b vendor.img edl w xbl_a xbl.img edl w xbl_b xbl.img edl w xbl_config_a xbl_config.img edl w xbl_config_b xbl_config.img edl reset
- Boot again into fastboot mode, from here boot into recovery, erase/wipe all data and reboot. This will take approx.10 minutes to boot!
After rebooting the phone into Android: enable wifi, bluetooth, location.
-
Flash PostmarketOS with [https://wiki.postmarketos.org/wiki/Pmbootstrap pmbootstrap]
-
fastboot erase dtbo
Notes:
-
If you have a bootloop, just run first edl command, try pressing all buttons on phone and plugin usb cable repetitively until edl catches the phone, then proceed.
-
Trying to downgrade android with edl can also result in a kind of '''dead phone (no response, just black, very hard to get edl mode again)'''. I had this on a '''256GB version''' the trick here is time consuming but it works:
first edl OnePlus6Oxygen_22.J.62_OTA_0620_all_2111252336_287bcb1636d743d3, then boot into fastboot and
install twrp:
fastboot flash boot TWRP-x.x.x-OP6.img
then boot into twrp
fastbootboot boot TWRP-xxx.img
Note: the different TWRP Versions do matter!
and erase all
(worst case you can mess with OrangeFox, loaded via twrp or an other recovery. This will also give you hardware info like screen brand. if your pmos install used fulldisk encryption the data partition may be gone and causing trouble.. first reflash pmos without encryption and the go on.)
and push the zip:
adb push fulldowngrade_wipe_MSM_17819_181025_2315_user_MP1_release.zip /sdcard
then in twrp select install and install the zip
boot, this will take a while but you are in android 9.0.2, next get OnePlus6Oxygen_22_OTA_033_all_1908012012_0b41e6554cc7409a.zip copy it to the phone and install it from the software installer menu. Then switch to fastboot set_active b and do the same. Finally you did it, you have Android 9.0.8 on your OP6 to be ready to flash PostmarketOS. Please drop me a line if this helped you :-)
-
If you think your phone is bricked, there is a 99,9% chance that it is not bricked! Push the power button very long to turn it off, then push all buttons and plugin the usb cable, try this a hundred times, sometimes restart edl, switch to different usb slots on your computer, it will bring it once into edl mode.... just keep on plugin/out and remember to take a tee break before you loose your nerves... if i can do it, you can do it!
-
I installed LineageOS, Android, Ubports, Droidian, Mobian, PostmarketOS, bricked the partitions, had a dead phone, had boot loops, somehow i always brought it back to life (its just annoying and time consuming).
{{warning| If you see a 'crash dump' screen, plug the phone again to your computer and run edl without any commands. Provide the logs here. }}
Boot Warning
To you get rid of
"Your device is corrupt. It can't be trusted and may not work properly"
boot warning, simply adb shell into the phone and:
reboot "dm-verity enforcing"
Reformating / Partitiontable
JUST NOTES
For worst case scenarios or when you somehow lost GB of storage.
use fdisk /dev/sda
'''Table of a 128GB OP:'''
Disk /dev/sda: 116.11 GiB, 124671492096 bytes, 30437376 sectors Disk model: KLUDG4U1EA-B0C1 Units: sectors of 1 * 4096 = 4096 bytes Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 8192 bytes / 8192 bytes Disklabel type: gpt Disk identifier: 5A170C25-3FE4-866E-85E9-7154538C9DD1 Device Start End Sectors Size Type /dev/sda1 6 7 2 8K unknown /dev/sda2 8 8199 8192 32M unknown /dev/sda3 8200 8455 256 1M unknown /dev/sda4 8456 8711 256 1M unknown /dev/sda5 8712 8839 128 512K unknown /dev/sda6 8840 8967 128 512K unknown /dev/sda7 8968 74503 65536 256M unknown /dev/sda8 74504 77063 2560 10M unknown /dev/sda9 77064 79623 2560 10M unknown /dev/sda10 79624 81647 2024 7.9M unknown /dev/sda11 81648 85695 4048 15.8M unknown /dev/sda12 85696 85823 128 512K unknown /dev/sda13 85824 817983 732160 2.8G unknown /dev/sda14 817984 1550143 732160 2.8G unknown /dev/sda15 1550144 1575743 25600 100M unknown /dev/sda16 1575744 1601343 25600 100M unknown /dev/sda17 1601344 30437370 28836027 110G unknown
'''Table of a 256GB OP:'''
it died before i could get it 🤷
Get the GPT Partition Tables
Download the '''OPX_UnBrick_Mini_By_Naman_Bhalla''' from xdadevelopers,
in there you will find the needed gpt_main0.bin
If edl is still working:
./edl qfil rawprogram0.xml patch0.xml .
and hopefully its fixed.
if you need to restore all partitions, grab the pygpt. Use it to create the partition table (run it with python2 !!!
- extract partition table
gpt_reader.py gpt_main0.bin > partition.xml
now you have the table as partition.xml and we need a tool to create them now as rawprogram0.xml and patch0.xml files which then can be pushed to the phone.
- find the needed tools here.....
GPTParserTool -x partition.xml
now flash with '''qdl'''
qdl
Installation:
sudo pacman -S libxml2 git clone https://git.codelinaro.org/clo/yocto-mirrors/github/linux-msm/qdl.git cd qdl make
Usage, just guessing:
./qdl --debug --storage ufs prog_firehose_ddr.elf rawprogram0.xml patch0.xml
above seems to work
or maybe something like that:
./qdl --debug --storage emmc --include 8974_msimage.mbn prog_emmc_firehose_8974.mbn rawprogram0.xml patch0.xml
Backup via EDL mode
did not test yet, should be more or less:
The EDL commands to dump the partitions into image files:
edl r persist persist_backup.img
edl r modemst2 modemst2_backup.img
edl r modemst1 modemst1_backup.img
edl r fsc fsc_backup.img
edl r fsg fsg_backup.img
or
edl rl dumps
edl rf flash.bin
restore
edl wl or edl wf.