[G2 and Desire Z Android Development] sparksco:
Update:

YOU MUST have a recovery that supports ext4 in order to use this patch. Currently there is only one recovery for G2 that I know of that is up-to-date that supports ext4 partitioning. That recovery is ext4 recovery. After you get ext4 recovery installed format and wipe everything before installing your rom of choice.

1. Format system

2. Format data

3. Format cache

4. Format sd-ext

----------

A lot of these scripts are based on the stock Cyanogenmod scripts to mount sd-ext partition and allow a2sd.

I've edited the stock system/etc/init.d/05mountsd to mount ext partition as ext4 instead of ext3. The system/etc/init.d/10apps2sd was made by Cyanogen himself and it can be found on the Cyanogenmod github. I've edited it to activate and utilize the sd-ext partition of the device. The swap patches and the cmparts source edits are all my own work. Please see the github for more details.

Required for swap: For swap you need a kernel that supports swap. E.G., Tiamat, and may be others but it is your responability to find out which kernels support swap

;)

Udate: this current patch is still working fine for me on the latest nightlies (deodex roms only). But there is a certain way that this patch needs to be installed.

It does not matter if you wipe or do not wipe before flashing.

1. If you are flashing this on cyanogenmod nightlies you need

to flash in this order, otherwise the permissions for your

rom will not be correct. Flash the rom first, then the

patch, then the gapps.

2. For flashing on other CM based roms (deodex only). As

many of you might know, Some roms already include

gapps. So because of this, we will need to flash a

compatible deodex Rom, since the patch sets

permissions for the system, and gapps will not work

correctly with the permissions if already installed in the

system. Flash in the same order you would for normal

cyanogenmod roms. Rom first, then patch, then gapps.

Yes even if the rom already includes

gapps you still must flash gapps.

This thread will only be discussion for Cyanogenmod These are AOSP Roms. DO NOT EVER ASK ABOUT SENSE ROM TWEAKS EVER, they just simply won't work with these mods.

Do not submit revised versions that are already posted, I will try to keep the patches as updated as possible. Do not distribute or modify any of the scripts without my given consent, or at least give me credit!

I am not responsible for you breaking something on your device. If you come and tell me that my mods messed up your phone, I will laugh at you.

I have been running these mods flawlessly with no issues. So let's get right into it.

Options:

WARNING: Before you do anything, do a nandroid

backup. If you need to partition your sdcard via recovery, back up your

entire sdcard to your pc before doing so as it will get formated.

If you want a2sd, then you will need a ext4 partition on your sdcard. I

recommend at least a 1GB+ partition. That's it, the scripts will do the

rest.

You can not have any other types of a2sd installed before applying the patch.

The patch doesn't remove, it installs ;) If you have manually installed some

other type of a2sd, you will need to wipe and re-flash rom. The main

important thing is, make sure system gets wiped.

If you want Linux-swap, just simply add a swap partition to your sdcard when

you go to format it in recovery, simple.

Next download and flash the latest patch over your current rom. Be aware

that if you have a swap partition, that your phone will reboot itself once after

your initial boot. Don't freak out and come crying about how your phone is

boot looping, it only reboots once. This is all part of the initial setup to make

sure swap is working properly.

How to check if a2sd is active and working in terminal emulator from your

phone

$ su
# df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 183.6M 32.0K 183.6M 0% /dev
tmpfs 183.6M 0 183.6M 0% /mnt/asec
tmpfs 183.6M 0 183.6M 0% /mnt/obb
/dev/block/mmcblk0p26
487.8M 143.8M 318.9M 31% /system
/dev/block/mmcblk0p27
430.0M 147.3M 260.5M 36% /data
/dev/block/mmcblk0p28
149.6M 47.5M 94.4M 33% /cache
/dev/block/mmcblk0p31
19.9M 17.2M 2.7M 86% /devlog
/dev/block/mmcblk1p2 1.9G 1.0G 788.7M 57% /sd-ext
/dev/block/mmcblk1p2 1.9G 1.0G 788.7M 57% /data/app
/dev/block/mmcblk1p2 1.9G 1.0G 788.7M 57% /data/app-private
/dev/block/mmcblk1p2 1.9G 1.0G 788.7M 57% /data/dalvik-
cache

If you see this part then you are golden

/dev/block/mmcblk1p2 1.9G 1.0G 788.7M 57% /sd-ext
/dev/block/mmcblk1p2 1.9G 1.0G 788.7M 57% /data/app
/dev/block/mmcblk1p2 1.9G 1.0G 788.7M 57% /data/app-private
/dev/block/mmcblk1p2 1.9G 1.0G 788.7M 57% /data/dalvik-cache

How to check if swap is active working from terminal emulator on your

phone

$su
# free
total used free shared buffers
Mem: 376008 353776 22232 0 15756
-/+ buffers: 338020 37988
Swap: 249544 36780 212764

Next, enjoy your new mods :D

CMParts (Cyanogenmod settings source): https://github.com/pbeeler/android_packages_apps_CMParts

Changelog: https://github.com/pbeeler/android_packages_apps_CMParts/commits/gingerbread