nandroid before unlocking. possible? - Nexus One General

I have my phone on the way and the first thing I would like to do is backup before unlocking anything so that I can always go back to original. Possible?

just an fyi: "unlocking" means making your phone work on any carrier that uses GSM technology (in the states it means opening up a phone that was once T-Mobile-only OR ATT-only to both att or t-mobile).
"rooting" (or if you're an iphone user, "jailbreaking") means gaining permissions to the underlying filesystem of the phone that the shipped phone usually locks you out of.
and sorry, no dice. you have to flash the recovery partition to do a nandroid backup.

Sorry for that. I meant unlocking, the bootloader to be exact. I do know it is possible to boot to a custom recovery without flashing it. What I want to know is if I can do that without unlocking the bootloader, or maybe some other method?

You can boot a custom recovery image without flashing it: fastboot boot recovery.img
You cannot do this until you've unlocked the bootloader, however.
The bootloader unlock process does not modify the boot, recovery, or system partitions, so you could still back them up as they originally were.
We had hoped to have an official factory image made available (perhaps through developer.htc.com) for restoring the device to it's original state, should you install a custom build that doesn't work, or otherwise want to get back to the original build. We're till working out the details on this.

Related

[Q] Root after unlocking bootloader, retain stock rom & bootloader

I am sorry if this is a dupe of other threads but I couldn't find a complete answer to my problem anywhere else.
I have a nexus 7 (2012), on stock 4.4.2, unlocked bootloader (i think, unlocked padlock on startup).
I want to root. I gather this will not wipe? (or will it?) and what tool should i use? I already have N7 toolkit and android sdk, so i can use that most easily, otherwise any other program needed is fine. I want to use stock bootloader and stock rom and ensure ota updates will occur. (i understand i may lose root through ota updates, but i assume i can just reroot as i have unlocked the bootloader?)
Thanks
Since your tab has already gone through the bootloader unlocking process, there is neither a need nor a requirement to wipe the device.
And since you want to stay as close to Stock as possible, you can even "root" without ever flashing a recovery: you just soft-boot a recovery image rather than flashing one. That is - "fastboot boot (...etc)" instead of "fastboot flash (...etc)". That allows you to use a custom recovery every once in a while while leaving a stock recovery on the tablet. That preserves maximum compatibility with future OTAs.*
And with that soft-booted recovery, immediately take a Nandroid backup including the Stock recovery (which is still on the tablet because you soft-booted the recovery you are using). In the same session, use "adb pull" to get a copy of your 100% pure-stock Nandroid backup off the tablet. (Make sure you name it clearly so you will know exactly what it is 12 or 24 months later)
Finally, use a flashable .zip installer package for SuperSU to "flash root".
After an OTA, you can just reinstall root by soft-booting a custom recovery and using the same (or updated) flashable .zip installer method for reinstalling SuperSU. And just like above, capture a new 100% pure-stock Nandroid backup (including the new stock recovery) *before* re-rooting.
This strategy allows you to roll back to any version of stock you please at any time in the future.
good luck
* flashaholics prefer to have a recovery hard-flashed on their device so they can flash things on a whim, wherever they are. The approach here is a bit more restrictive as you have to have a PC handy in order to soft-boot a recovery in order to do any flashing. I would say that the biggest limitation of this approach is that it tends to reduce the number of Nandroid backups of your ROM personalization.
Backup are a good thing. You can always throw them away later, but you can't create a missing one that is urgently needed.

[Q] Many Advanced Questions Regarding ROMs

I am getting into development more and have a new load of questions. And yes, I searched first.
Do all Roms include firmware(OS), kernal, baseband, and boot loader?
Do over-the-air updates include the baseband and boot loader, or only the kernal and firmware/(OS).
I once used the Wugfreth toolkit to reinstall the stock ROM. It flashed the baseband with the same version and then attempted to flash the boot loader with the same version, but failed. How can I JUST flash the kernal and firmware/os.
This may be dumb question, but what language is the boot loader and baseband written in? Is it encrypted, or can anyone edit it and flash?
What happens if the boot loader, baseband, kernal, and firmware versions do not match?
I did not know the ROM included the bootloader, and I almost purposely flash the ROM of another device to see what would happen, figuring I could have restored using fastboot. But that probably would have hard-bricked it, right? I thought flashing a ROM was completely safe because it did not touch the boot loader, and could always be undone with fastboot?
How do you developers test out modified bootloaders without making a simple coding mistake and ruining your device?
How can you flash a bootloader using itself (fastboot)?
I saw a post for a different device for changing the boot loader logo. Not the firmware's boot animation. I don't want mine to say "Google" with an unlock icon. Can this be done on the Nexus 7?
I read the partition sizes are determined by the boot loader, and not adjustable. Is this correct? I am running stock 4.4.3 and only have 11MB free on the system partition. How do custom Roms fit within this limit? I am worried this will prevent a custom ROM based in 5.0 Lollipop, and the Nexus 7 2012 will be stuck on Kitkat. Maybe the firmware could be loaded on the data partition with a symbolic link to the system partition?
Thank you
I'm not a developer, but can answer some of your questions (at least as they relate specifically to the Nexus 7).
Custom ROMS typically just include the firmware/kernel (and i believe the radio/baseband if it's for a 3g/mobile device, though these can also be flashed separately, and i could be wrong on this part.) Bootloader is typically untouched, but this might differ on other devices.
As for OTA updates and what all they include, well that depends on the device, manufacturer, carrier, and even the specific OTA. It could potentially include everything (firmware/kernel updates, bootloader, radio/baseband, etc.), but may be any combination of the different components.
Available free space on the system partition doesn't really matter if you're flashing a new ROM, because you'll be wiping the partition as part of the flashing process. ROMs typically don't include GAPPS either (unless it's just a modified version of stock), so will actually take up much less room than the stock ROM on their own. Then you can decide which GAPPS to flash separately, there are various packages available in different sizes; some just include the basic google play services needed to have the play store and related basic functionality, others will mirror the stock pre-installed apps.
If you're using a custom recovery to flash a ROM, they typically contain a script to first verify the device matches, if not, it won't even flash. If you do manage to flash an incompatible ROM (via fastboot maybe, or if it doesn't include a verification script), with a Nexus this typically is not a big deal, you just won't ever actually boot into the ROM, but should still be able to boot into recovery or bootloader and then flash a compatible ROM.
If you flash an incompatible kernel on top of a ROM, you'll likely get a bootloop/softbricked device.
Flashing an incompatible bootloader may brick the device. Any tinkering with the bootloader is always risky.
Hope that helps a little, I'll take another look when I'm not at work
flyoffacliff said:
I am getting into development more and have a new load of questions. And yes, I searched first.
Do all Roms include firmware(OS), kernal, baseband, and boot loader?
Do over-the-air updates include the baseband and boot loader, or only the kernal and firmware/(OS).
I once used the Wugfreth toolkit to reinstall the stock ROM. It flashed the baseband with the same version and then attempted to flash the boot loader with the same version, but failed. How can I JUST flash the kernal and firmware/os.
This may be dumb question, but what language is the boot loader and baseband written in? Is it encrypted, or can anyone edit it and flash?
What happens if the boot loader, baseband, kernal, and firmware versions do not match?
I did not know the ROM included the bootloader, and I almost purposely flash the ROM of another device to see what would happen, figuring I could have restored using fastboot. But that probably would have hard-bricked it, right? I thought flashing a ROM was completely safe because it did not touch the boot loader, and could always be undone with fastboot?
How do you developers test out modified bootloaders without making a simple coding mistake and ruining your device?
How can you flash a bootloader using itself (fastboot)?
I saw a post for a different device for changing the boot loader logo. Not the firmware's boot animation. I don't want mine to say "Google" with an unlock icon. Can this be done on the Nexus 7?
I read the partition sizes are determined by the boot loader, and not adjustable. Is this correct? I am running stock 4.4.3 and only have 11MB free on the system partition. How do custom Roms fit within this limit? I am worried this will prevent a custom ROM based in 5.0 Lollipop, and the Nexus 7 2012 will be stuck on Kitkat. Maybe the firmware could be loaded on the data partition with a symbolic link to the system partition?
Thank you
Click to expand...
Click to collapse
1. roms dont include a bootloader.
2. no
3. easily in a custom recovery.
4. i have no idea, and its the most secure part of the device.
5. nothing.
6. roms DO NOT EVER include bootloaders.
7. developers on nexus devices never modify the bootloader. first off, its extremely tedious and difficult. secondly, there is no need, as our bootloaders are unlockable and lockable.
8. it overwrites itself, but you are on your computer using fastboot, phone is just plugged into it.
9. no.
10. each partition has its own size. roms go into a partition that also holds your storage, and is separated from the storage. another reason why you dont have 16gb storage when you buy a 16gb device, because some of it gets allocated to the system.

Some questions regarding flashing the stock firmware

Hello, so basically when I was on the June update of my Moto G4 Plus, build NPJS25.93-14-8, software channel reteu, model XT1642 when I decided to unlock my bootloader and flash RR. Now I want to go back to the stock firmware for several reasons, but I have some questions about flashing it. I know how to flash it trough fastboot, but I have some other questions.
1. What are the risks if I flash it?
2. Can I just restore my twrp backup for the fully stock rom, flash the stock recovery and update to the last build through ota? will that work?
3. Will there appear other problems I have to worry about?
4. Can I just flash the June patch through fastboot so that I don't have to flash the updated modems, fsg, bootloader, etc. but instead update them through ota after flashing the stock firmware? Or will that cause bugs?
Thanks for the help and please don't throw hate at me, the last device that I hade with android had android 4.4 and a MediaTek chipset, then I switched to Windows Mobile till last year.
1) As long as you flash the same or newer stock firmware as the latest on your device, you should be okay.
As of writing, if you flash the June 2017, Sept 2017 or Dec 2017 stock firmwares (NPJS25.93-14-8, NPJS25.93-14-10 or NPJS25.93-14-13 respectively) then you shouldn't run into issues and be okay to take OTA updates provided you do a full flash. By a full flash, I mean flashing GPT, bootloader, system, OEM, DSP, modem and the erase steps. If you're flashing the NPJS25.93-14-8 firmware, flashing the same firmware should do nothing to your GPT, bootloader or modem, but is a good routine to ensure your device is clean.
As you're switching from RR to stock firmware, a data wipe/erase is recommended - you may be able to use Titanium Backup or another backup app to preserve your app data, then restore it after flashing the stock ROM (though ensure the backup is off your device). You will have to root your stock ROM to use Titanium Backup however.
The risks come when you flash stock firmware of an older patch level than the stock firmware currently on your device (custom ROMs do not matter in this regard) - strictly speaking, it's not the act of downgrading but attempting to take OTA updates whilst downgraded that causes hard bricks. In most cases, if not all, I've noted that a mismatch of the bootloader patch level and the system patch level are what cause issues for most users. You cannot downgrade bootloaders, so downgrading leads to the following situation:
Say you're on the June 2017 firmware:
June 2017 bootloader, June 2017 system (or RR).
You downgrade to Marshmallow or an earlier build of Nougat (say in this case Dec 2016 Nougat firmware):
June 2017 bootloader (bootloader will block downgrades with a security downgrade error), December 2016 firmware.
You try to take an OTA update. However, OTA updates are only designed for updating, and appear to assume (from looking at the script) your system patch level is the same as your bootloader. If you did not downgrade, this assumption would hold. However, as you've downgraded, you'll get this:
March/June 2017 bootloader *, March 2017 system.
Due to the OTA having authorisation to flash to your bootloader without prior checks, the older OTA corrupts your newer bootloader (as denoted by the *), leading to a hard brick. We do have a blankflash at the moment to help with this, though the easiest way to avoid this situation is to only flash firmware of the same or newer build that what is on your device. Motorola does not support downgrading and assumes the user takes responsibility for downgrading.
2)In theory yes. However, if TWRP was allowed to make modifications before you took the backup, the subsequent OTA might fail as your system partition would be detected as not read-only. Furthermore, you'd need a stock logo.bin, so if you've flashed a logo.bin to hide the bootloader unlocked warning, you'd have to pull that from the NPJS25.93-14-8 stock ROM. TWRP to my knowledge does not back that up.
3)As long as you take your time, and have not downgraded/hard bricked in the past, you should be okay. Ensure you back up as much data with Titanium Backup as previously mentioned, and ensure that you do a full flash, so your GPT, bootloader and system are at the same patch level. As mentioned previously, having your device on the same patch level should mean you have fewer issues with OTAs and stability.
4)I'm not sure what you mean by the June patch, do you mean the June OTA update, or do you mean the June stock ROM?
echo92 said:
1) As long as you flash the same or newer stock firmware as the latest on your device, you should be okay.
As of writing, if you flash the June 2017, Sept 2017 or Dec 2017 stock firmwares (NPJS25.93-14-8, NPJS25.93-14-10 or NPJS25.93-14-13 respectively) then you shouldn't run into issues and be okay to take OTA updates provided you do a full flash. By a full flash, I mean flashing GPT, bootloader, system, OEM, DSP, modem and the erase steps. If you're flashing the NPJS25.93-14-8 firmware, flashing the same firmware should do nothing to your GPT, bootloader or modem, but is a good routine to ensure your device is clean.
As you're switching from RR to stock firmware, a data wipe/erase is recommended - you may be able to use Titanium Backup or another backup app to preserve your app data, then restore it after flashing the stock ROM (though ensure the backup is off your device). You will have to root your stock ROM to use Titanium Backup however.
The risks come when you flash stock firmware of an older patch level than the stock firmware currently on your device (custom ROMs do not matter in this regard) - strictly speaking, it's not the act of downgrading but attempting to take OTA updates whilst downgraded that causes hard bricks. In most cases, if not all, I've noted that a mismatch of the bootloader patch level and the system patch level are what cause issues for most users. You cannot downgrade bootloaders, so downgrading leads to the following situation:
Say you're on the June 2017 firmware:
June 2017 bootloader, June 2017 system (or RR).
You downgrade to Marshmallow or an earlier build of Nougat (say in this case Dec 2016 Nougat firmware):
June 2017 bootloader (bootloader will block downgrades with a security downgrade error), December 2016 firmware.
You try to take an OTA update. However, OTA updates are only designed for updating, and appear to assume (from looking at the script) your system patch level is the same as your bootloader. If you did not downgrade, this assumption would hold. However, as you've downgraded, you'll get this:
March/June 2017 bootloader *, March 2017 system.
Due to the OTA having authorisation to flash to your bootloader without prior checks, the older OTA corrupts your newer bootloader (as denoted by the *), leading to a hard brick. We do have a blankflash at the moment to help with this, though the easiest way to avoid this situation is to only flash firmware of the same or newer build that what is on your device. Motorola does not support downgrading and assumes the user takes responsibility for downgrading.
2)In theory yes. However, if TWRP was allowed to make modifications before you took the backup, the subsequent OTA might fail as your system partition would be detected as not read-only. Furthermore, you'd need a stock logo.bin, so if you've flashed a logo.bin to hide the bootloader unlocked warning, you'd have to pull that from the NPJS25.93-14-8 stock ROM. TWRP to my knowledge does not back that up.
3)As long as you take your time, and have not downgraded/hard bricked in the past, you should be okay. Ensure you back up as much data with Titanium Backup as previously mentioned, and ensure that you do a full flash, so your GPT, bootloader and system are at the same patch level. As mentioned previously, having your device on the same patch level should mean you have fewer issues with OTAs and stability.
4)I'm not sure what you mean by the June patch, do you mean the June OTA update, or do you mean the June stock ROM?
Click to expand...
Click to collapse
Thanks for taking your time and answering my silly questions. 4) I mean the June stock ROM. And I've forgotten...
5) If you relock the bootloader, will you be able to unlock it again? How exactly does this work? The device gets another ID that you use again on the Moto site? Or you unlock it with the key that you used the first time you unlocked?
6) I have seen people that flashed the stock firmware through fastboot without relocking the bootloader and the software status shown in bootloader mode changed from "Official" (like mine) to "Modified" and the phone would show "Your device has failed verification and may not boot propertly." instead of the one with the unlocked bootloader. Just like here: https://www.youtube.com/watch?v=4OQQn105Bp8 . Though I have seen that some of these packages on xda are "Signed by Moto". So the problem does not occur when flashing those images?
corlatemanuel said:
Thanks for taking your time and answering my silly questions. 4) I mean the June stock ROM. And I've forgotten...
Click to expand...
Click to collapse
You have stock backup of current firmware, restore it and check build number in settings >about.
5) If you relock the bootloader, will you be able to unlock it again? How exactly does this work? The device gets another ID that you use again on the Moto site? Or you unlock it with the key that you used the first time you unlocked?
Click to expand...
Click to collapse
There are no benefits for relocking. if you want to lock you can, and it can be unlocked with same key.
6) I have seen people that flashed the stock firmware through fastboot without relocking the bootloader and the software status shown in bootloader mode changed from "Official" (like mine) to "Modified" and the phone would show "Your device has failed verification and may not boot propertly." instead of the one with the unlocked bootloader. Just like here: https://www.youtube.com/watch?v=4OQQn105Bp8 . Though I have seen that some of these packages on xda are "Signed by Moto". So the problem does not occur when flashing those images?
Click to expand...
Click to collapse
Not true, that Modified status comes when you try to modify stock ROM, for various meaning, say installing mods in system (not in case of systemless), or if you try to remove/add apps to system/oem, when you change something in stock ROM, then you will get modified status. (Modification in custom ROM will not change it, only stock ROM does.)
So if you have official status right now, you don't need to worry about it.
Otherwise, to remove modified status,
You need to take OTA, (which can be dangerous as echo92 told you above.),
Bootloader relocking is not necessary to remove Modified, you can still take OTA and it will work..
> Flash June's patch (if you are 100% sure about current firmware)
> take OTA of September
Taking OTA makes it again official. (There was no update for bootloader in September patch, if not official again, December will make it..)
____Mdd said:
You have stock backup of current firmware, restore it and check build number in settings >about.
There are no benefits for relocking. if you want to lock you can, and it can be unlocked with same key.
Not true, that Modified status comes when you try to modify stock ROM, for various meaning, say installing mods in system (not in case of systemless), or if you try to remove/add apps to system/oem, when you change something in stock ROM, then you will get modified status. (Modification in custom ROM will not change it, only stock ROM does.)
So if you have official status right now, you don't need to worry about it.
Otherwise, to remove modified status,
You need to take OTA, (which can be dangerous as echo92 told you above.),
Bootloader relocking is not necessary to remove Modified, you can still take OTA and it will work..
> Flash June's patch (if you are 100% sure about current firmware)
> take OTA of September
Taking OTA makes it again official. (There was no update for bootloader in September patch, if not official again, December will make it..)
Click to expand...
Click to collapse
Ok then, since I'm 100% sure that I was on NPJS5.93-14-8 I'll flash that firmware, but where exactly do I find the one that I need? Doesn't the region matter? I'm on XT1642, in Europe, on the software channel reteu. So which one package do I use? I found 2 of them on AFH from tywinlannister7. And also, quite many people flashed the wrong modem and got into trouble, from what I've seen on xda. So any precautions I should take in that matter?
P.S. I don't want to flash the December patch since it updates the bootloader and there is no blankflash for that version yet... Also can't find the September one.
corlatemanuel said:
Ok then, since I'm 100% sure that I was on NPJS5.93-14-8 I'll flash that firmware, but where exactly do I find the one that I need? Doesn't the region matter? I'm on XT1642, in Europe, on the software channel reteu. So which one package do I use? I found 2 of them on AFH from tywinlannister7. And also, quite many people flashed the wrong modem and got into trouble, from what I've seen on xda. So any precautions I should take in that matter?
P.S. I don't want to flash the December patch since it updates the bootloader and there is no blankflash for that version yet... Also can't find the September one.
Click to expand...
Click to collapse
One by tywinlennister7, it is fine and confirmed working on different retails, (retin, retus, retla, many others.)
I have seen modem and other critical problems when one flashes old firmware (marshmallow roms), those all problems happened when old (MM) firmware is flashed.
You can take backup of all partitions by TWRP (fsg, data, system, boot, firmware, all options in shreps twrp), this all things can be helpful in case if something wrong happens, internal memory will be wiped so move them to external... Then flash....
About December, it's your wish to update or not.
If you are worried about blank-flash, then let me remind you again, you will need blank-flash only if you downgrade and take OTA. When you update to December's patch update, remove all older firmware on your computer and keep December's firmware zip only. If you need to flash stock, flash it, not other old..
List of Nougat firmware:
NPJS25.93-14-8 (June 2017) : https://androidfilehost.com/?fid=889764386195918175
This build appears to be targeted towards India, Brazil, EU and UK users, other territories may apply. This updates to NPJS25.93-14-10 (Sept 2017):
https://drive.google.com/file/d/0B9tngVBGIajVQkQtLUUxR2NOTnc/edit
NPJS25.93-14-13 is the December 2017 update from NPJS25.93-14-10: https://androidfilehost.com/?fid=745849072291698845
As ____Mdd has mentioned, the blankflash is only useful if you hard brick your device, and even then that usually only happens if you go flashing older firmware than what's on your device and then take an OTA update. If you don't downgrade, then you won't have a use for the blankflash normally.
If you want to be sure you're getting the right updates, you can flash the NPJS25.93-14-8 stock ROM, which should leave your device on the same patch level (if it was previously on NPJS25.93-14-8 and you're certain about that), then let the OTA updates download the correct patch. As your device firmware should all be on the same patch level, OTA updates should be okay. Bear in mind you may not receive the December 2017 OTA yet, as I've only seen it deployed to India/Mexico so far. It should be coming to EU soon if it's not arrived.
____Mdd said:
You can take backup of all partitions by TWRP (fsg, data, system, boot, firmware, all options in shreps twrp), this all things can be helpful in case if something wrong happens, internal memory will be wiped so move them to external... Then flash....
Click to expand...
Click to collapse
Ok, I was busy this week but I'm back with just a couple more questions:
Which partitions should I back up with the Partition Backup app and with TWRP? What format should I choose for the Partition Backup app?
Can I lock the bootloader after flashing and booting the stock ROM or do I have to do it while flashing?
I have restored my TWRP backup for NPJS5.93-14-8 and rooted it for the backup app. Is there any other helpful information about my device that I should share with you?
What should I install on my PC? I currently have mfastboot-v2 on my C:\ drive in the adb folder, should I install the Minimal ADB and Fastboot as I have seen people using it for the stock ROM flash? Also, do I need to install any drivers in particular?
echo92 said:
2)In theory yes. However, if TWRP was allowed to make modifications before you took the backup, the subsequent OTA might fail as your system partition would be detected as not read-only. Furthermore, you'd need a stock logo.bin, so if you've flashed a logo.bin to hide the bootloader unlocked warning, you'd have to pull that from the NPJS25.93-14-8 stock ROM. TWRP to my knowledge does not back that up.
Click to expand...
Click to collapse
So If I use this guide and relock the bootloader would I be okay? https://forum.xda-developers.com/moto-g4-plus/how-to/guide-sucsessfull-ota-update-rooting-t3472658
Also, relocking wipes Data and Internal Storage, right?
corlatemanuel said:
Ok, I was busy this week but I'm back with just a couple more questions:
Which partitions should I back up with the Partition Backup app and with TWRP? What format should I choose for the Partition Backup app?
Can I lock the bootloader after flashing and booting the stock ROM or do I have to do it while flashing?
I have restored my TWRP backup for NPJS5.93-14-8 and rooted it for the backup app. Is there any other helpful information about my device that I should share with you?
What should I install on my PC? I currently have mfastboot-v2 on my C:\ drive in the adb folder, should I install the Minimal ADB and Fastboot as I have seen people using it for the stock ROM flash? Also, do I need to install any drivers in particular?
So If I use this guide and relock the bootloader would I be okay? https://forum.xda-developers.com/moto-g4-plus/how-to/guide-sucsessfull-ota-update-rooting-t3472658
Also, relocking wipes Data and Internal Storage, right?
Click to expand...
Click to collapse
1) If you want to make a backup, I would make a backup with the standard TWRP partitions selected (should be all of them but without cache). I've not used the Partition Backup app so cannot comment as to which formats to use, but standard formats for system and cache should be ext4, and data as f2fs.
2)Generally if you want to lock your bootloader, you should flash the stock ROM first, then boot to the stock ROM. In Settings > Developer Options, you will want to turn on OEM unlocking. Then, you can re-lock your bootloader with a full flash of all the commands. For more info and things to be aware of, have a look at this post: https://forum.xda-developers.com/showpost.php?p=74971791&postcount=497 Be aware that if you choose to lock your bootloader, you may not be able to use backups of data you made as TWRP and backup apps may require an unlocked bootloader. Anything you kept on internal storage should be transferable back to your device though.
Re-locking likely wipes data and internal storage, so ensure you back up and keep the back ups off your device - on your computer is the best location - until you are done. Also, be warned that any SD cards you have formatted and adopted as internal storage will be unreadable and need erasing, unless you retain the encryption key. So if you have an adopted SD card, back that up too.
3)I would install Minimal ADB and fastboot (v1.4.2 or newer) as most of the newer guides are based on fastboot rather than mfastboot (which is Motorola's version of fastboot, if I recall). You may wish to have the Motorola device drivers installed too - https://motorola-global-portal.custhelp.com/app/answers/prod_detail/a_id/79106/p/30,75,27,
4)That guide is quite old, plus only restores your device back to a state where OTA updates would be possible (i.e. flashing stock recovery, system, OEM). That guide you linked will not re-lock your bootloader. If you want the commands to re-lock your device bootloader, this guide should help: https://forum.xda-developers.com/moto-g4-plus/how-to/stock-rom-npjs25-93-14-4-march-1-t3608138 Again, heed the warnings I note in the above link.
echo92 said:
1) If you want to make a backup, I would make a backup with the standard TWRP partitions selected (should be all of them but without cache). I've not used the Partition Backup app so cannot comment as to which formats to use, but standard formats for system and cache should be ext4, and data as f2fs.
2)Generally if you want to lock your bootloader, you should flash the stock ROM first, then boot to the stock ROM. In Settings > Developer Options, you will want to turn on OEM unlocking. Then, you can re-lock your bootloader with a full flash of all the commands. For more info and things to be aware of, have a look at this post: https://forum.xda-developers.com/showpost.php?p=74971791&postcount=497 Be aware that if you choose to lock your bootloader, you may not be able to use backups of data you made as TWRP and backup apps may require an unlocked bootloader. Anything you kept on internal storage should be transferable back to your device though.
Re-locking likely wipes data and internal storage, so ensure you back up and keep the back ups off your device - on your computer is the best location - until you are done. Also, be warned that any SD cards you have formatted and adopted as internal storage will be unreadable and need erasing, unless you retain the encryption key. So if you have an adopted SD card, back that up too.
3)I would install Minimal ADB and fastboot (v1.4.2 or newer) as most of the newer guides are based on fastboot rather than mfastboot (which is Motorola's version of fastboot, if I recall). You may wish to have the Motorola device drivers installed too - https://motorola-global-portal.custhelp.com/app/answers/prod_detail/a_id/79106/p/30,75,27,
4)That guide is quite old, plus only restores your device back to a state where OTA updates would be possible (i.e. flashing stock recovery, system, OEM). That guide you linked will not re-lock your bootloader. If you want the commands to re-lock your device bootloader, this guide should help: https://forum.xda-developers.com/moto-g4-plus/how-to/stock-rom-npjs25-93-14-4-march-1-t3608138 Again, heed the warnings I note in the above link.
Click to expand...
Click to collapse
So shreps' twrp can also backup the modems? I am on the 64-bit twrp from lannister7 (too lazy to check his name ) and it doesn't show the modems in "Backup", it only shows firmware, fsg, hw and ol the other stuff. And also, I have to flash the firmware twice if I want to lock the bootloader? I can imagine some really bad situations if you flash it with the OEM lock command included, some sh*t happens, you get an error and the device gets bricked whilst also being locked, and not being able to unlock it because of the "OEM Unlocking" option not being accessible, since the device would be bricked. So if I understand correctly, the OEM lock begin and OEM lock commands fully wipe the device, even the system, causing the need to flash everything again? Or the OEM lock commands require you to flash the stock ROM again because of safety issues?
corlatemanuel said:
So shreps' twrp can also backup the modems? I am on the 64-bit twrp from lannister7 (too lazy to check his name ) and it doesn't show the modems in "Backup", it only shows firmware, fsg, hw and ol the other stuff. And also, I have to flash the firmware twice if I want to lock the bootloader? I can imagine some really bad situations if you flash it with the OEM lock command included, some sh*t happens, you get an error and the device gets bricked whilst also being locked, and not being able to unlock it because of the "OEM Unlocking" option not being accessible, since the device would be bricked. So if I understand correctly, the OEM lock begin and OEM lock commands fully wipe the device, even the system, causing the need to flash everything again? Or the OEM lock commands require you to flash the stock ROM again because of safety issues?
Click to expand...
Click to collapse
Don't think shrep's TWRP backs up the modem, only the FSG partition (which appears to be half of the modem/baseband function). Modems are provided in the stock firmware anyhow.
Yes, you have to flash the firmware first (without OEM locking commands), then enable OEM unlocking in Settings>Developer Options, as I mentioned in the other post I wrote. Else, you may not be able to re-lock your bootloader. With OEM unlocking enabled, if a flash failed, you may still be able to unlock your bootloader and flash a custom ROM. Hence, this way gives you a way out, as you have OEM unlocking enabled, hence I recommending that you flash twice. After enabling OEM unlocking, then you flash fully with the OEM locking commands included.
Again, this is why I always say have plenty of time and do not rush this process, as this is critical to your device properly functioning, and to read up as much as you can on the pros and cons of the process.
The two OEM lock begin commands at the beginning of the locking command list will erase your device. Entering the first of those commands will prompt you and alert you to the fact your device is going to be erased. It only erases your data and likely your internal storage/cache, it should not erase any other partitions as they are usually not user modifiable.
If you are certain that your device is fully stock and at the same patch level, then you can use the OEM lock begin commands and OEM lock commands to lock your bootloader. However, if any of your device firmwares is not on the same patch level as your bootloader, you will likely have a boot failure as the firmware fails the bootloader verification checks (as the bootloader expects only firmware of the same patch level). Hence, I strongly recommend to re-flash the firmware to ensure you have clean stock firmware with matching patch levels.
Again, this process of re-locking your bootloader will mean no TWRP (no backups) or root or Titanium Backup.
echo92 said:
Don't think shrep's TWRP backs up the modem, only the FSG partition (which appears to be half of the modem/baseband function). Modems are provided in the stock firmware anyhow.
Yes, you have to flash the firmware first (without OEM locking commands), then enable OEM unlocking in Settings>Developer Options, as I mentioned in the other post I wrote. Else, you may not be able to re-lock your bootloader. With OEM unlocking enabled, if a flash failed, you may still be able to unlock your bootloader and flash a custom ROM. Hence, this way gives you a way out, as you have OEM unlocking enabled, hence I recommending that you flash twice. After enabling OEM unlocking, then you flash fully with the OEM locking commands included.
Again, this is why I always say have plenty of time and do not rush this process, as this is critical to your device properly functioning, and to read up as much as you can on the pros and cons of the process.
The two OEM lock begin commands at the beginning of the locking command list will erase your device. Entering the first of those commands will prompt you and alert you to the fact your device is going to be erased. It only erases your data and likely your internal storage/cache, it should not erase any other partitions as they are usually not user modifiable.
If you are certain that your device is fully stock and at the same patch level, then you can use the OEM lock begin commands and OEM lock commands to lock your bootloader. However, if any of your device firmwares is not on the same patch level as your bootloader, you will likely have a boot failure as the firmware fails the bootloader verification checks (as the bootloader expects only firmware of the same patch level). Hence, I strongly recommend to re-flash the firmware to ensure you have clean stock firmware with matching patch levels.
Again, this process of re-locking your bootloader will mean no TWRP (no backups) or root or Titanium Backup.
Click to expand...
Click to collapse
Well how can I backup the modem, modemst1 and modemst2 partitions then? that app that I mentioned doesn't work, It doesn't backup anything, and the shreps TWRP doesn't include modem backup. Need help ASAP, everything else is ready except for the backup.
P.S. I'm really tired of my G4 Plus having the icon of a keyboard in This PC )
Edit: I'm dumb, just realised that the FSG IS the modemst1 and modemst2, right?
corlatemanuel said:
Well how can I backup the modem, modemst1 and modemst2 partitions then? that app that I mentioned doesn't work, It doesn't backup anything, and the shreps TWRP doesn't include modem backup. Need help ASAP, everything else is ready except for the backup.
P.S. I'm really tired of my G4 Plus having the icon of a keyboard in This PC )
Edit: I'm dumb, just realised that the FSG IS the modemst1 and modemst2, right?
Click to expand...
Click to collapse
Let me clarify my recent post of backup of modem,
All issue i have seen related to corrupted modems and HW partition are happened when one tried to flash older firmwares, those are marshmallow firmwares..
Till then, i have never seen any modem or corrupted hw partition while flashing latest firmwares..
Just make sure your downloaded firmware is latest or same as you have right now..
corlatemanuel said:
Well how can I backup the modem, modemst1 and modemst2 partitions then? that app that I mentioned doesn't work, It doesn't backup anything, and the shreps TWRP doesn't include modem backup. Need help ASAP, everything else is ready except for the backup.
P.S. I'm really tired of my G4 Plus having the icon of a keyboard in This PC )
Edit: I'm dumb, just realised that the FSG IS the modemst1 and modemst2, right?
Click to expand...
Click to collapse
As ____Mdd has mentioned, backups of modem is only required if you've flashed the wrong firmware at some point (due to the different variants of stock firmware). You've given us no indication of that.
modemst1 and modemst2 are, as I understand it, caches and temporary storage of details that are normally wiped during a stock ROM flash, and are then re-filled when the device reboots. FSG is different to modemst1 and modemst2 I think, being one part of the modem/baseband firmware.
As we've both mentioned, modem and FSG are both provided by the stock ROM (as NON-HLOS.bin and fsg.mbn).
I have made it! I've flashed the stock rom without any problem or error!
I want to thank you all because I wouldn't have been able to flash this without your help! I have also locked the bootloader, then I updated to September update and, shortly afterwards, to December update. Now, if I will ever flash custom ROMs again (which has a high probability) I will know how to restore to the stock ROM. So thanks, and I will leave the thread open if anyone will have the need of assistance with this process, or maybe I will have other questions in the future! So, for the third time, thanks for your valuable help guys!

TWRP Gone after a Reboot

Whenever I flash twrp in, it's gone after a reboot and again returns to the stock recovery
I'm using fastboot method (fastboot flash recovery recovery.img) Please help me out of this prob.
Assuming that you have not flashed any other rom, and are on pure stock, then it is because dm-verity is restoring the stock recovery. That's how it works.
Were you intending to install custom roms / kernels or root your phone? If so, these will disable dm-verity, but at the expense of not being able to take OTAs and automatically upgrade stock. What is your intention with unlocking the bootloader?
Edit: Whilst you have your bootloader unlocked, you may as well back up your efs and persist partitions before doing anything else. There's a million reasons why in the forums (people losing IMEI, etc).
what is the solution of this prob cz i don't use stock rom anymore im always using custom roms & kernel. and actually i even don't knw what is dm verity
dm-verity (a.k.a verified boot) checks certain places to make sure they haven't been tampered with. So if it detects a recovery image it doesn't expect, it restores the original. That's what you're seeing.
Try flashing magisk, as it disables dm-verity. If that doesn't work and you're on custom roms and kernels then maybe ask in those threads to see if people face that issue.

Bootloader updates for Android 6+ on an S5 Dev Edition: needed, or not?

Hi there,
I have a rooted Verizon S5 Developer Edition (CID 15, if it matters) running Android 4.4.4 (NK2, bootloader NCG). I am trying to get this phone up-to-date, with root, on at least the newest VZW stock Android release for now, and probably LineageOS in the future.
I’ve been spending hours searching through the forums trying to understand what is the deal with the bootloader requirements for these newer Android versions, and I’m stumped. In this QL1 thread it’s said that the bootloader doesn’t ever need to be changed to install a newer OS version, and LineageOS doesn’t mention anything about needing to do bootloader updates in its installation instructions. However, the ROMs from jrkruse with full installation instructions, like their QA1 ROM, clearly state that the bootloader “MUST BE ON PD1+”.
Can someone please clarify this apparent contradiction for me, so I know the correct way to proceed? I’ve tried reading through the hundreds of pages of comments on those threads as well as the bootloader unlocking thread, and there’s so much noise that I’ve been unable to find the answer, if it already exists.
Also, I know this is kind of an academic point, but if it’s true that the bootloader does need updating, is there a way to get an updated bootloader without changing the phone’s CID, since it is already an unlocked Dev Edition phone? (Search results are absolutely overwhelmed with people talking about “make your S5 a Dev Edition S5” so I have been unable to find any information about the actual Dev Edition phones.) The SamsungCID code seems to append a hard-coded blob of data onto the end of any bootloader; is this really all that needs to be done? The extra data at the end of my original NCG bootloader is 668 bytes, not 256 bytes, so it’s not obvious to me if it really is enough to just copy it straight over.
Thank you!
1CDT said:
Hi there, I have a rooted Verizon S5 Developer Edition (CID 15, if it matters) running Android 4.4.4 (NK2, bootloader NCG)..........
Click to expand...
Click to collapse
Since you've got a G900V device, with a CID15, you are able to unlock the bootloader. The following threads OP provides the instructions for unlocking the bootloader.
https://forum.xda-developers.com/showthread.php?t=3561529
From there you will be able to install TWRP Recovery and thus install a Custom Firmware like LineageOS.
Regarding the updates, the G900V is the only GS5 variant that doesn't require the Bootloader to be updated. Regarding the Firmware Baseband Modem Updates, the following thread provides them all that you can flash via Odin.
https://forum.xda-developers.com/showthread.php?t=3926673
Good Luck!
~~~~~~~~~~~~~~~
Unless asked to do so, PLEASE don't PM me regarding support. Sent using The ClaRetoX2 Forum App on my Sanyo Juno device.
Hi Ibuprophen,
Thank you for your help!
Ibuprophen said:
Since you've got a G900V device, with a CID15, you are able to unlock the bootloader. The following threads OP provides the instructions for unlocking the bootloader. […]
Click to expand...
Click to collapse
The phone already has a TWRP recovery installed, and is a Dev Edition phone so the bootloader is factory unlocked. As such, my understanding is that those unlocking instructions don’t apply unless I need a newer bootloader. Is this correct?
Ibuprophen said:
Regarding the updates, the G900V is the only GS5 variant that doesn't require the Bootloader to be updated. […]
Click to expand...
Click to collapse
It’s interesting to hear that the G900V is the only variant which doesn’t require the bootloader to be updated along with the system and baseband software, since the other threads I linked with the bootloader requirement are also G900V-specific. Do you know it’s not the case because you’ve personally used an Android 6+ ROM with a pre-PD1 bootloader? I know I could just flash the new ROM to Try It And See, but I’m hoping to avoid wasting time and energy on something that other experienced people know won’t work.
Thanks again!
1CDT said:
Hi Ibuprophen, Thank you for your help! The phone already has a TWRP recovery installed, and is a Dev Edition phone so the bootloader is factory unlocked..........
Click to expand...
Click to collapse
I only stated that the Bootloader doesn't have to be updated for the G900V device.
The Baseband Modem Firmware does require updates (as their released).
Though, it's not harmful to this device to flash the Bootloader, it won't do anything different and you'll actually end up locking the bootloader again and have to go through the process of unlocking it.
The Verizon variant just passes on the same Bootloader image from one Firmware to the next one. This is just a Verizon thing and they don't make sense for allot of what they do.
If you want to update the Bootloader, that's, of course, up to you...
~~~~~~~~~~~~~~~
Unless asked to do so, PLEASE don't PM me regarding support. Sent using The ClaRetoX2 Forum App on my Sanyo Juno device.
So I will keep working on this, but I can’t currently verify that the bootloader doesn’t need to be updated on SM-G900V, based on the work I did today. So far I can only verify that LineageOS will boot and work with an NCG bootloader, except for some bug where it destroys data in the EFS partition which I suppose is not actually bootloader-related
First, after backing everything up in TWRP, I started with the baseband modem and firmware updates to QL1. The steps for this were:
1. Boot into download mode (vol dn + home + power)
2. Run heimdall flash --RECOVERY recovery.img --BOOT boot.img --no-reboot using the files from the stock QL1 image (any of them will do)
3. Hold power button to turn off phone
4. Pull battery
5. Boot into download mode
6. Verify that “Current Binary” is ”Samsung Official”
7. Run heimdall flash --MODEM modem.bin --APNHLOS NON-HLOS.bin --RPM rpm.mbn --SBL1 sbl1.mbn --DBI sdi.mbn --TZ tz.mbn using the files from the stock QL1 image (or from the baseband firmware thread, they are the same)
8. Hold power button to turn off phone
9. Pull battery
10. Boot phone back into download mode
11. Run heimdall flash --RECOVERY twrp.img to reinstall TWRP
12. Hold power button to turn off phone
13. Boot into recovery (vol up + home + power) to verify the flash and to ensure it doesn’t get erased
14. Reboot to system
This caused every application to crash on boot in the already-installed NK2 system ROM. I don’t know if I did something wrong, or if they are just incompatible; I did wipe cache and dalvik cache from TWRP, but that didn’t make things work. (I had the same problem when I had to roll back everything later; more on that in a bit.)
Since everything suddenly was broken, I assumed that the baseband update must have been successful (I later verified in LineageOS that it was indeed successful), so I followed the LineageOS instructions to sideload LineageOS and Open GApps from TWRP. This was successful and the OS installed and booted to the setup wizard.
The first problem I encountered at this point was that the mobile network wasn’t connecting during the setup wizard. I skipped this step of the wizard and continued on to configuring the OS settings. Eventually the mobile network connected while I was doing that.
When I started installing apps, I noticed that it took a very long time to receive SMS from the network. Upon investigation I discovered that LineageOS was using legacy CDMA for voice and SMS. I did research and discovered that LineageOS does not, and apparently never will, support VoLTE on klte. Since this is a non-starter for me (Verizon will be LTE-only by the end of next year, so I have no idea how LineageOS klte will exist at that point) I opted to wipe and load stock QL1.
While preparing to load stock QL1, I restarted the phone accidentally, and noticed that I’d permanently lost mobile network connectivity. I tried restoring my EFS backup from TWRP; this didn’t seem to fix the problem. I was going to install stock QL1 system anyway due to the VoLTE problem so I didn’t think about it any more.
At this point I followed these steps to flash stock QL1:
1. Boot to download mode
2. Run heimdall --BOOT boot.img --SYSTEM system.img --no-reboot using files from the stock QL1 image
3. Turn off phone
4. Reboot to recovery
5. Wipe data, cache, dalvik cache
6. Reboot to system
After 15 minutes at the Verizon logo while the dalvik cache was built, the setup wizard started and mobile network connection was working and I was able to complete initial setup for stock QL1. However, the system was not OK:
1. Wifi would not enable
2. The back and menu buttons did not work
3. When the phone locked, after a while, the notification LED turned red and the phone wouldn’t respond to any button presses (I had to pull the battery; this happened multiple times)
At this point I needed a working phone, so I found an NK2 stock image (this was difficult because all the links on xda-developers are dead and sammobile wants money for these old versions, so someone might want to reupload these!) and ran these steps to roll back:
1. The same steps above for installing the baseband modem and firmware, except using NK2 images and firmware
2. Boot to recovery
3. Wipe data, cache, dalvik cache
4. Restore NK2 TWRP backups of System, Boot, Data, EFS
5. Reboot to system
Instead of being fully restored, every app was crashing on boot again, like when I had updated the QL1 firmware and rebooted into the old NK2 system. I was finally able to get my full backup restored successfully by following these extra steps:
1. Boot to TWRP
2. Wipe Data
3. Reboot to system, until the setup wizard starts
4. Turn off the phone without running the wizard
5. Boot to TWRP
6. Restore Data
7. Reboot to system, everything is OK now
The hard buttons and wifi problem are noted by @jrkruse on the unlocking the bootloader thread. I had to get my phone back in a working state for tomorrow so I didn’t try the instructions to reflash the PD1 boot+recovery+firmware. I’m not actually sure if it’s correct today to reflash PD1 firmware instead of QL1 firmware; clarity here would be helpful. If anyone also sees a clear mistake in the steps I outlined above, I would be grateful to know that.
If I can’t get stock QL1 to not be broken, and it’s due to the bootloader requirement, then I guess I am stuck unless I start messing with the bootloader (given the “We still are unsure if changing the CID causes app store, verification, activation, provision, or other issues, everything you do is at your own risk!” warning, this means me trying to transplant my dev signature onto the EMMC 15 bootloaders even though my signature is a different size). I’m pretty terrified of doing that since there’s conflicting information about whether it’s possible to flash an old bootloader once you’ve upgraded past certain versions, and I haven’t learned yet how bricked the phone becomes if a bad bootloader is flashed. I know it’s not possible to flash old bootloaders on a retail device; is that true on Dev Edition devices too?
Thanks again for your help! I wish I had more positive news.
1CDT said:
Hi there,
I have a rooted Verizon S5 Developer Edition (CID 15, if it matters) running Android 4.4.4 (NK2, bootloader NCG). I am trying to get this phone up-to-date, with root, on at least the newest VZW stock Android release for now, and probably LineageOS in the future.
I’ve been spending hours searching through the forums trying to understand what is the deal with the bootloader requirements for these newer Android versions, and I’m stumped. In this QL1 thread it’s said that the bootloader doesn’t ever need to be changed to install a newer OS version, and LineageOS doesn’t mention anything about needing to do bootloader updates in its installation instructions. However, the ROMs from jrkruse with full installation instructions, like their QA1 ROM, clearly state that the bootloader “MUST BE ON PD1+”.
Can someone please clarify this apparent contradiction for me, so I know the correct way to proceed? I’ve tried reading through the hundreds of pages of comments on those threads as well as the bootloader unlocking thread, and there’s so much noise that I’ve been unable to find the answer, if it already exists.
Also, I know this is kind of an academic point, but if it’s true that the bootloader does need updating, is there a way to get an updated bootloader without changing the phone’s CID, since it is already an unlocked Dev Edition phone? (Search results are absolutely overwhelmed with people talking about “make your S5 a Dev Edition S5” so I have been unable to find any information about the actual Dev Edition phones.) The SamsungCID code seems to append a hard-coded blob of data onto the end of any bootloader; is this really all that needs to be done? The extra data at the end of my original NCG bootloader is 668 bytes, not 256 bytes, so it’s not obvious to me if it really is enough to just copy it straight over.
Thank you!
Click to expand...
Click to collapse
Hi, I'm the guy who did the bootloader unlock. It's kind of a complicated situation, upgrading bootloaders after having an unlocked retail bootloader. The issue is that once you have a dev device (CID + matching RSA signature, the extra 256 bytes), the bootloader write-protects the eMMC where aboot lives. Normally, if we wanted to upgrade the bootloader and maintain our unlocked bootloader, we'd grab the new bootloader, append our dev blob/signature, and just flash to the aboot partition.
The only way to get the newest bootloader is to flash the latest stock ROM (which locks your bootloader), and then unlock it again by rooting and appending the dev blob. I'm not sure if the latest ROMs can be rooted or not since I don't play with my S5 very often. You don't have to change the CID ever again. If you have a real dev device (you purchased it from Samsung as unlocked, not using our exploit), you will want to back up your device signature by just making a copy of the aboot partition. If this is the case for you, you can feel free to send me your aboot partition, and I'll carve out the signature that you need.
It's more so a limitation of the bootloader trying to prevent people from accidentally re-locking the bootloader. When Samsung signs the real dev device bootloaders, the dev blob/sig is apart of the code being signed, which means we can flash that in Odin while retaining your unlocked bootloader. We don't want to use an ancient bootloader, so this isn't useful. You can PM me if you want and I can walk you through the process, but it's pretty complicated so I feel better not posting the whole process and having people possibly brick their devices.
TL;DR
Just send me a PM and I'll walk you through everything. Don't flash or change anything if you have Developer Edition device that you purchased directly from Samsung. We want to preserve your device-unique "key".

Categories

Resources