Advertisement
erodemobiles

How-To: a2sd for CM7

Apr 17th, 2011
804
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Android.Control 2011/04
  2.  
  3. How to manually apply a2sd on CM7 from recovery - Carried out on a Hero, but other phones should be the same.
  4. (details taken from cm7_legacy_a2sd_r3-signed.zip)
  5.  
  6. Boot into your recovery image. I used ClockworkMod as it allowed me to mount /system very easilly
  7.  
  8. If adb it is NOT in your search path you will need to specify the /full/path/to/adb
  9.  
  10. DO NOT complain to me if the adb commands below fail if adb is not in your path
  11.  
  12. All adb commands issued from a regular user account on Linux - (Windoze will be the same, I'm sure you can work it out)
  13.  
  14.  
  15. Let us begin...
  16.  
  17. 1. Mount the /system partition
  18.  
  19. Recovery: Select: [mounts and storage] > [- mount /system]
  20.  
  21. [ALTERNATIVE]
  22. $ adb shell mount /system
  23.  
  24.  
  25. Just to check all went well
  26.  
  27. $ adb shell df
  28.  
  29. Filesystem           1K-blocks      Used Available Use% Mounted on
  30. tmpfs                    98400         0     98400   0% /dev
  31. /dev/block/mtdblock4    133120    122304     10816  92% /cache
  32. /dev/block/mtdblock3    174080    118224     55856  68% /system
  33.  
  34.  
  35. 2. Find your sd-ext partition - usually /dev/block/mmcblk0p2
  36.  
  37. Recovery: Select [mounts and storage] > [- mount /sd-ext]
  38.  
  39. [ALTERNATIVE]
  40. $ adb shell mount /sd-ext
  41.  
  42.  
  43. Just to check all went well and to see what the /sd-ext device details are
  44.  
  45. $ adb shell df
  46.  
  47. Filesystem           1K-blocks      Used Available Use% Mounted on
  48. tmpfs                    98400         0     98400   0% /dev
  49. /dev/block/mtdblock4    133120    122304     10816  92% /cache
  50. /dev/block/mtdblock3    174080    118224     55856  68% /system
  51. /dev/block/mmcblk0p2    505636     10532    468999   2% /sd-ext
  52.  
  53.  
  54. Recovery: Select [mounts and storage] > [- umount /sd-ext]
  55.  
  56. [ALTERNATIVE]
  57. $ adb shell umount /sd-ext
  58.  
  59.  
  60. 3. Manually aplly firstboot.sh actions - from cm7_legacy_a2sd_r3-signed.zip
  61.  
  62. Using "/dev/block/mmcblk0p2" from the df output above exceute the following (replace with apropriate value for your phone!)
  63.  
  64. $ adb shell
  65.  
  66. ~ # /system/bin/e2fsck -fy /dev/block/mmcblk0p2
  67. ~ # /system/bin/tune2fs -O has_journal /dev/block/mmcblk0p2
  68. ~ # /system/bin/e2fsck -fy /dev/block/mmcblk0p2
  69. ~ # /system/bin/tune2fs -c 0 -i 0 /dev/block/mmcblk0p2
  70. ~ # /system/bin/tune2fs -l /dev/block/mmcblk0p2
  71.  
  72.  
  73. 4. Then mount the sd-ext partition using existing script
  74.  
  75. Need additional entry in PATH to allow /system/etc/init.d/05mountsd to work
  76.  
  77. ~ # PATH=$PATH:/system/bin
  78.  
  79. ~ # /system/etc/init.d/05mountsd
  80.  
  81. You should see something very similar to below
  82.  
  83. e2fsck 1.41.10 (10-Feb-2009)
  84. /dev/block/mmcblk0p2: clean, 11/130560 files, 27008/522112 blocks
  85.  
  86.  
  87. 5. Create app and app-private in sd-ext
  88.  
  89. If app and app-private [or dalvik-cache] exist on sd-exe BUT are NOT a directory then they must be removed!
  90.  
  91. ~ # rm /sd-ext/app
  92. ~ # rm /sd-ext/app-private
  93.  
  94. [OPTIONAL]
  95. ~ # rm /sd-ext/dalvik-cache
  96.  
  97.  
  98. Now we can create the directories proper
  99.  
  100. ~ # install -m 771 -o 1000 -g 1000 -d /sd-ext/app
  101. ~ # install -m 771 -o 1000 -g 1000 -d /sd-ext/app-private
  102.  
  103. [OPTIONAL]
  104. ~ # install -m 771 -o 1000 -g 1000 -d /sd-ext/dalvik-cache
  105.  
  106.  
  107. If you didn't see any errors you can assume everything is ok, but just to make sure...
  108.  
  109. ~ # ls -l /sd-ext/
  110.  
  111. drwxrwx--x    2 system   system        1024 Apr 16 13:49 app
  112. drwxrwx--x    2 system   system        1024 Apr 16 13:49 app-private
  113. drwxrwx--x    2 system   system        1024 Apr 16 13:49 dalvik-cache
  114. drwx------    2 root     root          1024 Apr 16 01:42 lost+found
  115.  
  116.  
  117. 6. Create the userinit.d and functions script directories on /sd-ext
  118.  
  119. ~ # install -m 755 -o 0 -g 0 -d /sd-ext/userinit.d
  120. ~ # install -m 755 -o 0 -g 0 -d /sd-ext/userinit.d/functions
  121.  
  122.  
  123. Now we need to quit adb back to the host to push some files onto the phone
  124.  
  125. ~ # exit
  126.  
  127.  
  128. 7. Push the userinit.d files into /sd-exe/userinit.d
  129. (extract the contents of "cm7_legacy_a2sd_r3-signed.zip" to a temporary directory, then cd into sd-ext for the following adb commands)
  130.  
  131.  
  132. $ adb push ./userinit.d/functions/a2sd /sd-ext/userinit.d/functions/a2sd
  133.  
  134. $ adb push ./userinit.d/10cache2sdext-binds /sd-ext/userinit.d/10cache2sdext-binds
  135. $ adb push ./userinit.d/11data2sdext-binds /sd-ext/userinit.d/11data2sdext-binds
  136. $ adb push ./userinit.d/12app2sdext-binds /sd-ext/userinit.d/12app2sdext-binds
  137.  
  138. $ adb shell
  139.  
  140. ~ # chmod 750 /sd-ext/userinit.d/functions/a2sd
  141. ~ # chmod 750 /sd-ext/userinit.d/10cache2sdext-binds
  142. ~ # chmod 750 /sd-ext/userinit.d/11data2sdext-binds
  143. ~ # chmod 750 /sd-ext/userinit.d/12app2sdext-binds
  144.  
  145. ~ # chown root:shell /sd-ext/userinit.d/functions/a2sd
  146. ~ # chown root:shell /sd-ext/userinit.d/10cache2sdext-binds
  147. ~ # chown root:shell /sd-ext/userinit.d/11data2sdext-binds
  148. ~ # chown root:shell /sd-ext/userinit.d/12app2sdext-binds
  149.  
  150. ~ # exit
  151.  
  152.  
  153. [ADVISORY]
  154. If app, app-private or dalvik-cache was NOT working you would see a line similar to these lines below in the logcat output
  155.  
  156. I/busybox (  113): sd-ext /sd-ext/app bindings not enabled
  157. I/busybox (  113): sd-ext /sd-ext/app-private bindings not enabled
  158. I/busybox (  113): sd-ext /sd-ext/dalvik-cache bindings not enabled
  159.  
  160.  
  161. Reboot the phone, then quickly run adb logcat to watch the initial progress to confirm success
  162.  
  163. If you do NOT see any lines like those above in the logcat output then everything went OK
  164.  
  165.  
  166. $ adb logcat
  167. - waiting for device -
  168. --------- beginning of /dev/log/main
  169. I/cm      (   67): Welcome to Android 2.3.3 / CyanogenMod-7.0.0-Hero
  170. I/cm      (   68):                                                 _  
  171. I/cm      (   69):  __ __ _ ___  _ _  __  ___  __ _ _  _  _  __  __))
  172. I/cm      (   70): ((_ \(/'((_( ((\( ((_)((_( (('((\( ((`1( ((_)((_(  
  173. I/cm      (   71):      ))                 _))
  174. I/cm      (   72):  
  175. I/mountsd (   87): Checking filesystems..
  176. I//system/xbin/run-parts(   62): e2fsck 1.41.10 (10-Feb-2009)
  177. I//system/xbin/run-parts(   62): /dev/block/mmcblk0p2: recovering journal
  178. I//system/xbin/run-parts(   62): /dev/block/mmcblk0p2: clean, 555/500856 files, 428759/1000173 blocks
  179. I/logwrapper(   93): busybox terminated by exit(0)
  180. I/logwrapper(   97): busybox terminated by exit(0)
  181. I/logwrapper(   99): busybox terminated by exit(0)
  182. I/mountsd (  101): /sd-ext successfully mounted
  183. I/busybox (  113): sd-ext /sd-ext/data bindings not enabled
  184. I/busybox (  113): sd-ext /sd-ext/system bindings not enabled
  185. I/logwrapper(  113): busybox terminated by exit(0)
  186. I/logwrapper(   62): /system/xbin/run-parts terminated by exit(0)
  187.  
  188.  
  189. 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
  190.  
  191. 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
  192.  
  193.  
  194. [NOTE]
  195. $ = regular user shell prompt (on your PC, depending which user you use for you adb environment)
  196. # = root user shell prompt (on your phone)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement