[GUIDE] How to flash a ROM on an encrypted device with TWRP. - T-Mobile Samsung Galaxy S 4

THIS WILL WIPE YOUR DATA
Android's encryption of the /data partition cannot be unlocked via TWRP or other recoveries. The normal "wipe data/factory reset" will fail, because /data can't be accessed.
I assume your phone has root, and you know how to get a root shell in ADB. There are tons of guides for that, but very few (none that I could find) for this.
First, in your root shell, run:
Code:
cat /etc/fstab
and copy the output to a text file or such where you can refer back to it. You should get something like this:
Code:
/dev/block/mmcblk0p16 /system ext4 rw
/dev/block/mmcblk0p29 /data ext4 rw
/dev/block/mmcblk0p18 /cache ext4 rw
/dev/block/mmcblk0p10 /efs ext4 rw
/external_sd vfat rw
/usb-otg vfat rw
/dev/block/mmcblk0p1 /modem vfat rw
But the /dev/block/... bits may be different for different devices. Mine is a T-Mobile Samsung Galaxy S 4.
Find the line with /data listed on it. In my case, that's "/dev/block/mmcblk0p29 /data ext4 rw".
Then you'll need just the first part. In my case, that's "/dev/block/mmcblk0p29". Using mke2fs we'll format the appropriate block device as ext4.
Code:
mke2fs -t ext4 /dev/block/mmcblk0p29
If your block device is different, then USE YOURS. Using the wrong block device will format the wrong partition. Formatting the /efs partition has been known to brick phones.
This will take a few minutes to complete. Once done, you will have a blank unencrypted /data partition.
Then you can do a normal data wipe/factory reset, install the rom, etc.

Thanks for sharing this but surely it's a lot easier/safer just to Format Data from TWRP?

doveman said:
Thanks for sharing this but surely it's a lot easier/safer just to Format Data from TWRP?
Click to expand...
Click to collapse
Read paragraph after the all caps

serio22 said:
Read paragraph after the all caps
Click to expand...
Click to collapse
Yes, the normal wipe/factory reset doesn't work when it's encrypted but format does. I just did it myself from TWRP for the very reason that there was no other way to factory reset and it worked fine.

Keyword "format" vs "wipe" , it's like the obelisk from "2001", you don't mess with "format" .
Pp.

PanchoPlanet said:
Keyword "format" vs "wipe" , it's like the obelisk from "2001", you don't mess with "format" .
Pp.
Click to expand...
Click to collapse
Er, from the OP
"Then you'll need just the first part. In my case, that's "/dev/block/mmcblk0p29". Using mke2fs we'll format the appropriate block device as ext4.
mke2fs -t ext4 /dev/block/mmcblk0p29"
So that's just formatting it, with the additional risk of failying to identify the correct dev and formatting something you shouldn't!

Related

[Dev Kernel] 2.6.29 Support for ext2/ext3/ext4/yaffs2

Here is the kernel with yaffs2 and MTD block support, I am missing some mtd util tools like nandwrite so i cannot continue. Those that have the tools like mkyaffs2image, nandwrite, flash_eraseall can try to create an image and mount it
here are the steps that i think should work:
# mknod /dev/mtd0 c 90 0
# flash_eraseall /dev/mtd0
# mkyaffs2image /data/data yaffs2.img
# nandwrite -p /dev/mtd0 yaffs2.img
# mkdir /data/data2
# mount -t yaffs2 /dev/mtdblock0 /data/data2
If you have the tools, please attach so we can continue.. Its getting late so I am going to bed, have fun
Download
yaffs2_support.tar
Oh my god! I was just about to post similar findings, what a coincidence!
I just had compiled a kernel with yaffs2 support. My idea was to modify /init.rc in the kernel to mount the partitions with yaffs2 instead of rfs. Problem: we can't just change the filesystem without backing up and restoring all the files inside. My idea was to do that inside the recovery. Mount a mountpoint, backup with tar to /sdcard, unmount, format with dd (in theory a partition filled with 0's is ok for yaffs2), mount again with yaffs2 and restore from tar.
I'm stuck at the point that I can't seem able to mount any partition with yaffs2 previously formatted (with /system/xbin/busybox dd if=/dev/zero of=/dev/block/stl10). If I mount (/system/xbin/busybox mount -t yaffs2 /dev/block/stl10 /dbdata) there is always an "Invalid argument" error. It happens with /dev/block/stl*, /dev/block/bml* and /dev/block/mmcblk*
I'm no kernel expert, neither I know a lot about yaffs2, but I think I read you can't mount a yaffs2 partition anywhere, it has to be an MTD flash device.
Anyway, I'm going to try with the tools you said. Wish me luck.
Thanks for your work rasdeep! Is it only YAFFS2 and MTD support that you added? Because the kernel already had support for EXT2 and EXT3.
darksnarfer said:
I think I read you can't mount a yaffs2 partition anywhere, it has to be an MTD flash device.
Click to expand...
Click to collapse
Does the kernel that rasdeep posted load the existng flash devices/partitions as MTD devices?
I think as a start you only have to worry about formatting the /dev/block/mmcblk0p2 device which is mapped to the /data directory. With the new lag fix we are only moving directories stored in /data and that is what gives a big performance improvement. RyanZA did tests and found that the /dbdata partition was already quite fast and I don't think we have to worry about the /system partition etc. because we don't really write to them.
I think after a new firmware flash the /dev/block/mmcblk0p2 (mounted as /data) will be safe to format into YAFFS2 without loosing anything important.
I think these are the steps we can do:
1. Flash new firmware with repartition option on to erase everything.
2. Boot into recovery and format /dev/block/mmcblk0p2 as YAFFS2 filesystem.
3. Copy on new a init.rc script which will mount /dev/block/mmcblk0p2 to /data as a YAFFS2 filesystem and not a RFS filesytem to get much faster speeds.
bub181 said:
Does the kernel that rasdeep posted load the existng flash devices/partitions as MTD devices?
Click to expand...
Click to collapse
Just checked, there isn't any /dev/block/mtd* so I guess the kernel still can't see them as mtd.
/data is on the internal SD not in NAND so will we be able to use yaffs2 at all? I was working on formatting to EXT4 and adding the init.rc to match as well as compiling with EXT4 support, but if yaffs2 works, I'm fine with that.
modifying the init.rc is secondary because that is easy.. the main problem now is to be able to manually setup yaffs2 to mount properly.. if everything works like it should, init.rc can be change in matter of seconds
its funny now u said mtd not found.. i know we can mknod /dev/mtd* but there should be /dev/mtdblock* when booting with kernel right? hmm.. something to investigate further..
keep suggestions and finding coming, we may hit something that i've missed
problem is im lacking those tools that will do write to flash directly.. for example nandwrite.. anyone has that can share so i can try more stuff?
also, are my steps for "preparing" yaffs2 partitions/image correct? if anyone familiar with yaffs, please give some insight
raspdeep said:
modifying the init.rc is secondary because that is easy..
Click to expand...
Click to collapse
Do you need to recompile the kernel to modify the init.rc? If not could you post some instructions on how to do it please? I would like to try some things in there before /data gets mounted as a RFS filesystem.
bub181 said:
Do you need to recompile the kernel to modify the init.rc? If not could you post some instructions on how to do it please? I would like to try some things in there before /data gets mounted as a RFS filesystem.
Click to expand...
Click to collapse
i'm afraid so for now until someone found a way to extract the initramfs from later kernel and restore it back after modification..
I think it would be easier to start out with EXT2 since we can easily format that. Just as a proof of concept. I'm planning to do so tonight. Then I'll add support for EXT4 formatting and try that.
raspdeep said:
problem is im lacking those tools that will do write to flash directly.. for example nandwrite.. anyone has that can share so i can try more stuff?
Click to expand...
Click to collapse
Have you seen these pages rasdeep? They seem to describe how to create the YAFFS filesystem. Also, are there any /dev/mtdblock* devices using the kernel that you created? According to what I read elsewhere it is supposed to create both /dev/mtd* and /dev/mtdblock*. I think we have to use /dev/mtdblock* to create the new filesystem.
http://processors.wiki.ti.com/index.php/Create_a_YAFFS_Target_Image
http://processors.wiki.ti.com/index.php/MTD_Utilities
http://processors.wiki.ti.com/index.php/Put_YAFFS_Image_to_Flash
Also, I know that the Nexus One uses YAFFS2 for its internal filesystem. Maybe someone has worked out a way to write a new image file for that and we can use what they have learnt?
Can we potentially use this kernal (with the right tools) to format the NAND in YAFFS2 instead of RFS? Then still have way of flashing firmware onto it?
If so, that would be awesome and it would seem to have the least draw backs.
Currently the A2SD lag fix requires an external microsd card, and the one click lag fix, mounts a EXT2 image ontop of the RFS NAND, and that could drastically affect NAND life.
This is great !!!
Thank you raspdeep and all the devs here, this is one step closer to a stable kernel and a permanent genuine solution for the lag problem as far as a n00b like me understands
cheers !
Daemos said:
Can we potentially use this kernal (with the right tools) to format the NAND in YAFFS2 instead of RFS? Then still have way of flashing firmware onto it?
If so, that would be awesome and it would seem to have the least draw backs.
Click to expand...
Click to collapse
Not if we can't mount the NAND as a MTD-device instead of STL-device.
Daemos said:
Currently the A2SD lag fix requires an external microsd card, and the one click lag fix, mounts a EXT2 image ontop of the RFS NAND, and that could drastically affect NAND life.
Click to expand...
Click to collapse
Say what? /data/ is mounted on the internal SSD, not the NAND. /dbdata/ is however mounted on the NAND. Just do a df -h and you can see all the mountpoints.
Also, mounting and using a ext2-image that reside on an rfs-partition will not damage your drive. The rfs filesystem is still the one used to store the image itself (the ones and the zeros), even though you write it inside an image that uses another filesystem.
I stumbled upon these documents while Googling for STL-devices:
http://www.samsung.com/global/busin...y/downloads/LinuStoreII_GPL Compliance_10.pdf
http://www.samsung.com/global/busin...ionmemory/downloads/RFS_130_Porting_Guide.pdf
I haven't had the time to read them through yet. But if there's a porting guide, there must be a way to reverse it
Go go reverse engineers!
Is it really necessary to format the NAND with another filesystem? /dbdata seems fast enough as it is. Wouldn't it be enough (and easier?) to only convert the internal SD to yaffs2?
Quote from someone that knows a lot more than I do:
yaffs2 won't work on a sdcard
Click to expand...
Click to collapse
http://twitter.com/wesgarner/status/20805997718
So right now we have /data that is mounted in the second partition of the internal sdcard (mmcblk0p2), where all the critical files are stored (data, dalvik-cache, etc..) but we can't use yaffs2 there because it's not MTD.
We could, however, format and mount the other partitions (/system, /dbdata, /cache, etc...) with yaffs2, but that might not help because there isn't many heavy read/write there. And we should figure out how to make the kernel see them as /dev/block/mtdblock* instead of /dev/block/stl*.
rasdeep, can you share the .config for the kernel you used? I managed to get some mtd devices (atleast in /proc/mtd) but they were virtual devices. Maybe we need some more options enabled in the kernel.
Also, anybody knows why there are /dev/block/stl* and /dev/block/bml* they seem the same though.
darksnarfer said:
Also, anybody knows why there are /dev/block/stl* and /dev/block/bml* they seem the same though.
Click to expand...
Click to collapse
According to http://www.samsung.com/global/busin...ducts/fusionmemory/Products_XSR_Brochure.html
STL and BML are independent layers for managing I/O to the NAND devices
STL manages the sector translations while BML manages the invalid blocks (whatever that means)
Did any of you notice that in init.rc there are many references to yaffs2 ? Perhaps in engineering Samsung did use it ?
Chainfire said:
Did any of you notice that in init.rc there are many references to yaffs2 ? Perhaps in engineering Samsung did use it ?
Click to expand...
Click to collapse
Yeah, I think they are just android standard (maybe they took them from a template) and commented to use their better(?) filesystem.
darksnarfer said:
Quote from someone that knows a lot more than I do:
http://twitter.com/wesgarner/status/20805997718
So right now we have /data that is mounted in the second partition of the internal sdcard (mmcblk0p2), where all the critical files are stored (data, dalvik-cache, etc..) but we can't use yaffs2 there because it's not MTD.
We could, however, format and mount the other partitions (/system, /dbdata, /cache, etc...) with yaffs2, but that might not help because there isn't many heavy read/write there. And we should figure out how to make the kernel see them as /dev/block/mtdblock* instead of /dev/block/stl*.
rasdeep, can you share the .config for the kernel you used? I managed to get some mtd devices (atleast in /proc/mtd) but they were virtual devices. Maybe we need some more options enabled in the kernel.
Also, anybody knows why there are /dev/block/stl* and /dev/block/bml* they seem the same though.
Click to expand...
Click to collapse
Ok, so what filesystem does the internal SD use currently? Would it help if we change that to EXT4? That would emulate the current mimocan fix, but without having to use an external SD card.

[Dev Q] mount 2nd ext partition as mmcblk0p3?

Hope this is in the right section, I need help from a developer on this as I don't quite understand what is needed to do this.
I use Gingervillain and the DT a2sd. What I want to do is move my /cache (not dalvik cache but the partition itself) to ext.
I have the commands all ready to do this and that aspect works fine (thanks to help from droidzone).
However, as its sharing the ext partition with DT, when I mount cache there, the apps don't work. Added to which if a market app is downloaded, it downloads the apk to the cache folder I created on ext fine. When it attempts to intall, it fails.
I assume (with my limited knowledge) that there is a conflict here due to multiple mounts on the same partition. I initially thought my mount cache command needed to with the same options that DT mounts, but cant find that reference in his script or the files it calls.
So I have created a 2nd ext partition, but I dont know how to use it. I thought it would automatically be mmcblk0p3, but I cant find it that way using adb.
I know data2ext uses multiple partitions for sqlite etc, but cant for the life of me work this out.
Can anyone point me in the right direction please?
The aim of this is to develop myself a cache2sd solution. I have searched around a lot but can't find one. I thought CM had one but cannot find that either.
Further to this, ls /dev/block lists mmcblk0p3
However,
Code:
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p3 /system/sd
Returns
Code:
failed: Invalid Argument
but
Code:
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /system/sd
Works fine.
Does anyone have any idea how I can use the second EXT partition at all or any tips or info please?
format
rootSU said:
Does anyone have any idea how I can use the second EXT partition at all or any tips or info please?
Click to expand...
Click to collapse
format mmcblk0p3 in ext4 format and mount it
susmaz said:
format mmcblk0p3 in ext4 format and mount it
Click to expand...
Click to collapse
Better 2.5 years late than never
Although that would not have been the answer.
Why do you need this 2nd partition??
If i understnad correctly you want the cache on a ext partition, so the play store can download to this partition and than install the apk to intern bzw. The prim ext??

[Q] Error formatting /data! Error formatting /cache!

Using CWM 5.0.2.0, when I try to format /data, I get:
Error formatting /data!
When I try to format /cache, I get:
Error formatting /cache!
This all started because I decided to try Albinoman's AOSP 4.2 ROM. This is what happened:
1. Booted into CWM 5.0.2.0, made a nandroid backup of stock GB ROM.
2. Installed Albinoman's ROM using CWM, wiped /cache and /data.
3. Booted Albinoman's ROM, no problems. Decided I wanted to backup and restore some apps in the old ROM using Titanium Backup.
4. Restored nandroid backup of stock ROM. When it rebooted, all was well.
5. Used Titanium Backup to back up my apps.
6. Installed Albinoman's ROM again.
7. Cleared /data, it was fine. Cleared /cache. Stuck at "formatting" for half an hour.
8. Rebooted back to recovery and tried it again. Couldn't find E:.
9. Tried letting it boot. Stuck on the boot animation for 30-minutes.
10. Wipe everything and re-flash. Tried again. Still stuck on boot animation.
11. Manually unmount and tried to format /data and /cache, and I get the error messages.
I had installed Convert2Ext4_no_data_limit_normal_dalvik.zip to the stock ROM about 4-months ago, not sure if that makes a difference or not.
When I search, it looks like the news is bad... most people that had this error gave up and believed it to be hardware NAND failure. Anything I can do to confirm or rule out NAND failure?
UPDATE: Managed to flash RUU, but results were interesting. It worked and it boots, home screen is blank (no HTC widgets), and apps I'd installed are still there. Clear Storage and Factory Reset does not get rid of them! I can manually uninstall apps, but when I reboot, they come back. I guess the /data must be stuck in some kind of read-only state.
GnatGoSplat said:
Using CWM 5.0.2.0, when I try to format /data, I get:
Error formatting /data!
When I try to format /cache, I get:
Error formatting /cache!
This all started because I decided to try Albinoman's AOSP 4.2 ROM. This is what happened:
1. Booted into CWM 5.0.2.0, made a nandroid backup of stock GB ROM.
2. Installed Albinoman's ROM using CWM, wiped /cache and /data.
3. Booted Albinoman's ROM, no problems. Decided I wanted to backup and restore some apps in the old ROM using Titanium Backup.
4. Restored nandroid backup of stock ROM. When it rebooted, all was well.
5. Used Titanium Backup to back up my apps.
6. Installed Albinoman's ROM again.
7. Cleared /data, it was fine. Cleared /cache. Stuck at "formatting" for half an hour.
8. Rebooted back to recovery and tried it again. Couldn't find E:.
9. Tried letting it boot. Stuck on the boot animation for 30-minutes.
10. Wipe everything and re-flash. Tried again. Still stuck on boot animation.
11. Manually unmount and tried to format /data and /cache, and I get the error messages.
I had installed Convert2Ext4_no_data_limit_normal_dalvik.zip to the stock ROM about 4-months ago, not sure if that makes a difference or not.
When I search, it looks like the news is bad... most people that had this error gave up and believed it to be hardware NAND failure. Anything I can do to confirm or rule out NAND failure?
UPDATE: Managed to flash RUU, but results were interesting. It worked and it boots, home screen is blank (no HTC widgets), and apps I'd installed are still there. Clear Storage and Factory Reset does not get rid of them! I can manually uninstall apps, but when I reboot, they come back. I guess the /data must be stuck in some kind of read-only state.
Click to expand...
Click to collapse
Did you reflash the Convert2Ext4 mod after you flashed the new rom? See this thread and read the top part after 'IMPORTANT:' There is a link in there to the old thread as well with a lot of info.
I did try that, but my /data and /cache are still unable to be written to, wiped, or formatted.
e2fsck won't touch /data, it has a superblock error. It finds errors on /cache and appears to be fixing them, but when I re-run it, the same errors are still there.
GnatGoSplat said:
I did try that, but my /data and /cache are still unable to be written to, wiped, or formatted.
e2fsck won't touch /data, it has a superblock error. It finds errors on /cache and appears to be fixing them, but when I re-run it, the same errors are still there.
Click to expand...
Click to collapse
Since you flashed the RUU, did you install an EXT4 compatible kernel or are you using the stock kernel? Maybe try restoring your working nandroid backup, then run the .zip to revert Convert2Ext4. Or even better, if you have a nandroid from before you installed the EXT4 mod.
DaggerDave said:
Since you flashed the RUU, did you install an EXT4 compatible kernel or are you using the stock kernel? Maybe try restoring your working nandroid backup, then run the .zip to revert Convert2Ext4. Or even better, if you have a nandroid from before you installed the EXT4 mod.
Click to expand...
Click to collapse
Wiping /data and /cache are enough to revert the mod.
Sent from my Galaxy Nexus using Tapatalk 2
Uggh, definitely doesn't sound so good. Since the RUU won't work, I'd say check out this thread:
http://forum.xda-developers.com/showthread.php?t=2123966
Yep, my partitions are no longer EXT4. #1 is EXT3 and #2 is EXT2. I guess that means Convert2Ext4 is no longer in play and the problem is unrelated.
Here is my parted:
Code:
parted /dev/block/mmcblk0 print
Model: MMC SEM08G (sd/mmc)
Disk /dev/block/mmcblk0: 7944MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8192B 797MB 797MB primary ext3
2 797MB 1007MB 210MB primary ext2
3 1007MB 7944MB 6937MB primary fat32 lba
Yeah, I read that thread and it didn't sound encouraging! I get pretty much the same errors.
Even rm 1 and rm 2 don't remove the partitions. It's like they're read-only. I'm using the parted from CWM 5.0.2.0. Should I use a different one?
Also when I try e2fsck on it:
Code:
~ # e2fsck -pf /dev/block/mmcblk0p1
e2fsck -pf /dev/block/mmcblk0p1
/dev/block/mmcblk0p1: recovering journal
e2fsck: unable to set superblock flags on /dev/block/mmcblk0p1
~ # e2fsck -pf /dev/block/mmcblk0p2
e2fsck -pf /dev/block/mmcblk0p2
/dev/block/mmcblk0p2: Unconnected directory inode 34817 (/???)
/dev/block/mmcblk0p2: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
~ # e2fsck -f /dev/block/mmcblk0p2
e2fsck -f /dev/block/mmcblk0p2
e2fsck 1.41.6 (30-May-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Unconnected directory inode 34817 (/???)
Connect to /lost+found<y>? y
yes
Pass 4: Checking reference counts
Inode 2 ref count is 2, should be 3. Fix<y>? yes
Inode 34817 ref count is 3, should be 2. Fix<y>? y
yes
Pass 5: Checking group summary information
Block bitmap differences: +274 +(449--510) +(645--701) -(139524--139541) -(139
85--139800)
Fix<y>? yes
Free blocks count wrong for group #0 (7919, counted=7799).
Fix<y>? y
yes
Free blocks count wrong for group #17 (7934, counted=7929).
Fix<y>? yes
Free blocks count wrong (198324, counted=198199).
Fix<y>? y
yes
Free inodes count wrong for group #17 (2048, counted=2045).
Fix<y>? yes
Directories count wrong for group #17 (0, counted=1).
Fix<y>? y
yes
Free inodes count wrong (51189, counted=51186).
Fix<y>? yes
/dev/block/mmcblk0p2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p2: 14/51200 files (14.3% non-contiguous), 6601/204800 blocks
When I tried it without the -p is when it looks above like it's fixing something, but it really didn't fix anything because it does the same thing when I try e2fsck again (as if it's read-only).
Is MMCBLK0 one physical NAND chip? If so, how come I can read/write/erase the /emmc with no problems? Isn't that just another partition on the same NAND disk?
If /data and /cache are really bad, is there any possible way to do an equivalent of a low-level format on the NAND and repartition?
Is booting CWM 5.0.2.0 and using adb shell supposed to have root privileges?
I can't modify the partition table using either parted or fdisk. I even tried zeroing the partitions using dd if=/dev/zero of=/dev/block/mmcblk0p1, p2, and even the whole of mmcblk0, but nothing actually gets written.
Since it seems like the NAND is probably irreparably borked, can I approach this problem from a different angle?
Can I partition my sdcard with an ext3 and ext2 partition, and tell Android to use those as /data and /cache respectively?
What in Android maps /dev/block/mmcblk0p1 to /data and /dev/block/mmcblk0p2 to /cache, and can I change those to point to partitions on sdcard?
Or is that hard-coded into the kernel?
GnatGoSplat said:
Since it seems like the NAND is probably irreparably borked, can I approach this problem from a different angle?
Can I partition my sdcard with an ext3 and ext2 partition, and tell Android to use those as /data and /cache respectively?
What in Android maps /dev/block/mmcblk0p1 to /data and /dev/block/mmcblk0p2 to /cache, and can I change those to point to partitions on sdcard?
Or is that hard-coded into the kernel?
Click to expand...
Click to collapse
It is hard coded into the kernel. To get root in adbshell try typimg su. This seems to be happening to more and more people as these phones get up there in age.
GnatGoSplat said:
Since it seems like the NAND is probably irreparably borked, can I approach this problem from a different angle?
Can I partition my sdcard with an ext3 and ext2 partition, and tell Android to use those as /data and /cache respectively?
What in Android maps /dev/block/mmcblk0p1 to /data and /dev/block/mmcblk0p2 to /cache, and can I change those to point to partitions on sdcard?
Or is that hard-coded into the kernel?
Click to expand...
Click to collapse
The answer is yes to both actually. Thrle boot.img would need to be customized. The best way is a flashable zip in recovery. Data and cache would need to be wiped manually ad recovery will not pick this up. Expect poorer performance though as SD cards tend to be slower than built in storage.
Sent from my Galaxy Nexus using Tapatalk 2
Thanks! So it sounds like the way to make this work is to compile a custom kernel? I don't know the first thing about it, but I think I could learn.
This is only in the kernel, so I could flash any 3rd party D-Inc ROM and just flash my customized kernel and it will see /data and /cache on the sdcard?
I could probably get one of those fast Class 10 cards if it turns out this is too slow, but I do recall changing vold.fstab once to fool Android into seeing /emmc as /sdcard and the /emmc (as /sdcard) didn't benchmark all that much faster than a real sdcard. I'm assuming /data and /cache are the same speed as /emmc since they're on the same mmcblk0 device, so I'm thinking maybe sdcard performance would be acceptable.
This actually sounds like it could be a better long-term solution than replacing the motherboard because no telling if a new motherboard will fail soon too.
The motherboard should be reliable. Emmc may die. Especially considering how old current dincs are.
I was talking about the boot.img which is not ROM independent and kernels aren't always either. Best idea is a flashable zip to modify the ram disk but I need the partition names if you decide to do it. I recommend keeping cache and data in the same order.
Also there would need to be a flashable wipe script to wipe data and cache.
Sent from my Galaxy Nexus using Tapatalk 2
Sorry, I wasn't very clear. By motherboard failing, I was assuming NAND is soldered to the motherboard, and if that's the case, ruined NAND = ruined motherboard. I had thought maybe I could buy a DInc with smashed LCD and good motherboard and just swap into mine (because mine is MINT condition), but I thought if I do that, I could very well end up in the same place as I'm in now and using sdcard would be more of a guarantee I wouldn't have to worry about this again.
I think I understand, the boot.img and kernel aren't exactly the same thing, but the kernel is part of boot.img? Or is it only the RAMDisk that needs changed, or both? You mentioned partition names, are you offering to make these modifications for me?
By same order, do you mean because mmcblk0p1 is /data, mmcblk0p2 is /cache, and mmcblkp3 is /emmc, I should partition my sdcard the same way with data 1st, cache 2nd, and sdcard 3rd?
Should I partition it with the phone, PC, or does it matter? Should the sizes of the new /data and /cache be the same size as original, or is there any reason I should make them larger?
Could I wipe the new /data and /cache simply by booting into Recovery and using adb shell and format them?
Also, the commands I was issuing in adb shell were from booting into CWM Recovery. Is it possible that mode can't write because I didn't login as root using the su command? I hadn't thought that would be the problem seeing as how the RUU and Android itself can't write to /data and /cache and other people managed to fix partition problems without needing to run su.
GnatGoSplat said:
Sorry, I wasn't very clear. By motherboard failing, I was assuming NAND is soldered to the motherboard, and if that's the case, ruined NAND = ruined motherboard. I had thought maybe I could buy a DInc with smashed LCD and good motherboard and just swap into mine (because mine is MINT condition), but I thought if I do that, I could very well end up in the same place as I'm in now and using sdcard would be more of a guarantee I wouldn't have to worry about this again.
I think I understand, the boot.img and kernel aren't exactly the same thing, but the kernel is part of boot.img? Or is it only the RAMDisk that needs changed, or both? You mentioned partition names, are you offering to make these modifications for me?
By same order, do you mean because mmcblk0p1 is /data, mmcblk0p2 is /cache, and mmcblkp3 is /emmc, I should partition my sdcard the same way with data 1st, cache 2nd, and sdcard 3rd?
Should I partition it with the phone, PC, or does it matter? Should the sizes of the new /data and /cache be the same size as original, or is there any reason I should make them larger?
Could I wipe the new /data and /cache simply by booting into Recovery and using adb shell and format them?
Also, the commands I was issuing in adb shell were from booting into CWM Recovery. Is it possible that mode can't write because I didn't login as root using the su command? I hadn't thought that would be the problem seeing as how the RUU and Android itself can't write to /data and /cache and other people managed to fix partition problems without needing to run su.
Click to expand...
Click to collapse
The NAND is likely soldered to the motherboard, so you're right about that.
To answer your first question, yeah, the kernel is part of the boot.img. The other part is the RAMdisk which is the only thing that needs to be changed.
Partition it in the same order. Probably parted via adb shell. 100MB for cache and at least 750MB for data. Sizes don't matter too much but you want enough.
adb shell has root access automatically in recovery. The issue is hardware most likely so your proposed workaround may be the only option.
First plan of attack is to find the partition names which would be mmcblk1p1 and mmcblk1p1 if you partition the sdcard the same way as the ROM is partitioned. Ideally you need to be able to fix the partitions themselves. I'll try to give more info later.
I copied the partition sizes from mmcblk0, so here's what I have on my 16GB SD card:
Code:
Model: SD SA16G (sd/mmc)
Disk /dev/block/mmcblk1: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8192B 797MB 797MB primary ext2
2 797MB 1007MB 210MB primary ext2
3 1007MB 16.0GB 15.0GB primary fat32 lba
mmcblk1p1 for /data
mmcblk1p2 for /cache
mmcblk1p3 for /sdcard
Will that work? I couldn't get mmcblk1p1 to show up as ext3. I did use mke2fs -j /dev/block/mmcblk1p1 to format it and I've read ext3 = ext2+journal, so I guess the fact it's not saying "ext3" under filesystem is okay?
GnatGoSplat said:
I copied the partition sizes from mmcblk0, so here's what I have on my 16GB SD card:
Code:
Model: SD SA16G (sd/mmc)
Disk /dev/block/mmcblk1: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8192B 797MB 797MB primary ext2
2 797MB 1007MB 210MB primary ext2
3 1007MB 16.0GB 15.0GB primary fat32 lba
mmcblk1p1 for /data
mmcblk1p2 for /cache
mmcblk1p3 for /sdcard
Will that work? I couldn't get mmcblk1p1 to show up as ext3. I did use mke2fs -j /dev/block/mmcblk1p1 to format it and I've read ext3 = ext2+journal, so I guess the fact it's not saying "ext3" under filesystem is okay?
Click to expand...
Click to collapse
You would be correct. Yes, that's fine.
Thanks, what should be my next steps?
GnatGoSplat said:
Thanks, what should be my next steps?
Click to expand...
Click to collapse
I'll have to find time to make scripts that will modify the ramdisk, unless you can just extract it and make the changes yourself.
That would be great, I really appreciate all the help so far.
Do you think ramdisk is the only place a change will need to be made?
I was trying to see if I could figure out how to extract ramdisk from boot.img and found a perl script, but I haven't gotten around to playing with it.

How to Build new recovery modded for Zopo zp999 or 3X mtk 6595M

How to Build new recovery modded for Zopo zp999 or 3X Mtk 6595M ​
In this thread we will discuss how to create or build new recovery modded for Zopo zp999 Mtk 6595M.
Everybody are Welcome!​
MANY THANKS TO OUR MODERATOR TO OPEN AGAIN THIS THREAD !
More attention to the Xda-developers Rules:
http://forum.xda-developers.com/announcement.php?f=256
Many thanks to "SUPER ADMIN" MR. MIKE​
Software section​
Firmware
http://www.needrom.com/download/zopo-3x/
Procedure Section
In this new Phone there are new memory sectors!​
Thread under construction​
Hello everyone, alllora 999 has one partition , I tried to compile several times TWRP but with the classic method for mtk does not work. Even the cwm works , you accept advice
I'm following the thread, interested to understand the new recovery for mediatek 6595 cpus
marsapa said:
Hello everyone, alllora 999 has one partition , I tried to compile several times TWRP but with the classic method for mtk does not work. Even the cwm works , you accept advice
Click to expand...
Click to collapse
MTKtools doesn't seem to work at the moment, either.
csdhhong said:
MTKtools doesn't seem to work at the moment, either.
Click to expand...
Click to collapse
Yes this is true.
Mtkdroid tools maybe not compatible with the mtk 6595
Sent from my GT-I9505 using XDA Free mobile app
ghost45 said:
Yes this is true.
Mtkdroid tools maybe not compatible with the mtk 6595
Sent from my GT-I9505 using XDA Free mobile app
Click to expand...
Click to collapse
Hi @ghost45,
I know very little about this phone and I do not have one. so I can only offer some observations.
Questions.
1. Has anyone got their hands on an update.zip yet?
2. Does spflashtool still work with this phone?
Thought:
If there is only 1 partition then maybe the ROM is in fact more like a .ISO or live DVD
Has anyone tried to Mount the partition in such a way?
Just thinking out loud guys.
bigrammy said:
Hi @ghost45,
I know very little about this phone and I do not have one. so I can only offer some observations.
Questions.
1. Has anyone got their hands on an update.zip yet?
2. Does spflashtool still work with this phone?
Thought:
If there is only 1 partition then maybe the ROM is in fact more like a .ISO or live DVD
Has anyone tried to Mount the partition in such a way?
Just thinking out loud guys.
Click to expand...
Click to collapse
Hi Big,
Yes flashtool have problems... Run only the last version n. 5.xxxx
There is only one partition.. So i think, probably, this big primary partition is not good for the recovery mod that try to find the sd memory and sd internal memory..
I must study too much.
Thanks for your help... You know are always welcome.... Elsewhere!
Understood?
Sent from my GT-I9505 using XDA Free mobile app
Can someone please explaie how to root this model? I don't want to flash a custom ROM, just to root it.
hopeayaska said:
Can someone please explaie how to root this model? I don't want to flash a custom ROM, just to root it.
Click to expand...
Click to collapse
Custom rom?
Where is it?
There isn't any recovery modded for this phone.
Sent from my GT-I9505 using XDA Free mobile app
I don't think there are any custom ROMs yet, but since the space in the device has only one partition and without root you can't transfer the apps in the SD card. DO you think Vroot will work with it?
hopeayaska said:
I don't think there are any custom ROMs yet, but since the space in the device has only one partition and without root you can't transfer the apps in the SD card. DO you think Vroot will work with it?
Click to expand...
Click to collapse
According me there isn't reason to transfer the app in the sd card... The space is too big and there isn't internal memory like internal sd like before.
In this phone there is only one partition system =data.
Vroot and all the type of root aren't able to receive right root.
We wait for the great Russian Seven Max that could create new recovery mod for this mtk 6595.
After this step we will try to start to all the root procedure under recovery to mod this phone.
Sent from my GT-I9505 using XDA Free mobile app
ghost45 said:
According me there isn't reason to transfer the app in the sd card... The space is too big and there isn't internal memory like internal sd like before.
In this phone there is only one partition system =data.
Vroot and all the type of root aren't able to receive right root.
We wait for the great Russian Seven Max that could create new recovery mod for this mtk 6595.
After this step we will try to start to all the root procedure under recovery to mod this phone.
Sent from my GT-I9505 using XDA Free mobile app
Click to expand...
Click to collapse
According to the fstab in the official recovery you definitely have partitions
Code:
boot /boot emmc defaults defaults
/dev/block/mmcblk0p2 /cache ext4 defaults defaults
/dev/block/mmcblk0p3 /data ext4 defaults defaults
misc /misc emmc defaults defaults
recovery /recovery emmc defaults defaults
/dev/block/mmcblk0p4 /sdcard vfat defaults defaults
/dev/block/mmcblk0p6 /system ext4 defaults defaults
# Vanzo:songlixin on: Wed, 22 Feb 2012 18:31:03 +0800
# To support external sdcard
/dev/block/mmcblk1p1 /sdcard2 vfat defaults defaults
# End of Vanzo:songlixin
Of course I suppose these could be fake but I do not know why they would put in a fake recovery.
Please try these
You flash At your own risk of course as I do not have a phone to test it on. :crying:
Mods are made to the needrom .img's that you posted in the first post so do not flash if in any doubt that this rom is incorrect.
CWM Recovery modded by me so now should hopefully support sdcard internal (emmc) external sdcard (vfat) sd-ext (auto) and maybe even usb-otg (auto) :fingers-crossed:
(init.rc edited and recovery.fstab)
Code:
/boot dev/bootimg emmc defaults defaults
/misc dev/misc emmc defaults defaults
/recovery dev/recovery emmc defaults defaults
/logo dev/logo emmc defaults defaults
/misc dev/misc emmc defaults defaults
/nvram dev/nvram emmc defaults defaults
/uboot dev/uboot emmc defaults defaults
/dev/block/mmcblk0p2 /cache ext4 defaults defaults
/dev/block/mmcblk0p3 /data ext4 defaults defaults
/dev/block/mmcblk0p6 /system ext4 defaults defaults
/dev/block/mmcblk0p4 /sdcard vfat defaults defaults
/dev/block/mmcblk1p1 /sdcard2 vfat defaults defaults
/dev/block/mmcblk1p2 /sd-ext auto defaults defaults
/dev/block/sda1 /usb-otg auto defaults defaults
It will be almost impossible to make TWRP fit in the recovery partition of this phone as it is just too small. Maybe later you can workout how to resize the partitions.
I modded the shoe image too so now unsecured with adb
Code:
boot=shoe
for rename hope you understand.
Warning!! Only flash this if the recovery works fine and you have made a successful backups.
Hi big,
your recovery mod not boot remaining in black boot like the recovery of Seven.
I see the block in the files but i do not understand if them are fake or i can't able to see these new sectors.
i see only one partition system=data
I try also:
rename the file shoe in:
boot.img
and the recovery that you have made
but not run at all the phone remaining in boot!
see you and thanks for your great help.
ghost45 said:
Hi big,
your recovery mod not boot remaining in black boot like the recovery of Seven.
I see the block in the files but i do not understand if them are fake or i can't able to see these new sectors.
i see only one partition system=data
I try also:
rename the file shoe in:
boot.img
and the recovery that you have made
but not run at all the phone remaining in boot!
see you and thanks for your great help.
Click to expand...
Click to collapse
Ok bro Sorry it did not work it's difficult to help without actually having the phone in my hands.
If what you say is true then I would ask someone with linux to try mount the single partition as you would mount an .iso
I read some place that Total Commander for pc maybe able to mount the entire drive without the need of root. :fingers-crossed:
Regards bigrammy.
bigrammy said:
Ok bro Sorry it did not work it's difficult to help without actually having the phone in my hands.
If what you say is true then I would ask someone with linux to try mount the single partition as you would mount an .iso
I read some place that Total Commander for pc maybe able to mount the entire drive without the need of root. :fingers-crossed:
Regards bigrammy.
Click to expand...
Click to collapse
Thanks big... Yesterday i work to hard together other friends that we known.. But nothings..
Sent from my GT-I9505 using XDA Free mobile app
ghost45 said:
Thanks big... Yesterday i work to hard together other friends that we known.. But nothings..
Sent from my GT-I9505 using XDA Free mobile app
Click to expand...
Click to collapse
Ok I have done some more research and changed the recovery fastab's to this.
Code:
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <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/platform/mtk-msdc.0/by-name/system /system ext4 ro wait
/dev/block/platform/mtk-msdc.0/by-name/vendor /vendor ext4 ro wait
/dev/block/platform/mtk-msdc.0/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check
/dev/block/platform/mtk-msdc.0/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check,encryptable=footer
/dev/block/platform/mtk-msdc.0/by-name/protect1 /protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check
/dev/block/platform/mtk-msdc.0/by-name/protect2 /protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check
/dev/block/platform/mtk-msdc.0/by-name/boot /boot emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/misc /misc emmc defaults defaults
/devices/platform/mtk-msdc.0/mmc_host auto vfat defaults voldmanaged=sdcard0:[email protected],noemulatedsd
/devices/platform/mtk-msdc.1/mmc_host auto vfat defaults voldmanaged=sdcard1:auto
/devices/platform/xhci-hcd auto vfat defaults voldmanaged=usbotg:auto
You can now retry and see if this will now work it may require a little more editing but lets see what works and what does not first. :fingers-crossed:
bigrammy said:
Ok I have done some more research and changed the recovery fastab's to this.
Code:
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <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/platform/mtk-msdc.0/by-name/system /system ext4 ro wait
/dev/block/platform/mtk-msdc.0/by-name/vendor /vendor ext4 ro wait
/dev/block/platform/mtk-msdc.0/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check
/dev/block/platform/mtk-msdc.0/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check,encryptable=footer
/dev/block/platform/mtk-msdc.0/by-name/protect1 /protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check
/dev/block/platform/mtk-msdc.0/by-name/protect2 /protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check
/dev/block/platform/mtk-msdc.0/by-name/boot /boot emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/misc /misc emmc defaults defaults
/devices/platform/mtk-msdc.0/mmc_host auto vfat defaults voldmanaged=sdcard0:[email protected],noemulatedsd
/devices/platform/mtk-msdc.1/mmc_host auto vfat defaults voldmanaged=sdcard1:auto
/devices/platform/xhci-hcd auto vfat defaults voldmanaged=usbotg:auto
You can now retry and see if this will now work it may require a little more editing but lets see what works and what does not first. :fingers-crossed:
Click to expand...
Click to collapse
Thanks... I will try it.
But according me the problem is connected with the repack operation... Or as someone sayed pack operation.
Sent from my GT-I9505 using XDA Free mobile app

will formatting /data from TWRP/heimdall recreate sdcard ?

I am trying to install postmarketos on /data partition on Galaxy Tab 3 7.0. I am trying to use /data for installation rather /system as /data is much bigger.
While installing postmarketos, /data will be reformatted. I know /sdcard is a special mount inside /data. If after installing postmarketos I want to come back to AOSP/Lineage, will formatting /data in TWRP or via heimdall recreate /sdcard properly. I am not sure if /sdcard is just a inode/path reference or a particular sector reference inside /data.

Categories

Resources