[EVO 4G Q&A, Help & Troubleshooting] Android.Control:
Hey dude,

I had the same problem (or need depending on your view) - I tried to apply "cm7_legacy_a2sd_r3-signed.zip" which failed for some reason I couldn't be bothered to work out.

Which lead me to look inside and see how it was going to apply itself. Which then took me on a happy journey of discovery that resulted in the following How-To: pastebin.com/TgqtMuYX

Check it out and let me know how it goes. If you have any issues along the way either pm me or reply here if it's helpful to the wider audience. I'll feedback any relevant details if necessary.

Cheers.

AC

PS. The phone I applied this on was my Hero (GSM) before they pulled CyanogenMod-7.0.0-Hero - seems to behave quite well when you increase the heap to 32MB, but it's still work in progress for testing.

# Android.Control 2011/04

How to manually apply a2sd on CM7 from recovery - Carried out on a Hero, but other phones should be the same.

(details taken from cm7_legacy_a2sd_r3-signed.zip)

Boot into your recovery image. I used ClockworkMod as it allowed me to mount /system very easilly

If adb it is NOT in your search path you will need to specify the /full/path/to/adb

DO NOT complain to me if the adb commands below fail if adb is not in your path

All adb commands issued from a regular user account on Linux - (Windoze will be the same, I'm sure you can work it out)

Let us begin...

1. Mount the /system partition

Recovery: Select: [mounts and storage] > [- mount /system]

[ALTERNATIVE]

$ adb shell mount /system

Just to check all went well

$ adb shell df

Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 98400 0 98400 0% /dev
/dev/block/mtdblock4 133120 122304 10816 92% /cache
/dev/block/mtdblock3 174080 118224 55856 68% /system

2. Find your sd-ext partition - usually /dev/block/mmcblk0p2

Recovery: Select [mounts and storage] > [- mount /sd-ext]

[ALTERNATIVE]

$ adb shell mount /sd-ext

Just to check all went well and to see what the /sd-ext device details are

$ adb shell df

Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 98400 0 98400 0% /dev
/dev/block/mtdblock4 133120 122304 10816 92% /cache
/dev/block/mtdblock3 174080 118224 55856 68% /system
/dev/block/mmcblk0p2 505636 10532 468999 2% /sd-ext

Recovery: Select [mounts and storage] > [- umount /sd-ext]

[ALTERNATIVE]

$ adb shell umount /sd-ext

3. Manually aplly firstboot.sh actions - from cm7_legacy_a2sd_r3-signed.zip

Using "/dev/block/mmcblk0p2" from the df output above exceute the following (replace with apropriate value for your phone!)

$ adb shell

~ # /system/bin/e2fsck -fy /dev/block/mmcblk0p2
~ # /system/bin/tune2fs -O has_journal /dev/block/mmcblk0p2
~ # /system/bin/e2fsck -fy /dev/block/mmcblk0p2
~ # /system/bin/tune2fs -c 0 -i 0 /dev/block/mmcblk0p2
~ # /system/bin/tune2fs -l /dev/block/mmcblk0p2

4. Then mount the sd-ext partition using existing script

Need additional entry in PATH to allow /system/etc/init.d/05mountsd to work

~ # PATH=$PATH:/system/bin

~ # /system/etc/init.d/05mountsd

You should see something very similar to below

e2fsck 1.41.10 (10-Feb-2009)
/dev/block/mmcblk0p2: clean, 11/130560 files, 27008/522112 blocks

5. Create app and app-private in sd-ext

If app and app-private [or dalvik-cache] exist on sd-exe BUT are NOT a directory then they must be removed!

~ # rm /sd-ext/app
~ # rm /sd-ext/app-private

[OPTIONAL]

~ # rm /sd-ext/dalvik-cache

Now we can create the directories proper

~ # install -m 771 -o 1000 -g 1000 -d /sd-ext/app
~ # install -m 771 -o 1000 -g 1000 -d /sd-ext/app-private

[OPTIONAL]

~ # install -m 771 -o 1000 -g 1000 -d /sd-ext/dalvik-cache

If you didn't see any errors you can assume everything is ok, but just to make sure...

~ # ls -l /sd-ext/

drwxrwx--x 2 system system 1024 Apr 16 13:49 app
drwxrwx--x 2 system system 1024 Apr 16 13:49 app-private
drwxrwx--x 2 system system 1024 Apr 16 13:49 dalvik-cache
drwx------ 2 root root 1024 Apr 16 01:42 lost+found

6. Create the userinit.d and functions script directories on /sd-ext

~ # install -m 755 -o 0 -g 0 -d /sd-ext/userinit.d
~ # install -m 755 -o 0 -g 0 -d /sd-ext/userinit.d/functions

Now we need to quit adb back to the host to push some files onto the phone

~ # exit

7. Push the userinit.d files into /sd-exe/userinit.d

(extract the contents of "cm7_legacy_a2sd_r3-signed.zip" to a temporary directory, then cd into sd-ext for the following adb commands)

$ adb push ./userinit.d/functions/a2sd /sd-ext/userinit.d/functions/a2sd

$ adb push ./userinit.d/10cache2sdext-binds /sd-ext/userinit.d/10cache2sdext-binds
$ adb push ./userinit.d/11data2sdext-binds /sd-ext/userinit.d/11data2sdext-binds
$ adb push ./userinit.d/12app2sdext-binds /sd-ext/userinit.d/12app2sdext-binds

$ adb shell

~ # chmod 750 /sd-ext/userinit.d/functions/a2sd
~ # chmod 750 /sd-ext/userinit.d/10cache2sdext-binds
~ # chmod 750 /sd-ext/userinit.d/11data2sdext-binds
~ # chmod 750 /sd-ext/userinit.d/12app2sdext-binds

~ # chown root:shell /sd-ext/userinit.d/functions/a2sd
~ # chown root:shell /sd-ext/userinit.d/10cache2sdext-binds
~ # chown root:shell /sd-ext/userinit.d/11data2sdext-binds
~ # chown root:shell /sd-ext/userinit.d/12app2sdext-binds

~ # exit

[ADVISORY]

If app, app-private or dalvik-cache was NOT working you would see a line similar to these lines below in the logcat output

I/busybox ( 113): sd-ext /sd-ext/app bindings not enabled
I/busybox ( 113): sd-ext /sd-ext/app-private bindings not enabled
I/busybox ( 113): sd-ext /sd-ext/dalvik-cache bindings not enabled

Reboot the phone, then quickly run adb logcat to watch the initial progress to confirm success

If you do NOT see any lines like those above in the logcat output then everything went OK

$ adb logcat
- waiting for device -
--------- beginning of /dev/log/main
I/cm ( 67): Welcome to Android 2.3.3 / CyanogenMod-7.0.0-Hero
I/cm ( 68): _
I/cm ( 69): __ __ _ ___ _ _ __ ___ __ _ _ _ _ __ __))
I/cm ( 70): ((_ \(/'((_( ((\( ((_)((_( (('((\( ((`1( ((_)((_(
I/cm ( 71): )) _))
I/cm ( 72):
I/mountsd ( 87): Checking filesystems..
I//system/xbin/run-parts( 62): e2fsck 1.41.10 (10-Feb-2009)
I//system/xbin/run-parts( 62): /dev/block/mmcblk0p2: recovering journal
I//system/xbin/run-parts( 62): /dev/block/mmcblk0p2: clean, 555/500856 files, 428759/1000173 blocks
I/logwrapper( 93): busybox terminated by exit(0)
I/logwrapper( 97): busybox terminated by exit(0)
I/logwrapper( 99): busybox terminated by exit(0)
I/mountsd ( 101): /sd-ext successfully mounted
I/busybox ( 113): sd-ext /sd-ext/data bindings not enabled
I/busybox ( 113): sd-ext /sd-ext/system bindings not enabled
I/logwrapper( 113): busybox terminated by exit(0)
I/logwrapper( 62): /system/xbin/run-parts terminated by exit(0)
...

Please be patient while any existing files in /data/app, /data/app-private and /data/dalvik-cache are copied to /sd-ext/app, /sd-ext/app-private and /sd-ext/dalvik-cache respectively

If you have manually populated the app directory prior to enabling a2sd, then this will further delay your first boot while the dalvik-cache is updated for each unseen .apk file

[NOTE]

$ = regular user shell prompt (on your PC, depending which user you use for you adb environment)

# = root user shell prompt (on your phone)