This project is intended mainly for those interested in trading the near plug-and-play convenience of a dual boot flashable zip for increased flexibility when experimenting with different ROMs.
Users may also be interested in comparing the performance of identical ROMs hosted on different physical devices. Others may want to configure their emmc-based ROM, clone to SD and then flush emmc to host their entire system on removable media.
Preliminaries
Unlocked phone with fully charged, healthy battery and ClockWorkMod (CWM) Recovery 5.0.2.0 installed.
Instructions
1. Boot to primary ROM to ensure that correct boot image is flashed, though it is not necessary with the initial release of clone ROM zip.
2. Boot to CWM and connect phone to computer.
3. Partition SD card to host ROM. There are many ways to do this, but the most convenient is “SmartPart”: http://forum.xda-developers.com/showthread.php?t=1651356 .
If you're already dual booted, this step shouldn't be necessary unless you are cloning a “heavy” ROM that doesn't quite fit. If so, you can modify SmartPart to increase the size of your SD ext partitions at the expense of further downsizing FAT32. I did this when porting NottachTrix 1.3.1 to SD.
4. Flash Clone-ROM-to-SD-Card-signed.zip : http://www.mediafire.com/?ara2r3174cb9yir
This will, in sequence: a) Backup any existing SD card-based ROM, b) wipe all three ROM partitions on SD card (it does not touch your FAT32), c) push primary ROM /system, /cache and /data to SD card and d) push ROM boot image to /tmp/boot.img. That's all for now --- see Note below. The entire process can take 15-20 minutes depending mainly on prior existence of SD ROM partitions, ROM size and performance of SD card.
Faster (no SD ROM backup) Clone-ROM-to-SD-Card-No-BK-signed.zip: http://www.mediafire.com/?kbaowagqmnu6k5o
Note: In the clone zip “updater-script”, there is a block of source code commented out. I was trying to modify the boot image, but CWM does not appear to support the "unpackbootimg" and "mkbootimg" executables. And CWM's “busybox awk” does not include the gawk extensions required to adequately support binary file processing. Another (smaller) problem is that the user has no direct knowledge as to which boot image is being modified unless that image is manually inserted into the zip prior to flash, or user boots to primary ROM before cloning. So, for now I am content with modifying boot image ramdisks offline using Perl on my Ubuntu 12.04 laptop.
5. User modifies ROM boot image offline to redirect /system, /cache and /data mounts from emmc to sdcard (just three lines of code in “init.olympus.rc”). For example if ROM = Neutrino V2.8 GT, modify Neutrino GT boot image to create “boot-Neutrino-V2.8-GT-sdcard.img”. See my Auto-Modify Boot Image thread here: http://forum.xda-developers.com/showthread.php?t=1766939
Here are sample boot images ported to SD card:
boot-Neutrino-V2.8-GT-sdcard.img: http://www.mediafire.com/?oudm9qm5a0d7glh
boot-NottachTrix-1.3.1-att-sd-ext.img: http://www.mediafire.com/?nok6hp4rl5e92h6
Faux-CM7-1.00GHz-026b1boot-sdcard.img: http://www.mediafire.com/?fesm0hff58pnv28
6. Power down, enter fastboot and flash modified boot image, for example:
[email protected]:~/Desktop# fastboot flash boot boot-Neutrino-V2.8-GT-sdcard.img
sending 'boot' (2963 KB)...
OKAY [ 0.210s]
writing 'boot'...
OKAY [ 0.266s]
finished. total time: 0.476s
[email protected]:~/Desktop# fastboot reboot
rebooting...
finished. total time: 0.000s
[email protected]:~/Desktop#
After boot-up to SD, you can cross-verify that Neutrino-V2.8 was indeed cloned to sdcard by entering the android “mount” command via ADB or on phone using Terminal Emulator:
Code:
rootfs on / type rootfs (ro,noatime,nodiratime)
tmpfs on /dev type tmpfs (rw,noatime,nodiratime,mode=755)
devpts on /dev/pts type devpts (rw,noatime,nodiratime,mode=600)
proc on /proc type proc (rw,noatime,nodiratime)
sysfs on /sys type sysfs (rw,noatime,nodiratime)
tmpfs on /mnt/asec type tmpfs (rw,noatime,nodiratime,mode=755,gid=1000)
tmpfs on /mnt/obb type tmpfs (rw,noatime,nodiratime,mode=755,gid=1000)
[COLOR="Blue"]/dev/block/mmcblk1p2 on /system type ext4 (rw,noatime,nodiratime,errors=continue,barrier=0,nobh,data=writeback,noauto_da_alloc,discard)
/dev/block/mmcblk1p4 on /data type ext4 (rw,nosuid,nodev,noatime,nodiratime,barrier=0,nobh,data=writeback,noauto_da_alloc,discard)
/dev/block/mmcblk1p3 on /cache type ext4 [/COLOR](rw,nosuid,nodev,noatime,nodiratime,errors=continue,barrier=0,nobh,data=writeback,noauto_da_alloc,discard)
/dev/block/mmcblk0p13 on /osh type ext4 (rw,nodev,noatime,nodiratime,barrier=1,data=ordered,noauto_da_alloc)
/dev/block/loop0 on /pds type ext3 (rw,noatime,nodiratime,data=ordered)
/dev/block/vold/179:33 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/vold/179:33 on /mnt/secure/asec type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /mnt/sdcard/.android_secure type tmpfs (ro,relatime,size=0k,mode=000)
/dev/block/vold/179:18 on /mnt/emmc type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
Benchmarks (CF Bench)
Identical ROMs (Neutrino V2.8 GT) hosted on emmc and Class 6 SD card. Guess which one is SD ROM...
Standard disclaimers apply. In short, I am not responsible for any harm you or your phone may incur by using any or all of this material.
Many thanks to Notorious544d and CM/Photon/Atrix/Android dev teams for their excellent ROMs, hatefuel19 for porting NottachTrix to SD, Koush (CWM and AnyKernelUpdater) and Always_Jonezen for offering the clone-to-SD concept.
Thanks man and it's definitely worth the leg work.
Sent from my MB860 using Tapatalk 2
Nice job... :>)
downloading...
Thanks for the tips!
AWWWWWESOME!!!
Thank you for your work - man I´ve been waiting for something like this.:laugh:
I think more interesting tool would be one which changes partitions installation in zip files to one which is preferred by user with all symlinks etc.
Adam
greenwitch said:
I think more interesting tool would be one which changes partitions installation in zip files to one which is preferred by user with all symlinks etc.
Adam
Click to expand...
Click to collapse
All of the partitioning tools I have used to date perform auto-numbering.
Also, any partitions added beyond the first four primary partitions (e.g. beyond FAT32 and three primary "ext"s for dual boot) must be extended, not primary.
One interesting experiment would be to try adding a fourth "ext" for webtop2sd.
Hope this helps.
I finally got this working however the cloned version shows "Wifi error" and cannot turn on Wifi. I think this is similar to the Data error that someone posted. I am guessing this is due to permissions. I am going to try re-cloning with all of the Radios turned on at the time of cloning to see if this makes a difference. I will post back if successful.
[Update: Wifi not working even when cloned with all radios turned on prior to cloning. BTW, my ROM which shows this issue on ext-SD only is Notatrix 1.3.1. I might try a CM7 based ROM if I can get a system.img of it - right now I don't want to wipe Notatrix without getting it to fully work off ext-SD.]
If someone can create a flashable zip that fixes permissions on ext-SD card (just like CWM does for int SD), that would solve a lot of such issues easily and would be appreciated.
In order get the cloning done successfully, I did have to modify SmartPart a bit since I am using a 32GB SD card and it appears that the last 6 MB on a 32GB SD card are reserved or cannot be allocated for some reason. I already PMd sendust7 on this and am posting in case someone else also has the same issue with 32GB SD cards. Again, I am not sure if this is something to do with the specific SD card that I am using (Samsung Class10 32GB micros SD). This is the change I made to the part-sd script to get it working (reduce the size of the last created partition by 6):
After this line:
parted /dev/block/mmcblk1 mkpartfs primary ext2" $val7" "$val8"
added this block:
if [ $? -ne 0 ]
then
val8=`expr $val8 - 6`
echo "Partition 3 create failed. Retrying with a slightly smaller size to account for some large SD cards(New last sector=$val8).."
parted /dev/block/mmcblk1 mkpartfs primary ext2" $val7" "$val8"
fi
shenoyh said:
I finally got this working however the cloned version shows "Wifi error" and cannot turn on Wifi. I think this is similar to the Data error that someone posted. I am guessing this is due to permissions. I am going to try re-cloning with all of the Radios turned on at the time of cloning to see if this makes a difference. I will post back if successful.
[Update: Wifi not working even when cloned with all radios turned on prior to cloning. BTW, my ROM which shows this issue on ext-SD only is Notatrix 1.3.1. I might try a CM7 based ROM if I can get a system.img of it - right now I don't want to wipe Notatrix without getting it to fully work off ext-SD.]
If someone can create a flashable zip that fixes permissions on ext-SD card (just like CWM does for int SD), that would solve a lot of such issues easily and would be appreciated.
In order get the cloning done successfully, I did have to modify SmartPart a bit since I am using a 32GB SD card and it appears that the last 6 MB on a 32GB SD card are reserved or cannot be allocated for some reason. I already PMd sendust7 on this and am posting in case someone else also has the same issue with 32GB SD cards. Again, I am not sure if this is something to do with the specific SD card that I am using (Samsung Class10 32GB micros SD). This is the change I made to the part-sd script to get it working (reduce the size of the last created partition by 6):
After this line:
parted /dev/block/mmcblk1 mkpartfs primary ext2" $val7" "$val8"
added this block:
if [ $? -ne 0 ]
then
val8=`expr $val8 - 6`
echo "Partition 3 create failed. Retrying with a slightly smaller size to account for some large SD cards(New last sector=$val8).."
parted /dev/block/mmcblk1 mkpartfs primary ext2" $val7" "$val8"
fi
Click to expand...
Click to collapse
Since you're having problems with Nott 1.3.1 on SD-ext and I need a stable ROM for my business trip to Europe tomorrow, I thought it would be helpful to go through the entire process of cloning Nott 1.3.1.
Here's what I did today:
Install NottachTrix 1.3.1 using CWM 5.0.2.0 and select all defaults.
At MotoBlur welcome screen, go to Settings > Set up Wifi to configure wireless.
Set up MotoBlur and Google. This should not be necessary, but we want to reduce duplication of effort after cloning.
Accept all updates to existing apps.
Clone: http://forum.xda-developers.com/showthread.php?t=1764680
Configure dual boot: http://forum.xda-developers.com/showthread.php?t=1645344
Modify ROM2 boot.img: http://forum.xda-developers.com/showthread.php?t=1766939 Call it “boot-repack.img”.
Then...
Code:
adb shell mount sdcard (may not be necessary)
adb push boot-repack.img /sdcard/Boot/ROM2/boot.img
Boot to fastboot and reboot to ROM2:
Code:
fastboot flash boot boot-repack.img
fastboot reboot
Use Android mount command to verify ROM2 mounts for /system, /cache and /data.
System can now dual boot Nott 1.3.1 on internal (/sdcard) and external (/sdcard-ext) . And wifi comes right up on both sides.
I'm not sure why ROM2 would misbehave for you since it is an exact replica of ROM1...
sendust7 said:
Install NottachTrix 1.3.1 using CWM 5.0.2.0 and select all defaults.
I'm not sure why ROM2 would misbehave for you since it is an exact replica of ROM1...
Click to expand...
Click to collapse
Thanks, works now - I think (but cannot be certain) that it was the faux 1.0G kernel that I had installed on Notta earlier that seems to be the reason. (Maybe the faux 1.0G kernel in Nottachtrix Aroma installer may have some paths set that refer to internalSD and are not changed during the cloning process?)
I didn't do all that you mentioned (mainly because I wanted to preserve the Nottachtrix install in the state it was in on the internal SD), but you pointed me in the right direction by saying "defaults" and that helped.
I reinstalled Nottachtrix, without deleting existing data, directly to SD using hatefuel19's Nottachtrix1.3.1.sd-ext.zip http://forum.xda-developers.com/showpost.php?p=27543308&postcount=1 from the other thread selecting the default ATT kernel and now the Wifi is working!.
Thanks for taking the time to experiment with this and respond to me.
Now that Nottachtrix has been successfully cloned to ext-SD, I can now proceed to do more experimental work by using my internal SD for CM7, CM9 or related ROMs.
CF-bench results from Nottachtrix 1.3.1 ROM on ext-SD versus int-SD. The better one is int-SD. However, despite the gap in the benchmarks, I didn't feel much of a difference during regular usage between the two and I think I can confidently say that the ext-SD version is going to be my primary now that its fully working. I plan to use the int-SD for experimental ROMs.
[Note the ext-SD version benchmark is uising the stock ATT kernel while the internal-SD version is using the Faux1G kernel. So not necessarily a good comparison, but realized that only after posting].
Related
The basic idea of this mod is moving all partitions to the SD card, and running the full OS from the SD card.
There are many reasons why not to do this and probably is a bad idea, but the main reason behind this mod is just a proof of concept that can potentially result in a better internal and external memory utilization and speed improvements.
Reasons I can think of for not doing this:
- Reduced responsiveness and overall speed.
- Over stress on the SD card that can potentially leed to permanent damage to the card.
- The need to use modified boot and recovery images, thus leading to an install incompatible with any rom update (as it is) out there.
- Reduced battery autonomy.
- Many more I can't think of right now.
Reasons to do this:
- Because we can.
- As a proof of concept.
- For developing purposes.
- We get the ability to switch between 2 installations just by switching the SD card (of the same rom or roms with compatible boot images: kernel+ramdisk).
Don't do any of this if you don't know what you are doing!!!
Simplified steps (I've only tested this with Mik's CM7 (betas 6.2 and 6.3) + ClockWorkMod recovery on a Ubuntu machine):
- Download and flash ClockWorkMod recovery.
- Download and flash Mik's CM7.
- Do a full backup from recovery.
- Turn the phone off.
- Take out the SD card and put it on a Card reader on your PC.
- Backup the SD Card contents (including the full backup).
- Use Gparted (or any partition manager that has support for ext4 partition creation) to create the following partition structure:
Code:
num mount point size type
1: /sdcard REST fat32
2: /data 500M ext4
3: /system 190M ext4
4: /cache 64M ext4
The partition number is important, so you should calculate the fat32 partition beforehand or resize the existing one.
- Put new boot and recovery images on the fat32 partition. *
- Put the card on the phone and boot into recovery.
- Mount the sdcard trough menu.
- Connect the phone to your pc and start adb shell.
- Flash custom boot and recovery images:
Code:
flash_image boot /sdcard/boot-everything2sd.img
flash_image recovery /sdcard/recovery-everything2sd.img
- Reboot recovery.
- Through menu, mount all partitions.
- Connect trough adb shell and copy your data:
Code:
adb shell
cp -a /int-cache/* /cache/
cp -a /int-system/* /system/
cp -a /int-data/* /data/
- In adb shell, remove the sd_ext mount script:
Code:
rm /system/etc/init.d/05mountsd
- Reboot the phone.
Off course, no other method of storing the apps on the SD is desired as they are already there.
* I've attached custom boot and recovery images for Mik's CWM and CM7 beta 6.2 (updated boot images to Mik's CM7.02 beta 6.3 in post #3), but, the steps for creating them are next:
- Extract the original images (boot.img and recovery.img) from the root of the downloaded zips (signed-recovery.zip and cyanogen_thunderg-ota-eng.mik.zip).
- Unpack the images following this guide: HOWTO: Unpack, Edit, and Re-Pack Boot Images: Alternative Method (Perl scripts are attached, you'll need compiled mkbootfs and mkbootimg for your OS).
- On recovery ramdisk, change the etc/recovery.fstab file as follows:
Code:
# mnt pnt fstype device [device2] [fstype2]
/boot mtd boot
/cache ext4 /dev/block/mmcblk0p4
/data ext4 /dev/block/mmcblk0p2
/misc mtd misc
/recovery mtd recovery
/sdcard vfat /dev/block/mmcblk0p1 /dev/block/mmcblk0 ext4
/system ext4 /dev/block/mmcblk0p3
/int-cache yaffs2 cache
/int-data yaffs2 userdata
/int-system yaffs2 system
- On boot ramdisk, change the init.rc file as follows (diff output):
Code:
[email protected]:~/Descargas/bootimages$ diff boot.img-orig_ramdisk/init.rc boot.img-ramdisk/init.rc
22d21
< export SD_EXT_DIRECTORY /sd-ext
68,69d66
< mkdir /sd-ext 0771 system system
<
100,103c97,100
< mount yaffs2 [email protected] /system
< mount yaffs2 [email protected] /system ro remount
< mount yaffs2 [email protected] /data nosuid nodev
< mount yaffs2 [email protected] /cache nosuid nodev
---
> mount ext4 /dev/block/mmcblk0p3 /system
> mount ext4 /dev/block/mmcblk0p3 /system ro remount
> mount ext4 /dev/block/mmcblk0p2 /data nosuid nodev
> mount ext4 /dev/block/mmcblk0p4 /cache nosuid nodev
- Recreate the ramdisks and images following the guide posted above, changing the mkbootimg command line to (notice the base and cmdline parameters; for recovery, change boot to recovery on all instances):
Code:
mkbootimg --base 0x12800000 --cmdline 'mem=471M console=ttyMSM2,115200n8 androidboot.hardware=thunderg' --kernel boot.img-kernel --ramdisk boot.img-ramdisk.gz -o boot-new.img
Ahaha another sleepless night ahead to test this out. Any Quadrant Advanced I/O score for comparison?
I've updated boot images to Mik's CM7.02 beta 6.3, attached below.
I'm going to run a Quadrant Advanced and let you know. Anyway, I don't think I will get good results, as my SD card is cheap and buggy, half the time it doesn't get mounted, with or without this mod. Also, I think we'll get better scores with your tweaks, especially with the modded libsqlite.so.
The idea behind this is not to get impressive results or leave it as a definitive mod (as it is right now). Instead, the idea I have is to start moving some things back to the internal memory, for instance, mounting [email protected] as /data/dalvik-cache (just an idea). Basically, leaving the things that need fast reading times, but infrequent writes in the SD, and the things that are constantly being written to, in the internal memory.
Seems awesome. I already booted up perfectly with the modded .imgs, no issues.
so what class of sd card do you preffer?
still class 4 above?
well, sorry about what im going to say , but if **** happened and luckily sd card got corrupted, then the phone does as well?
ive not read all of your first post,
but if ever we are changing sd cards, like example upgrading from 4g-8g,
is it necessary to repeat the whole process or copy paste is enough?(i bet not due to ext)
cmangalos said:
so what class of sd card do you preffer?
still class 4 above?
well, sorry about what im going to say , but if **** happened and luckily sd card got corrupted, then the phone does as well?
ive not read all of your first post,
but if ever we are changing sd cards, like example upgrading from 4g-8g,
is it necessary to repeat the whole process or copy paste is enough?(i bet not due to ext)
Click to expand...
Click to collapse
If **** happened you could mount it in a computer with a card reader and perform a disk check + recovery. If the sd card broke, well.. I think there's still hope, since you may boot in recovery and replace the mount points back to the internal memory ( right ? )
As for the storage upgrade, well, it's not exactly copy-paste but you should be able to duplicate the partitions without much hassle..
I really like this idea,we could get 3000+ quadrant score
But can be potentially dangerous. If anything goes wrong i think that Phone can't boot anymore.
how abt two separate roms in 6 separate partitions ???? is the bootloader cracked ??? Can we have a grub like menu to select two roms ???Way 2: Maybe somebody cud mod android's initramfs and add options there to select two different fstabs ...just a thought
a dual boot would be cool... one rom on the internal nand memory and the other on SD card...
Having fastboot disabled is such a pain in the ass...
ciaox said:
I really like this idea,we could get 3000+ quadrant score
Click to expand...
Click to collapse
Not me, because my SD card is very buggy. Anyway, it depends very much on the card, the card reader and the kernel. Anyway, it's just a proof of concept and it opens a great window for experimentation.
ciaox said:
But can be potentially dangerous. If anything goes wrong i think that Phone can't boot anymore.
Click to expand...
Click to collapse
Not at all, recovery can boot even if the SD card is damaged or not present. Then you can flash the original recovery, boot it and flash any ROM without this mod.
Steps:
- Extract recovery.img from your desired custom recovery.
- Boot recovery.
- Mount /int-cache from mounts and storage menu.
Code:
adb push recovery.img /int-cache/recovery.img
adb shell
flash_image recovery /int-cache/recovery.img
- Reboot recovery
- Flash desired ROM from any SD card.
OR: Just flash an original (released by LG) ROM through emergency mode.
sarfaraz1989 said:
how abt two separate roms in 6 separate partitions ???? is the bootloader cracked ??? Can we have a grub like menu to select two roms ???Way 2: Maybe somebody cud mod android's initramfs and add options there to select two different fstabs ...just a thought
Click to expand...
Click to collapse
Bootloader isn't cracked yet, so it would have to be implemented on the boot.img (kernel and/or ramdisk), and I don't know how. Right now is easier to swith SD cards. Anyway, ROMs should be able to share boot.img (kernel + ramdisk).
ciaox said:
Having fastboot disabled is such a pain in the ass...
Click to expand...
Click to collapse
+1. But bootloader isn't cracked yet.
Just a little heads up, but if anyone is paying attention to the Nook Color development, this is exactly how the boot process on that device works, I am running one os off the sd card and if I remove it I am back to stock. The main point of my brining this up is you create the sd card with all it's partitions by flashing an image of the sd card with the WinImage application on windows. Might at least save you some steps. Hope this helps.
tsukisan said:
Just a little heads up, but if anyone is paying attention to the Nook Color development, this is exactly how the boot process on that device works, I am running one os off the sd card and if I remove it I am back to stock. The main point of my brining this up is you create the sd card with all it's partitions by flashing an image of the sd card with the WinImage application on windows. Might at least save you some steps. Hope this helps.
Click to expand...
Click to collapse
Possibilities seem to be limitless.
Sent from my LG-P500 using Tapatalk
Hi all,
Tearing my hair out here (and I have SFA left anyway)
My Father-in-law's SGS i9000 seems to have real issues. Initially problem I was having was that there was an app I could not uninstall- it would reappear on reboot. I initially suspected malware or such, but it appears to be a real problem with the internal memory. I had MIUI installed on it, but wanted to change to a more stock ROM.
First time I really started to worry was when I found that every time I put a new rom onto the internal sdcard, it disappeared at reboot (and thus wasn't there to install when rebooted into CWM)
Since then, haven't had a functioning phone.
adb push to sdcard still not persistent on reboot.
Cannot flash new ROM with ODIN either, although KERNEL changes, filesystem no longer mounts.
I think the version of MIUI I was using used an ext4 lagfix, as inside an adb shell, I can see the partitions:
parted /dev/block/mmcblk0
a "print" lists two partitions:
Number Start End Size Type File system Flags
1 32.8kB 14.4GB 14.4GB primary fat32 lba
2 14.4GB 16.4GB 2013MB primary ext4 lba
rm 1, rm 2
to try to delete the partitions and start again- doesn't work. Nothing happens
If I load partition 2 into parted:
parted /dev/block/mmcblk0p2
print
Model: Unknown (unknown)
Disk /dev/block/mmcblk0p2: 2013MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 2013MB 2013MB ext4
Can;t check any partitions as ext4 isn't supported by parted.
I cannot remove any partitions, reformat them or anything.
e2fsck errors as it cant read superblock flags on any of the partitions.
Any other ideas? Anyone?
I don't want to toss the phone out
http://forum.xda-developers.com/showthread.php?t=845708
i dont know if this will help u but u can try this guy instruction. See link above
compacity said:
http://forum.xda-developers.com/showthread.php?t=845708
i don't know if this will help u but u can try this guy instruction. See link above
Click to expand...
Click to collapse
If that worked, it would have been just what I was looking for
I googled the hell out of this problem, and that one never came up, but others I'd seen led me to try that same plan.
Where it fails on my device, is that deleting the partitions in "parted" fails- rm1 followed by rm 2 to delete the partitions. "Print" reveals they're still there.
Any other partition tools worth trying?
I got it back to square one:
Flashed kernel thru Odin with a version of CWM that worked.
reboot into recovery.
Flash update from SDcard- card contents still the same, so could re-flash MIUI.
reboot, bootloop. Re-enter CWM recovery and reflash.
Back to Square One - MIUI 1.12.16 (JVK)
Cannot install anything - nothing is persistent after reboot, even WIFI settings disappear
If it is any help to anyone who knows what they're talking about:
Now that MIUI boots I can look at the filesystem better.
Can anyone point me in the direction of what I should be looking for/trying to do to figure out what is wrong here?
try finding solution here, its PIT stop for i9000 problem
http://forum.xda-developers.com/showpost.php?p=30415128&postcount=1
Mine seems to be a bit tougher than these solutions can deal with.
Tried assorted ROMs over past day. No install works.
Cannot install anything from internal memory, as nothing dropped into that card will remain after a reboot.
Installing anything from an external card just throws up bootloops etc- as the only thing that seems to be able to retained between boots is the kernel/CWM.
If I install a new ROM, first flash says partition table is incompatible and /data will be overwritten (no problems, nothing on it). I accept the inevitable and re-select the ROM.
Reboot bootloops, as expected, reboot into CWM (now a new version with the Kernel), try reflashing the ROM image- Error 0 or 7. Try from External Memory- same. Try sideloading image. Same. All I can do is re-flash the MIUI image on internal SDcard (which works)
It looks like the internal memory refreshes itself from a recovery image at each boot? (I think).
Anyway- can't get anything to stick, except MIUI
edit:
http://forum.xda-developers.com/showthread.php?t=761537&page=3
http://forum.xda-developers.com/showthread.php?t=1230059&page=3
hav u try this 2 link as this is da only thread matches ur MBR problem
compacity said:
did u try any jb kernel out there? as its also ext4 n push it using adb. juz a suggestion though.
Click to expand...
Click to collapse
Good suggestion Logical
I'd thought that also- The JB kernels should support ext4.
No joy though
The version of CWM recovery that is stable with the MIUI install is 5.0.2.7, and it doesn't have any voodoo/lagfix options
When I flash a kernel with a CWM with lagfix, and try to use the CWM lagfix toggles, nothing changes.
Doesn't matter what I select inside CWM, it reads the status from memory as "Lagfix on, Debug off"
The reason I asked about ext4 tools in ADB is that running filesystem commands in a shell just throws up errors I can't seem to fix.
e2fsck just throws up superblock errors (on both /dev/block/mmcblk0 and the partition /dev/block/mmc0p2.
Defining one of the backup superblocks doesn't help- they're all bad.
"parted" doesn't work anymore (i note it isn't in /sbin, so I am picking this kernel doesn't install it), but even when I did have it, "parted" doesn't support ext4. Using "rm" to remove a partition did exactly nothing.
Starting to think the only way forward would possibly be flashing a custom .pit file to define partitions that move the data off an obviously bad block? Above my skill level however LOL
refresh browser see my post above again
I'm attempting to format my external sdcard to ext2, just one single partition (no apps2sd magic).
The reasons are to have the ability to store >4GB files on the card, faster read times, and not needing compatibility with any M$ systems/PCs/Junk, journaling (>ext2) is not needed.
At the moment, I'm running a CM based ROM (cyanfox) and will likely try this out on a moto/stock based ROM after.
Here is my progress so far :
I'm able to mount the SD manually, though with some hoops being involved. The bionic will not mount it automatically, and is constantly telling me that it is unsupported/empty/needs to be formatted in the storage menu, and a permanent notification.
In a terminal shell, I can mount the device (/dev/block/vold/179:97) by specifying the type only as ext4. This is definitely not ideal, but I get errors when the type is specified as ext2 or ext3. (error : mount: Operation not supported on transport endpoint ).
At the moment, I've made an init script to mount the sd at /storage/sdcard1 but this doesn't cause android to think that the actual sd is mounted properly (empty sd notification still exists). Though it is at least mounted.
And I have edited the fstab file at root to change the sd type from vfat to ext2, but this file rewrites itself at boot. Unfortunately I'm not able to set an immutable bit on the file.. (android is not a type writer).
The ext2 filesystem has been checked for errors, does have files written to it, and is able to be read/written to in android after manually mounting it. Android just insists on a fat partition though.
Any help/tips would be appreciated. I'll update this thread in case anyone else would like to apply this as well.
Also, if I'm missing something blatantly obvious, please let me know
FIRST OF ALL, we should say thanks to @alvinhochun 's work on porting kexec hardboot patch to Xperia M. His original thread is here: http://forum.xda-developers.com/showthread.php?t=2568151
And @Tasssadar who has ported kexec hardboot patch on MSM chips. Original thread is here: http://forum.xda-developers.com/nexus-4/orig-development/kexec-hardboot-patch-t2472316/post46223952
As for the kernel patch and kexec binary for TX, they are here: http://forum.xda-developers.com/showthread.php?t=2747215
OK let's begin our tour on TX...
0. Disclaimer
This is a rather dangerous hack. I'm not responsible for data loss, broken SD cards, dead internal storage or bricked phones. Try this at your own risk. Proceed only when you know what you are doing.
1. Requirements
a. ROM with “kexec hardboot” patched kernel. My OmniROM build will do the job. Since Alx31Tse is also using my kernel source for TX, the Carbon builds for TX may be capable of handling this as well. This ROM should be installed into internal storage : just flash it in recovery as usual.b. External MicroSD card which is big enough for your ROMs. One ROM takes up ~4GB space.c. Some basic knowledge of partitions, device nodes, ramdisk modding(check this thread by letama: http://forum.xda-developers.com/showthread.php?t=2418893).
2. Partitioning the external sdcard
a. Plan the partitions
Each ROM need three partitions : system, data and cache. You need at least 1.4GB system + 2GB data + 400MB cache for stock ROMs. The system partition for third-party ROMs can be shrinked to ~900MB. Of course you can set your own data partition size if 2GB does not suit your needs. The space left can be used for storing data just like a normal sdcard.
For example, I'm using a 16GB card and going to install two stock ROMs (9.1.B.1.67 + 9.2.A.0.295). So I have to create at least 6 partitions for them:
1.4GB system for 295
2GB data for 295
400MB cache for 295
1.4GB system for 67
2GB data for 67
400MB cache for 67
There is ~8GB left after all these partitions. This can be used as a normal sdcard. Just create another partition for it.
b. Go partitioning it!
Everyone has his own way of doing this. I prefer using a USB card reader and Disk Utility that comes with Ubuntu.
Erase the card and initialize it with GUID Partition Table (GPT). Of course you can use MBR, but I didn't test it. Be careful in the following steps if you choose MBR.
Create the “normal sdcard” partition. In my example, create a 8GB partition here and format it with FAT32. THIS PARTITION SHOULD BE THE FIRST ONE ON THE CARD! Otherwise Android system may not be able to recognize it.
Create the partitions for guest systems. There are no particular order for the partitions. Just make sure you remember their order. DO NOT FORMAT them for now.
In my example:
PART 1: 8GB, FAT32
PART 2: 1.4GB unformatted
PART 3: 2GB unformatted
PART 4: 400MB unformatted
PART 5: 1.4GB unformatted
PART 6: 2GB unformatted
PART 7: 400MB unformatted
3. Kernel mods for guest systems
For each guest system:
a. Unpack its kernel.
If you are going to install a full stock ROM, please choose a corresponding kernel with recovery built-in in Android Development section.
If you are going to install a third-party ROM (OmniROM, CM etc) or customized stock ROM (Rockers etc), chances are that their kernels have recovery built-in already and you can proceed.
Now unpack the kernel.
We have zImage(sec0.bin), ramdisk(sec1.bin) now. The rest can be ignored.
b. Modify the mount entries in fstab (and other files)
fstab is the file that suggests the real device for the /system, /data and /cache mount points. Modding it will make it possible to mount the partitions other than the ones in internal storage on /system /data and /cache, so that we can separate different systems into different partitions.
Now you have to be clear about “how the partitions on external card will be presented in your phone” (their device nodes). In my example (GPT with 7 partitions):
PART 1: 8GB → /dev/block/mmcblk1p1
PART 2: 1.4GB → /dev/block/mmcblk1p2
PART 3: 2GB → /dev/block/mmcblk1p3
PART 4: 400MB → /dev/block/mmcblk1p4
PART 5: 1.4GB → /dev/block/mmcblk1p5
PART 6: 2GB → /dev/block/mmcblk1p6
PART 7: 400MB → /dev/block/mmcblk1p7
As has been mentioned above, mmcblk1p1 is for normal file storage, p2~p4 is for 295, p5~p7 is for 67.
Files that need modding:
(sec1.bin/sbin/ramdisk.cpio) /fstab, /fstab.qcom, /init.target.rc
Click to expand...
Click to collapse
(sec1.bin/sbin/ramdisk-recovery.cpio) /fstab, /fstab.qcom, /etc/recovery.fstab, /etc/twrp.fstab
Click to expand...
Click to collapse
The fstabs are easy to deal with. Just change the block device name for /system /cache and /data to /dev/block/mmcblk1p* accordingly. The init.target.rc has only one line that should be modded. For example,
FOR 9.1.B.1.67 in my example:
ramdisk.cpio/fstab:
/data ext4 /dev/block/mmcblk1p6
/cache ext4 /dev/block/mmcblk1p7
/boot/modem_fs1 raw /dev/block/platform/msm_sdcc.1/by-name/modemst1
/boot/modem_fs2 raw /dev/block/platform/msm_sdcc.1/by-name/modemst2
Click to expand...
Click to collapse
ramdisk.cpio/fstab.qcom:
/dev/block/mmcblk1p5 /system ext4 ro,barrier=1,discard wait,check
/dev/block/mmcblk1p6 /data ext4 nosuid,nodev,noatime,barrier=1,noauto_da_alloc,discard wait,check,encryptable=footer
/dev/block/mmcblk1p7 /cache ext4 nosuid,nodev,noatime,barrier=1,discard wait,check
/dev/block/platform/msm_sdcc.1/by-name/SDCard /mnt/int_storage ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check
Click to expand...
Click to collapse
ramdisk.cpio/init.target.rc:
(SEARCH FOR /system)
on post-fs
mount ext4 /dev/block/mmcblk1p5 /system ro remount barrier=1
Click to expand...
Click to collapse
Just do the same for ramdisk-recovery.cpio. For example:
ramdisk-recovery.cpio/etc/recovery.fstab
/boot emmc /dev/block/mmcblk0p4
/system ext4 /dev/block/mmcblk1p5
/cache ext4 /dev/block/mmcblk1p7
/data ext4 /dev/block/mmcblk1p6 length=-16384
/sdcard ext4 /dev/block/mmcblk0p15
/external_sd auto /dev/block/mmcblk1p1 /dev/block/mmcblk1
Click to expand...
Click to collapse
And replace mmcblk1p5~p7 with p2~p4 then do it all again for 9.2.A.0.295's ramdisk.cpio & ramdisk-recovery.cpio
NOTE: All these fstab and rc files should be rw-r—r-- and owned by root:root. Otherwise the system may fail to boot.
Now repack the ramdisk.cpio, ramdisk-recovery.cpio and then the whole ramdisk.
4. Installing the guest systems
Take notice of the texts in red. Change them to fit your needs.
a. Preparing the guest systemsIf you are installing full stock ROM (FTF format), you can use Flashtool to dump the system image (Flashtool > Tools > Sin Editor, load system.sin from FTF archive and dump data). Then write the image to the sdcard by “dd if=system.ext4 of=/dev/sdb2“ on the computer.
If you are installing ROMs in ZIP format, you need to modify updater-script and replace all (for 9.1.B.1.67 in my example)
/dev/block/mmcblk0p12 or /dev/block/platform/msm_sdcc.1/by-name/System to /dev/block/mmcblk1p5
Click to expand...
Click to collapse
/dev/block/mmcblk0p13 or /dev/block/platform/msm_sdcc.1/by-name/Cache to /dev/block/mmcblk1p7
Click to expand...
Click to collapse
/dev/block/mmcblk0p14 or /dev/block/platform/msm_sdcc.1/by-name/Userdata to /dev/block/mmcblk1p6
Click to expand...
Click to collapse
And
remove /dev/block/mmcblk0p4 or /dev/block/platform/msm_sdcc.1/by-name/Kernel formatting/writing lines
Click to expand...
Click to collapse
Then repack the ROM and push it into phone's internal sdcard.
b. Boot the guest kernel/systemRemember we have zImage and modded ramdisk for each guest system? adb push them to /data partition. The kexec binary is needed as well. Now you can use the kexec binary(check the beginning of this thread) to boot your guest kernel and then recovery.
For example:
I pushed 295 kernel zImage to /data/boot4.3/zImage-stock, modded ramdisk to /data/boot4.3/initrd-stock, and kexec binary to /data/kexec. Now execute as root:
Code:
cd /data
chmod 755 kexec
busybox sync
busybox mount -o remount,ro /system
busybox mount -o remount,ro /cache
busybox mount -o remount,ro /data
busybox sync
./kexec --load-hardboot [COLOR="Red"]./boot4.3/zImage-stock[/COLOR] –initrd=[COLOR="Red"]./boot4.3/initrd-stock[/COLOR] --mem-min=0x85000000 --command-line="`cat /proc/cmdline`"
busybox sync
./kexec -e # phone reboots and guest kernel (295) starts
NOTE: the guest kernel's cmdline may not be exactly the same as the host one. However, it doesn't matter much. 67 and 295 both boot fine using the same cmdline as OmniROM. Since bootloader will append some parameters to the command line, using guest's sec3 without appending these parameters manually is not a good idea.
c. Preparing filesystems and installing ROMs in ZIPAfter the phone reboots, press Vol buttons at purple LED to go into recovery. Now you are in the recovery for your guest system (295).
FORMAT (not wipe) /data and /cache there. For ZIP ROMs you need to format /system as well.
Then install the modded ZIP file if needed. You can also flash SuperSU or anything else to this guest system in the recovery (remember to check if there are wrong block device paths in updater-script).
After finishing the installation of one guest system, reboot and you will go into the host ROM. Execute the commands again and specific the next guest system's zImage and ramdisk to boot into the next guest system. Then do the formatting and flashing things as described above.
5. Boot into guest systems
Once you finish installing all the guest systems, reboot. Then in the host ROM you can execute the commands in Step 4 again to boot into the corresponding guest system. Don't press any key after the reboot. If there's nothing wrong, you will see the bootanimation and then the Android system. Since external sdcards may not be as fast as internal storage, the first boot may take very long time. If you see the bootanimation, just be patient and it will boot up finally.
===========================================================
I know I can't speak English well and it's hard to make myself clear. So if you feel confused, please post your questions here so that everyone who knows the answer will be able to help.
And if you are skilled in Android things, you can choose your own way to achieve the goal:
Partition the sdcard → Mod fstsb and rcs to mount partitions on sdcard to /system etc → Mod the ROM installation script → Boot into guest recovery to format(initialize) data & cache &system and flash ROM → Boot into the guest Android OS
Click to expand...
Click to collapse
This is a little bit complicated. But I do hope this will add more fun to our device
Thanks for your sharing
got it
Although this is labeled for the Xperia TX, after reading through everything, it looks like this works on all devices, you just have to change a few things. Good job putting this together! (Even though I don't have an Xperia TX)
r3pwn said:
Although this is labeled for the Xperia TX, after reading through everything, it looks like this works on all devices, you just have to change a few things. Good job putting this together! (Even though I don't have an Xperia TX)
Click to expand...
Click to collapse
Yeah, it seems that the guide applies to all devices with patched kernels
updateing said:
Yeah, it seems that the guide applies to all devices with patched kernels
Click to expand...
Click to collapse
This guide is nice, full of content, and detailed, but wouldn't it have been easier, though, to just make a MultiROM port?
r3pwn said:
This guide is nice, full of content, and detailed, but wouldn't it have been easier, though, to just make a MultiROM port?
Click to expand...
Click to collapse
I have thought of porting MultiROM, but I'm running a tight schedule...sorry
Whether this Xperia V can also be made from ??
Mircinko96 said:
Whether this Xperia V can also be made from ??
Click to expand...
Click to collapse
It's applicable to Xperia V in theory. But you need a kernel with kexec hardboot patch, which hasn't appeared yet (as far as I have seen). If you know how to compile a kernel, you can try patching the kernel yourself.
.........
do I need linux to unpack kernel?
Hello,
I have got a samsung p1000 tablet from my friend, that it does not boot, there is no warranty for it, and he doesn't need this anymore. I googled what is its problem, and the internal sd was corrupt. I followed tutorials to open the tablet, got off the internal memory which stored the data and the cache partition, then put everything back. After many tries,reflashes, bricks, etc, I got to this solution: I flashed the stock t-mobile firmware with odin 3.07 (this version ignored fail of movinand.rfs and hidden.rfs, not like earlier versions, like 1.85), installed overcome kernel, went to recovery, edited the /system/etc/vold.fstab file and partitioned the sd card as it needed. I booted and it worked, the android system ran from the sd, and the sd's 4gb fat32 partition was used as "internal" sd. I did it by this tutorial: http://forum.xda-developers.com/showthread.php?t=1463756& My partitions are:
1. Primary, fat32, ~5400mb (sdcard)
2. Primary, ext4, 2000mb (data, so applications' place)
3. Primary, fat32, 100mb (preload, or cache?)
OK. It's 2014, I cannot stick with gingerbread. I installed the official cm11 kitkat (http://download.cyanogenmod.org/?device=p1), but it had a problem, after searching i found it:
I can't use camera, cannot download anything and cannot open sdcard0 because: sdcard's fat32 partition is mounted as sdcard1. In KitKat, fstab file (fstab.p1) is in the root. I have to do one of these, but I cannot:
- unpack boot.img then edit fstab.p1 file, repack and reflash it, to use as sdcard0. simply modifying it does nothing, it changes itself back, and sometimes causes a bootloop.
- this solution, that I don't understand: http://forum.xda-developers.com/showpost.php?p=52931787&postcount=118
I'm pretty much confused, because it worked in gingerbread, but it had fstab in other folder, had an other structure of it, it was touchwiz, not cyanogenmod, etc.
Adb logcat and file manager both say: permission denied to sdcard0, ok, because it has been got out by me, but I don't need sdcard1, only sdcard0.
I would appreciate any help from you guys, telling me how to do one of these solutions, which would work and be the better for this case.
(i know this tab is old and obsolete, but it would be good for me for youtube, movies, xda, some games, just for home )
Same problem
I am having the same damn problem. I'm not a developer, and I'm using cygwin, but I do want to poke around in boot.img. How did you unpack it? I was getting an error involving magic android header or something. Also is there an fstab in the recovery? Should I flash that with heimdall, and push edited rom? Thanks for any help, and if you figure it out please post.
bluesnaketree said:
I am having the same damn problem. I'm not a developer, and I'm using cygwin, but I do want to poke around in boot.img. How did you unpack it? I was getting an error involving magic android header or something. Also is there an fstab in the recovery? Should I flash that with heimdall, and push edited rom? Thanks for any help, and if you figure it out please post.
Click to expand...
Click to collapse
I wasn't able to unpack it in cm11 rom. It says the same, there is no magic android header.
I am able to do the following:
DOWNLOAD MODE (turn off, volume down + turn on)
RECOVERY MODE (turn off, volume up + turn on)
- Format 16g memory card like this (e.g. with miniTool Partition): | sdcard,primary,fat32,~5000mb | data,primary,ext4,~1800mb | preload,primary,fat32,~200mb |
(with bigger cards, obviously bigger sdcard and data partition)
- DO NOT format sd with inserted in tab, and mounted in recovery; it will make partitions INSIDE of mmcblk0p1 block, not 3 blocks, mmcblk0p1, 0p2 and 0p3. So, DO format like in laptop, with microSD>SD transformer
- Insert SD card to TAB
- Flash gt-p1000_mr.pit and GB_Stock_Safe.tar with odin 3.07 (the only one which can push hidden.rfs, or skipping it automatically, like ignoring it in heimdall)
- Reboot in recovery mode, see that it can't see int. memory
- Reboot to download mode, flash overcome kernel
- Reboot to recovery, connect to adb, and now you can "adb pull /system/etc/vold.fstab"
- The file pulled to the adb folder should be edited to this (got this from a tutorial):
Code:
# internal sdcard
{
ums_path = /sys/devices/platform/usb_mass_storage/lun0/file
asec = disable
discard = disable
format_option = -r 1558
}
dev_mount sdcard /mnt/sdcard 1 /devices/platform/s3c-sdhci.2/mmc_host/mmc1
# externel sdcard
{
ums_path = /sys/devices/platform/usb_mass_storage/lun0/file
asec = enable
}
dev_mount sdcard /mnt/sdcard/external_sd auto /devices/platform/s3c-sdhci.2/mmc_host/mmc2 /devices/platform/s3c-sdhci.2/mmc_host/mmc1
#end line ## keep this line
- Now type in adb: "adb push vold.fstab /system/etc/"
- To check out booting, type in adb: "adb logcat".
- Reboot your device.
- A female robot voice tells you not enough space on system partition, converting it, estimated time 2 mins, etc etc.
- After a while you should see many-many lines written in adb window, and see your tab booting.
- When turned off charging for 1st time, don't worry, it will convert something again, female voice will appear again. Never so again.
- Now you have your tab working camera, sdcard, apps, etc.
STOP HERE? IF YOU WANT A WORKING 2.3, CONTINUE IF YOU WANT A HALF-WORKING CM11.
2.3 is outdated, I tried to update to cm11
- Go to overcome recovery
- Recovery detects sdcard0 and sdcard1 normally.
- (I didn't do any wipes )
- Flash cm11.
- It will reboot to clockworkmod recovery.
- NOW FCKN recovery detects external sd partition 1 (your savior) as sdcard 1, FUUUUU!
- You have to flash the zip file again.
- Flash gapps. Because of "missing" (it's just mounted in the wrong place) sdcard partiton, some of them can not install.
- Now system boots, you can install apk-s. But even if you umount and mount the sd in the good place, camera and market sd-required apps won't work. So like fb, messenger, circle don't need them, so they work. BADLAND, Real Racing, won't, they need the sdcard mounted in place by the fstab file. You cannot download files in stock browser, neither in Dolphin, only in CM Browser.
Choose, you want to use an older, working os, or a half-working, but newer os, with more (cm features)
Maybe I will include the programs I used, when XDA allows me to place links in this post.
still trying...
Thanks for the info. Maybe if I knew what to do with this http://forum.xda-developers.com/showpost.php?p=52931787&postcount=118 I could get somewhere. I'm still determined to get this to work properly. It worked in that old terenceng rom so there has to be a way...