yashsingh1/xdaforums huggingface dataset:
[Xiaomi Mi 2] NightHeron:
I have general questions. I have stock bootloader with CWM 6.0.5.0 and sMiui kk. If i choose mikka's way to change my MI2s partition to singleboot, can i flash any MIUI lollipop rom again? Like the latest sMIUI? And i can't understand how to flash mikka's custom bootloader to make things work. Will this affect sth? Any MIUI flash issues ? If there is not the right forum to ask please inform me first
[Xiaomi Mi 2] m11kkaa:
don't confuse singlepartition with merged data partition.

both packages still use the old partition layout. the singlesystem layout just deletes modem1, boot1, system1 and increases the system partition size.

there's nothing special to do about the bootloader. just flash the zip's as usual using miflash and u're done.
[Xiaomi Mi 2] NightHeron:
Ok the next and i hope final question is: do you suggest to merge the data with system as xiaomi did in the last few weeks. Do you suggest both? I mean yours and xiaomi's or there is sth that we have to avoid. Thanks in advance
[Xiaomi Mi 2] m11kkaa:
I totally recommand merging data+sdcard(not system) partitions like Xiaomi did.

There's absolutely no downside(except for ROM compatibility, but CM will support it soon) and Xiaomi should've shipped the phone at the release date with that config.

I'll create new flash packages as soon as I have some time to reverse engineer the new layouts.
[Xiaomi Mi 2] Zosenko:
GRUB

Yes, exactly thats were my questions, when approximately you publish GRUB, i understand that you have pretty work abuot CM12.1 but i mean many users would like to use your GRUB. BTW why CM12.1 has high priority? Isnt enough to have CM12, because in the moment will arrive new Android M and after your CM12.x or whatelse, isnt it?
[Xiaomi Mi 2] m11kkaa:
G4A got a little setback because I had an idea that would change the whole concept(in a very good way both technical and for usability).

I still have to proof that it can work and it really makes things easier for development.

About CM12.1: the current version of CM is very unstable - especially when it comes to audio, camera and call bugs.

I started to work from scratch based on Ivans new sources and am improving it step by step until we reach our old Nexus quality.

This will definitely be helpful (and the base) for all future releases.
[Xiaomi Mi 2] infinitely:
I just want to take a moment and give you a big THANKS for all the work you've been doing. You're probably the best developer for this phone! :o
[Xiaomi Mi 2] infinitely:
Is TWRP 2.8.5.0 also available as a zip somewhere? I only seem to find older versions in the other threads.

EDIT: never mind, found the recovery.img in images folder.

Are these bootloader and recovery compatible with MIUI V6 with merged partitions?
[Xiaomi Mi 2] m11kkaa:
from now on yes :) I just updated both the thread and the downloads, so make sure to read everything again :)

I removed the G4A bootloader and replaced it with a modified Xiaomi bootloader.

TWRP is now at 2.8.7.0 compiled from the new cm-12.1 sources with support for both merged and separated partition layouts.

Also, TWRP supports backing up EFS now, PLS DO THAT!
[Xiaomi Mi 2] m11kkaa:
there was a typo in the code which checks the bootloader version. I've uploaded new packages :)
[Xiaomi Mi 2] INFINUM:
TWRP can switch active \system partition?
[Xiaomi Mi 2] m11kkaa:
It always installs to the currently active partition but there's no need to switch it manually as it's deprecated anyway.
[Xiaomi Mi 2] netweaver2009:
Does your last twrp support f2fs partitions?
[Xiaomi Mi 2] UserC:
Hi M1cha, I've flashed aries_core_unified_single and everything went fine. However, I can't recreate the filesystem for Internal Storage, it just says "Invalid partition selection" when I select it and choose "Repair or Change File System". Connection the phone to the computer shows that there's only 3.44GB of internal storage, do you have a possible solution for this?

Thanks in advance!
[Xiaomi Mi 2] NightHeron:
SOLVED
[Xiaomi Mi 2] gonito:
I have the same problem. Can't recreate the file system for Internal Storage.
[Xiaomi Mi 2] m11kkaa:
"Internal Storage" is a virtual partition. As I wrote in the OP you have to recreate the filesystems fo System,Data and Cache(and in case you use the separated layout, "Virtual SDCard").
[Xiaomi Mi 2] NightHeron:
Errors in process, nothing happens when i flash .bat s..

solved
[Xiaomi Mi 2] eintr:
Got some error...

I turn my mi2 into fastboot mode and

:confused:

---------- Post added at 03:48 PM ---------- Previous post was at 03:45 PM ----------

oh, sorry, saw your reply on this, i'll try.
[Xiaomi Mi 2] eintr:
adb in recovery mode needs authorizing... :eek:

How to authorize in recovery?
[Xiaomi Mi 2] m11kkaa:
by authorizing in Android :)
[Xiaomi Mi 2] thewoZa:
Hi. I've just merged partitions (single unified) but am now unable to install Ivan's 5.1 rom with error "Can't install this package over newer build" even though there is nothing installed! Sudamod 5.1.1 installs ok but I want to go back to Ivan's rom because the sound is much better.

I've googled and found something about editing the edify script to remove the check but have no idea how to! Any help gratefully received...

Thanks
[Xiaomi Mi 2] eintr:
Yeah, that's the problem, the system partition had just been formatted... :silly::silly:

Forget it, I entered dload mode by erasing the aboot partition, formatted data partition and copied the files into it.

dlload mode is really a precious. :D

BTW: Adb in recovery needs android support is really not a good idea.
[Xiaomi Mi 2] Shuvo_bd:
Hi there, I have faced this issue few days back when i used the same package and merged partition for the first time too. Solved this issue by formating the ''Data'' partition from recovery. As, u have noticed TWRP recovery is pre built with package, just go to wipe>Advanced menu> tick only Data partition and press wipe to reformat the partition. After that reboot the device and viola. Now you will be able to see around 27 GB as internal storage.

---------- Post added at 01:20 AM ---------- Previous post was at 01:16 AM ----------

m11kkaa, since i have marged partition using unified singe core package, will i be able to flash all the regular roms out there without any hassle or only those roms that having marged partition patch? I found some CM 11 built exclusively for marged partition, thats why asking. and If i ever want to flash older roms, i assume i have to again split the partition to Xiaomi's original old one using your seperated single pack right?? Thanks in advance.
[Xiaomi Mi 2] m11kkaa:
well you can use all ROM's with support for the new layout. If you want to use an older ROM you have to go back to the old layout.
[Xiaomi Mi 2] INFINUM:
My adb working fine in Android, but in recovery mode it says "unauthorized" (adb v1.0.32). What am I doing wrong?

---------- Post added at 01:23 PM ---------- Previous post was at 01:19 PM ----------

PS I'm using MIUI 5.7.31
[Xiaomi Mi 2] INFINUM:
I resolved it for me. Just changed "ro.adb.secure" to 0 in default.prop.
[Xiaomi Mi 2] No-New-Phone:
Some noob questions regarding flashtools

I read the big red warnings, so i prefer to ask noobish questions more then loosing my phone. It is my goal to flash CM12.1, and I'd like to follow the recommendation in the CM-thread's installation instructions.

So here we go:

Do I need MiFlash4linux to istall aries_core_unified_single? I mean, thes is a collection of flashtools, does one depend on the other, or do they work independently? I have downloaded the whole aries-image-builder-master.zip and unpacked it. I don't know "MiFlash", and thats why "follow the miflash guidelines" is difficult for me. When I look for it, I find this link with an .exe that I cannot run (I am using linux mint right now). In youtube miflash looks easy in windows. But how do I start the gui in linux? Or is it terminal-only?

Regarding the big red warning:

I am not sure about the bootloader, I guess it's still the original one. So I'd prefer to flash_core first. But I need a place to start...
[Xiaomi Mi 2] Shuvo_bd:
m11kkaa, I tried to install Ivan's AOSP 5.1.1, which supposedly needs Xiaomi's new partition layout and a particular Chinese CWM recovery to flash the rom. So from aries_core_unified_single, i manually flashed that CWM using adb which replaced TWRP in built with ur package. I successfully flashed the rom using that but now i m unable access my internal storage. While i try to access gallery, it shows, please insert an SDcard. In the settings menu, its showing i have 27 GB of internal storage. So i decided to tryout aries_core_unified pack. But unfortunately could flash ''flash_partition_table and core'' using Miflash tool. It gives me an error in the midway while trying to flash recovery. Screenshot is attached. Any help would be appreciated. Thanks.
[Xiaomi Mi 2] SkiFire13:
Does TWRP 2.8.7 work with default xiaomi bootloaders?
[Xiaomi Mi 2] m11kkaa:
yes, the custom bootloader is just to add some extra protection when changing the partition table.
[Xiaomi Mi 2] Shuvo_bd:
I m pretty ****ed man. Tried to revert back to Original Xiaomi Partition by flashing fastboot rom. But IDK, its showing unspecified error. I seek ur attention regarding this matter. Please help me out. How can i revert to stock xiaomi partition? Downloaded Stock partition package. Hope it will work.
[Xiaomi Mi 2] MSephiroth:
Same here... I'm feeling very noobish. I didn't change my bootloader or layout or partitions size so i started reading all the instructions and downloaded all the files.

But.... where I can find flash_core.bat ??? Is it possible to have a single package which contains all neccessary files? and a guide step by step?

Sorry guys to bother you with this request but really I find this very confusing.. I'm sure i am missing something and i dont't want to lose my phone messing up with bootloader....

thanks to everyone that will help me and special thanks to Micha that realized this. Your work is the most precious for our community
[Xiaomi Mi 2] SkiFire13:
Flash_core and flash_core_and_partitions_table.bat are in file .zip file you downloaded...

The installation is easy.

Backup everything and save it on the pc. The flash flash_core.bat with MiFlash if you don't have a custom bootloader installed and after flash flash_core_and_partitions_table.bat

Then go to the recovery, wipe menu, advanced and resize all the partitions (sd-card, cache, system, data) and recreate the file system. Now you can restore you backup.
[Xiaomi Mi 2] MSephiroth:
Thank you for your reply!

I'm still having doubt about FlashTool menù: what to select in "Flash Programmer", "Boot Image", "Raw XML File", "Patch XML File" ??
[Xiaomi Mi 2] m11kkaa:
These do only matter when flashing in dload mode( when u can't even enter fastboot anymore)
[Xiaomi Mi 2] No-New-Phone:
Just one more question, regarding step 1: is this obligatory? I installed MiPhone on a Windows PC, but when I try to connect my phone, MiPhone tells me that it cannot connect until I update the phone.

Miflash sees the phone in fastboot, so I could flash the whole image from en.miui.com.
[Xiaomi Mi 2] lokkiyo:
I installed Separated-Single and i hate the dual SD card.

How can i revert to the classic one with only one SD?
[Xiaomi Mi 2] SkiFire13:
Are you using latest M1cha's CM12.1?
[Xiaomi Mi 2] No-New-Phone:
YES! I did it. But I had a heart attac in the process, so I'm glad everything is good now.

I tried to read a lot before changing the partition table, and as some of my questions have remained unanswered, I have some annotations for other noobs.

1.) No, there is no GUI in the linux version. But there's no need for it. There's a .sh-file to execute. That's all.

2.) Until now I don't know how you can see if you have an modified bootloader or an original one. I have googled (better: noobled) about it, and I've learned that "bootloader" and "fastboot" is not the same, so you cannot see it from the fastboot pic if it's a modified version or not. But flashing "flash_core.sh" also installes latest TWRP. Befor flashing, I had TWRP from juliussss. After flashing, it was TWRP not from juliussss. It's worth mentioning, that flashing "flash_core.sh" doesn't touch nothing else: last running OS kept on running as before.

I've seen the new TWRP-version as an indicator that the script does what it should do.

3.) Flashing "flash_partition_table_and_core.sh" resulted in a "hanging" system: after the process came to an end, last OS tried to reboot, but of course hang. That's when I rebooted to recovery. And that's when I got my first heart attac.

Like said in the OP, next step would be to "format system, data, cache". I don't know why, but TWRP -> WIPE -> ADVANCED just gave me errors. (I didn't start TWRP in safe mode, at least I'm as sure as I can be.) What the hack. And adb devices returned "unauthorized". Booo. I hate being a noob. But, for reasons also unknown, I've remembered the old cure from windows systems, wich is: reboot to recovery. Before rebooting, TWRP asked me wheather I want root acces, and I confirmed. And now, finally, I was able to format everything (system, cache, data) to EXT4. Exept "internal storage" and "virtual SD", but, as I've learned, that's what all is about. One Isengard-partition ("one to rule them all"). After the last TWRP-Status-message ("Success!") my heart started beating again.

4.) nothing more to say, just rebooting TWRP again and copying CM12.1 and Playstore to the phone and flashing them.

Thanks, [MENTION=3530648]m11kkaa[/MENTION]! When everything is settled, I'll try to provide some bluetooth logs. I'd love to see some progress there, so it's the least thing I can do.
[Xiaomi Mi 2] MSephiroth:
Thanks guys! I have succesfully flashed aries_core_unified_single so now i have rom partition of 528 mb, internal+media of 3.69 gb and virtual sd card of 25.2 gb (values from titanium backup). However there is something strange... I have 380 mb free in internal+media but i cannot update apps from play Store (maps for example) or install new ones because it keeps saying "insufficient storage space"... Why? Is there a way to encrease that partition taking space from vsdcard? I think is more useful to have more space there for apps and pictures (which are saved in internal by default)... Thank you again for support!

Inviato dal mio MI 2 utilizzando Tapatalk
[Xiaomi Mi 2] SkiFire13:
Did you recreated the partitions?

With aries_core_unified_single I have:

ROM: 1.05GB

Internal+Media: 13.3GB (I have a 16GB Mi2S)
[Xiaomi Mi 2] No-New-Phone:
Virtual SD card will be gone after formatting. I was as well confused in the beginning about the error message when I first tried to format data and system. If you get the same, try to reboot recovery, and answers the question "root" with yes. Then formatting worked for me.

Only format system, cache and data. Then reboot recovery again and have a look at the wipe menu again.

I have 32 GB mi2s, size see screenshot.
[Xiaomi Mi 2] isaacbh:
I don't think I flashed this right..

- I dl aries_core_unfied single

- Put phone in fasboot mode

- I flashed using Miflash flash_core.bat

- I saw that recovery is now TWRP 2.8.7.0

- again put phone in fastboot and flashed flash_partition_table_and_core.bat

- wiped system, data, cache

However... I still have these in wipe menu after reboot:

Dalvik cache

system

data

internal storage

cache

virtual sdcard

usb otg

I shouldn't see virtual sdcard, right?
[Xiaomi Mi 2] No-New-Phone:
See last post before yours. Go on formatting.
[Xiaomi Mi 2] isaacbh:
I don't see format option in recovery. Isn't wipe = format? I just went to wipe - advanced wipe, and selected system, data, cache.
[Xiaomi Mi 2] No-New-Phone:
Correct. That should do the trick.
[Xiaomi Mi 2] isaacbh:
That's what I did.. Maybe you can share your steps you took? Maybe I'm missing something.
[Xiaomi Mi 2] SpPes:
OK, guys,

and now I'm trouble.... I ting I has a long time ago changed the partitions with some sh script, now I flashed the core then core unified single and formatting(wipe) is not possible every time and after reboot too failed, i tryed install miui v6 via mi flash and no go too... what I can try more?

thans for help...

Still I get the error unable to mount '/cache'

please what is wrong?

My daugther will kill me ;-(
[Xiaomi Mi 2] No-New-Phone:
Look at post 100, these were my steps (in addition to what I quoted).

---------- Post added at 10:30 PM ---------- Previous post was at 10:28 PM ----------

I had run that script as well, that should not be the cause of your trouble.
[Xiaomi Mi 2] SpPes:
OK, thanks, now i found the way to format cache, what I need more that the Virtual sSDCard will gone?

Wow and now I got 29Gb cache and w/o Internal storage wtf?.... something is realy not the best....
[Xiaomi Mi 2] isaacbh:
What do I choose in Advanced dialog of Miflash?

Fastboot script: I chose "flash_core.bat"

NvBoot script: ??

and the rest?
[Xiaomi Mi 2] NightHeron:
3. Download M1cha's "aries unified single" package from MiFlash4Linux thread at XDA in Original Android Development

4. UnZip the aries unified single, search for recovery.img then

5. Open in Fastboot mode, and type a. "fastboot oem unlock" b. "fastboot flash recovery recovery.img" and then you have TWRP 2.8.7.0 which can save your phone, open in Recovery mode, and make a full EFS backup from backup menu just to be sure

6. Download MiFlash and flash the two scripts as Micha says in his post. I mean the first to install custom bootloader and the second to repartition your phone. It's simple, you just fastboot your phone, you select under the browse menu of MiFlash and in the first place (ONLY)(YOU DO NOT CHANGE ANYTHING ELSE) which ask a script, you enter flash core bat at first and then the repartition bat. (it will reboot after each flash, dont worry, just dont forget to press Refresh in the MiFlash)

7. After you flash the two scripts, Open in Recovery again and in the Wipe Menu when you go to wipe somewhere there is a script for repartition. Repartition all of them (Don't forget to remove any TWRP theme that you have install)

8. You are able to flash anything on your fresh phone.
[Xiaomi Mi 2] NightHeron:
Flash via USB-OTG, drop there your ROM and flash from there, or save it inside one of your partition, search for AROMA File Manager

http://xdaforums.com/showthread.php?t=1646108

, open it via Recovery and then drop the zip in /etc/temp/ and Install it from here. You should try Miui v7 + setCPU with 1024 max freq tremendous battery life

PS: After Lollipops drop on our life, in MIUI SELinux is non permissive, I suggest you to instal from Play Store "Universal Init.d" install it work it and then from "Root Explore" search /etc/init.d and add a file named "08setperm" with the lines "#!/system/sh

setenforce 0"

http://xdaforums.com/xposed/how-to-set-selinux-to-permissive-boot-t3034245
[Xiaomi Mi 2] isaacbh:
First of all thank you for the detailed help. In recovery, I went to wipe, advanced wipe. I don't see anything about "repartition", just a list of partitions for wiping. I assume I should select system, data, cache (internal storage?). Is that what you mean?
[Xiaomi Mi 2] NightHeron:
I don't remember exactly but i remember when i inserted in wipe menu i choose in example system and in the advance wipe there was another one option which says sth about a script.
[Xiaomi Mi 2] isaacbh:
Hmm I just wiped all partitions. I think it did the trick. Titanium Backup reports 1.05GB for system and 28.9GB for storage. Thx again for your help!

(I'm using Mokee until CM12.1 matures).
[Xiaomi Mi 2] badtzo:
Ok... my mistake..

Guys I think there is some missreading for some of us :p Just to be clear... when the process mean format all the partitions, it is not enough trying to do WIPE for all off them. You need to go to "Repair or Change File System" on Wipe Advance menu, and then touch on "Change File System" and select ext4 every partition one by one. :p

:cyclops: I know it sounds stupid... but at least I wasn't the only one missreading this process. :D

Good luck folks!
[Xiaomi Mi 2] cogano:
Yes, the "change filesystem" label in TWRP is confusing.
[Xiaomi Mi 2] 5ulo:
So this is my procedure:

e@arch $ fastboot reboot
rebooting...

finished. total time: 0.050s
e@arch $ fastboot oem unlock
...
OKAY [ 0.000s]
finished. total time: 0.000s
e@arch $ cd aries_core_unified
e@arch aries_core_unified $ sh flash_core.sh
soc-id: 109
sending 'tz' (196 KB)...
OKAY [ 0.011s]
writing 'tz'...
FAILED (remote: flash write failure)
finished. total time: 0.013s
Flash tz error

I am unable to boot into recovery. But I can boot to recovery with

e@arch $ fastboot oem unlock
e@arch $ fastboot boot recovery.img

Any idea?
[Xiaomi Mi 2] m11kkaa:
once booted into recovery(TWRP, the one of the miflash packages), run "adb reboot dload". this put's the device in a low level flashing mode(miflash4linux supports this as well as the official windows miflash application)

Also, u just need to do "oem unlock" once a lifetime(and after dload flashes)
[Xiaomi Mi 2] 5ulo:
e@arch ~ $ adb reboot dload
error: device unauthorized. Please check the confirmation dialog on your device.

When I'm in CWM theres no unauthorized device. This happens only with TWRP from your package. ADB debug was ON in MIUI.
[Xiaomi Mi 2] m11kkaa:
this recovery image has adb security disabled: https://transfer.sh/SI65b/recovery-insecure.img
[Xiaomi Mi 2] 5ulo:
Thanks.. after adb reboot dload phone looks like it's turned off..

fastboot devices / adb devices shows nothing.

Please keep in mind I don't have recovery installed on my phone. I can boot recovery only from my pc. After reboot is TWRP lost and I need to do the whole procedure oem unlock, boot recovery.img again..
[Xiaomi Mi 2] m11kkaa:
that's normal. it's a special qcom download mode. linux should see it as 'Bus 001 Device 000: ID 05c6:9006 Qualcomm, Inc.'
[Xiaomi Mi 2] 5ulo:
Yep.. visible

Bus 002 Device 035: ID 05c6:9006 Qualcomm, Inc.

But how can I flash at this point?
[Xiaomi Mi 2] m11kkaa:
in linux: ./flashtool/flash.sh path/to/unpacked/flashpackage

DEVICES:
Bus 001 Device 070: ID 05c6:9006 Qualcomm, Inc.

Would flash to 05c6:9006(/dev/sdb) in sd mode

Continue? [y/n]:
[Xiaomi Mi 2] 5ulo:
Hmm.. Do I need any concrete python version?

e@arch aries-image-builder-master $ ./flashtool/flash.sh /home/e/aries_core_unified/
DEVICES:
Bus 002 Device 035: ID 05c6:9006 Qualcomm, Inc.

Would flash to 05c6:9006(/dev/sdc) in sd mode

Continue? [y/n]: y
File "./flashtool/program.py", line 9
print "Programming "+device+" with "+package
^
SyntaxError: Missing parentheses in call to 'print'
File "./flashtool/patch.py", line 80
print "Patching "+device+" with "+package
^
SyntaxError: Missing parentheses in call to 'print'
Done.
[Xiaomi Mi 2] m11kkaa:
yes, python2. you can use virtualenv if you are on arch linux
[Xiaomi Mi 2] 5ulo:
Still no luck.. python 2.7

e@arch ~/aries-image-builder-master $ ./flashtool/flash.sh /home/e/aries_core_unified/images/
DEVICES:
Bus 002 Device 038: ID 05c6:9006 Qualcomm, Inc.

Would flash to 05c6:9006(/dev/sdc) in sd mode

Continue? [y/n]: y
Programming /dev/sdc with /home/e/aries_core_unified/images/
Traceback (most recent call last):
File "./flashtool/program.py", line 72, in <module>
do_program(sys.argv[1], sys.argv[2])
File "./flashtool/program.py", line 15, in do_program
dom = parse('out/images/rawprogram_core.xml')
File "/usr/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
return expatbuilder.parse(file)
File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 922, in parse
fp = open(file, 'rb')
IOError: [Errno 2] No such file or directory: 'out/images/rawprogram_core.xml'
Patching /dev/sdc with /home/e/aries_core_unified/images/
Traceback (most recent call last):
File "./flashtool/patch.py", line 121, in <module>
do_program(sys.argv[1], sys.argv[2])
File "./flashtool/patch.py", line 85, in do_program
dom = parse('out/images/patch0.xml')
File "/usr/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
return expatbuilder.parse(file)
File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 922, in parse
fp = open(file, 'rb')
IOError: [Errno 2] No such file or directory: 'out/images/patch0.xml'
Done.
[Xiaomi Mi 2] m11kkaa:
just replace ./flashtool/flash.sh /home/e/aries_core_unified/images/ with:

./flashtool/flash.sh /home/e/aries_core_unified