2

I'm sure this question has been asked before, but I'm unable to find a good answer that I can understand, so bear with me:

I've recently installed TWRP & LineageOS 15 on my Moto G5 (cedric), although I'm sure I messed the process up a bit, because I had almost-bricked my phone in the meantime and don't really understand how I solved it either. Now everything is working again, except for the fact that when I (re)start my phone, it automatically boots into TWRP instead of LineageOS. The way I boot into LineageOS anyway, is to tell TWRP to reboot into the bootloader (or go to the bootloader directly with the volume key trick), and then from the bootloader I use 'start'.

A possible solution that I've found on the internet involved changing / erasing the misc partition, as it would be responsible for directing a boot to either TWRP or LineageOS. However, other google results tell me that erasing misc could gravely upset your phone.

The main question is: Is it correct that zero-ing the misc partition is a solution to this boot issue, as the possible solution states? Or is it misleading and the boot issue is probably something else entirely?

Here's the hexdump of the current contents of my misc partition (the result of first copying it to my computer with dd if=/dev/block/bootdevice/by-name/misc of=/storage/FE84-1705/misc.img and adb pull ..., and then running hexdump -C misc.img):

hexdump -C misc.img 
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000800  62 6f 6f 74 2d 72 65 63  6f 76 65 72 79 00 00 00  |boot-recovery...|
00000810  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000840  72 65 63 6f 76 65 72 79  0a 2d 2d 77 69 70 65 5f  |recovery.--wipe_|
00000850  64 61 74 61 0a 2d 2d 72  65 61 73 6f 6e 3d 77 69  |data.--reason=wi|
00000860  70 65 5f 64 61 74 61 5f  76 69 61 5f 72 65 63 6f  |pe_data_via_reco|
00000870  76 65 72 79 0a 00 00 00  00 00 00 00 00 00 00 00  |very............|
00000880  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001500  71 65 20 30 2f 30 00 00  00 00 00 00 00 00 00 00  |qe 0/0..........|
00001510  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00001520  31 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |1...............|
00001530  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00100000

And this is the result of running fdisk -l misc.img:

Disk misc.img: 1 MiB, 1048576 bytes, 2048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Furthermore, I've installed TWRP 3.2.1-0-cedric and LineageOS 15.0-20171125_073252-UNOFFICIAL-cedric.

0

2 Answers 2

2

Some comments for those who need (save your time to google):

What is the misc partition?

MISC - also FOTA on older devices
It's a tiny partition used by recovery to communicate with bootloader store away some information about what it's doing in case the device is restarted while the OTA package is being applied. It is a boot mode selector used to pass data among various stages of the boot chain (boot into recovery mode, fastboot etc.). e.g. if it is empty (all zero), system boots normally. If it contains recovery mode selector, system boots into recovery mode. It may also carry some necessarily required information in the form of switches to control hardware or settings related tasks such as CID (Carrier or Region ID) information and USB configurations etc.

Source: [INFO] ANDROID DEVICE PARTITIONS and FILESYSTEMS | XDA Developers Forums

Locating misc/fota folder

From TWRP terminal (or via adb shell):

ls -d $(find /dev/block -name by-name)/*

Windows equivalent of hexdump

Windows doesn't provide an equivalent command for hexdump. However, in PowerShell 5.0+, there is one with format-hex. Still, in my opinion hexdump is better.

Don't forget to backup

To create backup:

adb pull /dev/block/platform/soc/7824900.sdhci/by-name/fota fota.img

To restore backup:

adb push fota.img /dev/block/platform/soc/7824900.sdhci/by-name/fota

In my case it didn't work, so I restore it because only the OEM knows what it means

0
1

I went ahead and changed it anyway, and the answer is YES.

The qe 0/0 part has something to do with Motorola's way of assessing whether the phone is and/or has been rooted, and the last 1 I don't understand. I went ahead and used hexedit to remove only the boot-recovery and recovery.--wipe_data.--reason=wipe_data_via_recovery parts, then transferred and wrote the new image back to the misc partition; and now the phone starts up to LineageOS automatically.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .