[MOD][A2SD] Apps2sd-Simple v2 - G2/DZ Flashable Zips ANY-ROM - G2 and Desire Z Android Development

Pretty simple.
A rom with busybox, and init.d support are required.
all zips assume normal mmcblk1p2 ext partition on your sdcard.
If you have completely wiped your device flash this (WIPE):
apps2sd-simplev2-G2-DZ-WIPE.zip - sets up /data/app /data/data and dalvik-caches on ext partition
If you have apps in /data and want to keep them, but switch to apps2sd, flash this (NO-WIPE):
apps2sd-simplev2-G2-DZ-NOWIPE.zip - moves all apps installed to ext, moves all app data installed to ext, moves dalvik caches to ext, fixes permissions after moving depending on how many apps you have this takes a LONG TIME the be patient message should be followed, you can open adb shell during the update and check the sd-ext with df -h to make sure it's growing (give it twenty to thirty second between df -h runs) I flashed this with about 400mb of apps and data, booted perfectly. YMMV
after flashing your favorite rom update (no-wipe updates with roms that DO NOT PROVIDE APPS2EXT Support already, or you will need to disable this function first) flash this (MOUNTEXT):
app2sd-simplev2-mountext-G2-DZ.zip - creates a mount script that has more luck than the provided 05mountsd from cyanogen.
whats happening under the hood?
well i used a very common way of implementing apps2sd with symlinks. the fun part was having the updater-script pretty much do the whole process. instead of making a script and having that executed by the updater-script i used the updater-script itself to perform the scripting.
example (NO-WIPE)
Code:
assert(getprop("ro.product.device") == "vision" || getprop("ro.build.product") == "vision" || getprop("ro.product.board") == "vision");
run_program("/sbin/busybox", "mount", "/dev/block/mmcblk0p26", "/data");
run_program("/sbin/busybox", "mount", "/dev/block/mmcblk0p25", "/system");
package_extract_dir("system", "/system");
set_perm(0, 0, 0777, "/system/etc/init.d/05mountsd");
run_program("/sbin/busybox", "umount", "/system");
ui_print("Simple APPS2SD");
ui_print("Hope you made a backup of /data!!");
run_program("/sbin/busybox", "mount", "/dev/block/mmcblk1p2", "/sd-ext");
delete_recursive("/sd-ext/data/app/");
delete_recursive("/sd-ext/data/data/");
delete_recursive("/sd-ext/data/dalvik-cache/");
ui_print("Destroying dalvik-cache...");
delete_recursive("/data/dalvik-cache/");
delete_recursive("/cache/dalvik-cache/");
ui_print("Creating external data folders...");
run_program("/sbin/busybox", "mkdir", "-p", "/sd-ext/data/dalvik-cache");
ui_print("Moving existing apps.. BE PATIENT.");
run_program("/sbin/busybox", "cp", "-R", "/data/app", "/sd-ext/data");
run_program("/sbin/busybox", "cp", "-R", "/data/data", "/sd-ext/data");
delete_recursive("/data/data/");
delete_recursive("/data/app/");
ui_print("Linking directories...");
run_program("/sbin/busybox", "ln", "-s", "/sd-ext/data/app", "/data/app");
run_program("/sbin/busybox", "ln", "-s", "/sd-ext/data/data", "/data/data");
run_program("/sbin/busybox", "ln", "-s", "/sd-ext/data/dalvik-cache", "/data/dalvik-cache");
run_program("/sbin/busybox", "ln", "-s", "/sd-ext/data/dalvik-cache", "/cache/dalvik-cache");
run_program("/sbin/chown", "1000:1000", "/data/app");
run_program("/sbin/chown", "1000:1000", "/data/data");
run_program("/sbin/chown", "1000:1000", "/data/dalvik-cache");
run_program("/sbin/chown", "1000:1000", "sd-ext/data/app");
run_program("/sbin/chown", "1000:1000", "/sd-ext/data/data");
run_program("/sbin/chown", "1000:1000", "/sd-ext/data/dalvik-cache");
run_program("/sbin/busybox", "umount", "/data");
ui_print("Fixing permissions...");
set_perm(0, 0, 0777, "/sbin/fix_permissions");
run_program("/sbin/sh", "/sbin/fix_permissions");
ui_print("Done, give it a whirl.");
is this easier? no way. could have just done a script in two minutes, but where's the fun in that?
the mountext zip is for situations where you already have links setup, you just need to reflash /system for some reason (update, weirdness etc) just flash this directly afterward, and unless you wiped data you should be able to boot right back up.
why make flashable zips? a request, also people want this for rom's that don't natively support it, works on almost any rooted rom. i cant be sure of sense roms, but it shouldnt be any different.
Have fun everyone. let the flaming begin (for some reason my threads just attract trolls, go figure..)
i tested these for hours, seem to be working as planned, MAKE A BACKUP. if you dont, dont come a cryin'.
I don't endorse using external sd partitioning on the g2, but i'll try to stay up with suggestions or fixes should problems arise.

Perfect! Thanks for developing tjis flash
Sent from my HTC Vision using XDA Premium App

The only reason I've started using sd-ext is because I was getting the dreaded installation failed due to not enough space message, or something to that effect, even though there was plenty of space reported on the phone. Don't know if it's a CM7 bug or what, but I've run in to it multiple times. Thanks for this, I'll play with it and see if it does me well!

How long should it take for the phone to boot up after the no-wipe method?

SomEngangVar said:
How long should it take for the phone to boot up after the no-wipe method?
Click to expand...
Click to collapse
On a really terrible sdcard I used last night it was upward of twenty minutes, but I was watching a logcat to be certain that it was moving forward and not looping. As long as the boot animation isn't restarting you should be alright. Using a slow sdcard will seriously degrade performance though.
Run a logcat during boot if in doubt, or run ddms.

amazinglarry311 said:
On a really terrible sdcard I used last night it was upward of twenty minutes
As long as the boot animation isn't restarting you should be alright.
Click to expand...
Click to collapse
I would think a class 4 would be fine? I'm just asking because it spent a lot of time on the splash screen.

SomEngangVar said:
I would think a class 4 would be fine? I'm just asking because it spent a lot of time on the splash screen.
Click to expand...
Click to collapse
The one I was using said it's a class four, the class 2 that came with the device is way faster, I'm pretty sure the c4 card I have has some bad or dead blocks, it's only a matter of time, that or the manufacturer is full of **** and it isn't really a c4.
Like I said, if in doubt watch a logcat and make sure it isn't repeating.

Related

[DOC][DEV] More free space on /data for the Hero

Hey Devs,
As you may have noticed, I recently released a ROM with 276 MB free space on /data.
I accomplished this by using the MTD hack discovered by firerat and lbcoder.
It changes the kernel cmdline and includes addresses where the partitions are located.
This way, we are able to change the sizes.
That's exactly what I did.
The bad thing is that you need a recovery with a cmdline, which matches the ROM's boot.img's one!
So, a user needs to flash a recovery first and can then flash the ROM after a reboot into the new recovery.
Now, if the user wants to change his ROM to something else, he will need to revert the recovery.
It would be a lot easier if some other developers here would be interested in the MTD hack, so there is no need to revert.
I hope that some other developers will jump on the bandwagon now.
Here is the command I use for creating boot.img's, with modified partition sizes:
Code:
mkbootimg --kernel kernel --ramdisk ramdisk --cmdline 'mtdparts=msm_nand:[email protected](misc),[email protected](recovery),[email protected](boot),[email protected](system),[email protected](cache),[email protected](userdata)' -o boot.img --base 0x19200000
This reduces the /cache partition to 4 MB and makes /data as big as possible (the space which is left).
Now, the Market would normally fail to download huge APKs, because /cache is so small.
The problem can be easily solved by symlinking /cache to /data/cache and mounting the native cache partition on /dev/cache.
This can be done even without modifying the ramdisk, just do it in a script which runs before the Android frameworks start, like a2sd scripts.
Here are the necessary commands:
Code:
mount -o rw,remount /
umount /cache
rm -rf /cache
mkdir /data/cache
ln -s /data/cache /cache
mkdir /dev/cache
mount /dev/block/mtdblock4 /dev/cache
chmod 777 /data/cache
mount -o ro,remount /
Regarding the recovery:
Klothius from the Sapphire section created an update.zip which automatically patches the current recovery to use the provided cmdline.
You can find it here and include it in your instructions:
http://www.megaupload.com/?d=FY6CBAEE
I hope this little documentation will help you and will make you interested in doing this for your ROM.
Nice work. We'll look at implementing this into the next FroydVillain release. My only reservation would be keeping a wee bit more space on /cache than 4MB since our OTA app uses it. We could always hack it to use a dir on /data I suppose.
Hacre said:
Nice work. We'll look at implementing this into the next FroydVillain release. My only reservation would be keeping a wee bit more space on /cache than 4MB since our OTA app uses it. We could always hack it to use a dir on /data I suppose.
Click to expand...
Click to collapse
Yea, that would be better.. The whole purpose of this thread is to make things more compatible, means same cmdline Also you wll need to write the instructions for the recovery to /dev/cache then, keep that in mind
I will also add the RecoveryMod and an explanation in the documentation now.
I think the limitation of needing to switch recovery when changing ROMs is quite bothersome. Is there anyway we can get a recovery which supports both modes?
erasmux said:
I think the limitation of needing to switch recovery when changing ROMs is quite bothersome. Is there anyway we can get a recovery which supports both modes?
Click to expand...
Click to collapse
Sure, it can be done, but that would take a looot of work!
maxisma said:
Sure, it can be done, but that would take a looot of work!
Click to expand...
Click to collapse
More than I think it would be worth, to be honest. It'd make more sense for all the ROM developers to pull together on this and just make it a fact that we're giving more space to data, since it also eliminates the need to create fancy hacks moving dalvik to cache or to sdcard or splitting it between 2-3 file systems to cater for people who like to have the entire Android Market on their phone.
This has my/Villain's full support Maxisma, it makes perfect sense. Might I suggest you PM the other ROM developers here, or at least the popular ones like Fusion etc, and refer them to this thread so we can all work together on it.
Now that it's safe to assume that HTC have pretty much ditched the Hero, it makes sense for us to fix/improve -everything- including partition layout. There is a lot of wasted space in /cache that only gets used if a ROM developer starts fudging about with where dalvik lives, but /cache isn't quite big enough to completely migrate dalvik cache to for people who like to have a lot of apps.
Is there any more work on this? :d
shinyfong said:
Is there any more work on this? :d
Click to expand...
Click to collapse
I believe maxisma stopped work on it due to it breaking something or causing something not to work. I think he mentioned it in his Rom thread...
pulser_g2 said:
I believe maxisma stopped work on it due to it breaking something or causing something not to work. I think he mentioned it in his Rom thread...
Click to expand...
Click to collapse
It was me who broke it ;-) I accdidentally booted with a different mtd layout and thus killed all my data.
This method is perfectly fine though.
But I switched to a Nexus and I don't have a Hero anymore.

[Q] Howto install apps via update_script

Hi,
i am actually trying to install apps via an update_script. But it doesnt work like i thought it would^^
i have a zip-file containing the following structure:
Code:
/META-INF
/META-INF/com
/META-INF/com/google
/META-INF/com/google/android
/META-INF/com/google/android/update_script
someapp.apk
my update_script:
Code:
show_progress 0.1 0
mount("MTD", "userdata", "/data");
mount("MTD", "system", "/system");
show_progress 0.1 3
run_program("/system/xbin/busybox", "install", "*.apk", "/data/app");
show_progress 0.1 6
unmount("/data");
unmount("/system");
show_progress 0.1 10
but actually after reboot there is no installed app!
what is going wrong? did i missunderstand the usage of busybox out of an update_script?
and yes, i already tried google -.-
i dont want to just move the apk to /data/app, because it is installed in the system, but does not appear in the market and there wont be any updates then.
hope u can help me
device info
------------
Desire GSM (AMOLED-Display)
Hboot 0.83
Radio 32.56.00.32U_5.17.05.08
ClockwerkMod Recovery 2.5.0.7
ROM: InsertCoin Sense 2.1 1.0.3 A2SD
if you need further information, feel free to ask
hi, mhm ... why not using adb?
anyway had you cleared all data from the market-app after you installed it by pushing?
because sometimes this is an solution
other thing is just try to reinstall it over the market
or i just dont get what you mean
ok. i dont use adb, because im trying to create a .zip file, in which any users/friends can put .apk and install them by flashing the .zip through CM recovery.
well plz dont ask for the sense behind it, but it is a good practice do get a bit more involved in scripting and understanding ROMs and customizing
i dont cleared the data from the market app. maybe thats the point.. i'll give it a try when i have some more time than now at work.
but it is the same thing when u repack any ROM. if u add/delete apps, they wont show in the market and so u are not able to get updates for it.
anyway thanks for the answer!

[Q]When insering apps into a rom build, how to prevent the market reboot issue?

So, after compiling my rom, when having 3rd party apps in the Data/App folder of the rom, once installed and running, when installing apps from the market, or downloading anything in general it causes the infamous reboot issue (due to what seems to be a permissions issue for the cache).
Simply putting those apps into the system app folder, once installed, will cause the programs to error out when starting (eg: rom manager, google earth, and the shadow galaxy live wallpaper)
So here's a question to all dev's
when building your roms, have you come across that issue, and how did you manage to fix it?
(im still new to dev'ing, and no, im not using a kitchen, but doing it the hard way and just typing up code)
also, If anyone knows how to in the mns/default.xml choose a live wallpaper rather than a fixed wallpaper, please let me know
Would simply adding
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
to the begining of the updater-script with the symlinks work?
Edit: Well I seem to have answered my own question again, doing this works. lol

[KERNEL MOD] Get unlimited space in /system partition ! [FOR ADVANCED USERS ONLY]

Hello all,
I recently joined the Marvellous Team, and we started working on a Sense 5 port.
The problem was that Sense 5 is a little bit huge. I mean, about 886 MB. So we would have to reduce a lot the size and nearly de-sense the ROM, which is absolutely pointless as we want Sense 5
So we thought we could try to link some system folders to /sd-ext. I already tried, but never with succes, because of many things like permissions, mounting, etc.
Now, I thought about one thing that would be great : mounting the whole /sd-ext partition to /system ! @thehacka1 and I worked a lot on the kernel, and finally it works ! You can see in the screenshot posted, I have 530 MB of system partition
HOW TO DO IT
We have to mod the kernel. I used to do everything myself (with a lot of commands and scripts) but then I found out that it absolutely didn't work because the kernel wasn't repacked correctly So I advice you to use @dsixda 's Android kitchen that you can found here.
Step 1
Install the latest version of the kitchen
Create a working folder with the ROM zip you want to patch
Go to advanced (0) then boot image options (12)
Uncompile the kernel
Step 2
Here we do the most important thing... Editing init.rc.
Open init.rc with your favourite editor and look for the lines
Code:
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /system ro remount
.
Delete them and replace them by
Code:
mount ext4 /dev/block/mmcblk0p2 /system
.
Save and voila ! You have done the most difficult part of the job
Step 3
Create a folder BOOT-EXTRACTED in the folder of the kitchen
Put the extracted and modded boot.img in it
Go back to the kitchen's boot image tools
Repack the kernel
Step 4
Here your are ! You have the kernel. Let's edit the ROM zip now.
Open your updater-script, and replace
Code:
format("yaffs2", "MTD", "system", "0", "/system");
mount("yaffs2", "MTD", "system", "/system");
package_extract_dir("system", "/system");
by
Code:
run_program("/sbin/busybox", "mount", "-t", "auto", "/dev/block/mmcblk0p2", "/system");
run_program("/sbin/busybox", "rm", "-rf", "/system/*");
package_extract_dir("system", "/system");
If I were you, I would also remove all the lines with tmpbackuptool. INFO by thehacka1 : do this only if you are porting a rom
Replace the boot.img in the zip by your new boot.img and you're done
I forgot to say : with this mod, the system is mounted as writable If you want to mount it read-only, add
Code:
mount ext4 /dev/block/mmcblk0p2 /system ro remount
after
Code:
mount ext4 /dev/block/mmcblk0p2 /system
DEVICE COMPATIBILITY
This mod should work for every device. If you use it for your ROM, please just give a link to this thread
What you need to know is that, for non-MTD based devices, there will be no line like
Code:
mount yaffs2 [email protected]
but lines like
Code:
mount yaffs2 [email protected]
or something like that.
Maybe, if your device isn't the WildFire S (poor you ), your sd-ext is not /dev/block/mmcblk0p2. I let you modify as you want and you can post here the path for other devs !
BE CAREFUL
This mod may not work. I am not responsible for anything that could happen to your device. This mod may eat your cat. It may eat your family. It may bring you back to the future. I don't care. If you complain about the fact that it broke your device, I will only laugh at you. You're warned Do it at your own risk !
Click to expand...
Click to collapse
I didn't test all the cases. Maybe there will be bugs if everything is not unmounted or wiped.
After modding your rom like that, you won't be able to use any something2sd tweak. I shal certainly mod one to work with a third sd partition, but not now. You won't be able to flash any scripts that install things in /system without modding them. It is easy : replace
Code:
mount("yaffs2", "MTD", "system", "/system");
by
Code:
run_program("/sbin/busybox", "mount", "-t", "auto", "/dev/block/mmcblk0p2", "/system");
in the updater-script.
This mod is for developers and advanced users ! Here is not a place for asking questions about how to decompile a kernel
CREDITS
dsixda for his amazing kitchen
thehacka1
thehacka1
thehacka1
thehacka1 who took all the risks for testing this mod, including bricking his own phone !
thehacka1, whom I told that he would be named 5 times in credits if this mod worked
All the Marvellous team people (you're so great guys )
Does it make it slower if you have a bad sdcard?
Btw AWESOMEEEEEEEE
Sent from my HTC "Marvellous" WFS
Guitarfreak12 said:
Does it make it slower if you have a bad sdcard?
Btw AWESOMEEEEEEEE
Sent from my HTC "Marvellous" WFS
Click to expand...
Click to collapse
Certainly. It will slow down the phone I think. But I didn't test a lot after flashing... This is mostly for development purposes
izi501 said:
Certainly. It will slow down the phone I think. But I didn't test a lot after flashing... This is mostly for development purposes
Click to expand...
Click to collapse
Great work guys
Awesome work guys , I needed it to load more system apps btw best of luck for sense 5 , my jimmies are unrustled
You mother ****ing genious izi. It finally worked. Come on Hangouts. We can now talk sense 5. You also need to give me that kernel.
EDIT: People only remove backuptool lines if you are porting a rom. If you are trying to do this for a rom that's already there then you don't need to remove those lines. You just need to mount sd-ext to system.
May be its only for s-off... Right???
Sent from my HTC Wildfire S A510e using xda app-developers app
finance.resat said:
May be its only for s-off... Right???
Sent from my HTC Wildfire S A510e using xda app-developers app
Click to expand...
Click to collapse
I actually don't think so mate. It is just a kernel mod.
Sent from my HTC "Marvellous" WFS
finance.resat said:
May be its only for s-off... Right???
Sent from my HTC Wildfire S A510e using xda app-developers app
Click to expand...
Click to collapse
I'm S-ON and it works for me
I don't think I will make a CronMod script modded now, because I tried to partition my sd card with a third partition, and I realized that it will need a modded recovery to wipe it and backup it.
If someone wants to do it, the third partition is /dev/block/mmcblk0p3.
Envoyé depuis mon HTC FeuSauvage S avec CM10.1 et Tapatalk 4
izi501 said:
I'm S-ON and it works for me
I don't think I will make a CronMod script modded now, because I tried to partition my sd card with a third partition, and I realized that it will need a modded recovery to wipe it and backup it.
If someone wants to do it, the third partition is /dev/block/mmcblk0p3.
Envoyé depuis mon HTC FeuSauvage S avec CM10.1 et Tapatalk 4
Click to expand...
Click to collapse
@JDevs might include that in next update of owlmod :good:
cyb3r.pr3dat0r said:
@JDevs might include that in next update of owlmod :good:
Click to expand...
Click to collapse
Maybe He musts get bored with all our requests Moreover he's in travel for now so he can't.
But you can always do that with ADB... It's just annoying because it needs a PC, USB drivers, and all.
Any chance to release a flashable zip?
LucidSomnia said:
Any chance to release a flashable zip?
Click to expand...
Click to collapse
It isn't possible, because the flashable zip would contain the whole kernel. I would have to release a flashable zip for every Android version, and for every ROM with a custom kernel So it is easier to ask the dev of your ROM to propose a modded kernel with this mod.
izi501 said:
It isn't possible, because the flashable zip would contain the whole kernel. I would have to release a flashable zip for every Android version, and for every ROM with a custom kernel So it is easier to ask the dev of your ROM to propose a modded kernel with this mod.
Click to expand...
Click to collapse
can we mount /data to /dev/block/mmcblk0p2 too ?
cyb3r.pr3dat0r said:
can we mount /data to /dev/block/mmcblk0p2 too ?
Click to expand...
Click to collapse
No, not on the same partition. But what is possible is to mount /data to a third SD partition (/dev/block/mmcblk0p3) or even to the original system partition ([email protected]). You can play a bit with the mount commands.
I tried to mount /data fully to sd-ext, but it slowed down the phone A LOT (AOSP from @thehacka1, without anything installed, was very laggy) and then the phone didn't reboot
And a third SD partition would need a modded recovery to wipe it and backup it. Certainly it only needs to mod a bit TWRP, but I don't have the time nor the will to do it You can wipe it and backup it yourself, it isn't very difficult, just takes more time.
cyb3r.pr3dat0r said:
my jimmies are unrustled
Click to expand...
Click to collapse
U aware?

Completely blank GW as wiped and cant restore

Hi guys
my father-in-law gave me his old galaxy w to 'sort' and maybe keep as he has just got a moto g.
i installed a 4.4.4 rom onto the sd card (ext) and the gapps ready. followed the tutorial which said to clear various parts including the sd card (int) which of course wiped away the backup i had just created. it then wouldnt install the new rom, coming up with status 7.
i have followed a few recommendations that said to ope the zip and browse to the update script and delete the first line or so back to the ';' which i did but then it came up with failed status 6.
any suggestions?
thanks, marc
marc.knuckle said:
Hi guys
my father-in-law gave me his old galaxy w to 'sort' and maybe keep as he has just got a moto g.
i installed a 4.4.4 rom onto the sd card (ext) and the gapps ready. followed the tutorial which said to clear various parts including the sd card (int) which of course wiped away the backup i had just created. it then wouldnt install the new rom, coming up with status 7.
i have followed a few recommendations that said to ope the zip and browse to the update script and delete the first line or so back to the ';' which i did but then it came up with failed status 6.
any suggestions?
thanks, marc
Click to expand...
Click to collapse
What recovery do you have? What version?
4.4.4 only works with latest recoveries i think. since u iped yr sdcard then u need to sideload it using a PC, then install
marc.knuckle said:
Hi guys
my father-in-law gave me his old galaxy w to 'sort' and maybe keep as he has just got a moto g.
i installed a 4.4.4 rom onto the sd card (ext) and the gapps ready. followed the tutorial which said to clear various parts including the sd card (int) which of course wiped away the backup i had just created. it then wouldn't install the new rom, coming up with status 7.
i have followed a few recommendations that said to ope the zip and browse to the update script and delete the first line or so back to the ';' which i did but then it came up with failed status 6.
any suggestions?
thanks, marc
Click to expand...
Click to collapse
Hey
1. Before you start messing with the updater-script, I would make sure that this Galaxy Wonder is the international version and not any other variant (like GT-I8150T or GT-I8150B). That line makes sure your phone it's not anything else other than a GT-I8150. And I would NOT recommend simply deleting it.
Also, the line is:
Code:
assert(getprop("ro.product.device") == "ancora" || getprop("ro.build.product") == "ancora" ||
getprop("ro.product.device") == "GT-I8150" || getprop("ro.build.product") == "GT-I8150" || abort("This package is for \"ancora,GT-I8150\" devices; this is a \"" + getprop("ro.product.device") + "\"."););
So you need to make sure you delete it all the way to the second line (not including the second line, of course) which says:
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p15", "/system");
But again, I would NOT mess with that, if I were you. That's a security measure, implemented to make sure you don't screw up your phone in case it's not a Galaxy Wonder International variant.
2. Make sure to install THIS recovery if you're planning to go with CM11.
3. Never create backups on Internal Memory if you have an External SD Card you can use for that.
4. I'm confused. Are you trying to install CM11 (or any other 4.4.4 ROM posted here) on your phone or restore the stock ROM (Android 2.3.6 Gingerbread) to it?
5. Please, post this kind of issues in the Q&A Section, or at least the General section.
thanks guys, i got it sorted by installing the latest cwm as mentioned above could be the issue.

Categories

Resources