Install original firmware

Search This thread

skoczo

Member
Dec 30, 2013
20
0
Hi. I had lineage os installed on my phone. Now i want to restore it to original. I can flash original firmware from there https://developers.google.com/android/images#occam without any error. The problem is during boot. It boot endless. I wait couple hours without any effect. I installed twrp and check partitions but it looks ok

Bash:
~ # ./parted /dev/block/mmcblk0 p
Model: MMC 016G92 (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name      Flags
1      524kB   67.6MB  67.1MB  fat16        modem
2      67.6MB  68.2MB  524kB                sbl1
3      68.2MB  68.7MB  524kB                sbl2
4      68.7MB  70.8MB  2097kB               sbl3
5      70.8MB  71.3MB  524kB                tz
6      71.3MB  94.4MB  23.1MB               boot
7      94.4MB  117MB   23.1MB               recovery
8      117MB   118MB   799kB                m9kefs1
9      118MB   119MB   799kB                m9kefs2
10      119MB   120MB   799kB                m9kefs3
11      120MB   121MB   524kB                rpm
12      121MB   121MB   524kB                aboot
13      121MB   122MB   524kB                sbl2b
14      122MB   124MB   2097kB               sbl3b
15      124MB   124MB   524kB                abootb
16      124MB   125MB   524kB                rpmb
17      125MB   125MB   524kB                tzb
18      125MB   126MB   524kB                metadata
19      126MB   143MB   16.8MB               misc
20      143MB   159MB   16.8MB  ext4         persist
21      159MB   1040MB  881MB   ext4         system
22      1040MB  1627MB  587MB   ext4         cache
23      1627MB  7817MB  6190MB  ext4         userdata
24      7817MB  7818MB  524kB                DDR
25      7818MB  7818MB  507kB                grow


Do you have any idea what is wrong?
 

Tulsadiver

Recognized Contributor
Jul 11, 2013
8,186
5,779
Hi. I had lineage os installed on my phone. Now i want to restore it to original. I can flash original firmware from there https://developers.google.com/android/images#occam without any error. The problem is during boot. It boot endless. I wait couple hours without any effect. I installed twrp and check partitions but it looks ok

Bash:
~ # ./parted /dev/block/mmcblk0 p
Model: MMC 016G92 (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name      Flags
1      524kB   67.6MB  67.1MB  fat16        modem
2      67.6MB  68.2MB  524kB                sbl1
3      68.2MB  68.7MB  524kB                sbl2
4      68.7MB  70.8MB  2097kB               sbl3
5      70.8MB  71.3MB  524kB                tz
6      71.3MB  94.4MB  23.1MB               boot
7      94.4MB  117MB   23.1MB               recovery
8      117MB   118MB   799kB                m9kefs1
9      118MB   119MB   799kB                m9kefs2
10      119MB   120MB   799kB                m9kefs3
11      120MB   121MB   524kB                rpm
12      121MB   121MB   524kB                aboot
13      121MB   122MB   524kB                sbl2b
14      122MB   124MB   2097kB               sbl3b
15      124MB   124MB   524kB                abootb
16      124MB   125MB   524kB                rpmb
17      125MB   125MB   524kB                tzb
18      125MB   126MB   524kB                metadata
19      126MB   143MB   16.8MB               misc
20      143MB   159MB   16.8MB  ext4         persist
21      159MB   1040MB  881MB   ext4         system
22      1040MB  1627MB  587MB   ext4         cache
23      1627MB  7817MB  6190MB  ext4         userdata
24      7817MB  7818MB  524kB                DDR
25      7818MB  7818MB  507kB                grow


Do you have any idea what is wrong?
If your stock firmware installed correctly you shouldn't have root any longer. How did you install TWRP? How did you install your firmware? flash-all.bat?
 

skoczo

Member
Dec 30, 2013
20
0
If your stock firmware installed correctly you shouldn't have root any longer. How did you install TWRP? How did you install your firmware? flash-all.bat?
So when i figure out that stock rom don't want to boot i installed twrp from command line by
Code:
sudo fastboot flash recovery twrp-3.5.0_9-0-mako.img
to check partitions.

I installed stock rom by executing
Code:
sudo ./flash-all.sh
 

skoczo

Member
Dec 30, 2013
20
0
I see that i have 16G version but from partitions it looks like 8G version. Can it be a problem? How to restore partitions to original?
 

Tulsadiver

Recognized Contributor
Jul 11, 2013
8,186
5,779
Your firmware should take care of everything. Did you edit the flash-all.sh? Take off the -w?
I've never used sudo before when flashing mine.
 

skoczo

Member
Dec 30, 2013
20
0
Your firmware should take care of everything. Did you edit the flash-all.sh? Take off the -w?
I've never used sudo before when flashing mine.
No i didn't edit files from google. Sudo is needed for fastboot execution on my system(manjaro). Then this command is run with higher privileges.
 

Tulsadiver

Recognized Contributor
Jul 11, 2013
8,186
5,779
No i didn't edit files from google. Sudo is needed for fastboot execution on my system(manjaro). Then this command is run with higher privileges.
Have you tried a factory reset from within TWRP?
It's been a while since I've had a working TWRP.
 

skoczo

Member
Dec 30, 2013
20
0
Have you tried a factory reset from within TWRP?
It's been a while since I've had a working TWRP.
Have you tried a factory reset from within TWRP?
It's been a while since I've had a working TWRP.
I have some progress. I run stock firmware but with some additional steps. This is what i did:
- install stock rom
- install clockwork or twrp
- boot to clockwork
- start `adb shell`
- execute `mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p23` in shell

But if i flash it again i need to do this procedure again. I don't understand why. I can't also do factory reset in twrp because it shows that can't mount some partitions.
IMG_20210304_203714.jpg
I can do factory reset after calling `mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p23` in adb shell
 

skoczo

Member
Dec 30, 2013
20
0
I started stock android and did some configuration. It looks that system is working. Now as a test i flash stock firmware again and i have boot loop again. Probably i need do the procedure one again. Do you have any idea why? And how to fix this? i see that cache also can't be mounted after flash stock rom so i did `mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p22` and now it can be mounted. But why i need to do this? Why stock rom is not working? And this happen each time when i flash stock rom.

There is also such thing that if i don't execute `mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p2` after flashing lineage os is showing screen that device is encrypted. Then i need to login do adb shell and execute mke2fs. This is wired that i need to do this every time when i flash device.
 
Last edited:

Akhilesh S V

Senior Member
I see that i have 16G version but from partitions it looks like 8G version. Can it be a problem? How to restore partitions to original?

You can find the Solution here:
 

skoczo

Member
Dec 30, 2013
20
0
You can find the Solution here:
I solve my problem by following this instruction https://forums.androidcentral.com/n...3923-guide-nexus-4-factory-image-restore.html

I think that key was those commands:
- fastboot erase boot
- fastboot erase cache
- fastboot erase recovery
- fastboot erase system
- fastboot erase userdata
- fastboot oem lock
- fastboot oem unlock