A Marshmellow based AOSP ROM was recently released by billchen1997. To flash it, re-partitioning of the partition table is required.To do so, following procedure can be used.
Note: This procedure doesn't work with nAOSP 6.0 ROM released by mickybart now, please find the appropriate instructions in ROM thread.
Do make a note of few things though:
Procedure:
Notes:
Calculations are not needed now since micybart has modified the TWRP to leave trailing 16384 bytes at end. The TWRP can be found here.
Note: This procedure doesn't work with nAOSP 6.0 ROM released by mickybart now, please find the appropriate instructions in ROM thread.
Do make a note of few things though:
- Internal storage which can be accessed via PC by selecting "File transfer"option manually after connecting.
- Recovery for Me was retained since I had flashed it in fota partition, hence I would recommend flashing recovery in fota partition before hand.
- Performing them on PC would be convenient as some calculations are required.
- Wiping all partitions before hand is recommended.
- Text formatting conventions are used in the code sections to depict different meanings:
- Bold : States the commands to be entered on adb.
- Italic : States what values, usually which varies user to user, has to be entered at the place.
- Underlined : States output shown by a certain command preceding it.
- Repeated x/y/z are variables.
- As pointed out by @GjorgiDxc, the phone is not directly encrypted. We need to encrypt it manually. To do so, flash only the ROM, without gapps or root, boot into ROM and encrypt the phone. More details can be found here. Encrypting data would make data partition inaccessible in TWRP.
Procedure:
- Take backup of Your apps as well as the data from the internal storage (Photos, Music, Video etc) as it will all be wiped.
- Boot into TWRP.
- Goto mount option and untick all partitions.
- On PC, using adb, type out the following commands,
Print the current partition table. Note down the starting cylinder of partition 14, It will be needed further.
Code:[B]adb shell fdisk /dev/block/mmcblk0 p[/B]
- Now delete the sdcard(15) and data(14) partition.
Code:[B]d 15 d 14[/B]
- Create new data partition which uses remaining space.
Code:[B]n[/B] [U]First cylinder (xxx-yyyyyy, default xxx): [/U] [I]You have to enter the start cylinder of partition 14 as read in partition table earlier.[/I] [U]Last cylinder or +size or +sizeM or +sizeK (zzzzz-yyyyyy, default yyyyyy):[/U] [I]Enter the yyyyyy value.[/I]
- Print and write the modified partition table. Note down the "Blocks" value of partition 14 here.
Code:[B]p w[/B]
-
Code:
[U]Command (m for help): [/U][B]t[/B] [U]Partition number (1-14): [/U][B]14[/B] [U]Hex code (type L to list codes):[/U][B] 83[/B] - One of the two paths can be followed here now. It depends on which filesystem is required for data partition, ext4 or f2fs. For ext4, follow the first subsection and for f2fs, second one.
- Now the calculation needs to be done for ext4 file system. From the "Blocks" value of partition 14, subtract 16, since we have to leave 16384 bytes and each block equals 1024 bytes (16*1024=16384).
For Me, the "Blocks" value of partition 14 was 29161464. Hence, my final value was 29161464-16=29161448. Now divide the solution by 4.
Therefore, 29145080/4=7290362. Consider it as final_size. This many blocks will be allocated for the data partition. This needs to be done since the partition needs to be made using blocks size.
- Now we format the data partition such that it acquires the space and as well as leaves the trailing 16384 bytes. This creates a data partition with ext4 type, allocation unit as 4096 and size in blocks as final_size.
Code:[B]mke2fs -t ext4 -b 4096 /dev/block/mmcblk0p14[/B] [I]final_size[/I]
- For f2fs file system, simply run the following command, no need of any calculation:
Code:[B]mkfs.f2fs -r 16384 /dev/block/mmcblk0p14[/B]
- Now the calculation needs to be done for ext4 file system. From the "Blocks" value of partition 14, subtract 16, since we have to leave 16384 bytes and each block equals 1024 bytes (16*1024=16384).
-
Code:
[B]exit adb push -p pure_aosp_marshmallow_r1.zip /tmp/[/B]
- Now on phone, in TWRP, Flash the ROM via install option, and done!
Notes:
- First Reboot is long.
- If after boot it says encryption failed, let it reset the phone. Then it will work properly.
- For root, flashing Update zip of SuperSU from here works.
- Wiping data via TWRP menu will allocate the trailing 16384 bytes to it too, so it is not to be done.
- For gapps, flash Pico gapps from here. Then after reboot and login, go to Settings, Apps>Settings icon at top right> App permissions. Now in each permission, open the permission, select show system from options and enable the permission for all system apps.
- If You get error like "Error retrieving information from sever.[RPC:C:S-7:AEC-7 CDY7-E3OJ-V2TKC]" in Google Play Store and are not able to install any app, then log out and log in again into Your google account via settings.
- If You copy a file and want to access it via TWRP, mount data partition and go to /data/media. Although data won't mount if You encrypt Your phone.
Calculations are not needed now since micybart has modified the TWRP to leave trailing 16384 bytes at end. The TWRP can be found here.
Last edited: