Sample Header Ad - 728x90

How to install a firmware without losing your data and restore the previous one in case it goes wrong?

3 votes
1 answer
8169 views
I have a OnePlus 5T and I can't install OTA updates anymore because my firmware is too old. In addition to that I don't have a full backup of my device because I'm using encryption and TWRP doesn't understand it. I would like to simply try the new firmware and revert in case anyhting goes wrong without losing any data. Is that possible? I'm not exactly sure what firmware means in this context and where to get it, but looking at the website , there is this download for a zip file with the following contents: file tree I'm pretty sure that this is the complete stock ROM, meaning if I were to install it, it would wipe everything and replace my LineageOS with the stock ROM. What I would like to do is to simply flash "the firmware" and only the firmware without losing data on my internal storage and also not my app data, contacts, sms, wifi passwords, bluetooth pairings etc etc. And before that I would like to create a backup of my old firmware so that I can go back in case it goes wrong. Can this be done? Can it be done with fastboot? Maybe using fastboot flash PARTITION [FILENAME] and some other command to do the backup? **Edit:** The updater-script in META-INF/com/google/android/update-script contains the following code: getprop("ro.display.series") == "OnePlus 5T" || abort("E3004: This package is for \"OnePlus 5T\" devices; this is a \"" + getprop("ro.display.series") + "\"."); is_part_existed("/dev/block/bootdevice/by-name/vendor") || abort("vendor partition is not existed, exit ota!!"); show_progress(0.650000, 0); ui_print("Patching system image unconditionally..."); block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat") || abort("E1001: Failed to update system image."); show_progress(0.100000, 0); ui_print("Patching vendor image unconditionally..."); block_image_update("/dev/block/bootdevice/by-name/vendor", package_extract_file("vendor.transfer.list"), "vendor.new.dat", "vendor.patch.dat") || abort("E2001: Failed to update vendor image."); show_progress(0.050000, 10); show_progress(0.050000, 5); package_extract_file("boot.img", "/dev/block/bootdevice/by-name/boot"); show_progress(0.200000, 10); ui_print("Writing static_nvbk image..."); package_extract_file("RADIO/static_nvbk.bin", "/dev/block/bootdevice/by-name/oem_stanvbk"); # ---- radio update tasks ---- ui_print("Patching firmware images..."); ifelse(msm.boot_update("main"), ( package_extract_file("firmware-update/cmnlib64.mbn", "/dev/block/bootdevice/by-name/cmnlib64"); package_extract_file("firmware-update/cmnlib.mbn", "/dev/block/bootdevice/by-name/cmnlib"); package_extract_file("firmware-update/hyp.mbn", "/dev/block/bootdevice/by-name/hyp"); package_extract_file("firmware-update/pmic.elf", "/dev/block/bootdevice/by-name/pmic"); package_extract_file("firmware-update/tz.mbn", "/dev/block/bootdevice/by-name/tz"); package_extract_file("firmware-update/abl.elf", "/dev/block/bootdevice/by-name/abl"); package_extract_file("firmware-update/devcfg.mbn", "/dev/block/bootdevice/by-name/devcfg"); package_extract_file("firmware-update/keymaster.mbn", "/dev/block/bootdevice/by-name/keymaster"); package_extract_file("firmware-update/xbl.elf", "/dev/block/bootdevice/by-name/xbl"); package_extract_file("firmware-update/rpm.mbn", "/dev/block/bootdevice/by-name/rpm"); ), ""); ifelse(msm.boot_update("backup"), ( package_extract_file("firmware-update/cmnlib64.mbn", "/dev/block/bootdevice/by-name/cmnlib64bak"); package_extract_file("firmware-update/cmnlib.mbn", "/dev/block/bootdevice/by-name/cmnlibbak"); package_extract_file("firmware-update/hyp.mbn", "/dev/block/bootdevice/by-name/hypbak"); package_extract_file("firmware-update/tz.mbn", "/dev/block/bootdevice/by-name/tzbak"); package_extract_file("firmware-update/abl.elf", "/dev/block/bootdevice/by-name/ablbak"); package_extract_file("firmware-update/keymaster.mbn", "/dev/block/bootdevice/by-name/keymasterbak"); package_extract_file("firmware-update/xbl.elf", "/dev/block/bootdevice/by-name/xblbak"); package_extract_file("firmware-update/rpm.mbn", "/dev/block/bootdevice/by-name/rpmbak"); ), ""); msm.boot_update("finalize"); package_extract_file("firmware-update/logo.bin", "/dev/block/bootdevice/by-name/LOGO"); package_extract_file("firmware-update/NON-HLOS.bin", "/dev/block/bootdevice/by-name/modem"); package_extract_file("firmware-update/adspso.bin", "/dev/block/bootdevice/by-name/dsp"); package_extract_file("firmware-update/BTFM.bin", "/dev/block/bootdevice/by-name/bluetooth"); set_progress(1.000000); Should I just take the msm.boot_update("main"), and the msm.boot_update("finalize"), part and flash them like this? # main fastboot flash cmnlib64 ./firmware-update/cmnlib64.mbn fastboot flash cmnlib ./firmware-update/cmnlib.mbn fastboot flash hyp ./firmware-update/hyp.mbn fastboot flash pmic ./firmware-update/pmic.mbn fastboot flash tz ./firmware-update/tz.mbn fastboot flash abl ./firmware-update/abl.elf fastboot flash keymaster ./firmware-update/keymaster.mbn fastboot flash xbl ./firmware-update/xbl.elf fastboot flash rpm ./firmware-update/rpm.mbn # finalize fastboot flash LOGO ./firmware-update/logo.bin fastboot flash modem ./firmware-update/NON-HLOS.bin fastboot flash dsp ./firmware-update/adspso.bin fastboot flash bluetooth ./firmware-update/BTFM.bin Or would this already overwrite a partition that contains some sort of user data? Can I make a backup of these partitions first? And what about RADIO/static_nvbk.bin, boot.bin, system.transfer.list, vendor.transfer.list and all that msm.boot_update("backup"), stuff? **Edit:** I ended up not being able to flash those firmware files via fastboot because it requires more than a "normal" unlocked bootloader. If I had done the necessary step to unlock the bootloader further it would have wiped all my data. Fortunately you can bypass that by creating a zip with the firmware files and a custom OpenRecoveryScript (updater-script). I found an awesome GitHub project that automates the whole process: https://github.com/angela-d/firmware_oneplus I simply sideloaded the generated zip via adb sideload firmware-update-oneplus5T.zip and finally I was able to install my OTA updates. https://github.com/angela-d/firmware_oneplus
Asked by Forivin (247 rep)
Dec 24, 2019, 09:05 PM
Last activity: Dec 25, 2019, 10:00 PM