[Defy Android Development] Sorensiim:
This thread is mostly to remind myself what needs to be done after a reflash. I reflash a lot. Tinkering, coding and hacking does *not* mate well with my ADHD (Attention Deficit ahh whatever), so I often find myself having to, pardon my french, unfuck my gear. Most of this thread will be links to the great work others have done, I'm just piling together the stuff I use. If you like your android experience to be nice and snappy, you might like these mods too. These steps work for me, your mileage may vary. If you screw something up, it's your own fault for taking advice from strangers over the Internet. But try asking for help here on XDA, somebody will most likely be able to help you.

So, either you've just unpacked your Defy or you have just had to flash an SBF after screwing something up.

Edit: 01/01/2011: Have added a few bits so the stuff below now applies to the 2.34.1 rom as well :)

0) Install LauncherPro

- Or ADW.Launcher, HELauncher or whatever you prefer. Press the Home button and set the new launcher as default.

1) Root the damn thing! Download Z4Root.apk here. You'll need to allow installation of non-market apps, as well as enabling USB debugging. Go to Settings -> Applications, tick the box for "Unknown sources" and go to Development to enable USB debugging. A file manager should be included in the stock rom, otherwise get one (I prefer ES File Explorer) from the Market. Once you have your file manager, dig up the z4root.apk you just downloaded, install it and run the app, press the appropriate button to root the phone and watch it reboot.

2) Get recovery!

The custom recovery for the Defy is described here. Mad props to Tenfar for his work, please buy him a beer, he's earned it. Here's the APK you'll need. Using the same process as for the Z4Root app, install and run the recovery system app. Press the "Install recovery system" button.

3) Get JIT'tery and deodexed :cool:

Superb work by Higgsy and Antibyte! They've not only gotten JIT (jfgi, mate) to run on the Defy, they've zipped it up nicely with the deodexed /system files from Paul at Modaco.com so you can all just install them as a zip file in one go. 2.21 Roms: Download the nicely packaged zip here, if you're running the 2.34.1 rom, get this version instead. Save the file to your SD card and remember where you put it.

4) Backup everything we've done so far

Start the System Recovery App and do a Recovery Boot. When booting into recovery, select Backup/restore and do a backup. I you have installed a bunch of apps, made a lot of changes to your settins, you might want to do a seperate backup of that (but not the rom), using Titanium backup from the Market.

5) Apply the coolness from step 3

After doing a backup, wipe all user settings as well as the Dalvik cache. Then select "Install zip from SD card" and install the zip you downloaded in step 3. Wipe alle settings and the cache again. Reboot when done. Note: The wiping may not be necessary, but not doing it could screw something up and have you back at re-flashing an SBF to your phone...

5.1) Re-root, using Z4Root.

Fire up the app and press "permanent root".

6) Weed out the bloat

This bit assumes that you have ADB or MotoDev studio installed and can connect to your Defy. If not? Search the forums. - Or read the US guide for trimming the Defy, tons of info right there, thanks a lot to Rob-T for elaborating many of the steps!

Assuming you have ADB fired up (or MotoDev Studio, which I prefer):

Gain root access:

su

Mount the /system partition with write access:

mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system

Switch to the /system/app dir:

cd /system/app

Now rename the apps you don't want: Thanks to NaeNee for proof-reading this hideous blob of commands!

mv AdService.apk AdService.rem; mv ArcPhotoworkshop.apk ArcPhotoworkshop.rem; mv ArcVideoEditorLite.apk ArcVideoEditorLite.rem; mv BlurEmail.apk Bluremail.rem; mv revolver_2_0_0012_embed_Signed_2010-04-13_11-07-08.apk revolver_2_0_0012_embed_Signed_2010-04-13_11-07-08.rem; mv BlurSNMessagingEngine.apk BlurSNMessagingEngine.rem; mv FBAndroid-1.3.2.apk FBAndroid-1.3.2.rem; mv Kindle-1.0.2-OEM-SingleSign.apk Kindle-1.0.2-OEM-SingleSign.rem; mv MySpace.apk MySpace.rem; mv StickyNoteWidget.apk StickyNoteWidget.rem; mv SocialMessaging.apk SocialMessaging.rem; mv Swype.apk Swype.rem; mv BlurUpdater.apk BlurUpdater.rem; mv CarDock.apk CarDock.rem; mv ContactsUnconnected.apk ContactsUnconnected.rem; mv amazonmp3_1.8.19_signed_zipaligned.apk amazonmp3_1.8.19_signed_zipaligned.rem; mv esmusica_2_0_0012_embed_Signed_2010-04-13_11-05-17.apk esmusica_2_0_0012_embed_Signed_2010-04-13_11-05-17.rem; mv Fota.apk Fota.rem; mv FriendFeed.apk FriendFeed.rem; mv HelpCenter.apk HelpCenter.rem; mv hiphopofficial_2_0_0012_embed_Signed_2010-04-13_11-08-31.apk hiphopofficial_2_0_0012_embed_Signed_2010-04-13_11-08-31.rem; mv truecountry_2_0_0012_embed_Signed_2010-04-13_11-06-12.apk truecountry_2_0_0012_embed_Signed_2010-04-13_11-06-12.rem; mv KPT.apk KPT.rem; mv HomeSyncWizard.apk HomeSyncWizard.rem; mv LiveWallpapers.apk LiveWallpapers.rem; mv LiveWallpapersPicker.apk LiveWallpapersPicker.rem; mv MagicSmokeWallpapers.apk MagicSmokeWallpapers.rem; mv MessagesWidget.apk MessagesWidget.rem; mv NewsWidget.apk NewsWidget.rem; mv Protips.apk Protips.rem; mv QuickContactWidget.apk QuickContactWidget.rem; mv Quickoffice_BasicViewer_2.0.42.apk Quickoffice_BasicViewer_2.0.42.rem; mv Quickoffice_BasicViewer_2.0.52.apk Quickoffice_BasicViewer_2.0.52.rem; mv revolver_2_0_0012_embed_Signed_2010-04-13_11-07-08.apk revolver_2_0_0012_embed_Signed_2010-04-13_11-07-08.rem; mv SocialMessaging.apk SocialMessaging.rem; mv StatusWidget.apk StatusWidget.rem; mv Stk.apk Stk.rem; mv ToggleWidgets.apk ToggleWidgets.rem; mv VisualizationWallpapers.apk VisualizationWallpapers.rem; mv UniversalInbox.apk UniversalInbox.rem; mv WeatherWidget.apk WeatherWidget.rem; mv WorkContacts.apk WorkContacts.rem

EDIT: NaeNee experienced a problem with the messaging app just closing (no FC or errors) after this... Update: This is caused by deleting or renaming BlurEmailEngine.apk, so it is no longer removed/renamed in the command above.

In case you want to undo the above rename:

mv AdService.rem AdService.apk; mv ArcPhotoworkshop.rem ArcPhotoworkshop.apk; mv ArcVideoEditorLite.rem ArcVideoEditorLite.apk; mv BlurEmail.rem Bluremail.apk; mv revolver_2_0_0012_embed_Signed_2010-04-13_11-07-08.rem revolver_2_0_0012_embed_Signed_2010-04-13_11-07-08.apk; mv BlurSNMessagingEngine.rem BlurSNMessagingEngine.apk; mv FBAndroid-1.3.2.rem FBAndroid-1.3.2.apk; mv Kindle-1.0.2-OEM-SingleSign.rem Kindle-1.0.2-OEM-SingleSign.apk; mv MySpace.rem MySpace.apk; mv StickyNoteWidget.rem StickyNoteWidget.apk; mv SocialMessaging.rem SocialMessaging.apk; mv Swype.rem Swype.apk; mv BlurUpdater.rem BlurUpdater.apk; mv CarDock.rem CarDock.apk; mv ContactsUnconnected.rem ContactsUnconnected.apk; mv amazonmp3_1.8.19_signed_zipaligned.rem amazonmp3_1.8.19_signed_zipaligned.apk; mv esmusica_2_0_0012_embed_Signed_2010-04-13_11-05-17.rem esmusica_2_0_0012_embed_Signed_2010-04-13_11-05-17.apk; mv Fota.rem Fota.apk; mv FriendFeed.rem FriendFeed.apk; mv HelpCenter.rem HelpCenter.apk; mv hiphopofficial_2_0_0012_embed_Signed_2010-04-13_11-08-31.rem hiphopofficial_2_0_0012_embed_Signed_2010-04-13_11-08-31.apk; mv truecountry_2_0_0012_embed_Signed_2010-04-13_11-06-12.rem truecountry_2_0_0012_embed_Signed_2010-04-13_11-06-12.apk; mv KPT.rem KPT.apk; mv HomeSyncWizard.rem HomeSyncWizard.apk; mv LiveWallpapers.rem LiveWallpapers.apk; mv LiveWallpapersPicker.rem LiveWallpapersPicker.apk; mv MagicSmokeWallpapers.rem MagicSmokeWallpapers.apk; mv MessagesWidget.rem MessagesWidget.apk; mv NewsWidget.rem NewsWidget.apk; mv Protips.rem Protips.apk; mv QuickContactWidget.rem QuickContactWidget.apk; mv Quickoffice_BasicViewer_2.0.42.rem Quickoffice_BasicViewer_2.0.42.apk; mv Quickoffice_BasicViewer_2.0.52.rem Quickoffice_BasicViewer_2.0.52.apk; mv revolver_2_0_0012_embed_Signed_2010-04-13_11-07-08.rem revolver_2_0_0012_embed_Signed_2010-04-13_11-07-08.apk; mv SocialMessaging.rem SocialMessaging.apk; mv StatusWidget.rem StatusWidget.apk; mv Stk.rem Stk.apk; mv ToggleWidgets.rem ToggleWidgets.apk; mv VisualizationWallpapers.rem VisualizationWallpapers.apk; mv UniversalInbox.rem UniversalInbox.apk; mv WeatherWidget.rem WeatherWidget.apk; mv WorkContacts.rem WorkContacts.apkk

I've noticed that some APK's change depending on the rom, these work for the UK 2.21 rom after applying the JIT/Deodex trick. If you get any errors, please check the exact names of the apk's in your rom:

ls

It simply renames all the app's I don't want to .rem instead of .apk. Want something back? Rename from .rem to .apk, say if you miss the weather widget:

mv WeatherWidget.rem WeatherWidget.apk

Update: Pretty slick way of listing the apps in your particular rom can be found here, props to Rob-T for that!

When you're done, reboot:

reboot

7) Overclocking time!

Install Milestone Overclock from the market and fire it up. Load the module and Press the menu button, go to settings and enter "1000000" as Custom rate and "54" as custom vsel. After pressing OK, pull the slider all the way to the right, so the selected frequency shows up as "1000MHz, 52vsel (Custom)". Click Apply and tick the box for "Autoload on boot"

8) Scaling

Install SetCPU from the market and start it up. Set scaling to "Ondemand" and tick the box for "Autoload on boot" and exit the program. Now it's time to make the vsel correspond to the cpu frequency and save some power, as explained so brilliantly by Higgsy. Buy the man a beer! My setscaling.sh is here, Higgsy's excellent startup script is here. Download both to the root of your SD card. Then connect your phone to your pc and fire up ADB/MotoDev Studio. Once connected to your phone, here's what you need to do:

su

mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system

cp /sdcard/setscaling.sh /system/xbin/setscaling.sh

cp /sdcard/install-recovery.sh /system/etc/install-recovery.sh

chmod 755 /system/etc/install-recovery.sh

chmod 755 /system/xbin/setscaling.sh

mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system

Reboot your phone, and it should now be humming along nicely at 300-1000mhz, sipping only the power it needs, without being held down by Motobloat. Again, I didn't come up with any of this, I just wrapped it up :)

After doing all this, feel free to restore your apps and settings with Titanium backup, but ONLY user apps, don't re-install the old non-optimized system apps. Here's a few screenshots with all my stuff (including locale, pure calendar and other always-running apps) is installed, after running the above tweaks and mods:

The above is at 1ghz. The phone is nice and snappy, while still getting two days use from a single charge. Here's how 1.2ghz looks:

Happy hacking!