I booted TWRP recovery onto kindle fire 2 - Kindle Fire 2 Android Development

hey guys! Using a factory cable I got into fastboot. Once in fastboot I downloaded TWRP image for the kindle fire 1 http://techerrata.com/file/twrp2/blaze/openrecovery-twrp-2.3.3.1-blaze.img then I typed
Code:
fastboot -i 0x1949 boot Downloads/openrecovery-twrp-2.3.3.1-blaze.img
but after doing that it just booted back into fastboot so then I did the same thing but right after the image got downloaded onto the device, I entered the command again and it booted right into TWRP. It takes a few tries but it works. Touch points all work but I am not sure about anything else. Hope this helps with further development.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
https://www.youtube.com/watch?v=5dL_QxFVRtc

I like the sound of this. I was looking around for the partition tables of the two devices, and they are a bit different.
KF:
I'm not sure how accurate this is...
KF2:1 131kB 262kB 131kB xloader
2 262kB 524kB 262kB bootloader
3 524kB 11.0MB 10.5MB dkernel
4 11.0MB 78.1MB 67.1MB ext4 dfs
5 78.1MB 78.2MB 65.5kB idme
6 78.2MB 78.2MB 16.4kB crypto
7 78.2MB 78.2MB 2048B misc
8 78.2MB 95.0MB 16.8MB ext4 efs
9 95.0MB 103MB 8389kB recovery
10 103MB 112MB 8389kB boot
11 112MB 1041MB 929MB ext4 system
12 1041MB 1722MB 682MB ext4 cache
13 1722MB 7818MB 6096MB ext4 userdata
How could we modify twrp to include these values instead?

fmkilo said:
I like the sound of this. I was looking around for the partition tables of the two devices, and they are a bit different.
KF:
I'm not sure how accurate this is...
KF2:1 131kB 262kB 131kB xloader
2 262kB 524kB 262kB bootloader
3 524kB 11.0MB 10.5MB dkernel
4 11.0MB 78.1MB 67.1MB ext4 dfs
5 78.1MB 78.2MB 65.5kB idme
6 78.2MB 78.2MB 16.4kB crypto
7 78.2MB 78.2MB 2048B misc
8 78.2MB 95.0MB 16.8MB ext4 efs
9 95.0MB 103MB 8389kB recovery
10 103MB 112MB 8389kB boot
11 112MB 1041MB 929MB ext4 system
12 1041MB 1722MB 682MB ext4 cache
13 1722MB 7818MB 6096MB ext4 userdata
How could we modify twrp to include these values instead?
Click to expand...
Click to collapse
We might have to build from source(https://github.com/TeamWin/device_amazon_blaze). How does the partitions compair to the kf hd? Because someone made cwm for hd.
Sent from my KFOT using xda app-developers app

powerpoint45 said:
We might have to build from source(https://github.com/TeamWin/device_amazon_blaze). How does the partitions compair to the kf hd? Because someone made cwm for hd.
Sent from my KFOT using xda app-developers app
Click to expand...
Click to collapse
I'm really no good when it comes to this, I'm not a dev... but I pay attention enough to know a little bit about what's going on. I think the partitions are very similar to the hd.
HD:
Code:
# parted /dev/block/mmcblk0 print
Error: Can't have overlapping partitions.
Model: MMC MAG2GA (sd/mmc)
Disk /dev/block/mmcblk0: 15.6GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 131kB 262kB 131kB xloader
2 262kB 524kB 262kB bootloader
3 524kB 590kB 65.5kB idme
4 590kB 606kB 16.4kB crypto
5 606kB 608kB 2048B misc
6 1049kB 11.5MB 10.5MB dkernel
7 11.5MB 213MB 201MB ext4 dfs
8 213MB 230MB 16.8MB ext4 efs
9 230MB 238MB 8389kB recovery
10 238MB 246MB 8389kB boot
11 246MB 1175MB 929MB ext4 system
12 1175MB 1857MB 682MB ext4 cache
13 1857MB 15.6GB 13.8GB ext4 userdata
KF2:
Code:
parted /dev/block/mmcblk0 print
Error: Can't have overlapping partitions.
Model: MMC M8G2FB (sd/mmc)
Disk /dev/block/mmcblk0: 7818MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 131kB 262kB 131kB xloader
2 262kB 524kB 262kB bootloader
3 524kB 11.0MB 10.5MB dkernel
4 11.0MB 78.1MB 67.1MB ext4 dfs
5 78.1MB 78.2MB 65.5kB idme
6 78.2MB 78.2MB 16.4kB crypto
7 78.2MB 78.2MB 2048B misc
8 78.2MB 95.0MB 16.8MB ext4 efs
9 95.0MB 103MB 8389kB recovery
10 103MB 112MB 8389kB boot
11 112MB 1041MB 929MB ext4 system
12 1041MB 1722MB 682MB ext4 cache
13 1722MB 7818MB 6096MB ext4 userdata
Is that switch on your cable to select whether or not you want fastboot? cause that's an interesting idea. I'm assuming you made that yourself.
also how would I build from that? I'm interested to learn, and have many resources... If I learn how to do this all now, I could be a pretty good dev.. I just don't know how.

fmkilo said:
I'm really no good when it comes to this, I'm not a dev... but I pay attention enough to know a little bit about what's going on. I think the partitions are very similar to the hd.
HD:
Code:
# parted /dev/block/mmcblk0 print
Error: Can't have overlapping partitions.
Model: MMC MAG2GA (sd/mmc)
Disk /dev/block/mmcblk0: 15.6GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 131kB 262kB 131kB xloader
2 262kB 524kB 262kB bootloader
3 524kB 590kB 65.5kB idme
4 590kB 606kB 16.4kB crypto
5 606kB 608kB 2048B misc
6 1049kB 11.5MB 10.5MB dkernel
7 11.5MB 213MB 201MB ext4 dfs
8 213MB 230MB 16.8MB ext4 efs
9 230MB 238MB 8389kB recovery
10 238MB 246MB 8389kB boot
11 246MB 1175MB 929MB ext4 system
12 1175MB 1857MB 682MB ext4 cache
13 1857MB 15.6GB 13.8GB ext4 userdata
KF2:
Code:
parted /dev/block/mmcblk0 print
Error: Can't have overlapping partitions.
Model: MMC M8G2FB (sd/mmc)
Disk /dev/block/mmcblk0: 7818MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 131kB 262kB 131kB xloader
2 262kB 524kB 262kB bootloader
3 524kB 11.0MB 10.5MB dkernel
4 11.0MB 78.1MB 67.1MB ext4 dfs
5 78.1MB 78.2MB 65.5kB idme
6 78.2MB 78.2MB 16.4kB crypto
7 78.2MB 78.2MB 2048B misc
8 78.2MB 95.0MB 16.8MB ext4 efs
9 95.0MB 103MB 8389kB recovery
10 103MB 112MB 8389kB boot
11 112MB 1041MB 929MB ext4 system
12 1041MB 1722MB 682MB ext4 cache
13 1722MB 7818MB 6096MB ext4 userdata
Is that switch on your cable to select whether or not you want fastboot? cause that's an interesting idea. I'm assuming you made that yourself.
Click to expand...
Click to collapse
Yes it is. It switches between fastboot an regular.I think I might try to flash a recovery image made for the kfhd later also I may try to flash the jb rom for kfhd
Sent from my DROIDX using xda app-developers app

powerpoint45 said:
Yes it is. It switches between fastboot an regular.I think I might try to flash a recovery image made for the kfhd later
Sent from my DROIDX using xda app-developers app
Click to expand...
Click to collapse
Unless they have a touch recovery it's probably going to be useless..

fmkilo said:
Unless they have a touch recovery it's probably going to be useless..
Click to expand...
Click to collapse
I think it is touch
http://forum.xda-developers.com/showthread.php?t=2029826
http://www.reverendkyle.com/index.php/articles/177-how-to-install-cm10-alpha-on-kindle-fire-hd-7
Its kinda funny how the kf2 is being left out Do you have a factory cable?

powerpoint45 said:
I think it is touch
http://forum.xda-developers.com/showthread.php?t=2029826
http://www.reverendkyle.com/index.php/articles/177-how-to-install-cm10-alpha-on-kindle-fire-hd-7
Its kinda funny how the kf2 is being left out Do you have a factory cable?
Click to expand...
Click to collapse
since his stuff is based off of the 8.9 development section, I shot over to there, and picked up this video. it shows the cwm in use. http://www.youtube.com/watch?v=MuZvz1McWNE
I went to amazon, and looked at their little drawings of the 7 and 8.9, they have volume buttons on their bottom edge.
I have my own factory cable, I will gladly test anything, I'm not scared to brick it, and have amazon replace it when I lie to them... That's happened twice now..

fmkilo said:
since his stuff is based off of the 8.9 development section, I shot over to there, and picked up this video. it shows the cwm in use. http://www.youtube.com/watch?v=MuZvz1McWNE
I went to amazon, and looked at their little drawings of the 7 and 8.9, they have volume buttons on their bottom edge.
I have my own factory cable, I will gladly test anything, I'm not scared to brick it, and have amazon replace it when I lie to them... That's happened twice now..
Click to expand...
Click to collapse
Oh i totally forgot about that. I guess twrp is my best bet... Do you think roms would flash properly with twrp made for kindle fire v1 or...
Sent from my KFOT using xda app-developers app

powerpoint45 said:
Oh i totally forgot about that. I guess twrp is my best bet... Do you think roms would flash properly with twrp made for kindle fire v1 or...
Sent from my KFOT using xda app-developers app
Click to expand...
Click to collapse
Like I said, I don't know much, but I wonder if we could mount the recovery partition and make changes and see how it works after flashing.
The partitions aren't going to be mounted correctly.
also, I saw a post a little bit ago that mentioned using adb to simulate volume button presses.(not sure if that's possible)
adb shell
input keyevent <volume button code>
and I also saw this post a little glimmer of hope for cwm..
(I think this is the reason the kf2 is left out.)
Try to make a backup first without flashing anything.. if that works..

fmkilo said:
Like I said, I don't know much, but I wonder if we could mount the recovery partition and make changes and see how it works after flashing.
The partitions aren't going to be mounted correctly.
also, I saw a post a little bit ago that mentioned using adb to simulate volume button presses.(not sure if that's possible)
adb shell
input keyevent <volume button code>
and I also saw this post a little glimmer of hope for cwm..
(I think this is the reason the kf2 is left out.)
Try to make a backup first without flashing anything.. if that works..
Click to expand...
Click to collapse
Good idea about the key codes. You mean try to make a backup in twrp? ....I think i will flash the cwm recovery made for kfhd and try to get keycodes working...but not now it is 4am over here lol
Sent from my KFOT using xda app-developers app

powerpoint45 said:
Good idea about the key codes. You mean try to make a backup in twrp? ....I think i will flash the cwm recovery made for kfhd and try to get keycodes working...but not now it is 4am over here lol
Sent from my KFOT using xda app-developers app
Click to expand...
Click to collapse
you know, making a backup might hurt more than it helps... keycodes sounds better anyway. Central time that stuff rocks, we live in the same timezone. cwm comes before twrp anyway. once we have a workingish cwm, we can start to make a twrp. Knowing that we have the proper setup within a previous build of twrp means it should be easier to do, rather than figure every value out from scratch. you said touch points work correctly... I'll play with twrp when I get my replacement tomorrowish. (or later today depending on how you look at it.) I'm tired of being a leech. I want to start figuring stuff out, maybe contribute a little lol.

fmkilo said:
you know, making a backup might hurt more than it helps... keycodes sounds better anyway. Central time that stuff rocks, we live in the same timezone. cwm comes before twrp anyway. once we have a workingish cwm, we can start to make a twrp. Knowing that we have the proper setup within a previous build of twrp means it should be easier to do, rather than figure every value out from scratch. you said touch points work correctly... I'll play with twrp when I get my replacement tomorrowish. (or later today depending on how you look at it.) I'm tired of being a leech. I want to start figuring stuff out, maybe contribute a little lol.
Click to expand...
Click to collapse
Sorry i feel asleep. Yeah that sounds good.
Sent from my KFOT using xda app-developers app

powerpoint45 said:
Sorry i feel asleep. Yeah that sounds good.
Sent from my KFOT using xda app-developers app
Click to expand...
Click to collapse
I pmed revkjr and asked him what the output of the button codes was in cwm so hopefully I could try that whenever my replacement is here.

fmkilo said:
I pmed revkjr and asked him what the output of the button codes was in cwm so hopefully I could try that whenever my replacement is here.
Click to expand...
Click to collapse
Ok cool. You should ask him if the ROM will flash correctly on the kf1 with cwm or even twrp...I think the keycodes wont be too hard.
Sent from my KFOT using xda app-developers app

Code:
[email protected]:~$ adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
[email protected]:/ $ su
[email protected]:/ # busybox mount -o remount,rw /system
[email protected]:/ # exit
[email protected]:/ $ exit
[email protected]:~$ adb pull /system/recovery.img
3421 KB/s (4944720 bytes in 1.411s)
[email protected]:~$ mv recovery.img Desktop/recovery.img.bak
[email protected]:~$ adb shell
[email protected]:/ $ su
[email protected]:/ # chmod 777 /dev/block/*
[email protected]:/ # exit
[email protected]:/ $ exit
[email protected]:~$ adb pull /dev/block/mmcblk0p9 Desktop/mmcblk0p9.bak
3339 KB/s (8388608 bytes in 2.453s)
[email protected]:~$ adb pull /dev/block/mmcblk0p10 Desktop/mmcblk0p10.bak
3271 KB/s (8388608 bytes in 2.503s)
[email protected]:~$ adb pull /dev/block/mmcblk0p11 Desktop/mmcblk0p11.bak
3640 KB/s (929038336 bytes in 249.200s)
[email protected]:~$
Code:
[email protected]:~$ I am now in fastboot mode and i am going to test my recovery b
ackup
/bin/sh: I: not found
[email protected]:~$ fastboot flash recovery Desktop/recovery.img.bak -i 0x1949
sending 'recovery' (4828 KB)...
OKAY [ 0.311s]
writing 'recovery'...
OKAY [ 0.518s]
finished. total time: 0.829s
[email protected]:~$ now i am booting into normal rom
/bin/sh: now: not found
[email protected]:~$ adb reboot recovery
[email protected]:~$ backup recovery works fine. going back into fastboot
/bin/sh: backup: not found
[email protected]:~$ fastboot flash recovery Desktop/revboot.img -i 0x1949
sending 'recovery' (8173 KB)...
OKAY [ 0.439s]
writing 'recovery'...
OKAY [ 0.869s]
finished. total time: 1.308s
[email protected]:~$ now i will test recovery again
/bin/sh: now: not found
[email protected]:~$ adb reboot recovery
[email protected]:~$ adb devices
List of devices attached
[email protected]:~$ the device just booted into factory recovery );
/bin/sh: syntax error: unexpected ")"
[email protected]:~$ fastboot flash recovery Desktop/recovery.img.bak -i 0x1949
< waiting for device >
sending 'recovery' (4828 KB)...
OKAY [ 0.308s]
writing 'recovery'...
OKAY [ 0.516s]
finished. total time: 0.825s

powerpoint45 said:
Code:
[email protected]:~$ adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
[email protected]:/ $ su
[email protected]:/ # busybox mount -o remount,rw /system
[email protected]:/ # exit
[email protected]:/ $ exit
[email protected]:~$ adb pull /system/recovery.img
3421 KB/s (4944720 bytes in 1.411s)
[email protected]:~$ mv recovery.img Desktop/recovery.img.bak
[email protected]:~$ adb shell
[email protected]:/ $ su
[email protected]:/ # chmod 777 /dev/block/*
[email protected]:/ # exit
[email protected]:/ $ exit
[email protected]:~$ adb pull /dev/block/mmcblk0p9 Desktop/mmcblk0p9.bak
3339 KB/s (8388608 bytes in 2.453s)
[email protected]:~$ adb pull /dev/block/mmcblk0p10 Desktop/mmcblk0p10.bak
3271 KB/s (8388608 bytes in 2.503s)
[email protected]:~$ adb pull /dev/block/mmcblk0p11 Desktop/mmcblk0p11.bak
3640 KB/s (929038336 bytes in 249.200s)
[email protected]:~$
Code:
[email protected]:~$ I am now in fastboot mode and i am going to test my recovery b
ackup
/bin/sh: I: not found
[email protected]:~$ fastboot flash recovery Desktop/recovery.img.bak -i 0x1949
sending 'recovery' (4828 KB)...
OKAY [ 0.311s]
writing 'recovery'...
OKAY [ 0.518s]
finished. total time: 0.829s
[email protected]:~$ now i am booting into normal rom
/bin/sh: now: not found
[email protected]:~$ adb reboot recovery
[email protected]:~$ backup recovery works fine. going back into fastboot
/bin/sh: backup: not found
[email protected]:~$ fastboot flash recovery Desktop/revboot.img -i 0x1949
sending 'recovery' (8173 KB)...
OKAY [ 0.439s]
writing 'recovery'...
OKAY [ 0.869s]
finished. total time: 1.308s
[email protected]:~$ now i will test recovery again
/bin/sh: now: not found
[email protected]:~$ adb reboot recovery
[email protected]:~$ adb devices
List of devices attached
[email protected]:~$ the device just booted into factory recovery );
/bin/sh: syntax error: unexpected ")"
[email protected]:~$ fastboot flash recovery Desktop/recovery.img.bak -i 0x1949
< waiting for device >
sending 'recovery' (4828 KB)...
OKAY [ 0.308s]
writing 'recovery'...
OKAY [ 0.516s]
finished. total time: 0.825s
Click to expand...
Click to collapse
Have you tried booting it like you did twrp?

fmkilo said:
Have you tried booting it like you did twrp?
Click to expand...
Click to collapse
It wont let me. It instantly reboots...I am softbricked from following guide for hd
Sent from my DROIDX using xda app-developers app

powerpoint45 said:
It wont let me. It instantly reboots...I am softbricked from following guide for hd
Sent from my DROIDX using xda app-developers app
Click to expand...
Click to collapse
how did you get twrp running then? Why did twrp boot but cwm didn't?
did you try flashing it in boot system and recovery to get it to boot to cwm?

fmkilo said:
how did you get twrp running then? Why did twrp boot but cwm didn't?
did you try flashing it in boot system and recovery to get it to boot to cwm?
Click to expand...
Click to collapse
Yes. that's what bricked it... I don't know why cwm wont boot.I need to upload a file onto the kindle in order to fix it. Any ideas
Sent from my DROIDX using xda app-developers app

Related

[Guide] Repartition Nexus5 to increase system partition - Space for Rom & Stock Gapps

[Guide] Repartition Nexus5 to increase system partition - Space for Rom & Stock Gapps
Before I begin...don't do this if you don't know what you're doing. If you know what you're doing still don't do this. This is dangerous, and in general people don't even make good guides for this likely because it's SUCH a stupid thing to do. Samsung phones support PIT re partitioning, but for something like a Nexus, there is no easy guide. You can and likely will brick your phone...at best you will certainly wipe all data.
I wanted to install a nougat rom on my cracked-screen Nexus5, but in flashing it AND stock gapps would error out since there isn't enough room on the /system partition for both. The Nexus5 comes with a 1GB system partition which was fine way back in the day, but isn't really fine anymore. In order to pull space from the large userdata partition, we need to do some linux trickery. I chose to make /system 2GB, which may be overkill, but this phone is going to be a baby monitor/white noise machine for a 5 month old so who cares.
The prerequisite for this process is a TWRP recovery, and that's pretty much it. Ideally, fdisk would be baked in with busybox or the parted utility would be on the phone and you could use the resize function...every time I tried to use busybox's fdisk led to errors or commands wouldn't work, and parted's resize command can't deal with ext4.
The high-level procedure here is, since filesystems must be contiguous and in order so they can be addressed properly, we need to delete every partition inclusively from system to userdata, then recreate them with new storage offsets. To visualize this, here's the storage layout as it started out on my Nexus 5:
Code:
Model: MMC SEM32G (sd/mmc)
Disk /dev/block/mmcblk0: 31.3GB
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.7MB 1049kB sbl1
3 68.7MB 69.2MB 524kB rpm
4 69.2MB 69.7MB 524kB tz
5 69.7MB 70.3MB 524kB sdi
6 70.3MB 70.8MB 524kB aboot
7 70.8MB 72.9MB 2097kB pad
8 72.9MB 73.9MB 1049kB sbl1b
9 73.9MB 74.4MB 524kB tzb
10 74.4MB 75.0MB 524kB rpmb
11 75.0MB 75.5MB 524kB abootb
12 75.5MB 78.6MB 3146kB modemst1
13 78.6MB 81.8MB 3146kB modemst2
14 81.8MB 82.3MB 524kB metadata
15 82.3MB 99.1MB 16.8MB misc
16 99.1MB 116MB 16.8MB ext4 persist
17 116MB 119MB 3146kB imgdata
18 119MB 142MB 23.1MB laf
19 142MB 165MB 23.1MB boot
20 165MB 188MB 23.1MB recovery
21 188MB 191MB 3146kB fsg
22 191MB 192MB 524kB fsc
23 192MB 192MB 524kB ssd
24 192MB 193MB 524kB DDR
25 193MB 1267MB 1074MB ext4 system
26 1267MB 1298MB 31.5MB crypto
27 1298MB 2032MB 734MB ext4 cache
28 2032MB 31.3GB 29.2GB ext4 userdata
29 31.3GB 31.3GB 5632B grow
Looking at that, we want to increase system (partition 25), shift crypto (partition 26), shift cache (partition 27), and shrink userdata (partition 28). If you try this on a different phone, you'll have different partitions to move.
I did this from a Debian desktop using adb, but you can use any platform that has adb. You need to download the parted binary linked below, a nexus5 Nougat rom (or any rom I guess), and a gapps package (I chose stock). Here's the commands I used:
Code:
wget http://iwf1.com/iwf-repo/parted.rar
unrar e parted.rar
sudo adb push parted /
sudo adb shell
~ # chmod +x parted
~ # ./parted /dev/block/mmcblk0 p
~ # umount /data
~ # umount /sdcard
~ # umount /cache
~ # ./parted /dev/block/mmcblk0 rm 25
~ # ./parted /dev/block/mmcblk0 rm 26
~ # ./parted /dev/block/mmcblk0 rm 27
~ # ./parted /dev/block/mmcblk0 rm 28
~ # ./parted /dev/block/mmcblk0 mkpart primary 193MB 2291MB
~ # ./parted /dev/block/mmcblk0 mkpart extended 2291MB 2322MB
~ # ./parted /dev/block/mmcblk0 mkpart primary 2322MB 3056MB
~ # ./parted /dev/block/mmcblk0 mkpart primary 3056MB 30.8GB
~ # ./parted /dev/block/mmcblk0 p
~ # ./parted /dev/block/mmcblk0 name 25 system
~ # ./parted /dev/block/mmcblk0 name 26 crypto
~ # ./parted /dev/block/mmcblk0 name 27 cache
~ # ./parted /dev/block/mmcblk0 name 28 userdata
~ # mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p25
~ # mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p27
~ # mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p28
~ # ./parted /dev/block/mmcblk0 p
~ # mount -a
~ # exit
# Download from here: http://www.androiddevs.net/downloads/
sudo adb push aosp_hammerhead-7.1-nougat-*.zip /data/
# Download from here: http://opengapps.org/
sudo adb push open_gapps-arm-7.1-stock-*.zip /data/
sudo adb reboot recovery
# Install the nougat rom through twrp...this will resize the /system partition back to 1GB!
sudo adb shell
~ # umount /system
~ # resize2fs -f /dev/block/mmcblk0p25 2000M
~ # mount -a
# Install opengapps in twrp
~ # exit
# Reboot into system through TWRP GUI
There were some logging errors with the SantoshM nougat rom I tried, but they had no impact. I am unmounting /sdcard and that's where it's trying to stash the logs, hence errors.
You can see that the offsets for the new partitions are 1024MB higher than the originals, meaning the partition will be 1GB bigger. Here's my final partition table:
Code:
Model: MMC SEM32G (sd/mmc)
Disk /dev/block/mmcblk0: 31.3GB
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.7MB 1049kB sbl1
3 68.7MB 69.2MB 524kB rpm
4 69.2MB 69.7MB 524kB tz
5 69.7MB 70.3MB 524kB sdi
6 70.3MB 70.8MB 524kB aboot
7 70.8MB 72.9MB 2097kB pad
8 72.9MB 73.9MB 1049kB sbl1b
9 73.9MB 74.4MB 524kB tzb
10 74.4MB 75.0MB 524kB rpmb
11 75.0MB 75.5MB 524kB abootb
12 75.5MB 78.6MB 3146kB modemst1
13 78.6MB 81.8MB 3146kB modemst2
14 81.8MB 82.3MB 524kB metadata
15 82.3MB 99.1MB 16.8MB misc
16 99.1MB 116MB 16.8MB ext4 persist
17 116MB 119MB 3146kB imgdata
18 119MB 142MB 23.1MB laf
19 142MB 165MB 23.1MB boot
20 165MB 188MB 23.1MB recovery
21 188MB 191MB 3146kB fsg
22 191MB 192MB 524kB fsc
23 192MB 192MB 524kB ssd
24 192MB 193MB 524kB DDR
25 193MB 2291MB 2098MB ext4 system
26 2291MB 2322MB 31.0MB crypto
27 2322MB 3056MB 734MB ext4 cache
28 3056MB 31.3GB 28.2GB ext4 userdata
29 31.3GB 31.3GB 5632B grow
When we resize /system, we're not quite giving it the whole space...I recommend running "resize2fs /dev/block/mmcblk0p25 2048M" and seeing the error...it's easier to adjust the actual filesystem size than the partition size, so we fudge it a bit here so long as it's safe. If this test is unsuccessful, it will tell you that you're allocating more blocks than you have. If it's successful, it'll tell you to run e2fsck...this is normal, and running the resize2fs command with the -f flag overrides that warning...but it'll also allow you to allocate too many blocks, hence why you run a test first as a sanity check. For this exact procedure, 2000M is the exact maximum size.
All in all, this technique can likely be adapted to other android phones. The key is making sure you resize system by the amount you take from data, and making sure you offset all partitions in between linearly by the correct amount. I'm not sure how updates will work...anything that basically lays down a partition is gonna cause issues since it'll try to resize to the default partition size. Anything just laying down new files should be fine.
Happy hacking!
I was looking for such an option as I wanted to install a bigger gapps package then just pico. But shrinking my userdata partition is not was i had in mind. I also really do not want to loose all my data, as i am leazy
so i was thinking about just resizing /cache to a bare minimum of lets say 128mb or even less. Because as i understand /cache is just used for OTA updates - if i am mistaken here, feel free to update my knowledge.
Has anybody done this? On the Galaxy Nexus this is the way to go afaik and one would not loose things in /data.
It worked, Thank you!
What i essentially did was make a nandroid backup followed by "adb pull /sdcard/" on the computer.
Followed your instructions (just before the flashing section), pushed the sdcard data back and restored the backup.
chowned and chmodded the /sdcard directory:
Code:
chown media_rw:media_rw /sdcard
chmod 755 /sdcard
Resized the /system bit, rebooted and hoped it wouldn't 'bootloop'.
The process was nerve wracking, but now the handset is ready for a future stable ROM (I'm still on stock).
So, we need to do
Code:
resize2fs -f /dev/block/mmcblk0p25 2000M
every time we flash a new ROM?
alexeius said:
So, we need to do
Code:
resize2fs -f /dev/block/mmcblk0p25 2000M
every time we flash a new ROM?
Click to expand...
Click to collapse
surfrock66 said:
All in all, this technique can likely be adapted to other android phones. The key is making sure you resize system by the amount you take from data, and making sure you offset all partitions in between linearly by the correct amount. I'm not sure how updates will work...anything that basically lays down a partition is gonna cause issues since it'll try to resize to the default partition size. Anything just laying down new files should be fine.
Happy hacking!
Click to expand...
Click to collapse
Depends on the ROM you're installing.​
Everyone must pay attention that this guide is for 32gb model........for 16gb commands are different.......pay attention else u brick seriously you phone.....
SoftWord said:
Everyone must pay attention that this guide is for 32gb model........for 16gb commands are different.......pay attention else u brick seriously you phone.....
Click to expand...
Click to collapse
Yes, this...my numbers show the methodology, but for the 16GB nexus 5 (or any other phone) you need to start by looking at the starting state of the partition table, then do the math from start to finish. I hope I've provided enough methodology and warnings that someone will either abort or do it right.
poioq said:
I was looking for such an option as I wanted to install a bigger gapps package then just pico. But shrinking my userdata partition is not was i had in mind. I also really do not want to loose all my data, as i am leazy
so i was thinking about just resizing /cache to a bare minimum of lets say 128mb or even less. Because as i understand /cache is just used for OTA updates - if i am mistaken here, feel free to update my knowledge.
Has anybody done this? On the Galaxy Nexus this is the way to go afaik and one would not loose things in /data.
Click to expand...
Click to collapse
In general I would say that's a very bad idea...however, if you're very careful and are willing to incur some risk, it could possibly work...on the N5, since the cache partition sits between system and userdata (and more importantly doesn't touch recovery) you could theoretically try it, and if it doesn't work, undo it, all while leaving your userdata partition untouched. If preserving your data is your goal...it's probably a bad idea, but that doesn't mean it isn't possible.
How about taking space from cache to userdata? 1-1,5GB'll be unused anyway and on 16gb variant it'll be nice to have some more memory to have
TL;DR
Success: Repartition of a Nexus 5 16GB
Success: Flash cm-14.1-20161028-UNOFFICIAL-hammerhead.zip
Success: Flash open_gapps-arm-7.1-stock-20161217.zip
FAIL: Getting through the Google/CM set up process (Google Play services crashes)
Success: Flash Aroma Gapps
Gapps selections:
Code:
AndroidPay=0
Books=0
CalculatorGoogle=1
CalendarGoogle=1
CalSync=0
CameraGoogle=1
Chrome=1
ClockGoogle=1
CloudPrint=0
ContactsGoogle=1
DialerFramework=1
DialerGoogle=1
DMAgent=0
Docs=0
Drive=0
Earth=0
ExchangeGoogle=0
FaceDetect=0
FaceUnlock=1
Fitness=1
GCS=1
Gmail=0
GoogleNow=0
GooglePlus=0
GoogleTTS=0
Hangouts=0
Hotword=0
Indic=0
Japanese=0
Keep=1
KeyboardGoogle=1
Korean=0
Maps=1
Messenger=0
Movies=0
Music=1
NewsStand=0
NewsWidget=0
PackageInstallerGoogle=0
Pinyin=0
PixelIcons=1
PixelLauncher=1
Photos=1
PlayGames=0
PrintServiceGoogle=0
ProjectFi=0
Sheets=0
Slides=0
Search=1
Speech=0
StorageManagerGoogle=0
Street=0
TagGoogle=0
Talkback=0
Translate=1
VRService=0
Wallpapers=1
WebViewGoogle=1
YouTube=1
Zhuyin=0
inclorexcl=1
Aim
To convert my Nexus 5 16GB into a Pixel using CM14.1 and Stock Open Gapps (I didn't want to keep flashing random pixel-experience.zip files)
Issue (strikethrough issues are with Stock Gapps)
When using Aroma Gapps:
1. Launcher3 crashes everytime the G search bar is clicked on
2. Google Now is not on the left pane despite my chosen packages
1. I couldn't Sign into my WiFi because no soft keyboard would appear (workaround: I created a password-less Hotspot on another phone)
2. I wasn't able to get past through the Google setup process; Google Play Services would crash every time I attempted to skip Tap & Go taking me back to a SIM card missing screen. On skipping this, I get taken to Tap & Go... and repeat
I've wiped all the caches (of course). If anyone has any ideas, it would be great.
Question to @surfrock66
You have a parted command that says:
Code:
~ # ./parted /dev/block/mmcblk0 mkpart primary 3056MB 30.8GB
Should this not be:
Code:
~ # ./parted /dev/block/mmcblk0 mkpart primary 3056MB 31.3GB
I may not have understood this fully
Thanks surfrock66 for the original method; my method varies slightly and is as follows:
Code:
Download and unpack parted.rar via the
# With phone in TWRP Recovery
$ sudo adb push parted /
$ sudo adb shell
~ # chmod +x parted
~ # ./parted /dev/block/mmcblk0 p
Model: MMC SEM16G (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.7MB 1049kB sbl1
3 68.7MB 69.2MB 524kB rpm
4 69.2MB 69.7MB 524kB tz
5 69.7MB 70.3MB 524kB sdi
6 70.3MB 70.8MB 524kB aboot
7 70.8MB 72.9MB 2097kB pad
8 72.9MB 73.9MB 1049kB sbl1b
9 73.9MB 74.4MB 524kB tzb
10 74.4MB 75.0MB 524kB rpmb
11 75.0MB 75.5MB 524kB abootb
12 75.5MB 78.6MB 3146kB modemst1
13 78.6MB 81.8MB 3146kB modemst2
14 81.8MB 82.3MB 524kB metadata
15 82.3MB 99.1MB 16.8MB misc
16 99.1MB 116MB 16.8MB ext4 persist
17 116MB 119MB 3146kB imgdata
18 119MB 142MB 23.1MB laf
19 142MB 165MB 23.1MB boot
20 165MB 188MB 23.1MB recovery
21 188MB 191MB 3146kB fsg
22 191MB 192MB 524kB fsc
23 192MB 192MB 524kB ssd
24 192MB 193MB 524kB DDR
25 193MB 1267MB 1074MB ext4 system
26 1267MB 1298MB 31.5MB crypto
27 1298MB 2032MB 734MB ext4 cache
28 2032MB 15.8GB 13.7GB ext4 userdata
29 15.8GB 15.8GB 5632B grow
~ # umount /data
~ # umount /sdcard
~ # umount /cache
~ # ./parted /dev/block/mmcblk0 rm 25
~ # ./parted /dev/block/mmcblk0 rm 26
~ # ./parted /dev/block/mmcblk0 rm 27
~ # ./parted /dev/block/mmcblk0 rm 28
~ # ./parted /dev/block/mmcblk0 mkpart primary 193MB 2291MB
~ # ./parted /dev/block/mmcblk0 mkpart extended 2291MB 2322MB
~ # ./parted /dev/block/mmcblk0 mkpart primary 2322MB 3056MB
~ # ./parted /dev/block/mmcblk0 mkpart primary 3056MB 15.8GB
~ # ./parted /dev/block/mmcblk0 p
~ # ./parted /dev/block/mmcblk0 name 25 system
~ # ./parted /dev/block/mmcblk0 name 26 crypto
~ # ./parted /dev/block/mmcblk0 name 27 cache
~ # ./parted /dev/block/mmcblk0 name 28 userdata
~ # mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p25
~ # mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p27
~ # mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p28
~ # ./parted /dev/block/mmcblk0 p
~ # mount -a
~ # exit
Model: MMC SEM16G (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.7MB 1049kB sbl1
3 68.7MB 69.2MB 524kB rpm
4 69.2MB 69.7MB 524kB tz
5 69.7MB 70.3MB 524kB sdi
6 70.3MB 70.8MB 524kB aboot
7 70.8MB 72.9MB 2097kB pad
8 72.9MB 73.9MB 1049kB sbl1b
9 73.9MB 74.4MB 524kB tzb
10 74.4MB 75.0MB 524kB rpmb
11 75.0MB 75.5MB 524kB abootb
12 75.5MB 78.6MB 3146kB modemst1
13 78.6MB 81.8MB 3146kB modemst2
14 81.8MB 82.3MB 524kB metadata
15 82.3MB 99.1MB 16.8MB misc
16 99.1MB 116MB 16.8MB ext4 persist
17 116MB 119MB 3146kB imgdata
18 119MB 142MB 23.1MB laf
19 142MB 165MB 23.1MB boot
20 165MB 188MB 23.1MB recovery
21 188MB 191MB 3146kB fsg
22 191MB 192MB 524kB fsc
23 192MB 192MB 524kB ssd
24 192MB 193MB 524kB DDR
25 193MB 2291MB 2098MB ext4 system
26 2291MB 2322MB 31.0MB crypto
27 2322MB 3056MB 734MB ext4 cache
28 3056MB 15.8GB 12.7GB ext4 userdata
29 15.8GB 15.8GB 5632B grow
# This didn't work for me
$ sudo adb push cm-14.1-20161028-UNOFFICIAL-hammerhead.zip /
$ sudo adb push open_gapps-arm-7.1-stock-20161217.zip /
$ sudo adb reboot recovery
# So I copied over the files once I reboot into recovery
# I had to reboot into recovery again to see my CM14.1 and Gapps files
# Flashed them using TWRP
$ sudo adb shell
~ # unmount /system/
/sbin/sh: unmount: not found
# I have no idea why this happened
~ # resize2fs -f /dev/block/mmcblk0p25 2000M
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/block/mmcblk0p25 to 512000 (4k) blocks.
The filesystem on /dev/block/mmcblk0p25 is now 512000 blocks long.
~ # mount -a
mount: mounting /dev/block/mmcblk0p1 on /firmware failed: Invalid argument
mount: mounting /usb-otg on vfat failed: No such file or directory
# I have no idea why this happened either
~ # exit
@surfrock66 Hi, is the same way for n7 (2013) 32gb?
Thanks
Sent from my Nexus 7 using XDA-Developers mobile app
jordirpz said:
@surfrock66 Hi, is the same way for n7 (2013) 32gb?
Thanks
Click to expand...
Click to collapse
No, this is not necessarily true. You will need to use Parted to analyse the partitions and then make the relevant modifications. Again, do not try this unless you are willing to potentially brick your device.
@surfrock66
Faied copy parted to //parted : read-only file system
Whats hapend?
Sent from my Nexus 7 using XDA-Developers mobile app
jordirpz said:
@surfrock66
Faied copy parted to //parted : read-only file system
Whats hapend?
Sent from my Nexus 7 using XDA-Developers mobile app
Click to expand...
Click to collapse
In TWRP, you have to choose to mount your system as read/write, for me with TWRP 3.x it's an option right when TWRP starts. If you don't do that, you can't write to / and thus can't copy the file over.
surfrock66 said:
In TWRP, you have to choose to mount your system as read/write, for me with TWRP 3.x it's an option right when TWRP starts. If you don't do that, you can't write to / and thus can't copy the file over.
Click to expand...
Click to collapse
Ok thank you.
Other question please. Adb Shell steps, works in trwp or i need mount system and reboot system for make it? Thank you
Sent from my Nexus 7 using XDA-Developers mobile app
jordirpz said:
Ok thank you.
Other question please. Adb Shell steps, works in trwp or i need mount system and reboot system for make it? Thank you
Sent from my Nexus 7 using XDA-Developers mobile app
Click to expand...
Click to collapse
All done while in twrp.
surfrock66 said:
All done while in twrp.
Click to expand...
Click to collapse
Ok, thanks for you awesome guide.
For me works, now i have 2gb in system?
Sorry for ETA: can you in near future make a reparted file and guide for N7 2013 wifi please?
Sent from my Nexus 7 using XDA-Developers mobile app
jordirpz said:
Ok, thanks for you awesome guide.
For me works, now i have 2gb in system?
Sorry for ETA: can you in near future make a reparted file and guide for N7 2013 wifi please?
Sent from my Nexus 7 using XDA-Developers mobile app
Click to expand...
Click to collapse
I don't have that device, but the original post here should have everything you need to re-create the process for another device. You'll have to re-calculate the offsets based on what you find when you run the original partition query.
souheil said:
Depends on the ROM you're installing.​
Click to expand...
Click to collapse
Just to double check.
Any ideas of what ROMs would need this?
I'm interested of the cyanogenmod in my particular case.
ricardo.adao said:
Just to double check.
Any ideas of what ROMs would need this?
I'm interested of the cyanogenmod in my particular case.
Click to expand...
Click to collapse
CM14.1 fits on the Nexus 5 /system partition WITHOUT repartitioning.
I wanted to try this because I want to flash Stock Gapps (as opposed to Nano), hoping to get a Pixel-like experience as described in my previous post (http://forum.xda-developers.com/showpost.php?p=70145560&postcount=10). However, I had lots of crashes with Stock Gapps.
Instead, I now use CM14.1 with Nano Gapps.
If you want a more Pixel-like experience, that side-loading doesn't provide (no Google Now on the left side of the Homescreen, no Pixel-like animations on clicking the G Search Bar), I have resorted to installing the Pixel Launcher and Wallpaper APKs into /system.
Instructions found: http://android.stackexchange.com/questions/76976/how-to-install-app-as-system-app
Re-flashing a ROM will require you to re-do these steps.

[wt88047] Redmi 2 -Resize system partition

Here is a guide to resize and repartition your redmi 2 emmc
Download and uncompress the attached View attachment parted.zip file
Download attached View attachment persist.img
Download latest twrp
Reeboot to bootloader(fastboot) and flash latest twrp
Code:
fastboot flash recovery twrp-3.1.1-0-wt88047.img
boot to the new twrp
Code:
fastboot boot twrp-3.1.1-0-wt88047.img
Copy the "parted" binary into your sdcard.
Use your file manager make new directory parted in sd card aand copy parted executable there.
now connect with adb:
Code:
adb shell
Change directory to external_sd/parted/ (where we copied the parted binary)
Code:
cd external_sd/parted/
Give permission to execute:
Code:
chmod +x parted
Use blkid to list out devices. My emmc is listed as
"/dev/block/mmcblk0" it should be same on all other devices too, its ok even if it is different
Code:
blkid
View attachment 4162723
now use parted command
Code:
./parted /dev/block/mmcblk0
Use option
Code:
p
to printout partition table
View attachment 4162725
we need to remove all partitions starting from 23 and recreate them. But when we recreate , everything except system and userdata should have the exact same number of sectors that they had before otherwise it wont boot.
use
Code:
u
to change units type in when it asks the unit
Code:
s
(for sectors)
here are the dfault sector sizes.... they should be same when we recreate them
24 655360s cache
25 6553 persist
26 65536s recovery
27 1024s keystore
28 64s config
29 131072s oem
View attachment 4162728
now remove all partitions upto system .
unmount /system and /data and /cache from twrp mounts menu before proceeding
Code:
rm 30
rm 29
rm 28
rm 27
rm 26
rm 25
rm 24
rm 23
View attachment 4162729
now we need to recreate partition table , first is system
syntax:
mkpart system ext4 [start sector] [end sector]
start sector is the end sector of the previous partition +1
for me its :
461919s+1s=461920s
each sector is 512B so calculate how many sectors you want.
for me resizing system to 1.2GB
1.2GB*1024*1024*1024=1288490188.8bytes
1288490188.8bytes/512bytes=2516582.4sectors
round it up 2516583s
end sector= required number of sectors +start sector -1s
=2516583s+461920s -1s =2978503s -1s
so my command is :
Code:
mkpart system 461920s 2978502s
due to bug in this parted name of partition was not set....
set it manually:
Code:
name 23 system
now create cache partion:
use p (print partition table) to find out start sectors
end sector=start sector+655360s -1s (refer table i posted, or your default partition table)
=2978503s+655360s-1s=3633862s
use:
Code:
mkpart cache 2978503s 3633862s
rename partition:
Code:
name 24 cache
similar way create persist:
end sector=start sector + 65536s -1s
Code:
mkpart persist 3633863s 3699398s
name persist:
Code:
name 25 persist
create recovery:
end sector=start sector + 65536s -1s
Code:
mkpart recovery 3699399s 3764934s
Code:
name 26 recovery
create partition keystore :
end sector=start sector + 1024s -1s
Code:
mkpart keystore 3764935s 3765958s
Code:
name 27 keystore
create partition config:
end sector=start sector + 64s -1s
Code:
mkpart config 3765959s 3766022s
Code:
name 28 config
create partition oem :
end sector =startsector + 131072s -1s
Code:
mkpart oem 3766023s 3897094s
Code:
name 29 oem
now create the last partition userdata ... userdata will shrink by as much as you increased in your system:
Code:
mkpart userdata 3897095s 100%
Code:
name 30 userdata
exit parted by typing
Code:
q
format the partitions /system(23) /cache(24) /persist(25) /userdata(30) :
Code:
make_ext4fs /dev/block/mmcblk0p23
make_ext4fs /dev/block/mmcblk0p24
make_ext4fs /dev/block/mmcblk0p25
make_ext4fs /dev/block/mmcblk0p30
run parted again and use p ,your partition table should look similar to this:
Code:
./parted /dev/block/mmcblk0
Use option
Code:
p
to printout partition table
View attachment 4162739
exit parted by typing
Code:
q
use command:
Code:
reboot bootloader
to boot into bootloader/fastboot
flash recovery:
Code:
fastboot flash recovery twrp-3.1.1-0-wt88047.img
flash persist:
Code:
fastboot flash persist persist.img
booot to recovery and reboot recovery:
Code:
fastboot boot twrp-3.1.1-0-wt88047.img
now you can flash any custom rom
please remember that some custom roms have a fixed system size and therefore you will have to resize the partition after installing rom from the twrp wipe menu/repair partition menu
Download links:
twrp: https://dl.twrp.me/wt88047/
parted: see attachment
persist: see attachment
Hope this helps
To revert to stock partition table :
download attachment extract and flash via fastboot:
View attachment gpt_both0.zip
Code:
fastboot flash partition gpt_both0.bin
@OP, how to revert back to default system partition? Via fastboot rom or ...? Thank you for providing the method bro!
Dyt199412syam said:
@OP, how to revert back to default system partition? Via fastboot rom or ...? Thank you for providing the method bro!
Click to expand...
Click to collapse
i have updated the post to include reverting instructions....
yes flashing the full fastboot stock rom will revert your partition table to default.
resize system partition to 1,5gb using fastboot, run partition.bat
download
inunxelex said:
resize system partition to 1,5gb using fastboot, run partition.bat
download
Click to expand...
Click to collapse
can you explain how to make that partition.img file..... i am guessing its like "gpt_both0.bin"
jsidney96 said:
can you explain how to make that partition.img file..... i am guessing its like "gpt_both0.bin"
Click to expand...
Click to collapse
yes, but im using hex editor with some crc cheksum
inunxelex said:
resize system partition to 1,5gb using fastboot, run partition.bat
download
Click to expand...
Click to collapse
Will this work on the 8gb model? I mean, is not too big for it?, if it is, can you make a smaller version for 8gb devices?
Thanks
inunxelex said:
resize system partition to 1,5gb using fastboot, run partition.bat
download
Click to expand...
Click to collapse
Do i need to reinstall rom after i did system repartition used this method bro?
TecnoTailsPlays said:
Will this work on the 8gb model? I mean, is not too big for it?, if it is, can you make a smaller version for 8gb devices?
Thanks
Click to expand...
Click to collapse
yes, but i think 1.5gb is small for 64bit rom
Dyt199412syam said:
Do i need to reinstall rom after i did system repartition used this method bro?
Click to expand...
Click to collapse
sure, and all your data will be lost
inunxelex said:
resize system partition to 1,5gb using fastboot, run partition.bat
download
Click to expand...
Click to collapse
Can you give more details. i.e the fastboot command. Sorry for noob question and bad english.
hey can you make a bash script for linux users??
Hello I try to follow your guide to try to format my internal sd and try to install a new rom (nor only boots withe fastboot)
This is the result:
Code:
~ # blkid
/dev/block/mmcblk0p25: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
/dev/block/mmcblk0p1: UUID="00BC-614E" TYPE="vfat"
/dev/block/mmcblk1p1: UUID="62E9-39D9" TYPE="vfat"
Click to expand...
Click to collapse
Code:
~ # parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Model: MMC HAG2e (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 67.1MB 134MB 67.1MB fat16 modem
2 134MB 135MB 524kB sbl1
3 135MB 135MB 524kB sbl1bak
4 135MB 136MB 1049kB aboot
5 136MB 137MB 1049kB abootbak
6 137MB 138MB 524kB rpm
7 138MB 138MB 524kB rpmbak
8 138MB 139MB 524kB tz
9 139MB 139MB 524kB tzbak
10 139MB 140MB 524kB hyp
11 140MB 141MB 524kB hypbak
12 141MB 142MB 1049kB pad
13 142MB 143MB 1573kB modemst1
14 143MB 145MB 1573kB modemst2
15 145MB 146MB 1049kB misc
16 146MB 146MB 1024B fsc
17 146MB 146MB 8192B ssd
18 146MB 156MB 10.5MB splash
19 201MB 201MB 32.8kB DDR
20 201MB 203MB 1573kB fsg
21 203MB 203MB 16.4kB sec
22 203MB 237MB 33.6MB boot
23 237MB 1310MB 1074MB system
24 1310MB 1646MB 336MB cache
25 1646MB 1679MB 33.6MB ext4 persist
26 1679MB 1713MB 33.6MB recovery
27 1745MB 1745MB 524kB keystore
28 1745MB 1745MB 32.8kB config
29 1745MB 1812MB 67.1MB oem
30 1879MB 15.8GB 13.9GB userdata
Click to expand...
Click to collapse
Code:
(parted) rm 30
rm 30
(parted) rm 29
rm 29
(parted) rm 28
rm 28
(parted) rm 27
rm 27
(parted) rm 26
rm 26
(parted) rm 25
rm 25
(parted) rm 24
rm 24
(parted) rm 23
rm 23
(parted) mkpart system 461920s 2978502s
mkpart system 461920s 2978502s
Warning: You requested a partition from 461920s to 2978502s.
The closest location we can manage is 3345504s to 3345504s.
Is this still acceptable to you?
Yes/No? Yes
Click to expand...
Click to collapse
I think that rm 30, ... rm 23 dose not delete de partitions
Another error is
Code:
name 25 persist
(parted) mkpart recovery 3699399s 3764934s
mkpart recovery 3699399s 3764934s
[B]Error: Unable to satisfy all constraints on the partition.[/B]
(parted) name 26 recovery
[email protected] ~/Descargas/Redmi 2 $ adb shell
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 944.7M 188.0K 944.6M 0% /dev
tmpfs 944.7M 344.0K 944.4M 0% /tmp
/dev/block/mmcblk1p1 29.0G 14.9G 14.0G 52% /external_sd
~ # blkid
/dev/block/mmcblk0p25: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
/dev/block/mmcblk0p1: UUID="00BC-614E" TYPE="vfat"
/dev/block/mmcblk1p1: UUID="62E9-39D9" TYPE="vfat"
~ # mount -a
mount: mounting /dev/block/mmcblk0p23 on /system failed: Invalid argument
mount: mounting /dev/block/mmcblk0p30 on /data failed: Invalid argument
mount: mounting /dev/block/mmcblk0p24 on /cache failed: Invalid argument
mount: mounting /dev/block/mmcblk0p25 on /persist failed: Invalid argument
mount: mounting /usb_otg on auto failed: No such file or directory
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 944.7M 188.0K 944.6M 0% /dev
tmpfs 944.7M 344.0K 944.4M 0% /tmp
/dev/block/mmcblk1p1 29.0G 14.9G 14.0G 52% /external_sd
/dev/block/mmcblk0p1 64.0M 44.6M 19.4M 70% /firmware
~ # umount /firmware/
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 944.7M 188.0K 944.6M 0% /dev
tmpfs 944.7M 344.0K 944.4M 0% /tmp
/dev/block/mmcblk1p1 29.0G 14.9G 14.0G 52% /external_sd
Click to expand...
Click to collapse
Do you think how can I format the disk and regenerate partitions to install a new rom?
Best regards, Julio.
Back to default
I execute the 1.5gb system partition file on post, and work... after i flash custom rom based lineage os, my system partition is back to default, how to fix it ? i repair via wipe menu partition it doesn't work...
help,
or what rom support custom partition ??
jriosa said:
Hello I try to follow your guide to try to format my internal sd and try to install a new rom (nor only boots withe fastboot)
This is the result:
Code:
~ # blkid
Code:
~ # parted /dev/block/mmcblk0
Code:
(parted) rm 30
rm 30
(parted) rm 29
rm 29
(parted) rm 28
rm 28
(parted) rm 27
rm 27
(parted) rm 26
rm 26
(parted) rm 25
rm 25
(parted) rm 24
rm 24
(parted) rm 23
rm 23
I think that rm 30, ... rm 23 dose not delete de partitions
Another error is
Code:
name 25 persist
(parted) mkpart recovery 3699399s 3764934s
mkpart recovery 3699399s 3764934s
[B]Error: Unable to satisfy all constraints on the partition.[/B]
(parted) name 26 recovery
Do you think how can I format the disk and regenerate partitions to install a new rom?
Best regards, Julio.
Click to expand...
Click to collapse
I dont understand what your problem is.... Reduce the quotings and please concentrate on your problem... To fix your partitiontable you can flash the gpt_both0.bin or flash a fastboot rom
jsidney96 said:
I dont understand what your problem is.... Reduce the quotings and please concentrate on your problem... To fix your partitiontable you can flash the gpt_both0.bin or flash a fastboot rom
Click to expand...
Click to collapse
Hello, thanks for your help.
I have download wt86047_images_5.9.24_20150917.0000.1_4.4_cn version from xiaomi, in the images folder exists the gpt_both0.bin to try to restore the partition disk in my internal sd.
I execute this command in my computer
Code:
fastboot flash partition gpt_both0.bin
and this is the result
target reported max download size of 268435456 bytes
sending 'partition' (33 KB)...
OKAY [ 0.005s]
writing 'partition'...
FAILED (remote: failed to write partition)
finished. total time: 0.027s
Click to expand...
Click to collapse
I think that the partitions in my internal sd disk is protected and I can not modify and reinstall any OS in this disk.
I do not know how can I unlock the internal disk and format the disk and install a new operating system.
Best regards.
Hello again , I have seen this url http://en.miui.com/thread-439425-1-1.html and say that:
A lot of Redmi 2 prime phones get "encryption failure" / "failed to write partition" after upgrading to miui 8 and the only solution is to change the memory chip/motherboard
But I think that it is a problem of software. Bootloader is locked and I can not modify the structure of disk, and I can not unlocked the bootloader and reformat the disk too. The result is the phone is dead, and I can not use it.
Hi, I am in the same situation as @jriosa, with a redmi 2. Moreover, when using parted, having rooted and given permissions, the commands
Code:
rm <partition_number>
even though they don't throw any error, don't remove the targeted partitions.
Is there anything we could do to unbrick our phones? Any help will be really appreciated. Thanks!
jriosa said:
Hello, thanks for your help.
I have download wt86047_images_5.9.24_20150917.0000.1_4.4_cn version from xiaomi, in the images folder exists the gpt_both0.bin to try to restore the partition disk in my internal sd.
I execute this command in my computer
Code:
fastboot flash partition gpt_both0.bin
and this is the result
I think that the partitions in my internal sd disk is protected and I can not modify and reinstall any OS in this disk.
I do not know how can I unlock the internal disk and format the disk and install a new operating system.
Best regards.
Hello again , I have seen this url http://en.miui.com/thread-439425-1-1.html and say that:
A lot of Redmi 2 prime phones get "encryption failure" / "failed to write partition" after upgrading to miui 8 and the only solution is to change the memory chip/motherboard
But I think that it is a problem of software. Bootloader is locked and I can not modify the structure of disk, and I can not unlocked the bootloader and reformat the disk too. The result is the phone is dead, and I can not use it.
Click to expand...
Click to collapse
I dont have a solution for this problem, i dont have a wt86047
reserved
My Redmi 2 sdcard and otg not working can it done by only internal storage.
I have tried and from 23 to 29 I have removed but 30 userdata is not removing giving error that first unmount it, when I will unmount it then parted directory will not be accessible.
What to do is there any way without ext sdcard or otg.
Pls help.
I used the "fastboot flash partition gpt_both0.bin" code and mi phone got black screen without recovery or fastbtoot boot...just black screen. What can I do?
This is the Console log:
fastboot flash partition gpt_both0.bin
Sending 'partition' (33 KB) OKAY [ 0.011s]
Writing 'partition' OKAY [ 0.046s]
Finished. Total time: 0.061s

[GUIDE] Increase your Nexus 4's system partition for more space!

I got tired of installing amazing ROMs created by the talented folks here on XDA, but being held back on things like Google Apps because of the tiny /system partition we have on the Nexus 4. I looked around and found guides to increase the system space in the Nexus 5 and Nexus 7 2013, so I basically just adapted them to work on our beloved Nexus 4.
As always, do this at your OWN risk. I am not responsible for bricking your Nexus 4. I will simply list the process which I used to increase my Nexus 4's system partition (by taking a big ol' chunk from the cache partition). Remember, any sort of modification to your device of this caliber WILL void any warranty you might still have.
REQUIREMENTS:
parted (Uploaded to my Google Drive. If it downloads as a .txt, rename it to remove the extension and make it a plain file)
adb and fastboot, and preferably knowledge on how they work
Step 1: Install TWRP onto your Nexus 4 and reboot into it.
Step 2: Open up command prompt / terminal and check to see if your Nexus 4 is connected properly with "adb devices".
Step 3: Once you've confirmed that adb is fully working and your Nexus 4 is properly connected to your PC, download parted and use adb to push it to your Nexus 4 using the command:
Code:
adb push parted /
Step 4: Now enter the following command:
Code:
adb shell
and then the command:
Code:
chmod +x parted
This will enter adb shell and make the "parted" binary you pushed to your device earlier executable.
Step 5:
Now run the command
Code:
./parted /dev/block/mmcblk0 p
You should see a long list with a bunch of numbers and names in your terminal. These are the partitions on your device. parted will give you the partition number, the "start" and "end" of the partition, the size, and the name.
This is the partition layout on my device. It will probably be the same on your device, though the size of userdata may vary depending on whether you have the 8gb or 16gb Nexus 4.
Code:
~ # ./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 ext2 system
22 1040MB 1627MB 587MB ext4 cache
23 1627MB 15.8GB 14.1GB ext4 userdata
24 15.8GB 15.8GB 524kB DDR
25 15.8GB 15.8GB 507kB grow
Step 6:
Now run the following three commands:
Code:
umount /data
umount /sdcard
umount /cache
Step 7: So, on my Nexus 4, the system partition is number 21, and cache is 22. We're kinda lucky in the fact that system and cache are right next to each other, meaning we don't have to touch any other partition.
You'll want to run these two next commands. These commands will essentially "remove" the two partitions.
Code:
./parted /dev/block/mmcblk0 rm 21
./parted /dev/block/mmcblk0 rm 22
Step 8: Now it is time to recreate these two partitions, however, when recreating them, we will make system bigger and the cache smaller. From the partitions list we got in Step 5, we can see that system starts at 159 and ends at 1040, while cache starts at 1040 and ends at 1627. The following two commands will rebuild /system starting at 159, but ending at 1590, while rebuilding cache at 1590, and ending at 1627. We are essentially stealing a large chunk from cache, since we don't really need that anymore on newer ROMs.
Code:
./parted /dev/block/mmcblk0 mkpart primary 159 1590
./parted /dev/block/mmcblk0 mkpart primary 1590 1627
Step 9: Now run this command:
Code:
./parted /dev/block/mmcblk0 p
This will bring up the partitions list, or table, again. This time, however, we'll see the new partitions where system and cache were, however, they have no names! The following two commands will name the two partitions again.
Code:
./parted /dev/block/mmcblk0 name 21 system
./parted /dev/block/mmcblk0 name 22 cache
Step 10: Great! Now the partitions should be named again! Now, we still have to format the partitions as ext4 so that we can actually use them. The following two commands will do that for you.
Code:
mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p21
mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p22
Step 11: At this point, feel free to run the command from Step 5 to take one more look at the partition table and make sure everything looks good. Now run the command
Code:
mount -a
and then type in
Code:
exit
.
Step 12: Now we are pretty much done. We've extended the system partition from approx. 881mb to 1431mb, which is a nice large chunk of memory. In the future, we could always mess with the partitions more to add even more space by stealing from userdata, but until we reach that point, I think we are pretty well set for now!
Now...
You'll want to reboot TWRP, and flash a new ROM. You can now use a much bigger Google Apps package, without any worries.
Do note, however, that flashing a ROM will "resize" system to be smaller, but this isn't a huge deal. After flashing a ROM, while still in TWRP, you'll want to go to Wipe > Advanced Wipe > check "system" then head to "Repair or Change File System", > then tap on "Resize File System." If you encounter any errors while trying to resize, try remounting system or rebooting TWRP. Afterwards, you should be able to flash your Google Apps package. I'm not sure if you need to repeat these steps after flashing things other than ROMs, but repeating this process within TWRP should work just as well.
I hope I helped y'all out and feel free to post if this guide worked for you or if you have any other comments!
CREDITS:
@surfrock66 for his Nexus 5 guide here.
@rkhat for his Nexus 7 2013 guide here.
RESERVED
Worked Thanx
It worked here on my 8 Gb mako. Here are the original parted output:
Code:
Model: MMC 008G92 (sd/mmc)
Disk /dev/block/mmcblk0: 7818MB
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 ext2 system
22 1040MB 1627MB 587MB ext4 cache
23 1627MB 7817MB 6190MB ext4 userdata
24 7817MB 7818MB 524kB DDR
25 7818MB 7818MB 507kB grow
I'm using Nitrogen OS 8.1 with GZR Gapps
jfsobreira said:
It worked here on my 8 Gb mako. Here are the original parted output:
Code:
Model: MMC 008G92 (sd/mmc)
Disk /dev/block/mmcblk0: 7818MB
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 ext2 system
22 1040MB 1627MB 587MB ext4 cache
23 1627MB 7817MB 6190MB ext4 userdata
24 7817MB 7818MB 524kB DDR
25 7818MB 7818MB 507kB grow
I'm using Nitrogen OS 8.1 with GZR Gapps
Click to expand...
Click to collapse
Awesome! Thanks for letting me know. Glad it worked for you. :good:
thank you very much !
Thx !
Thx !
Great guide works perfectly.. has anyone tried to reverse the process and go back to stock to reflash a factory image?
I just tried it on my old Nexus 4, and after resettting the partitions, and reflashing the factory image, its just a permanent bootloop. I've cleared all the cache, tried a wipe from the stock recovery, tried flashing TWRP and wiping there.. nothing seems to work. Im not too worried, but it'd be nice if it could boot again.
Thanks for your guide. It worked like a charm for my Nexus 4.
Just a small addition: To resize the system partition automatically I placed a script in /system/addon.d:
Code:
#!/sbin/sh
#
# /system/addon.d/10-resize-system.sh
#
. /tmp/backuptool.functions
case "$1" in
backup)
# Stub
;;
restore)
# Stub
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
/sbin/resize2fs /dev/block/platform/msm_sdcc.1/by-name/system
;;
post-restore)
# Stub
;;
esac
If it doesn't work for you
Thanks for this great guide!
Decided to breath some new life into an old N4 in my family and now it's going (very) strong again with LineageOS 15.1. Still had to clear a bit over 100 MB with .gapps-config from Stock-OpenGapps, but that's no biggie. I always liked to start with the big package and then remove everything that I don't need from it.
Second issue gave me some headaches at first.
"Resize File System" in TWRP apparently worked and Gapps-Install went through (~100 MB free at the end), but boot would fail and crash back to recovery.
(I'm using the daily LOS-nightlies by Milaq and Stock-Package from OpenGapps, maybe it's no problem with other ROMs and/or Gapps-Packages.)
Turns out the fix in TWRP wasn't really working, nevermind what partition size it shows for /system afterwards. It's somehow corrupted and still has the original size -> most of the gapps stuff get's written to nirvana, thus the failing boot.
I found the solution over in the Nexus5-Thread:
JekaPinsk said:
Hello guys!
Try this:
1) Install ROM
2) Backup ROM
3) Enable "Use 'rm -rf' instead of formatting" in TWRP settings
4) Format /system
4.1) Unmount /system and use 'resize2fs -f /dev/block/mmcblk0p21' in terminal (TWRP)
5) Reboot TWRP
5.1) Uncheck "Use 'rm -rf' instead of formatting" in TWRP settings
6) Restore backup
7) Install Stock OpenGapps
8) Done!
The idea behind it is that ROM installation somehow corrupt /system partition thus any write operations above normal data region silently fail.
Click to expand...
Click to collapse
at step 4.1 I already changed the partition number to 21 for Nexus4. In the original post it says mmcblk0p25, because on the Nexus 5 that's /system.
Now it works.
In theory this procedure should also work for updating the ROM without losing data, but haven't tested it yet. (Maybe throw in a wipe of /system as step 0...?)
To be clear: This isn't the fault of the guide to resize system-partition.
Problem is (at least certain) ROMs resetting size of file system to original and then TWRP failing to fix that doing it the easy way as described in OP (-> bug in TWRP?).
EDIT:
Above procedure also works for an update without data loss. Only difference was I did a normal wipe of /system first, "step 0" so to say.
No idea if all this is still necessary with TWRP 3.2.3-0, I'm not willing to risk a full wipe at this point. ^^
i need this...can't even install the smallest gapps package after oreo.... word!! thanks!
Really wanted to thank-you for this!
Two questions:
1. When you printed the partitions, system (21) was ext2. When you recreated it after resizing, you created it as ext4. Was that intentional?
2. You also made the claim that modern ROMs don't need such a big cache partition (your new one was 37MB, I wasn't so brave). Can you justify that claim or provide some technical details? It's not that I don't believe you (I trusted you enough to do this on my device!), just merely curious as to why/how this would be.
Thanks!
X:\xxx\xxx\xxx\xxx\adb>adb push parted /
487 KB/s (346680 bytes in 0.695s)
X:\xxx\xxx\xxx\xxx\adb>adb shell
~ # chmod +x parted
chmod +x parted
~ # ./parted /dev/block/mmcblk0 p
./parted /dev/block/mmcblk0 p
Error: Can't have overlapping partitions.
~ # 
Please Help!!!!!!!!!!!!!!!!!!!
caliban2 said:
Thanks for this great guide!
Decided to breath some new life into an old N4 in my family and now it's going (very) strong again with LineageOS 15.1. Still had to clear a bit over 100 MB with .gapps-config from Stock-OpenGapps, but that's no biggie. I always liked to start with the big package and then remove everything that I don't need from it.
Second issue gave me some headaches at first.
"Resize File System" in TWRP apparently worked and Gapps-Install went through (~100 MB free at the end), but boot would fail and crash back to recovery.
(I'm using the daily LOS-nightlies by Milaq and Stock-Package from OpenGapps, maybe it's no problem with other ROMs and/or Gapps-Packages.)
Turns out the fix in TWRP wasn't really working, nevermind what partition size it shows for /system afterwards. It's somehow corrupted and still has the original size -> most of the gapps stuff get's written to nirvana, thus the failing boot.
I found the solution over in the Nexus5-Thread:
at step 4.1 I already changed the partition number to 21 for Nexus4. In the original post it says mmcblk0p25, because on the Nexus 5 that's /system.
Now it works.
In theory this procedure should also work for updating the ROM without losing data, but haven't tested it yet. (Maybe throw in a wipe of /system as step 0...?)
To be clear: This isn't the fault of the guide to resize system-partition.
Problem is (at least certain) ROMs resetting size of file system to original and then TWRP failing to fix that doing it the easy way as described in OP (-> bug in TWRP?).
EDIT:
Above procedure also works for an update without data loss. Only difference was I did a normal wipe of /system first, "step 0" so to say.
No idea if all this is still necessary with TWRP 3.2.3-0, I'm not willing to risk a full wipe at this point. ^^
Click to expand...
Click to collapse
I'm using TWRP 3.2.3-0 and it has this bug, too. After I followed your steps I was able to install Nitrogen OS and Open Gapps Micro in my phone without erros.
Thanks!
I believe that resize2fs step can be packaged as a flashable zip so we can batch flashing without manual intervention to it (i.e. manually resize fs on system after each rom flash) .
ivanich said:
I believe that resize2fs step can be packaged as a flashable zip so we can batch flashing without manual intervention to it (i.e. manually resize fs on system after each rom flash) .
Click to expand...
Click to collapse
Maybe then more users would dare to use this solution and could calmly install gapps on Pie.
You have a lot of experience. What do you suggest?
Hi all. I only discovered this thread after independently figuring out the partitioning scheme (plain GPT) and process.
Sadly, even after this effort, it seems L-OS upgrades won't work unless L-OS devs modify their upgrade script to make use of resize2fs. Here's what happens as of package 2018-09-11:
L-OS runs backup procedure for all addons found in the existing /system/addon.d/
The above creates files (I guess) in /tmp
The /system is unmounted
The partition is overwritten with the image in the upgrade package
The script in addon.d/ are then run to restore the addons from /tmp
The problem is, the partition image in the upgrade package is for the old partition size, and therefore step 5 fails when the free space runs out. It seems the install or restore scripts don't detect this failure, and just exit without reporting an error, with 0B free space on /system.
I'm guessing the problem can be "solved" by formatting the system partition and installing LOS and all addons from scratch, but that's ridiculous. has anyone tried to raise this issue with devs? I'm about to report this in L-OS's JIRA, as I haven't seen any relevant report there.
EDIT: If anyone wants to track: https://jira.lineageos.org/browse/BUGBASH-2306
myxal said:
Hi all. I only discovered this thread after independently figuring out the partitioning scheme (plain GPT) and process.
Sadly, even after this effort, it seems L-OS upgrades won't work unless L-OS devs modify their upgrade script to make use of resize2fs. Here's what happens as of package 2018-09-11:
L-OS runs backup procedure for all addons found in the existing /system/addon.d/
The above creates files (I guess) in /tmp
The /system is unmounted
The partition is overwritten with the image in the upgrade package
The script in addon.d/ are then run to restore the addons from /tmp
The problem is, the partition image in the upgrade package is for the old partition size, and therefore step 5 fails when the free space runs out. It seems the install or restore scripts don't detect this failure, and just exit without reporting an error, with 0B free space on /system.
I'm guessing the problem can be "solved" by formatting the system partition and installing LOS and all addons from scratch, but that's ridiculous. has anyone tried to raise this issue with devs? I'm about to report this in L-OS's JIRA, as I haven't seen any relevant report there.
EDIT: If anyone wants to track: https://jira.lineageos.org/browse/BUGBASH-2306
Click to expand...
Click to collapse
You may be able to fix that on your own by adding an add-on.d named 00-resize-system (so that's it's ran first) that just does "resize2fs /dev/block/.../system", with maybe an unmount before and a mount after. This way, LOS can just flash the full image when upgrading and the system is resized before the other addons.d scripts run.
Fif_ said:
You may be able to fix that on your own by adding an add-on.d named 00-resize-system (so that's it's ran first) that just does "resize2fs /dev/block/.../system", with maybe an unmount before and a mount after. This way, LOS can just flash the full image when upgrading and the system is resized before the other addons.d scripts run.
Click to expand...
Click to collapse
Thanks for the tip, will give that a try. Any idea where I could find an "authoritative" docs/guide to those scripts? Just looked at the one supplied by open g-apps, and I don't really see the difference between the various commands that the script is supposed to handle (which is executed when?). Also what list_file() is supposed to provide.
backup
restore
pre-backup
pre-restore
post-backup
post-restore
myxal said:
Thanks for the tip, will give that a try. Any idea where I could find an "authoritative" docs/guide to those scripts? Just looked at the one supplied by open g-apps, and I don't really see the difference between the various commands that the script is supposed to handle (which is executed when?). Also what list_file() is supposed to provide.
backup
restore
pre-backup
pre-restore
post-backup
post-restore
Click to expand...
Click to collapse
You want to put the resize2fs call in the pre-restore section.
It should look like this:
Code:
pre-restore)
unmount /system
resize2fs /dev/block/platform/.../system
mount /system
;;
This includes unmounting and remounting /system which I think are needed, but YMMV. You'll need to fill in the full path to system under /dev.
There is no authoritative resource for backup scripts that I know of, but the gapps script is a good example.
P.S.: If you make it work, please post the script for others...

NOOK HD+ (Ovation) repit alternative - manually enlarge system partition

I didn't want to tax myself learning how repit works, so I used techniques that I've used for a long time on kindles.
will update if mistakes or improvements are needed. necessary binaries are in the attached zip.
THIS WILL WIPE YOUR SYSTEM PARTITION AND YOU NEED TO KNOW HOW TO GET TO RECOVERY IN SOME STEPS
THIS REMOVES THE FACTORY PARTITON , IF YOU EVER THINK YOU WILL GO BACK TO STOCK/STOCK RECOVERY BACK IT UP
remove factory partition and enlarge system
(I haven't tried this yet, but you could also remove
/system and /cache, leaving /factory alone and making a smaller /cache partition. Steps would be similar, but not exactly as below. /cache on Oreo is barely used, I think 100mb would suffice, giving 350mb additional for /system)
(these assume you have a folder called sdparted with the binaries in your current folder, otherwise just use the correct path))
adb push ./sdparted/parted /tmp
adb push ./sdparted/e2fsck /tmp
adb push ./sdparted/tune2fs /tmp
adb shell
chmod 755 parted
chmod 755 e2fsck
chmod 755 tune2fs
umount /cache
================= remove factory and system
parted /dev/block/mmcblk0
typing "p will show you partition layout
Before
Number Start End Size File system Name Flags
1 131kB 262kB 131kB xloader
2 262kB 524kB 262kB bootloader
3 524kB 16.3MB 15.7MB recovery
4 16.8MB 33.6MB 16.8MB boot
5 33.6MB 83.9MB 50.3MB fat32 rom
6 83.9MB 134MB 50.3MB fat32 bootdata
7 134MB 604MB 470MB ext4 factory
8 604MB 1309MB 705MB ext2 system
9 1309MB 1795MB 487MB ext4 cache
10 1795MB 31.3GB 29.5GB ext4 userdata msftres
====== remove factory and system partitions ========
rm 7
rm 8
====== make system partition ========
mkpartfs primary ext2
Start? 134
134
End? 1309
name 7 system
quit parted
still in adb shell
tune2fs -j /dev/block/mmcblk0p7
e2fsck -fDp /dev/block/mmcblk0p7
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p7
Number Start End Size File system Name Flags
1 131kB 262kB 131kB xloader
2 262kB 524kB 262kB bootloader
3 524kB 16.3MB 15.7MB recovery
4 16.8MB 33.6MB 16.8MB boot
5 33.6MB 83.9MB 50.3MB fat32 rom
6 83.9MB 134MB 50.3MB fat32 bootdata
7 134MB 1309MB 1174MB ext4 system
9 1309MB 1795MB 487MB ext4 cache
10 1795MB 15.6GB 13.8GB userdata
reboot to recovery
install rom and gapps, I use the patched magisk V2 for root
after rom install, before gapps, repair and resize system partition in recovery (I think it needs two tries)

[ROM-EXPERIMENT][FASTBOOT][Clamor's repartition] LineageOS 18.1 Android GO with GMS

HTML:
#include "std_disclaimer.h"
/*
* Your warranty is now void.
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*/
Here is something i wanted to try for a long time. A full package of GMS (Google Mobile Services) Android GO for Nexus 4.
This package includes all Android GO apps that come preinstalled on those phones plus some extra apps that only come with 2GB phones.
Other than that, everyting is the same as in regular LineageOS builds.
Only for Clamor's repartition (needs a /vendor partition).
IMPORTANT: You need to repartiton your device using Clamor's repartitioning script from HERE
Works:
- WiFi
- Bluetooth
- RIL
- Camera
- GPS
- Sensors
- Audio
- NFC
Doesn't work:
- L1 Widevine DRM
- Slimport
Flashing Instruction:
1. Backup all your data (Important).
2. Install fastboot. Here is a guide if you need: https://www.xda-developers.com/install-adb-windows-macos-linux/
3. Download ROM. Reboot phone to fastboot mode. Connect your phone to computer.
4. Open your command line or terminal, cd to directory where you put the ROM.
5. Perform a following command to flash the ROM:
fastboot -w -S 512M update image-mako-lineage-18.1-go-20220801-UNOFFICIAL-fastboot-signed.zip
Click to expand...
Click to collapse
WARNING: This will wipe all user data from phone but it is required if you flashing it first time.
For further updates wiping data is not required and you can remove -w from command line so it'll be:
fastboot -S 512M update image-mako-lineage-18.1-go-20220801-UNOFFICIAL-fastboot-signed.zip
Click to expand...
Click to collapse
Phone will reboot automatically. After first setup give phone some time to update all preinstalled Google apps.
Download: https://drive.google.com/drive/folders/1H3VHwpaRmv43styxZBRU1M9dLEin-UdC
Sources:
Device: https://github.com/voron00/android_device_lge_mako
Kernel: https://github.com/voron00/android_kernel_lge_mako
Vendor: https://github.com/voron00/proprietary_vendor_lge
Credits:
- LineageOS team.
- Google.
- @Ziyan for his great work on camera and other things.
- @Clamor repartitioning script.
- If i forgot someone, please tell me.
Contributors
voron00
Source Code: https://github.com/LineageOS
awesome. after handling clamors repartitioning, it seems to have installed fine so far, first boot takes its time of course
Now it booted and is updating the Apps. Appears to work and feels rather fluent for a recent OS.
i'm really curious about it... so thank you very much!
Is a wipe also needed if I come from your latest June 18.1 Go from here? There was no update for some time over there so I'm interested in this one but am NOT willing to wipe again. There were too many versions I jumped in and after some time abandoned getting updates. No longer interested in setting up the phone from scratch 2-3 times a year.
AraldoL said:
Is a wipe also needed if I come from your latest June 18.1 Go from here? There was no update for some time over there so I'm interested in this one but am NOT willing to wipe again. There were too many versions I jumped in and after some time abandoned getting updates. No longer interested in setting up the phone from scratch 2-3 times a year.
Click to expand...
Click to collapse
It's not abandoned, i just need to find some time to actually build it. Maybe even today.
That sounds great, thank you very much! Btw with the abandoned ones I meant the ones from EricLev, and before the official CyanogenMod and LineageOS for mako.
I tried to download the build linked in #1 but GDrive says the file is in the owner trash.
mcgyver83 said:
I tried to download the build linked in #1 but GDrive says the file is in the owner trash.
Click to expand...
Click to collapse
gms - Google Drive
drive.google.com
Hi!
Just wanted to say thank you again for this ROM.
Runs absolutely nice, pretty fast compared to others, and I do not miss a thing! Though I only use it for music playback ...
I tried to flash via fastboot the last image but I have this issue:
Code:
fastboot -S 512M update image-mako-lineage-18.1-go-20220831-UNOFFICIAL-fastboot-signed.zip
--------------------------------------------
Bootloader Version...: MAKOZ30f
Baseband Version.....: M9615A-CEFWMAZM-2.0.1701.07
Serial Number........: xxxxx (fake number added by me)
--------------------------------------------
extracting android-info.txt (0 MB) to RAM...
Checking 'product' OKAY [ 0.002s]
Snapshot cancel FAILED (remote: 'unknown command')
fastboot: error: Command failed
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 1732MB 1573MB ext4 system
22 1732MB 1994MB 262MB ext4 vendor
23 1994MB 2099MB 105MB ext4 cache
26 2099MB 15.8GB 13.7GB ext4 userdata
24 15.8GB 15.8GB 524kB DDR
25 15.8GB 15.8GB 507kB grow
mcgyver83 said:
I tried to flash via fastboot the last image but I have this issue:
Code:
fastboot -S 512M update image-mako-lineage-18.1-go-20220831-UNOFFICIAL-fastboot-signed.zip
--------------------------------------------
Bootloader Version...: MAKOZ30f
Baseband Version.....: M9615A-CEFWMAZM-2.0.1701.07
Serial Number........: xxxxx (fake number added by me)
--------------------------------------------
extracting android-info.txt (0 MB) to RAM...
Checking 'product' OKAY [ 0.002s]
Snapshot cancel FAILED (remote: 'unknown command')
fastboot: error: Command failed
Click to expand...
Click to collapse
Try with latest fastboot version from here: https://developer.android.com/studio/releases/platform-tools
voron00 said:
Try with latest fastboot version from here: https://developer.android.com/studio/releases/platform-tools
Click to expand...
Click to collapse
I will try. Just to share I'm using this fastboot version sin 2020 to play custom roms for many devices but never had problems.
Maybe the repartition step I did was not good?
This evening I will try with updated fastboot.
voron00 said:
Try with latest fastboot version from here: https://developer.android.com/studio/releases/platform-tools
Click to expand...
Click to collapse
Many thanks, updating adb/fastboot solved my issue!
Many many thanks!
Thanks! Just revived my mako for this. Still this old device don't wanna die.
Tried to flash:
Code:
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
failed to allocate 1472467416 bytes
error: update package missing system.img
Any fix?
image-mako-lineage-18.1-go-20221018-UNOFFICIAL-fastboot-signed.zip (R_asb_2022-10)
voron00 said:
image-mako-lineage-18.1-go-20221018-UNOFFICIAL-fastboot-signed.zip (R_asb_2022-10)
Click to expand...
Click to collapse
This, and also the one in the link above fail to install thanks to a package missing apparently. I have no idea what this does so it could be as simple as me adding a blank file? Not sure. But I'm on a Pemtium M laptop w 2GB RAM so really can't tinker much.
[email protected]:~/Downloads$ fastboot -w -S 512M update image-mako-lineage-18.1-go-20221018-UNOFFICIAL-fastboot-signed.zip-20221225T062808Z-001.zip
--------------------------------------------
Bootloader Version...: MAKOZ30f
Baseband Version.....: M9615A-CEFWMAZM-2.0.1701.07
Serial Number........: 02583b3a5310af35
--------------------------------------------
archive does not contain 'android-info.txt'
fastboot: error: could not read android-info.txt

Categories

Resources