[Q] Edit ROM (scatter file) for different partition sizes? - Android Q&A, Help & Troubleshooting

So I have a phone (ZOPO C2 Platinum B ver) with 32GB internal memory, divided with about 1.5GB for /data partition, and the rest for /sdcard partition.
Is it possible to edit the scatter file of my ROM to edit these partitions? So all memory or at least 8GB is on /data?
I know there are possibilities for Link2SD and whatnot, but this solution seems so much cleaner.
I included my scatter file. Maybe it's just a matter of moving some address ranges? Or would I need to edit something completely else? And how would I go about that?
Please help me out
edit: nevermind, got it working. Had to edit EBR1 and EBR2 using hex editor.

Related

Size of /system ?

Hi everyone,
I just wondered how big the /system partition should be?
Because I wanted to install a custom keyboard with a flashable .zip, but it's not working. So I tried to put it in /system by myself, but actually, there is no space, what also should be the reason for CWN not beeing able to flash it...
My partition is 315.87mb, according to root explorer, an 0mb left. Is this the normal size? My App folder is only around 100mb... Where is the other space??
Thanks!
The /system partition size on every single Atrix out there is exactly 320 MB. There is no known way to change that. That is the raw partition size - once it is formatted to contain a filesystem, some of that will be lost, depending on the actual filesystem (ext3, ext4, ...).
Also, questions should go to Q&A.
Thanks a lot for the quick reply!
I believe there are methods to grow through linking to /osh but I have not researched. However, you already have the option to move (root explorer) other apps to /data if you need to free up space.
Sent from my MB860 using Tapatalk 2

[GUIDE] Enlarge DATAFS partition and get rid of Internal SD (UMS)

Tired of running out of space in the /data partition? I found a way to get rid of the UMS partition and enlarge the DATAFS partition on our beloved Galaxy S II.
WARNING: with this guide you can brick your phone and it's not intended for novice users, you have to know what you're doing.
Theory about partitions
The internal MMC (/dev/block/mmcblk0) contains partition information in two areas, one standard, the GPT partition table and in another area Samsung-specific, the PIT. With odin (or heimdall) you can simply upload a new PIT and flag for repartition, this way both the PIT and the GPT get updated. I think the PIT needs to be updated in order to use Odin for flashing stock firmware.
Creating a modified PIT file
You can get your current PIT file by downloading it with heimdall or getting a stock one for your specific model from the internet. I attached the stock one for my phone, I9100 16GB (original_I9100_16GB.pit).
Code:
$ heimdall download-pit --output mypit.pit
After you got the original PIT you can edit it with PIT Magic, a Windows .NET tool to edit PIT information, you can also run it with mono on linux/osx.
Open the file in PIT Magic and go to PIT Entry list #11, the DATAFS partition. We need to focus on two fields, the "Block size", that's the block where the partition starts and "Block count", the size of the partition in blocks. The next partition must start on the block given by the sum of the previous partition block size and block count.
In order to enlarge the DATAFS partition, just raise the value in the block count field, keeping in mind the size of a block is 512 bytes. The next partition (UMS, the internal sd) must start as stated above, so just write the correct value in the block size field of the #12 partition. I suggest to keep the UMS partition if you're running a stock or stock-derived rom, just make it very small (in the attached PIT I made it about 50MB, small-ums_I9100_16GB.pit), but if you're running an AOSP flavor of android you can get rid of the UMS partition and the HIDDEN one (/preload). Keep in mind the sum of block size and block count of the #12 UMS partition must be exactly the number in the block size of the #13 HIDDEN partition (or the DATAFS must end on the last block of the HIDDEN partition if you're getting rid of the last two partitions).
After you saved the new pit file, just upload to your phone with heimdall or odin.
Code:
$ heimdall flash --repartition --pit newpit.pit
You can have a look at the new partition table in recovery, with an adb shell, using parted. You can see the same numbers as the ones in the PIT file using the command "unit s" then "print".
Code:
$ adb shell
~ # 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) unit s
unit s
(parted) print
print
Model: MMC V3U00M (sd/mmc)
Disk /dev/block/mmcblk0: 30777344s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 8192s 49151s 40960s ext4 EFS
2 49152s 51711s 2560s SBL1
3 53248s 55807s 2560s SBL2
4 57344s 73727s 16384s PARAM
5 73728s 90111s 16384s KERNEL
6 90112s 106495s 16384s RECOVERY
7 106496s 311295s 204800s ext4 CACHE
8 311296s 344063s 32768s MODEM
9 344064s 1392639s 1048576s ext4 FACTORYFS
10 1392640s 29720475s 28327836s ext4 DATAFS
11 29720476s 29720575s 100s fat32 UMS
12 29720576s 30769151s 1048576s ext4 HIDDEN
Change android storage layout
Now we have to tell android to ignore the internal partition and use the external sd card as the main one. If you just want to swap the two, just google around, there are plenty of guides about this.
We have to edit two files, /system/etc/vold.fstab and storage_list.xml inside /system/framework/framework-res.apk. I have attached an update.zip for samsung stock roms (no-internal-ums-samsung.zip) and for cyanogenmod 10.1 (no-internal-ums-cm10.1.zip), if you use one of these, you can skip the following details, the updater will take care of the modifications.
In vold.fstab we just have to remove references to the internal sdcard and change the mount point for the external one to /storage/sdcard0.
The other file, storage_list.xml is trickyer, as it's inside an apk. This file contains a list of all the storage the hardware can handle. We need to remove the internal sd card from this file. In order to do this you need apktool. These are the command I used to extract the apk.
Code:
$ java -jar /Android/apktool1.5.2/apktool.jar if framework-res.apk
$ java -jar /Android/apktool1.5.2/apktool.jar if twframework-res.apk
$ java -jar /Android/apktool1.5.2/apktool.jar d framework-res.apk
Now you have to edit framework-res/res/xml/storage_list.xml as follow for a samsung stock derived rom:
Code:
In order to repack the apk:
Code:
$ java -jar /Android/apktool1.5.2/apktool.jar b framework-res/ framework-res.apk
For the samsung stock you have to copy the signature from the original apk (the META-INF directory and AndroidManifest.xml).
Code:
$ zip -r ../framework-res.apk META-INF
$ zip -r ../framework-res.apk AndroidManifest.xml
CyanogenMod 10.2
In order to use this method with cm 10.2, repartition (removing both ums and preload or by resizing them) and add this in /system/build.prop (in order to make the external sd the main storage).
Code:
persist.sys.vold.switchexternal=1
ro.vold.switchablepair=/storage/sdcard0,/storage/sdcard1
No need for update zip, just repartition and edit build.prop
Files
original_I9100_16GB.pit
small-ums_I9100_16GB.pit
no-internal-ums-samsung.zip
no-internal-ums-cm10.1.zip
Credits
I would have never succeeded in making this guide if I hadn't found these useful forum posts on xda.
[GUIDE] External2Internal Ultimate
PIT file method to revive your phone from a MMC_CAP_ERASE brick
Sd card swapping on cm 10.2
Can this be used on other Sammy modles? Mrs got a galaxy ace and it can only get about 5 apps on with latest stock rom
Sent from my GT-I9100 using xda premium
+1 for this post this is what have been waiting to see i'm tired of the low internal storage i need to swap it to external 32gig mmc kudos to the poster hopes it works with stock 4.1.2 jellybean
garymeg said:
Can this be used on other Sammy modles? Mrs got a galaxy ace and it can only get about 5 apps on with latest stock rom
Sent from my GT-I9100 using xda premium
Click to expand...
Click to collapse
I think it could be done. Just take a look at the partition table or PIT file...
mathy007 said:
+1 for this post this is what have been waiting to see i'm tired of the low internal storage i need to swap it to external 32gig mmc kudos to the poster hopes it works with stock 4.1.2 jellybean
Click to expand...
Click to collapse
I made the update.zip for neatrom, I think it should also work on stock. But with no-internal-ums-samsung.zip it will get rid of internal storage and make external storage as primary.
One more thing must i factory reset the phone because I've already installed apps and games in it,or i just flash the update.zip
mathy007 said:
One more thing must i factory reset the phone because I've already installed apps and games in it,or i just flash the update.zip
Click to expand...
Click to collapse
I suggest to
1) backup your internal sd, as you'll loose everything
2) backup your pit with heimdall
3) backup with cwm or twrp
4) upload new pit with repartition flag
5) format data and restore backup
6) flash no-internal-ums-samsung.zip
If anything goes wrong you can restore your original pit, but beware that if you make changes to crucial partitions you can brick your phone, if you use my pit file, i suggest tolook if oother partitions remain unchanged.
mtpi said:
I suggest to
1) backup your internal sd, as you'll loose everything
2) backup your pit with heimdall
3) backup with cwm or twrp
4) upload new pit with repartition flag
5) format data and restore backup
6) flash no-internal-ums-samsung.zip
If anything goes wrong you can restore your original pit, but beware that if you make changes to crucial partitions you can brick your phone, if you use my pit file, i suggest tolook if oother partitions remain unchanged.
Click to expand...
Click to collapse
thanks I'll keep that in mind
Would this approach be useful for the galaxy s4? With the Google experience rom available there is tonnes of wasted space in the system partition.
Sent from my GT-I9505 using Tapatalk 2
I think it should also work on the s4 as it hase the pit partition and gpt i think, you have to experiment a bit... But if you flash the google experience rom with odin the size mismatch of the partition and the image file can be a problem, you have to find a solution for this, like extracting the files and make an update.zip.
Sent from my GT-I9100 using xda app-developers app
mtpi said:
I think it should also work on the s4 as it hase the pit partition and gpt i think, you have to experiment a bit... But if you flash the google experience rom with odin the size mismatch of the partition and the image file can be a problem, you have to find a solution for this, like extracting the files and make an update.zip.
Sent from my GT-I9100 using xda app-developers app
Click to expand...
Click to collapse
Yeah everyone is using a CWM install zip but many people would love to reclaim that wasted space. Google ROM is 500Mb sitting in a 2.5GB system partition!!
Sent from my GT-I9505 using Tapatalk 2
So I've made people over on the S4 forum aware of your awesome information. Hopefully some devs more experienced than me will adapt the concept.
Question: the S2 has a separate FAT partition for the SDcard. The S3 and 4 have a single partition for data/sdcard with the SD card being an emulated folder of dynamic size.
Ideally we will need to shrink the system partition and maybe preload and reallocate this to data.
Is this possible with your method?
Sent from my GT-I9505 using Tapatalk 2
I believe your idea should work, you just have to make a valid pit file with pit magic, repartition, format the affected partitions and reflash.
Sent from my GT-I9100 using xda app-developers app
mtpi said:
I believe your idea should work, you just have to make a valid pit file with pit magic, repartition, format the affected partitions and reflash.
Sent from my GT-I9100 using xda app-developers app
Click to expand...
Click to collapse
Thanks for the reply. It seems the PIT on the S4 is locked down preventing custom pit files from working...
However one user has successfully used a utility called parted to resize the existing partitions via adb I believe
Sent from my GT-I9505 using Tapatalk 2
rlorange said:
Thanks for the reply. It seems the PIT on the S4 is locked down preventing custom pit files from working...
However one user has successfully used a utility called parted to resize the existing partitions via adb I believe
Sent from my GT-I9505 using Tapatalk 2
Click to expand...
Click to collapse
It's fine if you dont need odin. Take a look here to get you started: http://forum.xda-developers.com/showthread.php?t=1887864
Make sure to have a backup of your partitions before modifying (inside parted: unit s; print)
Can galaxy chat b5330, and s2g i9100g do this too? What about xperia devices? Awesome way to make those storages like old skool gingerbread style.
Sent from My Awesome Paradox ST21i
zzztidurvirus said:
Can galaxy chat b5330, and s2g i9100g do this too? What about xperia devices? Awesome way to make those storages like old skool gingerbread style.
Sent from My Awesome Paradox ST21i
Click to expand...
Click to collapse
Don't know about xperia devices, but among samsung I think all of them are capable of being repartitioned.
Okay, now as for i9100g, do I need to upload the .pit file for you to mod? Or do I need to find the block size and location? Cant wait to see bigger /data size.
Sent from My Awesome Paradox ST21i
can u this mod for galaxy s2 i9100g??
Thing is, I dont know how to locate that internal sd address. Also how to edit that .pit file? Will simple .txt editor enough? I have 32gb now running as internal sd thanks to new jellybean easier vold.fstab edit.
Sent from My Awesome Paradox ST21i

[Q] Space on SD card

Hi!
Partitioned my 32GB sdcard, and put CM10.2 on it, but when I check it I have only about 400mb of space or something like that. I had the same amount of space on a 4GB sdcard I used before. Why am I not able to use up the rest of the GB's?! Can someone tell me how to fix it, I don't know if I'm partitioning wrong or doing something wrong, but I want to be able to have lots of extra space for music, apps, etc. Please help! Thanks!!!
I believe you used a low level utility like dd or similar to flash an image onto a partition.
You need to run fsck on that partition, then run resize2fs to expand the ext2/3/4 partition.
Let's say your partition is /dev/block/mmcblk1p1
You would do (in a terminal):
adb reboot recovery
adb shell
# umount /dev/block/mmcblk1p1
# e2fsck /dev/block/mmcblk1p1
# resize2fs /dev/block/mmcblk1p1
After that, your partition will get expanded to whatever size you made it.
It takes a while so be patient. The larger the partition, the longer it will take.
Zenile said:
Hi!
Partitioned my 32GB sdcard, and put CM10.2 on it, but when I check it I have only about 400mb of space or something like that. I had the same amount of space on a 4GB sdcard I used before. Why am I not able to use up the rest of the GB's?! Can someone tell me how to fix it, I don't know if I'm partitioning wrong or doing something wrong, but I want to be able to have lots of extra space for music, apps, etc. Please help! Thanks!!!
Click to expand...
Click to collapse
if you got a prebaked image of a bootable cm card from somewhere, then it usually has 4 partitions on it that were set to the sizes the author of the card specified.
/boot
/system
/data
/sdcard
You would need to put the card in a PC, and use a disk partitioning utility to resize the partitions
some of the images include additional flash files that you install to expand the card's partitions for you. (succulent's), but
you have to do it as you install for the first time.
I prefer to build the card empty first, and load the boot files and zips manually.
linux tools like gparted, Parted Magic , booting from a live USB or CD work pretty well.
Windows based ones like Easus Partition master, or Paragon, not so good.
Mini Tool partition wizard (windows/free) sometimes works
this looks to be a decent write up
http://www.mobileread.com/forums/showthread.php?t=202660
mikeataol said:
...
I prefer to build the card empty first, and load the boot files and zips manually.
linux tools like gparted, Parted Magic , booting from a live USB or CD work pretty well.
Windows based ones like Easus Partition master, or Paragon, not so good.
Mini Tool partition wizard (windows/free) sometimes works
this looks to be a decent write up
http://www.mobileread.com/forums/showthread.php?t=202660
Click to expand...
Click to collapse
The write-up is also posted on XDA at http://forum.xda-developers.com/showthread.php?t=2098419. It was written back in the days of CM10.1, so to use it for CM10.2 or CM11:
Obtain the boot files: MLO, u-boot.bin, and flashing_boot.img -- as well as the files boot.img and recovery.img, from the /boot partition of the pre-made SD CM image. Make sure that MLO is the first file to copy to the freshly made /boot partition.
Substitute in the appropriate ROM and Gapps zip files corresponding to the particular CM build of interest.

Solved -- Running safestrap on sdcard -- looking for input

So I got tired of my weird configuration of running the apps in a mounts2sd with a second ext4 partition on my sdcard and technically nothing should prevent us from running safestrap on the sdcard. So I looked around and it took me a while but I found Hashcode's source code and spent some time studying all the voodoo he does, and most of it is fairly straight forward. Small breakdown:
* Extend TWRP with ifdef statement to add new buttons
* sh scripts get called to perform the functionality for those button
* Swap out some links in /dev/block when you switch between slots and stock
* The entire boot partition including scripts, TWRP, etc are stored in boot image
* The boot image is stored in the stock system under /etc/safestrap
Like I said before, most of the functionality is done in borne shell scripts, but there is some hardcoding in TWRP like creating the .img file to /ss. I really don't want to try to recompile TWRP at this time. As such, I want to limit my changes to the borne shell and configuration INI files only. The simplest answer is to remap /ss from internal storage to the sdcard storage. Another option is to have "system" and "cache" in the internal storage and moving "data" to the sdcard. The difficulty here is since TWRP is hardcoded to create the .img file under /ss, I need to move it during the format stage which happens in the script. The danger with the first option I don't know if the phone will boot if the sdcard is removed. safestrap looks for that directory to figure out the mappings in /dev/block. I think if the directory is missing then it will attempt to create it. After that, things might go bad.
Anyway, what are your thoughts?
i wish and hope your still working on this..my phone is so low in internal storage..i cant even use a rom slot other than stock,,ive been useing stock slot ,flashing custom rom in stock slot....anyways hope you continue to figure this out..i know lots of people would appreciate it..thanks
So I've tried multiple ways and have had to step away, think about it some more, and come back to it. Essentially I was not able to get system to boot off of the sdcard. However, the good news is today I was able to have system and cache on internal storage and data on sdcard. So here are the keys to the kingdom that I have found....
The CM11 (and I assume other) ROMs there is a /system/etc/kexec/ramdisk.img file. This file is extracted (gunzip < ramdisk.img | cpio -iu) into the root directory "/" (rootfs). There is a shell script "/sbin/fixboot.sh" that gets executed by /init at the start of the android (on fs). That script essentially mounts /ss to /emstorage and does all the loop storage links to the system.img, cache.img, and data.img files. I was able to mount another /ss2 to my sdcard and point the userdata to /ss2/safestrap/rom-slot?/userdata.img. The limitation is that vfat limits all files to 4 GB max, so the userdata.img cannot be more than 4 GB of storage.
So an option is I can create an updated ramdisk.img file. You would just drop this into your /system/etc/kexec directory on the slot-rom you want to use it. The only file changed in ramdisk.img is /sbin/fixboot.sh. ramdisk.img is part of the CM11 distribution so you would need to replace it each time you perform an update on that rom slot. Other than that, safestrap would by default create userdata.img to be in internal storage.
The next part I'm going to look at is to create a f2fs partition on my sdcard and have my userdata use that f2fs partition. I figure I should good considerable more I/O as f2fs is suppose to be a good amount faster than ext3/4 and we wouldn't be going through a loop device from ext3 to vfat for all I/O. In addition, my data partition would no longer be limited to 4GB due to the file limitation size of vfat.
Thoughts...
So Spyder doesn't have f2fs on it so I've been running ext4. The kernel would need to be setup to be compiled with it. I have a second 6Gb partition formatted with ext 4 with writeback journaling but per my timing tests I don't think it has made a difference. Now I have more than enough space left in both the data and internal partitions. I don't know if it is just a placebo effect but my apps do seem to start slightly faster.
There doesn't seem much interest in this but it was a fun exercise for me. This will be good enough for me as I'll probably upgrade my phone sometime in the future.
Sent from my XT912 using XDA Free mobile app

[Q] delete all partition on disk mangment

hi guys
I got a big mistake.I delete all partition phone in disk mangment after my phone was full brick
about 40 partition.now i want create these partitions and flash file to this partitions but I do not know how to do it
what format partition (ext2 or ext4 or etc...)
what name partition?
what size partition?
my phone is lg g pro 2 (D838)
I've extracted all the files needed to the file Kdz but I do not know how to create this partition
please help me
thanks all.

Categories

Resources