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

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?

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.

[stopped] by formatting the internal /data partition

Hmm
sorry guys. by now, I'm going to stop fixing this, sigh, I'm not good enough to fix this at the moment.
Can not garantee you the safety of this method but hopefully, the fantastic voodoo lagfix is coming.
Let's hope to see it soon!
I'll leave the update.zip here, if anyone who is intersted in this method, feel free.
FILE LINK :
http://www.multiupload.com/DU013PW7LW
Hi
I have made an update.zip which fixes I9000's lag.
The idea is to format the /data partition, which is the same as /dev/block/mmcblk0p2, to the EXT4 or NILFS2 File Systems.
It's worth because, at least, we don't need an external MicroSD card.
### Before getting started... ###
This method can damage your phone, so you should know what you are attempting to do. All risks are on your own. Also, I strongly recommend you to have a nandroid backup.
### It contains... ###
- absolutely pure JM2 kernel but a tiny modification of the ramdisk. It's from JM2 firmware but should be working on every ECLAIR devices. This kernel helps mounting the data partition to be mounted in every booting and the reason why this is nearly identical to the stock is because some people mind using user-built kernels for some reasons.
- an application called "sl4a" which has shell scripts inside named "EXT4_Lagfix.sh", "NILFS2_Lagfix.sh" and "Openvpn.sh".
※It will install the kernel in the process of applying update.zip so you don't need the Odin.
### More information about this kernel... ###
- As I said, the only thing I've modified is the ramdisk. In details, I've put two files, user_init.sh and user_early_init.sh which are from Unhelpful's kernel, and these files are essential for mounting the /data partition.
- The kernel is almost pure, so it uses modules.
- The user_init.sh, user_early_init.sh support user scripts are very useful. You can see the idea in below thread, OP of Unhelpful.
http://forum.xda-developers.com/showthread.php?t=762171
### About the scripts... ###
- If you touch the EXT4_Lagfix.sh script or NILFS2_Lagfix.sh, it will ask you a superuser permission, back up the entire /data folder in your /sdcard directory, and finally, reboot and do the rest works automatically.
- You can go over to the other file system whenever you want, for instance, it can be changed to the nilfs2 while you are using the ext4 FS.
- There also is a script called Openvpn.sh which will insert tun.ko module and this is for the people who want to use openvpn.
### What you need to do is... ###
- Needs busybox installed and rooted
- Make enough space in /sdcard to make the backing up process work properly.
- In order to use NILFS2 FS, a bit of studying is needed.
About nilfs2 binaries and the Gabage Collector.
go to this site
http://www.nilfs.org/
### What I want to say is...###
- I'm not actually a goot developer so the scripts must be very messy. But it works well, at least with my device.
- Unfortunately, I haven't got the going-back-to-rfs script. I'm working on it recently so if you want to restore the all fixes, you need to flash the firmware.
- Quadrant scores : NILFS2 ~ around 1300
            EXT4 ~ around 1700
 Do you really concern about the score? I don't. The NILFS2 is exactly what I've needed.
### What I MUST say is... ###
- Big thanks to these people!
## Tayutama -- the beautiful sl4a application is from his rom!
## Unhelpful -- used his idea to mount the /data partition. And the NILFS2 as well!
## supercurio -- He's the one who found how to flash kernels from the phone!
Also, I uploaded some useful utils.
- mkyaffs2image / unyaffs
- chcp / lscp / lssu / mkcp / rmcp
Hope this will help you guys.
So what's different between this and the voodoo lagfix? Is the the partition? I know that voodoo ext4 is /dev/block/mmcblk0p4 while this one is /dev/block/mmcblk0p2
Nice dkcldark.
Will you share your method to unpack-repack the ramdisk from a stock kernel ?
Very nice! Great job!
NeoXTC said:
So what's different between this and the voodoo lagfix? Is the the partition? I know that voodoo ext4 is /dev/block/mmcblk0p4 while this one is /dev/block/mmcblk0p2
Click to expand...
Click to collapse
Oh, I've been busy so I couldn't have a look at the voodoo lagfix. I'm gonna check it. It could be the same as mine or much better
mmcblk0p2 is equal to /data partition, BTW.
supercurio said:
Nice dkcldark.
Will you share your method to unpack-repack the ramdisk from a stock kernel ?
Click to expand...
Click to collapse
Why not? To do this, I've done a bunch of experiments and it made me get older, I think. Will write a reply or a new thread very soon.
RyanZA said:
Very nice! Great job!
Click to expand...
Click to collapse
Thanks!!
dkcldark said:
Why not? To do this, I've done a bunch of experiments and it made me get older, I think. Will write a reply or a new thread very soon.
Click to expand...
Click to collapse
Yeah, theorically it's simple, we have the smallest piece of code building the kernel so why should extracting then reinserting the ramdisk difficult ?
And there comes the difference between the theory and the practice
Congrats for your research and the result, i hope your method can be applied to any kernel including a ramdisk!
This is a major breakthrough in our Opensource Toolbox.
So do you recommend NILFS or ext4 for phones with nand disk? Just reading up a bit on nilfs and seems to create lots of checkpoints? Is it good for nand disk to be writing that much?
I'm tempted to try this tonight
NeoXTC said:
So do you recommend NILFS or ext4 for phones with nand disk? Just reading up a bit on nilfs and seems to create lots of checkpoints? Is it good for nand disk to be writing that much?
I'm tempted to try this tonight
Click to expand...
Click to collapse
Personally, I recommend the NILFS2 File system. I've searched some infomations.
NILFS2 is log-structured File System and known that it's suitable for SSD which is based on nand flash. Normally, Flash has a limited read-write times but nilfs2 tries to write to the entire space equally, and has got the smallest removing interval so the NILFS2 file system makes SSD work very nice. And a great Wear-Leveling as well.
Click to expand...
Click to collapse
I'm not a good developer, as I already said on my post, so I'm not sure it'd also be nice for SGS but it sounds good to me. Actually, I'm using NILFS2 and it's bloody fast!
How difficult would this be to adapt to the Captivate variant of the Galaxy S?
dkcldark said:
Personally, I recommend the NILFS2 File system. I've searched some infomations.
I'm not a good developer, as I already said on my post, so I'm not sure it'd also be nice for SGS but it sounds good to me. Actually, I'm using NILFS2 and it's bloody fast!
Click to expand...
Click to collapse
on which firmware do u recommend to use it?
I'm actually on JM6 but tomorrow i want to try the JM7....
(Any battery drain? )
andars05 said:
How difficult would this be to adapt to the Captivate variant of the Galaxy S?
Click to expand...
Click to collapse
It's not difficult at all.
My kernel is originally from Unhelpful's idea so, people who use his kernel will easily be able to do it. All you need is just remove the zImage and redbend_ua files in the update.zip. Every kernel which supports Unhelpful's rules about /system/etc/init.d will be OK. Or, you can simply modifiy the scripts inside.
One more, if you use Unhelpful's kernel, you don't need the modules any more.
Narcissus85 said:
on which firmware do u recommend to use it?
I'm actually on JM6 but tomorrow i want to try the JM7....
(Any battery drain? )
Click to expand...
Click to collapse
Any firmware should be OK. I'm using JM2 at the moment but I'll try the JM7 as well. So as the result, I'm going to come up with JM7-based pure kernel, although I believe there won't be big differences between JM2 and JM7.
And the battery.. I'm sorry I haven't tested it yet since I've got 4 batteries. I'm not bothered by them lol.
dkcldark said:
It's not difficult at all.
My kernel is originally from Unhelpful's idea so, people who use his kernel will easily be able to do it. All you need is just remove the zImage and redbend_ua files in the update.zip. Every kernel which supports Unhelpful's rules about /system/etc/init.d will be OK. Or, you can simply modifiy the scripts inside.
One more, if you use Unhelpful's kernel, you don't need the modules any more.
Any firmware should be OK. I'm using JM2 at the moment but I'll try the JM7 as well. So as the result, I'm going to come up with JM7-based pure kernel, although I believe there won't be big differences between JM2 and JM7.
And the battery.. I'm sorry I haven't tested it yet since I've got 4 batteries. I'm not bothered by them lol.
Click to expand...
Click to collapse
4 batteries? ahah cool i'll test it tomorrow with my only one battery! :>
thanks for ur lagfix..
mmm just another question...my english isnt so good (i'm italian)....with this "I'm going to come up with JM7-based pure kernel, although I believe there won't be big differences between JM2 and JM7." do u mean that u are going to update ur lagfix with another kernel? so another version comes out soon?
thanks...
ivan
dkcldark said:
It's not difficult at all.
My kernel is originally from Unhelpful's idea so, people who use his kernel will easily be able to do it. All you need is just remove the zImage and redbend_ua files in the update.zip. Every kernel which supports Unhelpful's rules about /system/etc/init.d will be OK. Or, you can simply modifiy the scripts inside.
One more, if you use Unhelpful's kernel, you don't need the modules any more.
Click to expand...
Click to collapse
So, I should flash unhelpfuls kernel. I then next remove the zImage and redbend_ua files from the update.zip, install it, and then run the sl4a script?
Narcissus85 said:
4 batteries? ahah cool i'll test it tomorrow with my only one battery! :>
thanks for ur lagfix..
mmm just another question...my english isnt so good (i'm italian)....with this "I'm going to come up with JM7-based pure kernel, although I believe there won't be big differences between JM2 and JM7." do u mean that u are going to update ur lagfix with another kernel? so another version comes out soon?
thanks...
ivan
Click to expand...
Click to collapse
Yes, I am. Will Just come with a new kernel. Every else is the same.
andars05 said:
So, I should flash unhelpfuls kernel. I then next remove the zImage and redbend_ua files from the update.zip, install it, and then run the sl4a script?
Click to expand...
Click to collapse
In order to reuse after modifying the update.zip, you need to sign it again. If you want to use a plain kernel, I can make it which is not a big deal.
dkcldark said:
In order to reuse after modifying the update.zip, you need to sign it again. If you want to use a plain kernel, I can make it which is not a big deal.
Click to expand...
Click to collapse
That would be most helpful! Thanks for your work! I can't wait to test it out on my captivate
Edit:
I figured out how to resign the update.zip. I'm running the sl4a script now. I'll post the results shortly.
Edit 2:
It appears to back up the data partition, but upon reboot its still rfs.
You may want to make some other modifications I've since learn are needed. Specifically, the stock init will overwrite the MBR, removing any changes you've made to the partition table, and will then write some data to mmcblk0p2 if it does not find a valid RFS filesystem. You might not even see anything wrong at first, but with enough reboots, this will eventually corrupt your reformatted /data partition.
The edit I'm using will be in my next kernel release, and is very simple - open the init binary in a hex editor, find the string "/dev/block/mmcblk0" (make sure there's a NULL after the 0 so that it's not a substring of some longer string) and replace the "m" with a NULL. Init will then fail to rewrite the partition table (because it tries to open "/dev/block/", which is a directory). Then you simply need to change the partition table - you can use exactly the same region of the disk, you won't even need to reformat, just remove the existing partition 2 and make a new partition 3 or 4. Partitions 3 or 4 won't be checked by init on reboot.
Unhelpful said:
You may want to make some other modifications I've since learn are needed. Specifically, the stock init will overwrite the MBR, removing any changes you've made to the partition table, and will then write some data to mmcblk0p2 if it does not find a valid RFS filesystem. You might not even see anything wrong at first, but with enough reboots, this will eventually corrupt your reformatted /data partition.
The edit I'm using will be in my next kernel release, and is very simple - open the init binary in a hex editor, find the string "/dev/block/mmcblk0" (make sure there's a NULL after the 0 so that it's not a substring of some longer string) and replace the "m" with a NULL. Init will then fail to rewrite the partition table (because it tries to open "/dev/block/", which is a directory). Then you simply need to change the partition table - you can use exactly the same region of the disk, you won't even need to reformat, just remove the existing partition 2 and make a new partition 3 or 4. Partitions 3 or 4 won't be checked by init on reboot.
Click to expand...
Click to collapse
I really appreciate for this information!! Just wondering about one thing.
Should I replace the "m" to NULL once in "/dev/block/mmcblk0" or its friend "/dev/block/mmcblk0p2" as well?
Unhelpful said:
You may want to make some other modifications I've since learn are needed. Specifically, the stock init will overwrite the MBR, removing any changes you've made to the partition table, and will then write some data to mmcblk0p2 if it does not find a valid RFS filesystem. You might not even see anything wrong at first, but with enough reboots, this will eventually corrupt your reformatted /data partition.
The edit I'm using will be in my next kernel release, and is very simple - open the init binary in a hex editor, find the string "/dev/block/mmcblk0" (make sure there's a NULL after the 0 so that it's not a substring of some longer string) and replace the "m" with a NULL. Init will then fail to rewrite the partition table (because it tries to open "/dev/block/", which is a directory). Then you simply need to change the partition table - you can use exactly the same region of the disk, you won't even need to reformat, just remove the existing partition 2 and make a new partition 3 or 4. Partitions 3 or 4 won't be checked by init on reboot.
Click to expand...
Click to collapse
Yeah more like curios setup.
What needs to be done in order to adapt this to the Captivate?
I deleted the zImage and redbend_ua files and resigned the zip. I tried both of the lagfix scripts included and neither one worked. It backed up /data and rebooted. It doesn't reformat the fs, and it is still rfs. There doesn't appear to be a /system/etc/init.d directory. I'm running Unhelpful's kernel (v1.2).
I'm rooted and have busybox installed.
If only supercurio can adapt your method of editing the ramdisk inside the stock kernel, it would be awesome! As he already knows how to go back to rfs! We would then have a complete fix!

[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!

[MOD] How to replace /cache partition with a virtual one (any size)

I found a solution to temporarily replace the /cache partition with a virtual one having any arbitrary size.
I made a script that creates an empty file (64MB but it can be larger) on /data/local. Then it creates an ext4 filesystem on the file, unmounts the /cache and finally mounts the file as the cache partition through the loop device.
This virtual partition works until the next reboot and then the old /cache partition is mounted again.
To test this, copy the script to your phone give it executable permissions and run it through adb shell or a terminal. You have to be root and have busybox installed
I tested the script on stock JVQ, Semaphore kernel and works OK.
You may find a CWM edition (thanks to corgar) here. This version will create the cache partition (50 MB) in the /dbdata.
Use this script only if you know what you are doing and with your own risk!.
What does this do exactly? Does it take part of the flash memory to use as cache instead of RAM? I dont know much about advanced hacking etc, but this sounds like it could fix my constantly restarting apps when there are too many apps opened at the same time, or too many processes running at the same time. or are those things unrelated with this?
neswii said:
What does this do exactly? Does it take part of the flash memory to use as cache instead of RAM? I dont know much about advanced hacking etc, but this sounds like it could fix my constantly restarting apps when there are too many apps opened at the same time, or too many processes running at the same time. or are those things unrelated with this?
Click to expand...
Click to collapse
No, it creates a file in the /data partition and mount it as cache. I don't think that this will solve you the problem.
I made it mostly for people who want to download applications more that 30 MB from market
Nice idea @stratosk! I must give this a try!
Anyone tried this?
Please for your feedback.
I'm ready to test during the day. Do you have any name of a free app bigger than 30 Mb we can download to validate it works?
I've runned the script with SGS Tools. It runs ok, and creates a bigger cache partition, but i still can't download bigger apps on market, although it now gives me a different error (before was something like: There isn't space on this device. And now it is something like: There was an error). Tried with "Battle Bears 1 Lite" and "Extreme Formula"
EDIT: is it ok to run with SGS tools? I don't know how to run them in Terminal! Someone could tell me how?
EDIT 2: Actually i've tried now, and i can't download any apps from market!
lucbl1 said:
I've runned the script with SGS Tools. It runs ok, and creates a bigger cache partition, but i still can't download bigger apps on market, although it now gives me a different error (before was something like: There isn't space on this device. And now it is something like: There was an error). Tried with "Battle Bears 1 Lite" and "Extreme Formula"
EDIT: is it ok to run with SGS tools? I don't know how to run them in Terminal! Someone could tell me how?
EDIT 2: Actually i've tried now, and i can't download any apps from market!
Click to expand...
Click to collapse
Are you sure you have enough space on /data ?
stratosk said:
Are you sure you have enough space on /data ?
Click to expand...
Click to collapse
Yeah, pretty sure.
I've rebooted my device now, and downloads work fine again, except of course of those bigger than 30mb (actually 26mb, since ext4 conversion uses 4mb on cache).
PS: thinking about it now, could it be that the 4mb of ext4 conversion is keeping me from downloading the apps properly?
Just modified that script to move cache in dbdata ( onenand). A little request how to mount without specify fs? Instead of mount -t ext4. Thx
Inviato dal mio GT-I9000 usando Tapatalk
corgar said:
Just modified that script to move cache in dbdata ( onenand). A little request how to mount without specify fs? Instead of mount -t ext4. Thx
Inviato dal mio GT-I9000 usando Tapatalk
Click to expand...
Click to collapse
I have to test this, because the script makes ext4 file system on the cache.img. So it should be mounted as ext4
lucbl1 said:
Yeah, pretty sure.
I've rebooted my device now, and downloads work fine again, except of course of those bigger than 30mb (actually 26mb, since ext4 conversion uses 4mb on cache).
PS: thinking about it now, could it be that the 4mb of ext4 conversion is keeping me from downloading the apps properly?
Click to expand...
Click to collapse
I'm not sure about this.
If you don't use this remember to delete the cache.img file from /data/local because it's 64MB
If i delete the conversion and want to make the script dynamic? Mount rfs if rfs or mount ext4 if ext4. Dbdata is converted by kernel and by user decision so making it dynamically check is a must have i think.
Inviato dal mio GT-I9000 usando Tapatalk
corgar said:
If i delete the conversion and want to make the script dynamic? Mount rfs if rfs or mount ext4 if ext4. Dbdata is converted by kernel and by user decision so making it dynamically check is a must have i think.
Inviato dal mio GT-I9000 usando Tapatalk
Click to expand...
Click to collapse
Actually you may have dbdata in rfs and the file system of the cache.img could be ext4. You make and independent file system on this file
ok after some testing and tuning up, and since market apps can go up to 50mb maximum, and dbdata is on fast onenand i've modified a bit your script.
Code:
#!/system/bin/sh
#
# stratosk - 27/07/2011
# Corgar - 28/07/2011 ( changed location of cache in dbdata for onenand i/o, decreased cache dimension to 50mb )
# Remount /cache partition with a larger one (54.5 MB / 50mb cache)
# create a file 54.4 MB
dd if=/dev/zero of=/dbdata/cache.img bs=1024 count=55808
# create ext4 filesystem
mke2fs -F -T ext4 /dbdata/cache.img
# unmounting old cache partition
umount /dev/block/stl11
# mount
losetup /dev/block/loop7 /dbdata/cache.img
mount -t ext4 /dev/block/loop7 /cache
chown system.cache /cache
chmod 770 /cache
here are the script to push in /system/init.d folder. i'm not making a cwm flashable zip because is still in test version and i prefer at the moment to be used only by "veteran" user.
thx anyway to stratosk.
Download Here!
Nice script !
But why not make it on the sdcard ?
It should not have any problem there regarding space issues.
sdcard is mounted and checked after fs integrity check.
sdcard is slow compared to onenand memory. also sdcard is more fragmented than internal memory.
Any feedback?
Anyone tried this?
Running flawlessy on my custom rom. Very nice job indeed. Thx man. If you need a link Just ask but It's only for italian customer.
Inviato dal mio GT-I9000 usando Tapatalk
corgar said:
Running flawlessy on my custom rom. Very nice job indeed. Thx man. If you need a link Just ask but It's only for italian customer.
Inviato dal mio GT-I9000 usando Tapatalk
Click to expand...
Click to collapse
Glad to hear that
Did you test it on market applications > 30 mb?
Thanks for feedback.
P.S. with similar manner you can make portable (and maybe encrypted) filesystem. Create a file mount it as filesystem, write anything you want in it, then umount and mount somewhere else... Even in other phone or in your linux box
Edit: yes please send me the link

[PATCH] serious bug in LeeDroids automatic zipalignment

Hi!
I found a serious bug in LeeDroids automatic zipalignment that potentially damages installed apk files:
The 97zipalign script does not check the return code of zipalign.
So if aligning fails for some reason, the damaged result is used and copied back to /data/app!
This happens for example, if there is not enough free space on /cache.
For Data++ users, /cache is only 5 MB, which is insufficient for quite a few bigger apps like Documents To Go, Angry Birds, Viber or Camscanner!!!
Those apps will be corrupted after the first reboot, causing them to disappear from the laucher!
But also on non-Data++ installations /cache could be full or there could be other reasons for zipalign to fail.
I have added two fixes for that problem:
zipalign-fix.zip contains a patched version, that skips overwriting the original .apk file if zipaligning failed. (The diff is also included.)
cache2sd contains an initscript that bind-mounts /cache to /system/sd/cache. This is necessary for zipalign to work on Data++ installations.
Cheers,
leo
P.S.: I know that this post would better fit to the devel forum but unfortunately I am not allowed to post there... :-(
Hmm, I'm on data++ with a cache of only 5mb. I never get a problem with automatic zipalign, even with big apps like angry birds. In leedroid ROMs the cache is moved to a ramdisk with a few changes in init.rc.
Edit: posted a link to this thread in the leedroid 3.3.x thread...
Sent from my HTC Desire using XDA App
anderl78 said:
Hmm, I'm on data++ with a cache of only 5mb. I never get a problem with automatic zipalign, even with big apps like angry birds. In leedroid ROMs the cache is moved to a ramdisk with a few changes in init.rc.
Edit: posted a link to this thread in the leedroid 3.3.x thread...
Sent from my HTC Desire using XDA App
Click to expand...
Click to collapse
Maybe, however, I've seen a couple of users complaining of missing apps, and their problem being solved by removing the zipalign script, as far as I remember.
It happens on other ROMs too, gonna post the link in related thread. Thanks, I had that issue a couple of times and the only way out was to erase zipalign.
el.mariachi said:
Hi!
***
* zipalign-fix.zip contains a patched version, that skips overwriting the original .apk file if zipaligning failed. (The diff is also included.)
* cache2sd contains an initscript that bind-mounts /cache to /system/sd/cache. This is necessary for zipalign to work on Data++ installations.
Click to expand...
Click to collapse
Please advise:
1. If one has Data++, does one flash zipalign-fix followed by cache2sd, without rebooting in between?
2. Is cache2sd necessary for roms which have ramdisk for cache\ like LeeDroid?
Thank you!
s300pmu1 said:
2. Is cache2sd necessary for roms which have ramdisk for cache\ like LeeDroid?
Thank you!
Click to expand...
Click to collapse
Could it perhaps work on other roms which don't have a ramdisk?
s300pmu1 said:
Please advise:
1. If one has Data++, does one flash zipalign-fix followed by cache2sd, without rebooting in between?
2. Is cache2sd necessary for roms which have ramdisk for cache\ like LeeDroid?
Thank you!
Click to expand...
Click to collapse
Hello!
1. Both zip-files are not flashable. They contain the scripts. If you want to use them, you have to use root explorer... Setting the right permissions should be necessary too...
2. I don't know exactly, but I think not. Init.rc should be executed early enough to prevent us from the described problem. But that's only my guess, could not say exactly - perhaps somebody other know more? If its not as I guess, why my angry birds get zipaligned without problem? ;-)
Sent from my HTC Desire using XDA App
anderl78 said:
Hmm, I'm on data++ with a cache of only 5mb. I never get a problem with automatic zipalign, even with big apps like angry birds. In leedroid ROMs the cache is moved to a ramdisk with a few changes in init.rc.
Click to expand...
Click to collapse
On my LeeDroid V3.3.3 R5, /cache doesn't reside on a ramdisk:
Code:
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nosuid,nodev,noatime,nodiratime)
I think you are mixing this up with /app-cache, which in fact is a ramdisk...
Maybe you remounted /cache yourself and that's why large apps don't cause a problem on your installation.
Or maybe your angrybirds version is already zipaligned, so the zipalign check
Code:
zipalign -c 4 "$apk"
will return true (0) and the if clause won't be executed...
btw every app from the market should be zipaligned...even when i built some android apps with ecplise, the exported apk is already zipalign
why someone should create a non zip aligned apk? maybe some themed app from a bad dev? some framework apk from the uot kitchen??
el.mariachi said:
On my LeeDroid V3.3.3 R5, /cache doesn't reside on a ramdisk:
Code:
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nosuid,nodev,noatime,nodiratime)
I think you are mixing this up with /app-cache, which in fact is a ramdisk...
Maybe you remounted /cache yourself and that's why large apps don't cause a problem on your installation.
Or maybe your angrybirds version is already zipaligned, so the zipalign check
Code:
zipalign -c 4 "$apk"
will return true (0) and the if clause won't be executed...
Click to expand...
Click to collapse
Hello!
Angry birds is from market...
App cache is right, I'm talking from a other thing.
I looked into it a lil bit. The code in init.rc moves the market download (download cache) to a ramdisk - Nothing more.
The 97zipalign script uses /cache to do its work.
Cause of this, I think you are totaly right. The download cache doesn't affect /cache itself. The space there could be to low. If /cache is to low, zipalign could fail. The error caused by this (you described it in op) could end in unusable app...
I could only say, thanks for this! I will try the scripts, even if I have no problems here.
Sent from my HTC Desire using XDA App
andQlimax said:
btw every app from the market should be zipaligned...even when i built some android apps with ecplise, the exported apk is already zipalign
why someone should create a non zip aligned apk? maybe some themed app from a bad dev? some framework apk from the uot kitchen??
Click to expand...
Click to collapse
Yep, but a few user reported issues with installed apps after a restart. Removing the zipalign script cured it. No comment about devs and not zipaligned apps ;-)
Sent from my HTC Desire using XDA App
Just tested it, works as it should.
Is it ok for you, if I post a flashable zip?
Sent from my HTC Desire using XDA App
anderl78 said:
Just tested it, works as it should.
Is it ok for you, if I post a flashable zip?
Sent from my HTC Desire using XDA App
Click to expand...
Click to collapse
This would be great if we can have flashable zip. I know I am facing the problems with few of the apps I installed and they will disappear once rebooted.
Looking forward for the flashable zip files to install them on my desire.
anderl78 said:
Just tested it, works as it should.
Click to expand...
Click to collapse
Glad to hear that.
anderl78 said:
Is it ok for you, if I post a flashable zip?
Click to expand...
Click to collapse
Yes, of course. Feel free to create a zip!
Thanks,
leo
el.mariachi said:
Hi!
I found a serious bug in LeeDroids automatic zipalignment that potentially damages installed apk files:
The 97zipalign script does not check the return code of zipalign.
So if aligning fails for some reason, the damaged result is used and copied back to /data/app!
This happens for example, if there is not enough free space on /cache.
For Data++ users, /cache is only 5 MB, which is insufficient for quite a few bigger apps like Documents To Go, Angry Birds, Viber or Camscanner!!!
Those apps will be corrupted after the first reboot, causing them to disappear from the laucher!
But also on non-Data++ installations /cache could be full or there could be other reasons for zipalign to fail.
I have added two fixes for that problem:
zipalign-fix.zip contains a patched version, that skips overwriting the original .apk file if zipaligning failed. (The diff is also included.)
cache2sd contains an initscript that bind-mounts /cache to /system/sd/cache. This is necessary for zipalign to work on Data++ installations.
Cheers,
leo
P.S.: I know that this post would better fit to the devel forum but unfortunately I am not allowed to post there... :-(
Click to expand...
Click to collapse
Would you kindaly take a look at the ACEMOD007 Rom please, it also suffers from the same bug.. but im not a 100% sure what to change.
I also think where /system/sd is the SD CARD, on ACEMOD its on /SDCARD
It was driving me nuts Apps vanishing, until i saw this post
thanks.
flashable zipfile
flashable zipfile containing the fixed zipalign-script and the new cache2sdext-script. Simple flash it in recovery
thanks to el.mariachi for this!
Thanks. Works like a charm
Problem here!
Zipaligning com...apk FAILED (rc:1)
darkpain said:
Problem here!
Zipaligning com...apk FAILED (rc:1)
Click to expand...
Click to collapse
This is, of course, not a problem of the zipalign script.
com...apk is, according to the garbled filename, most likely not a valid apk file and thus zipalign will fail when trying to process it.
The only difference to the old zipalign is that the error is now detected. The old script just silently ignored the return code.
Cheers,
leo
Thanks so much for this! I was going crazy as my installation of Swype would vanish every time I rebooted my phone... flashing this has solved the problem.

Categories

Resources