• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [GUIDE] Custom MTD (system/data/cache) Layout for Desire with AmonRA 2.0.x

Rastaman-FB

Extreme Android User
Sep 11, 2009
6,113
1,010
UK
Long title i know but this needs to be done as all guides refer to clockwork and a few questions are asked but not answered with regards to whether this is possible with AmonRA and or a custom Alpharev hboot setup.

YES IT IS

1st things 1st, you must have S-OFF from Alpharev AlphaRev 1.8 1.8 is the latest and i would recommend flashing to this is you are on 1.5 or below
I was on N1table but it should work with all (other than oxygen)
Use "quick system info" from the market to determine your minimum layout requirements

Get the needed files from here [DEV][S-OFF] Custom MTD Partitions (resize data, system, and cache) - xda-developers and place them into a folder of choice on the SDCARD (i made one called "00CustomMTD" so it appeared at the top of the list

Create a file on the root of the SDCard called "mtdpartmap.txt" in the txt files put the values of the layout you are wanting to create (in my example i put "140 25" which is 140 system and 25 cache) - do not use quotes

once you have the files in place boot to recovery and make a nandroid backup with ext (remember this is amonRA 2.0.x)
Power down the device and boot back to hboot then select fastboot, connect device and use the following commands:
Code:
fastboot erase system
fastboot erase data
fastboot erase cache

select recovery then go to "flash zip from sdcard" navigate to your folder and choose "bravo-recovery-v1.5.3-CustomMTD.zip"
once complete you will need to reboot recovery, you cannot do this in amonRA so open command prompt on pc and use :
Code:
adb shell reboot recovery
once rebooted go back to backup/restore and restore your backup but do not reboot
once you have restored go back to "flash zip from sdcard" navigate to your folder and choose "bravo-boot-v1.5.3-CustomMTD.zip"
once done "reboot system now" and you will have your new custom layout

note: use system info to see your new layout
 
I have read and understood the procedure and the principle of custom partitioning the internal flash. Now I have another question. On the Alpharev site, there are several versions of HBOOT with custom MTD layouts. How are they built? I have performed a binary comparison between 2 versions and I have not been able to sort the things out (changing bytes between them to take into account the endianness hasn't helped).
 
Upvote 0
the alpharev hboots are not custom. By custom here, we refer to the ability to set your own custom sizes, not whatalpharev have designed.

Alpharev controls the partition sizes via hboot but these custom layouts are defined by a text file which is then used to patch recovery and romm boot.img

2 totally different methods to achieve the same thing, however with this method you can define your own sizes.

Rastaman's guide is if you use amon ra as your recovery. If you use clockwork, the original version of this is linked in my signature.
 
Upvote 0
Thank you for your answer.

the alpharev hboots are not custom. By custom here, we refer to the ability to set your own custom sizes, not whatalpharev have designed.
Well, I must admit that you are right. They are adapted by ieftm & co according to the most popular ROMs.

Alpharev controls the partition sizes via hboot (...)
This is precisely what I would like to understand and maybe do it: control the partitions sizes via hboot. I have found nothing on the internet so far. Maybe I am using the wrong query terms...

(...) but these custom layouts are defined by a text file which is then used to patch recovery and romm boot.img
I have understood that too: the kernel is forced to "find" the partitions at specific places via the command line by rebuilding the boot.img (for the rom and for the recovery).
 
Upvote 0
Hi

I tried it as per your instructions, but I still had the same layout.

I'm not sure if it was because I created the TXT file in TextEdit on the Mac, and changed the extension to .TXT, or if it was because the second time I changed the text in the file to " mtd 120 20 " (minus the ")

In the end I created the mtdpartmap.txt file using TextEdit, but changed it to a plain text file using the format menu and choosing the "make plain text" option, before saving it. (see attachment)

It didn't brick my phone, or cause any issues when I booted, but I still had the same layout when I used the renamed .RTF file instead of a true .TXT file. After using the proper .TXT file with mtd 120 25 in, it worked perfectly.

Thanks:D
 

Attachments

  • Textedit plain text.jpg
    Textedit plain text.jpg
    20.6 KB · Views: 272
Upvote 0
Ok, I just tried flashing my own custom MTD and the results are in. I wanted to set system at 260 (from 250) and cache at 30 (from 202) with the rest for data. In the mtdpartmap.txt I put "mtd 260 30" (minus parentheses)

It seems after going through the process above, I've got system at 260 but the cache is still at 202 which leaves not a great deal room left for data.

Any thoughts, help or suggestions on why this might've happened and what to do next?

Would love some advice on this -thanks!
 
Upvote 0
What ROM are you using?

The reason I ask is that I don't think you actually have a 202 MB /cache partition. 260 system + 202 cache would be 462 MB, which is larger than the internal space available on a Desire (stock configuration is 250 system + 40 cache + 147 data = 437 MB). I suspect that your ROM is using some other trick, such as an ext partition or a RAM disk, in place of the cache for market downloads and so the size of cache you see there is not the actual cache partition size. For example, I'm using dGB (which uses a temporary RAM disk for market downloads) with a 5MB /cache, but Quick System Info thinks my system cache is 203 MB.

What /data size do you think you have? I suspect that has not changed, because you've increased /system by 10MB and reduced /cache by the same (40 -> 30). If your ROM is using some other trick for market downloads you can probably get away with a much smaller /cache.
 
  • Like
Reactions: BobbyKSmooth
Upvote 0
Hi Hadron, thanks for the reply.

This is my first ever attempt at anything like this and it's taken me two weeks of solid reading and trial and error to get this far, so I'll do my best to explain what I've done!

I'm using AceSMod007-3D here: [ROM] AceSMod007-3D (Sense 3.0 | GB 2.3.5 | A2SD+) [STOCK | CM7] [v28 | 19/02] - xda-developers

I created a 1Gb partition on my SD card and used A2SD transferring the Dalvik Cache with Terminal Emulator. I did notice after installing the apps I wanted/needed that I was starting to get internal memory messages, which led me to trim back to only the essential apps. Hence my attempt at this.

If I understand you correctly, you're absolutely right those numbers don't add up. Quick System Info tells me the following:

Internal storage: 148mb /15mb
System storage: 260mb / 17.27mb
System cache: 202mb / 202mb

(A grand total of 610mb? Not possible surely?)

Also A2SD is 0.98Gb / 720mb

As I said, I had intended to set the custom MTD at 260 system 30 cache with the rest for data. Could it be the ROM is interfering with that?

Any further thoughts on why this might be happening or what next? I've managed to get this far without help but feel a bit stuck on this one.
 
Upvote 0
OK, I'm sure that the "cache" is misleading, i.e. isn't really showing the size of your cache partition. I don't know this ROM, so don't know what solution it is using, but it clearly has some way of dealing with small cache partitions if there is a CM7r2 version (that table uses a 5MB cache partition). Without downloading and dissecting the ROM I don't know what that solution is, but your numbers look like I suspected: 148 MB system = default, which is what I'd expect if you make /system 10MB larger and simultaneously shrink /cache by the same amount. I rather suspect that this would work fine with 250 system, 5 cache, which would gain you 35MB.

One question: why did you increase the size of /system? You now have 17MB free rather than 7MB, but unless you plan on moving stuff into /system that is just wasting space.

OK, back on topic. Your ext partition is clearly being used, but as this is a Sense 3.0 ROM that may just be the ROM using it. To be honest, unless you have a lot of apps, or some app has gone crazy with its data usage, you have too little space left in /data so I suspect the a2sd may not be working. You could use a root capable file browser to see what is actually using it (Root Explorer or ES File Explorer). Or you could try reinitialising the DarkTremor a2sd script: open a terminal emulator and type

su
a2sd reinstall

After that the phone will reboot. Then try

su
a2sd cachesd

See whether this makes a difference to your free space.
 
  • Like
Reactions: BobbyKSmooth
Upvote 0
Ah, my resizing of the system cache is probably showing up my inexperience there. I thought that was a fluctuating figure and that by adding an extra 10mb it might buy it some more 'breathing room' as it were. I'm guessing now that is not the case and I should reduce it to 250 again?

I reinitialised the Dark Tremor script as suggested and it was successful. However, the numbers didn't change at all.

I have ES File Explorer installed already - what should I be looking for?

If I flash CM7r2 instead would that buy me more space or am I barking up the wrong tree there? Should I stick with using a custom table?

Thanks once again for your help.
 
Upvote 0
It's probably worth reading the root memory faq again.

The Desire has 3 internal storage partitions: /system, /data and /cache. The sizes of all of these are fixed. The way the custom mtd works is that you specify the sizes of /system and /cache, and the rest is left for /data (which is what is shown as the "internal storage" space on the phone.

What you should look for? It's been a while since I used an a2sd script, so I can't give a definite answer and have to rely on memory. You need to look at the whole system, rather than the sd card (the default). Touch the star ("favourites") icon and select "/". You may have to enable "root explorer" in the settings. Just look in sdext and see what seems to be in there. Look for a dalvik-cache directory, for example (may be inside a "data" directory or something similar). Also an app directory. And see whether there is anything inside them.

You might also learn something by using the infamous terminal emulator and typing

su
ls -l /data/app

If that shows as a link (e.g. something like "/data/app -> /sdext/...) that would suggest that it's set up correctly.

Question is, how many apps have you got if it is working and only have 15MB left? I could believe that if the dalvik cache was still internal, but otherwise it should take effort to fill 133MB. Are any apps using crazy amounts of data (Quick System Info can display apps sorted by data size, and even the manage applications menu can sort by total size)? Remember that system apps use space for their data too.
 
  • Like
Reactions: BobbyKSmooth
Upvote 0
Ok, so I had a look in sdext and Dalvik Cache and it seems there is plenty in there - so I guess that is a good thing. Running the line on Terminal Emulator gave me a link to sdext/apps so that seems to be set up correctly too.

Sorting the apps by size showed that the second biggest for data use (after Contacts) was MyFitnessPal with 25mb. All others were 5mb or less (and I don't have that many). I guess that must be the problem but I do use it everyday.

Is there any way around this with a custom mtd or am I going to have to bite the bullet and just delete the app? Would an alternative ROM be worth considering?
 
Upvote 0
Second biggest after contacts? How much space was contacts using? I have several hundred contacts and order of 1000 phone numbers, and Contacts Storage is using 1.4 MB. If your contact storage is > 25MB it's worth looking into that a bit deeper. It may be that you have a lot of duplicated data - the normal contacts display hides this, but if you edit a contact you may see the duplication (or multiplication). This is something that does sometimes happen, and a known cause of low memory problems (it comes up in the non-root low memory threads often enough).
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones