FIREFIREFIRE with dualboot/multiboot support - Kindle Fire General

Hoping someone from the dev thread
reads this. Only reason I can't post there is I am "new".
I'm running into an issue booting using the alternate boot option.
My primary boot is Stock rooted 6.3
My alternate is Pure AOKP ICS with Hashcode 3.0 Kerne
This is my partition table.
Code:
~ # parted /dev/block/mmcblk0 print
parted /dev/block/mmcblk0 print
Model: MMC MMC08G (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 212MB 201MB dfs
5 212MB 229MB 16.8MB recovery
6 229MB 296MB 67.1MB ext4 backup
7 296MB 307MB 10.5MB boot
8 307MB 312MB 5243kB splash
9 312MB 849MB 537MB ext4 system
10 849MB 2241MB 1392MB ext4 userdata
11 2241MB 2369MB 128MB ext4 cache
12 2369MB 5750MB 3381MB fat32 media msftres
13 5750MB 5761MB 11.0MB boot2
14 5761MB 6298MB 537MB ext4 system2
15 6298MB 7690MB 1392MB ext4 userdata2
16 7690MB 7818MB 128MB ext4 cache2
This is from my init.omap4430.rc file
Code:
on fs
log "== init.omap4430.rc: on fs ------------------------"
mount ext4 /dev/block/mmcblk0p14 /system wait ro
mount ext4 /dev/block/mmcblk0p15 /data wait noatime nosuid nodev errors=continue
mount ext4 /dev/block/mmcblk0p16 /cache wait noatime nosuid nodev errors=continue
mount ext4 /dev/block/mmcblk0p8 /dropbox wait noatime nosuid nodev errors=continue
And this is my update-script
Code:
format("ext4", "EMMC", "/dev/block/platform/mmci-omap-hs.1/by-name/system2", "0");
mount("ext4", "EMMC", "/dev/block/platform/mmci-omap-hs.1/by-name/system2", "/system");
......
package_extract_file("boot.img", "/dev/block/platform/mmci-omap-hs.1/by-name/boot2");
The install works fine, and everything seems to go to its correct place. But when I select the alternate boot option it sits indefinitely on the selection screen.

What recovery are you using? Many people are reporting that ClockworkMod seems to have trouble with ROMs using the 3.0 kernel, making them unbootable even on a stock boot layout. TWRP doesn't have issues with it, so I would try that if you're currently using CWM.
If that's not the issue, then try using the "/dev/block/mmcblk0p#" style to specify the partitions in the updater-script. I had some difficulty getting it to play nicely with the "by-name" style for whatever reason, especially with the boot images (I'm not really sure why, though).

eldarerathis said:
What recovery are you using? Many people are reporting that ClockworkMod seems to have trouble with ROMs using the 3.0 kernel, making them unbootable even on a stock boot layout. TWRP doesn't have issues with it, so I would try that if you're currently using CWM.
If that's not the issue, then try using the "/dev/block/mmcblk0p#" style to specify the partitions in the updater-script. I had some difficulty getting it to play nicely with the "by-name" style for whatever reason, especially with the boot images (I'm not really sure why, though).
Click to expand...
Click to collapse
I'm used TWRP 2.0 and 2.1, neither "worked".
The rom installed, that doesn't seem to be the issue, unless I am completely off base.
I was unable to install gapps because moding its install script to goto the mmcblk0p14 caused it to fail, I think it was because it was signed, and I modded it making the md5 invalid. I need to work on that, but that shouldn't cause an issue with booting.
The only thing I can think of is that your boot2 is on p16 while mine is on p13?? would that be the issue?

Changed to
Code:
format("ext4", "EMMC", "/dev/block/mmcblk0p14");
mount("ext4", "EMMC", "/dev/block/mmcblk0p14", "/system");
.......
package_extract_file("boot.img", "/dev/block/mmcblk0p13");
and
Code:
on fs
mount ext4 /dev/block/mmcblk0p14 /system wait ro
mount ext4 /dev/block/mmcblk0p15 /data wait noatime nosuid nodev errors=continue
# mount ext4 /dev/block/platform/mmci-omap-hs.1/by-name/cache /cache wait noatime nosuid nodev errors=contin$
mount ext4 /dev/block/mmcblk0p8 /dropbox wait noatime nosuid nodev errors=continue
This time I am trying to put the 6.3 rooted version on the alternate.
The install occurs with no issue. It just gets stuck at the Alternate Boot menu.
I'm using 0.1, not sure if there is another version of the loader.

Related

[Help] Tablet Bricked as storage may be full but I cannot mount sda1 in recovery

Hi,
I have an Iconia A501 with Tabooney 2.0 rom and booting with ClockworkMod Recovery 5.0
The story : I was unzipping a big file (backtrack img) using gunzip in the /sdcard/BT directory. A nothing was happening after 5 minutes and Ctrl+C did not work I tried to reboot and the tablet hangs at the "Iconia" splash screen.
As the file I tried to gunzip is very big I think that the local storage (that is not a sdcard but mounted in /sdcard) is full.
The recovery boot loader doesn't want to mount /sdcard
I can access to the tabled using adb in recovery mode but I cannont mount the local storage as in fstab it is described as /dev/sda1
Code:
cat /etc/fstab
/dev/block/mmcblk0p4 /cache ext4 rw
/dev/block/mmcblk0p8 /data ext4 rw
/dev/block/mmcblk0p3 /system ext4 rw
/dev/block/sda1 /sdcard vfat rw
/dev/block/mmcblk0p6 /flexrom ext4 rw
but I don't have any sda1 in /dev/block
Code:
ls /dev/block
loop0 loop3 loop6 mmcblk0p1 mmcblk0p4 mmcblk0p7
loop1 loop4 loop7 mmcblk0p2 mmcblk0p5 mmcblk0p8
loop2 loop5 mmcblk0 mmcblk0p3 mmcblk0p6 platform
I tried to mount all of the mmcblk devices but it doesn't work.
So I cannot mount it in order to clean the content.
Please if you have any Idea, tell me. I am also wondering if it is not a hardware failure as I think I should be able to see the device in /dev/block
Thanks
Well, as I missed time I did a factory reset and could boot again. I would have prefered not to loose data :-(.
Anyway if anybody knows a way to mount local storage partition in recovery I think it would be very usefull for many people as it seems it could happen to anybody.

[Q] Can we use EXT4 on our phones?

All the kernels support this, can we format /system, /data and everything else to ext4 and get more speed out of the file system on this phone and if so, how?
The official ROM with 2.6.35 kernel, is already using ext4 for /system /data and /cache partitions.
Code:
$ busybox mount|grep ext4
/dev/block/mmcblk0p12 on /system type ext4 (ro,relatime,barrier=1,nodelalloc,data=ordered)
/dev/block/mmcblk0p13 on /data type ext4 (rw,nosuid,nodev,relatime,barrier=1,nodelalloc,data=ordered,noauto_da_alloc)
/dev/block/mmcblk0p6 on /cache type ext4 (rw,nosuid,nodev,relatime,barrier=1,nodelalloc,data=ordered)
Maybe it is time to get over my fear of the 2.6.35 kernel with its atmel problems and its wifi reboots and update.

[Q] Default CWM Compatible Zip

Has anybody got a default, empty, Nook compatible .zip I can work with?
By this I mean an updater.script with all the mounting block commands etc that I can modify.
Im working on a few things at the mo and struggle with little things like mounting commands
Once /system, /data and /sdcard are mounted properly Im ok with the scripting.
Or, alternatively, once rooted with NookManager, is busybox installed? I can work with busybox
Bear with me Im a NookNoob and still reading, NookST arrived yesterday and dived right in
:edit:
Ok, so Ive found these so far:
0 /tmp ramdisk (null) (null)
1 /boot vfat /dev/block/mmcblk0p1 (null)
2 /system ext2 /dev/block/mmcblk0p5 (null)
3 /cache ext3 /dev/block/mmcblk0p7 (null)
4 /data ext3 /dev/block/mmcblk0p8 (null)
5 /emmc vfat /dev/block/mmcblk0p6 (null)
6 /sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1
7 /sd-ext ext3 /dev/block/mmcblk1p2 (null)
Could someone confirm they are right?

A500 dead internal SD card?

Hi guys, I'm a new poster but long time reader of these boards, which helped me a lot since I got my A500 and an Android phone years ago. So far I've always found a ready solution for my 'droid needs and wants here but this time I think I've hit a bricked (tablet) wall! :laugh::crying:
My A500 has Skrilax_CZ's bootloader v9 with CWM v6.0.4.5 on the secondary partition and for more than a year has been running HenrikE's Android 4.4.4 (OmniROM unofficial) from this thread: http://forum.xda-developers.com/showthread.php?t=2705989 The ROM has been going fine apart from a few random freezes but overall I like it.
Yesterday I was using the tablet to read a book and it started running Play store auto updates, I went to look at the store app to check which apps etc, then switched back to my book and the tablet froze. Normally I'd just long press the power button and then press it again to turn it on, so I did, only this time the ROM would not boot anymore and the tablet got stuck at the bootloader screen. I went into recovery and wiped cache and dalvik, no change. I went back to recovery and then I realized the partitions aren't mounting nor can be formatted! /system, /data, /cache, nothing:
E: format_volume: make_extf4fs failed on /dev/block/mmcblk0p3
Without much hope I reinstalled the ROM with a data/factory reset and that of course didn't fix it. Tried to erase userdata and cache with fastboot, no change. It looks like either my internal SD card is broken/not found or my partitions are horribly corrupted? mmcblk0 isn't showing on /dev, see below from adb shell:
/dev/block # ls
loop0 loop2 loop4 loop6 mmcblk0p5 zram0
loop1 loop3 loop5 loop7 vold
/dev/block # fdisk /dev/block/mmcblk0
fdisk: can't open '/dev/block/mmcblk0'
/dev/block # parted
Error: No device found
Retry/Cancel? c
c
/dev/block #
/etc # cat fstab
/dev/block/mmcblk0p4 /cache ext4 rw
/dev/block/mmcblk0p8 /data ext4 rw
/dev/block/mmcblk0p3 /system ext4 rw
/etc # mount -t ext4 /dev/block/mmcblk0p8 /data
mount: mounting /dev/block/mmcblk0p8 on /data failed: No such file or directory
/etc #
Looking at other threads I guess the next step would be to try an APX reinstall however I use Linux and don't have a Windows machine around. While I can certainly spend my Easter break setting up a Windows Virtualbox :crying: do you guys think this is a hardware fault or something that can be fixed? Many thanks for any input. Oh and yeah I do have the tablet's SBK number.
Edit:
I forgot to paste this:
/etc # cat recovery.fstab
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
/dev/block/mmcblk0p3 /system ext4 ro,noatime wait
/dev/block/mmcblk0p4 /cache ext4 noatime,nosuid,nodev,errors=panic wait,check
/dev/block/mmcblk0p8 /data ext4 noatime,nosuid,nodev,errors=panic,discard,noauto_da_alloc wait,check
/dev/block/mmcblk0p2 /boot emmc defaults recoveryonly
/dev/block/mmcblk0p1 /recovery emmc defaults recoveryonly
/dev/block/mmcblk0p5 /misc emmc defaults recoveryonly
/dev/block/mmcblk0p3 /system ext4 defaults recoveryonly
/dev/block/mmcblk0p4 /cache ext4 defaults recoveryonly
/dev/block/mmcblk0p6 /flexrom ext4 defaults recoveryonly
/dev/block/mmcblk0p8 /data auto defaults recoveryonly
/dev/block/mmcblk1p1 /mnt/sdcard vfat defaults recoveryonly
# vold-managed volumes ("block device" is actually a sysfs devpath)
/devices/platform/sdhci-tegra.2/mmc_host/mmc1 /storage/sdcard1 auto defaults voldmanaged=sdcard:auto
/devices/platform/tegra-ehci.2 /storage/usbdisk0 auto defaults voldmanaged=sda:auto
/etc #
Hi all, I've narrowed it down to a bad sector on the tablet's internal storage and posted on this older thread about the same problem http://forum.xda-developers.com/showthread.php?t=1691729&page=5

[GUIDE][WORK IN PROGRESS]Oneplus one - resize system partition and maybe even more

WARNING!!!​Everyone is responsible for the proper functioning of their device. This guide is the result of personal experiments and I'm not responsible for any damage caused to your device as a result of improper use of its contents.
Introduction
Stock partitions layout has a 1.3Gb /system partition that is too small for users that flash modern custom roms + some kinds of google apps.
This is a step by step guide to change the layout of the partitions table with a bigger /system partition.
How
On OnePlus One, stock partition table looks like the following
Code:
... ... ...
/dev/block/mmcblk0p14 : start= 294912, name="system"
/dev/block/mmcblk0p15 : start= 3006464, name="persist"
/dev/block/mmcblk0p16 : start= 3072000, name="cache"
... ... ...
/dev/block/mmcblk0p28 : start= 4521984, name="userdata"
/dev/block/mmcblk0p29 : start= 121552896, name="grow"
With this layout, resizing the /system partition may seem difficult because it's close to other very important partitions.
So I've experimented with another approach. By resizing userdata partition, and relocate the /system partition at the beginning of the resulting free space, other partitions are left untouched.
There are mainly two (little) issues
almost all custom roms out of there assume that /system partition is 1.3gb of size
on internal storage the old area of /system partition are unused.
For the first point, the solution is to resize the filesystem when you first flash a custom rom. To automatically resize filesystem at every update there is an addon.d script.
For the second point the new free space available (the old 1.3G /system partition) can be used as a new /cache partition.
And, again, the new free space available (the old /cache partition) can be the famous /vendor partition (that is out of the scope of this guide).
This guide uses the sfdisk tool from util-linux. In my opinion, it's more powerful than parted and it's easy to use via script.
IMPORTANT - Before you start
Obviously, this method is destructive regarding userdata partition, so make a full backup of your data.
Manually resizing filesystem of /system partition is needed only once because the addon.d script will ensure that everything works as expected. The only exception is when you wipe /system and flash a new rom
Prerequisites
a working TWRP recovery installed on device
knowledge of adb tools
a statically cross compiled sfdisk tool (you can self compile, or use the one attached below)
this addon.d script (thanks to @osmosis)
flashable zip of a custom rom (and optionally gapps, magisk etc etc etc)
flashable zip bacon-resize-system.zip (attached on this post)
Let's go
enter TWRP recovery and connect phone on a PC
push sfdisk into a temporary dir and ensure is executable
Code:
adb push sfdisk-arm /tmp
adb shell
cd /tmp
chmod 755 sfdisk-arm
make and pull a backup of your partition table (there is also the 64Gb stock layout in attachments)
Code:
./sfdisk-arm -d /dev/block/mmcblk0 > bacon.gpt
exit
adb pull /tmp/bacon.gpt
looking into the partition table you see that userdata partition starts at sector 4521984.
So in order to resize partition (for example 53G instead of 55,8G).
Code:
adb shell
cd /tmp
umount /data
umount /sdcard
echo "4521984,53G" | ./sfdisk-arm --no-reread -N 28 /dev/block/mmcblk0
. Scrolling down the output of this command the new userdata partition is
Code:
Device Start End Sectors Size Type
/dev/block/mmcblk0p28 4521984 115671039 111149056 53G unknown
so the start sector of /system partition will be 115671040 (115671039+1)
relocating system partition at the end of the new userdata partition(size now will be 2,8G)
Code:
echo "115671040,+" | ./sfdisk-arm --no-reread -N 14 /dev/block/mmcblk0
reboot recovery (kernel need to reload partition table)
Code:
reboot recovery
format userdata with TWRP(no wipe... full format)
push custom rom with adb and flash with TWRP (without rebooting)
flash bacon-resize-system.zip
finish.. you can now reboot or continue with flashing gapps, magisk etc etc (but now with a bigger system partition)
Rollback
TODO
Nice to have
flashable zip for addon.d script (WIP)(DONE)
[*] looking into the partition table you see that userdata partition starts at sector 4521984.
So in order to resize partition (for example 53G instead of 55,8G).
Code:
adb shell
cd /tmp
umount /data
umount /sdcard
echo "4521984,53G" | ./sfdisk-arm --no-reread -N 28 /dev/block/mmcblk0
Click to expand...
Click to collapse
If I understand correctly, the system partition will now be 2.8 GB larger. So it will have a total of about 4.1 GB. Is that so?
BTW this is very good work. :good::good::good::good:
BoquinhaSK said:
If I understand correctly, the system partition will now be 2.8 GB larger. So it will have a total of about 4.1 GB. Is that so?
Click to expand...
Click to collapse
the /system partition are 'moved' at the end of the resized userdata partition.. so it's only 2.8G
I've made this decision for two reasons
no needs to move critical partitions
the unused space (the old /system partition) can be used in another way(for example a larger cache partition or a vendor partition)
BoquinhaSK said:
BTW this is very good work.
Click to expand...
Click to collapse
Thanks a lot
Michele
EDIT: another reason for this method is that almost all custom roms works
I have one small problem. Internal storage (/sdcard) I haven't defined. Is it defined as "Invalid partition selection." Full storage is for /data.
How I can mount /sdcard?
Edit: I mean this: /sdcard, /storage/emulated/0, /data/media/0
I changed partition system to ext2 in TWRP.
And system partition si bigger. This works.
Edit2:
I have problem with flash new ROM. Flashing change filesystem from ext2 to ext4 always with smaller previous value. I have problem maybe with script. But I try it again tomorrow.
BoquinhaSK said:
I have one small problem. Internal storage (/sdcard) I haven't defined. Is it defined as "Invalid partition selection." Full storage is for /data.
How I can mount /sdcard?
Edit: I mean this: /sdcard, /storage/emulated/0, /data/media/0
Click to expand...
Click to collapse
after formatting /data the filesystem is empty.. these directories are created when you first start android(if not found)
BoquinhaSK said:
Edit2:
I have problem with flash new ROM. Flashing change filesystem from ext2 to ext4 always with smaller previous value.
Click to expand...
Click to collapse
This is normal. Starting from nougat/oreo the building process of an android system creates a block-based flashable zip.
This means that the system partition is preformatted in ext4 and (for Oneplus One) with a size of 1.3G (the original /system partition). So you cannot change the type of filesystem.
BoquinhaSK said:
I have problem maybe with script. But I try it again tomorrow.
Click to expand...
Click to collapse
Check if the script has the right permission (I'll update the guide).
Also keep in mind that, like others addon.d scrips, it works only with the OTA updater.
If you flash directly from recovery (changing rom, or dirty flash) you need to manually repeat the steps described for resizing partition and installing the script.
I've planned to create a flashable zip to automate these steps.
Thanks
Michele
little update... I've uploaded a simple flashable zip that resize filesystem of /system partition and install the addon.d script.
The procedure now is more simpler.
ilmich said:
little update... I've uploaded a simple flashable zip that resize filesystem of /system partition and install the addon.d script.
The procedure now is more simpler.
Click to expand...
Click to collapse
Hi ilmich, I followed your guide while flashing LOS 17.1 on my OPO and this allowed me to have a /system partition large enough to be able to have a large GApps installation, so cheers for that! However, I installed an OTA update on LOS 17.1 today (29/10 update) and that rebooted to TWRP which seemed to have installed the zip, but then entered a boot loop with several "Could not find x for ctl.interface_start" on the dmesg log. I can see the resizesystem script in the addon.d folder but something must've gone wrong because the partitions seem to have been restored to its default and /system seems to be 1.3GB again in TWRP. I will pull the partition table and post it here.
Update:
I was wrong, /system seems to be the same size on running sfdisk. The cause of the update fail must be somewhere else. Here's the /system partition from sfdisk:
Code:
/dev/block/mmcblk0p14 : start= 115671040, size= 5881856, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=B17FA16F-3B1D-8D12-329D-88B49B096554, name="system", attrs="GUID:60"
I still don't understand why TWRP displays /system as 1303MB again though. Any idea?
Still working...?
Are you still working on this guide?
I'ld love to try it, but I'm a little frightened since there seem to be issues about future udates of Lineage (see previous post).
Zyndstoff said:
Are you still working on this guide?
I'ld love to try it, but I'm a little frightened since there seem to be issues about future udates of Lineage (see previous post).
Click to expand...
Click to collapse
Sorry for the late reply. For sure, but for now, I don't have with me my opo.
But if I understand correctly
BoquinhaSK said:
Update:
I was wrong, /system seems to be the same size on running sfdisk. The cause of the update fail must be somewhere else.
Click to expand...
Click to collapse
update problems are not the repartition procedure.
BoquinhaSK said:
I still don't understand why TWRP displays /system as 1303MB again though. Any idea?
Click to expand...
Click to collapse
I suppose that TWRP is built with 1.3Gb size limit (like everything that is based on opo device tree) and without mounting the filesystem show this static value.
But the power of this procedure (and the resize script) is that you can safely install your preferred rom. The filesystem is expanded in order to fill the 'new' partition size.
During my experiments, I've updated a lineage os (also simulating OTA by pushing a recovery command into the /cache partition), with and without GAPPS.
This guide, if executed step by step, should be safe.
I'm testing again my procedure. This is my situation
Code:
bacon:/ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/block/mmcblk0p14 2.7G 1.0G 1.7G 38% /
/dev/block/mmcblk0p28 52G 15G 37G 30% /data
I've latest official lineageos with some Gapps.
Now I'm waiting for an official OTA to see if anything goes wrong.
Hi all,
I've uploaded a new bacon-resize-system.zip that fixes the issue with OTA (wrong escape sequence when creating survival script in the updater binary).
Thanks all for the bug report.
Cheers
Michele
ilmich said:
Hi all,
I've uploaded a new bacon-resize-system.zip that fixes the issue with OTA (wrong escape sequence when creating survival script in the updater binary).
Thanks all for the bug report.
Cheers
Michele
Click to expand...
Click to collapse
Hello sir,
I am still using OPO in 2021 and i want 5gb system partition.. What will be start and end sectors for that changes? I am really confused so can you please recreate your post for 5gb and will you post it in reply?
Another one question if i flashed stock rom via fastboot then it will restore partition size to default or changes still remain which we did?
Thank You.
pbankar7 said:
Hello sir,
I am still using OPO in 2021 and i want 5gb system partition.. What will be start and end sectors for that changes? I am really confused so can you please recreate your post for 5gb and will you post it in reply?
Another one question if i flashed stock rom via fastboot then it will restore partition size to default or changes still remain which we did?
Thank You.
Click to expand...
Click to collapse
Code:
adb shell
cd /tmp
umount /data
umount /sdcard
echo "4521984,51G" | ./sfdisk-arm --no-reread -N 28 /dev/block/mmcblk0
After that
Code:
Device Start End Sectors Size Type
/dev/block/mmcblk0p28 4521984 111476735 106954752 51G unknown
After this
Code:
echo "111476736,+" | ./sfdisk-arm --no-reread -N 14 /dev/block/mmcblk0
Am I right for 4.8gb??
Please answer of this 2 questions
1. If i flashed stock rom via fastboot then it will restore partition size to default or changes still remains which we did?
2. It is necessary to flash bacon-resize-system.zip everytime whenever we flash new custom rom or after ota updates?
Thank You.
ilmich said:
WARNING!!!​Everyone is responsible for the proper functioning of their device. This guide is the result of personal experiments and I'm not responsible for any damage caused to your device as a result of improper use of its contents.
Introduction
Stock partitions layout has a 1.3Gb /system partition that is too small for users that flash modern custom roms + some kinds of google apps.
This is a step by step guide to change the layout of the partitions table with a bigger /system partition.
How
On OnePlus One, stock partition table looks like the following
Code:
... ... ...
/dev/block/mmcblk0p14 : start= 294912, name="system"
/dev/block/mmcblk0p15 : start= 3006464, name="persist"
/dev/block/mmcblk0p16 : start= 3072000, name="cache"
... ... ...
/dev/block/mmcblk0p28 : start= 4521984, name="userdata"
/dev/block/mmcblk0p29 : start= 121552896, name="grow"
With this layout, resizing the /system partition may seem difficult because it's close to other very important partitions.
So I've experimented with another approach. By resizing userdata partition, and relocate the /system partition at the beginning of the resulting free space, other partitions are left untouched.
There are mainly two (little) issues
almost all custom roms out of there assume that /system partition is 1.3gb of size
on internal storage the old area of /system partition are unused.
For the first point, the solution is to resize the filesystem when you first flash a custom rom. To automatically resize filesystem at every update there is an addon.d script.
For the second point the new free space available (the old 1.3G /system partition) can be used as a new /cache partition.
And, again, the new free space available (the old /cache partition) can be the famous /vendor partition (that is out of the scope of this guide).
This guide uses the sfdisk tool from util-linux. In my opinion, it's more powerful than parted and it's easy to use via script.
IMPORTANT - Before you start
Obviously, this method is destructive regarding userdata partition, so make a full backup of your data.
Manually resizing filesystem of /system partition is needed only once because the addon.d script will ensure that everything works as expected. The only exception is when you wipe /system and flash a new rom
Prerequisites
a working TWRP recovery installed on device
knowledge of adb tools
a statically cross compiled sfdisk tool (you can self compile, or use the one attached below)
this addon.d script (thanks to @osmosis)
flashable zip of a custom rom (and optionally gapps, magisk etc etc etc)
flashable zip bacon-resize-system.zip (attached on this post)
Let's go
enter TWRP recovery and connect phone on a PC
push sfdisk into a temporary dir and ensure is executable
Code:
adb push sfdisk-arm /tmp
adb shell
cd /tmp
chmod 755 sfdisk-arm
make and pull a backup of your partition table (there is also the 64Gb stock layout in attachments)
Code:
./sfdisk-arm -d /dev/block/mmcblk0 > bacon.gpt
exit
adb pull /tmp/bacon.gpt
looking into the partition table you see that userdata partition starts at sector 4521984.
So in order to resize partition (for example 53G instead of 55,8G).
Code:
adb shell
cd /tmp
umount /data
umount /sdcard
echo "4521984,53G" | ./sfdisk-arm --no-reread -N 28 /dev/block/mmcblk0
. Scrolling down the output of this command the new userdata partition is
Code:
Device Start End Sectors Size Type
/dev/block/mmcblk0p28 4521984 115671039 111149056 53G unknown
so the start sector of /system partition will be 115671040 (115671039+1)
relocating system partition at the end of the new userdata partition(size now will be 2,8G)
Code:
echo "115671040,+" | ./sfdisk-arm --no-reread -N 14 /dev/block/mmcblk0
reboot recovery (kernel need to reload partition table)
Code:
reboot recovery
format userdata with TWRP(no wipe... full format)
push custom rom with adb and flash with TWRP (without rebooting)
flash bacon-resize-system.zip
finish.. you can now reboot or continue with flashing gapps, magisk etc etc (but now with a bigger system partition)
Rollback
TODO
Nice to have
flashable zip for addon.d script (WIP)(DONE)
Click to expand...
Click to collapse
I'm interested in installing Ubuntu touch on my OnePlus One but since I used this guide successfully to resize my system partition I don't think I can install it without restoring the partition tables. How can I restore the partitions properly without bricking my phone?
Hi all. Please help.
I ruined my OPO phone.
iI followed the steps correctly.
After reboot the system partition cannot mount.
I see in the log:
Failed to mount '/system' (invalid argument)
My GPT after the change:
/tmp # fdisk -l /dev/block/mmcblk0
Found valid GPT with protective MBR; using GPT
Disk /dev/block/mmcblk0: 122142720 sectors, 2296M
Logical sector size: 512
Disk identifier (GUID): 98101b32-bbe2-4bf2-a06e-2bb33d000c20
Partition table holds up to 32 entries
First usable sector is 34, last usable sector is 122142686
Number Start (sector) End (sector) Size Code Name
1 16384 147455 64.0M 0700 modem
2 147456 148479 512K 0700 sbl1
3 148480 148543 32768 0700 dbi
4 163840 163903 32768 0700 DDR
5 180224 182271 1024K 0700 aboot
6 182272 183271 500K 0700 rpm
7 196608 229375 16.0M 0700 boot
8 229376 230375 500K 0700 tz
9 230376 232423 1024K 0700 pad
10 232424 235495 1536K 0700 modemst1
11 235496 238567 1536K 0700 modemst2
12 238568 259047 10.0M 0700 oppodycnvbk
13 259048 279527 10.0M 0700 oppostanvbk
14 115671040 121552895 2872M 0700 system
15 3006464 3071999 32.0M 0700 persist
16 3072000 4120575 512M 0700 cache
17 4120576 4153343 16.0M 0700 recovery
18 4153344 4156415 1536K 0700 fsg
19 4161536 4161537 1024 0700 fsc
20 4161538 4161553 8192 0700 ssd
21 4161554 4163601 1024K 0700 misc
22 4163602 4196369 16.0M 0700 LOGO
23 4196370 4261905 32.0M 0700 DRIVER
24 4261906 4327441 32.0M 0700 reserve1
25 4327442 4360209 16.0M 0700 reserve2
26 4360210 4376593 8192K 0700 reserve3
27 4376594 4507665 64.0M 0700 reserve4
28 4521984 115671039 53.0G 0700 userdata
29 121552896 122142686 287M 0700 grow
/tmp # cat /etc/fstab
/dev/block/mmcblk0p1 /firmware vfat rw 0 0
/dev/block/mmcblk0p14 /system ext4 rw 0 0
/dev/block/mmcblk0p28 /data ext4 rw 0 0
/dev/block/mmcblk0p16 /cache ext4 rw 0 0
/tmp # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 1.4G 32.0K 1.4G 0% /dev
tmpfs 1.4G 28.0K 1.4G 0% /tmp
/dev/block/mmcblk0p16
503.9M 8.4M 495.5M 2% /cache
/dev/block/mmcblk0p28
52.2G 180.0M 52.0G 0% /data
/dev/block/mmcblk0p28
52.2G 180.0M 52.0G 0% /sdcard
dimitrios5000 said:
Hi all. Please help.
I ruined my OPO phone.
iI followed the steps correctly.
After reboot the system partition cannot mount.
I see in the log:
Failed to mount '/system' (invalid argument)
My GPT after the change:
/tmp # fdisk -l /dev/block/mmcblk0
Found valid GPT with protective MBR; using GPT
Disk /dev/block/mmcblk0: 122142720 sectors, 2296M
Logical sector size: 512
Disk identifier (GUID): 98101b32-bbe2-4bf2-a06e-2bb33d000c20
Partition table holds up to 32 entries
First usable sector is 34, last usable sector is 122142686
Number Start (sector) End (sector) Size Code Name
1 16384 147455 64.0M 0700 modem
2 147456 148479 512K 0700 sbl1
3 148480 148543 32768 0700 dbi
4 163840 163903 32768 0700 DDR
5 180224 182271 1024K 0700 aboot
6 182272 183271 500K 0700 rpm
7 196608 229375 16.0M 0700 boot
8 229376 230375 500K 0700 tz
9 230376 232423 1024K 0700 pad
10 232424 235495 1536K 0700 modemst1
11 235496 238567 1536K 0700 modemst2
12 238568 259047 10.0M 0700 oppodycnvbk
13 259048 279527 10.0M 0700 oppostanvbk
14 115671040 121552895 2872M 0700 system
15 3006464 3071999 32.0M 0700 persist
16 3072000 4120575 512M 0700 cache
17 4120576 4153343 16.0M 0700 recovery
18 4153344 4156415 1536K 0700 fsg
19 4161536 4161537 1024 0700 fsc
20 4161538 4161553 8192 0700 ssd
21 4161554 4163601 1024K 0700 misc
22 4163602 4196369 16.0M 0700 LOGO
23 4196370 4261905 32.0M 0700 DRIVER
24 4261906 4327441 32.0M 0700 reserve1
25 4327442 4360209 16.0M 0700 reserve2
26 4360210 4376593 8192K 0700 reserve3
27 4376594 4507665 64.0M 0700 reserve4
28 4521984 115671039 53.0G 0700 userdata
29 121552896 122142686 287M 0700 grow
/tmp # cat /etc/fstab
/dev/block/mmcblk0p1 /firmware vfat rw 0 0
/dev/block/mmcblk0p14 /system ext4 rw 0 0
/dev/block/mmcblk0p28 /data ext4 rw 0 0
/dev/block/mmcblk0p16 /cache ext4 rw 0 0
/tmp # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 1.4G 32.0K 1.4G 0% /dev
tmpfs 1.4G 28.0K 1.4G 0% /tmp
/dev/block/mmcblk0p16
503.9M 8.4M 495.5M 2% /cache
/dev/block/mmcblk0p28
52.2G 180.0M 52.0G 0% /data
/dev/block/mmcblk0p28
52.2G 180.0M 52.0G 0% /sdcard
Click to expand...
Click to collapse
have you figured it out?
i was succeeded, through
Failed to mount '/system' (invalid argument)
i have seen also.
i was able to sideload lineage and boot it.
After rebooting into recovery the error message was away.
After that i sideloaded lienage again, then bacon-resize-system.zip.
After that i was able to sideload Gapps Nano, the required size check was successful
Oh wait, you have OPO Phone, not OnePlus One
you can try to restore your partiotion table from backup created earlier
Bash:
./sfdisk-arm -f /dev/block/mmcblk0 < bacon.gpt
OnePlus One (Bacon) 3/64
twrp-3.6.0_9-0-bacon.img
lineage-18.1-20211223-nightly-bacon-signed.zip
open_gapps-arm-11.0-nano-20220112.zip

Categories

Resources