[Defy General] Proverbs2:
This guide explains how to install and update CyanogenMod 11 (CM11) and SlimKat roms (aftermarket firmwares of Android 4.4) on your Motorola Defy (MB525) or Defy+ (MB526). Neither the CyanogenMod development team nor the Slim Roms development team officially support the Defy. Thankfully, a number of independent developers (listed below) are working hard to port those roms to the Defy, and the present versions are mostly (but not completely) bug-free and stable.

Please note: The latest CM11 and SlimKat roms for the Defy still have a few bugs, most of which are explained in a bug list that is frequently updated by okij. Although okij's bug list concerns the CM11 roms built by Quarx, most of these bugs also apply to TJKV's SlimKat roms, which are based partly on Quarx's sources.

If you just want a perfectly stable, bug-free phone, and don't care about having the latest and coolest features of Android, CM11 and SlimKat are not for you. I recommend installing CyanogenMod 7 (CM7) instead: it's very fast and perfectly stable. However, CM11 and SlimKat are continually becoming more stable, and are already usable as daily drivers if you can live with the few remaining bugs.

How to install Android 4.4 SlimKat or CM11 on the Motorola Defy or Defy+

Step 1: Download the correct files for installation.

If installing SlimKat, download the rom (Slim-mb526-4.4.2.build.4-UNOFFICIAL-20140407-2344.zip) and Google Apps package (minimal_Slim_AIO_gapps.4.4.2.build.4.zip) here.

If installing CM11, download the rom here (or here) and the minimal Google Apps package here (or here or here). (You want the file called "GApps_Minimal_4.4.4_signed.zip". Do NOT try to install the "Standard" Google Apps package, as there is not enough room on the Defy's system partition.)

Customize the rom file if desired. (See "Tips for customizing & improving performance," below.) Then put both files on your phone's SD card. Also download defy_twrp_recovery_2.6.3.0.zip and safewipe.zip, and put those files on the SD card too.

Note: SlimKat build 4 is very stable, but it does have a bug that causes the phone to reboot into recovery mode automatically if the phone encounters a telephony error, instead of rebooting normally. To fix this issue, download DefyParts.apk here and replace the old DefyParts.apk by following the instructions in this post.​

Step 2: Install Team Win Recovery (TWRP) version 2.6.3.0 (or newer).

If you have already installed a custom recovery on your phone (e.g. ClockWorkMod or an earlier version of TWRP) and you know how to use it, just flash defy_twrp_recovery_2.6.3.0.zip and proceed to step 3. If you've never used a custom recovery, keep reading.

If you're using a stock rom from Motorola, you first need to root the phone (I recommend using either Framaroot or SuperOneClick), then install 2ndInit. Run the 2ndInit app and use it to install the custom recovery (ClockworkMod Recovery). Then reboot the phone, and watch the small LED light at the top of your phone. If the recovery was installed properly, the LED will light up with a blue color for a few seconds during startup. Allow the phone to fully boot up, then reboot the phone again and watch for the blue light. As soon as you see the blue light, press the volume down button to enter the bootmenu. Use the volume buttons to navigate the menu and the power button to select an option. Select Recovery > Custom Recovery > Backup and restore > Backup (all), and wait for the backup process to complete. This will create a backup of your system on your SD card, so you can revert to the stock rom later if needed. Next, select Go Back > install zip from sdcard > choose zip from sdcard, and install defy_twrp_recovery_2.6.3.0.zip.

Step 3: Install CM11 or SlimKat, and the corresponding Google Apps package.

After installing TWRP 2.6.3.0, reboot the phone and enter the bootmenu again by pressing the volume down button when you see the blue LED. (Note: If you're updating from a recent version of SlimKat or CM11, you won't see any blue light. Instead you'll see a screen that tells you to either press the menu button to enter recovery or the search button to continue with normal bootup.)

Enter TeamWin Recovery, which you can navigate with the touchscreen rather than the volume buttons. Wait 30 seconds before proceeding, to make sure the recovery is behaving in a stable way. (If the phone spontaneously reboots, just try again.)

Select Install, choose safewipe.zip, then swipe to confirm the flash.

In the same way, flash the rom of your choice (either SlimKat or CM11), followed by the Google Apps package.

Reboot the phone. The first boot will take a while (typically 5-10 minutes), since the phone has to build the Dalvik Cache.

Step 4: Set the correct baseband, and adjust performance settings.

Go to System settings > Advanced options > Device > Baseband selection, and make sure that the correct baseband is selected for your region and carrier. (Note: This step is not necessary if you already changed the default baseband in the zip file. See "Tips for customizing & improving performance," below.)

I also strongly recommend configuring the rom for better performance, by following the tips listed below. (See especially the tips about using Aero Kernel Control. This will help with many problems, for example the infamous call wakeup delay issue.)

Step 5: Thank our awesome developers, and donate to them if you can.

You can find donation links under any post by the developers. (Just look for the button that says "donate to me.") Here's the donation link for Quarx.

How to update SlimKat or CM11 to newer versions (or downgrade to older versions)

Step 1: Backup your current rom, apps, and settings.

I recommend using Online Nandroid Backup to create TWRP-compatible backups, for the reasons mentioned here (see bug #36). In the Online Nandroid Backup app, select Custom Backup > Backup Type > TWRP. Then select Backup Mode > Selective, and select the "system" and "data" partitions to backup. Make sure the Save Location is set to /sdcard, and also check the box to "Exclude Dalvik Cache." Then press the blue arrow (looks like a "play" button) at the top right corner of the screen to begin the backup.

Also back up your apps and settings with Titanium Backup.

Step 2: Download the updated rom.

Customize the rom file if desired. (See "Tips for customizing & improving performance," below.) Then place it on your phone's SD card along with the appropriate Google Apps package. [Note: if using CM updater, you don't have to download the rom ahead of time.]

Step 3: Install the updated rom using one of the following three methods:

Note: If switching from SlimKat to CM11 or vice versa, you must use the clean install method.

"Clean" install (recommended)

- Boot into TWRP by pressing the menu button when you see the bootstrap image (the screen that tells you to either press the menu button to enter recovery or the search button to continue with normal bootup), which should appear just after the Motorola logo disappears and before the boot animation begins.

- Select "Install" and flash safewipe.zip, then flash the updated rom, followed by Google Apps.

- After rebooting the phone, you'll have to restore your apps and settings using Titanium Backup. Don't restore settings for system apps unless necessary, as that may lead to problems.

"Dirty" flash (easier, but may cause problems)

- Boot into TWRP and select Wipe > Advanced Wipe, and select Dalvik Cache, Cache, and System (not Data), then swipe to wipe. (WARNING: Wiping the system partition also deletes the custom recovery, so you must either flash a rom or restore a backup before rebooting the phone. If the phone is rebooted before a new system is installed, it will be "soft bricked" and you'll have to flash a stock sbf with RSD Lite to recover it.) Then press the back button to return to the main menu and select Install. Flash the updated rom, followed by Google Apps. Now it is safe to reboot the phone.

- Since this method does not affect the /data partition, you won't have to restore all of your apps and settings, but you may still need to switch the baseband. If you encounter any bugs or problems after updating the firmware by this method, do not report them. First try a "clean" install, and check whether that solves the issue.

CM updater method (easiest, but may cause problems)

- If you're using CM11, you can update via the built-in CM updater located under Settings > About Phone > CyanogenMod Updates. (Obviously this won't work on SlimKat.)

- If you encounter any bugs or problems after updating the firmware by this method, do not report them. First try a "clean" install, and check whether that solves the issue.

Tips for customizing & improving performance

How to customize the rom before installation:

Install 7-zip on your PC.

Right-click on the CM11 or SlimKat zip file and select 7-zip > Open archive. (Don't extract it; just open it.) Now you can:

Remove unnecessary files to save space on the system partition. For example, you can navigate to system > media > audio, and delete any ringtones you don't use. You can also delete unused apps from system > app. See [MENTION=5255002]x53[/MENTION]'s post here for a list of system apps that are safe to remove; see also here and here for more info. Here's a list of system apps that I removed before installing SlimKat: BasicDreams (live wallpaper), Browser (I use Next Browser instead), Calendar, Dashclock, Deskclock, Email (I just use Gmail app), Exchange2, Gallery2, Livewallpaperspicker, PhaseBeam (live wallpaper), PhotoTable, PicoTTS, Slimcenter, SlimFileManager, SlimIRC, SoundRecorder, VisualizationWallpapers.

Replace the default bootanimation in system > media. (Just drag and drop your custom bootanimation to replace the original.)

Replace the default bootstrap image in system > bootstrap > images.

Change the default baseband. To do this, navigate to system > etc > motorola > basebands, and find the zip file that corresponds to your region and carrier. Drag that file out to a folder on your PC, and extract (unzip) it. Then drag and drop those extracted baseband files into system > etc > motorola > bp_nvm_default, replacing the default baseband files in the rom.

Edit build properties. To do this, find the build.prop file in the system directory, and drag it out to a folder on your PC. Open the file in Notepad++, and edit the build properties as desired. (For example, you can change the LCD screen density by editing the line that says "ro.sf.lcd_density=". The default density in CM11 is 240, and the default in SlimKat is 213. Larger numbers make icons appear larger on your screen.) After making any desired changes, save the file and drag it back into the rom zip file where you found it, replacing the original.

After installation, configure the rom for better performance:

Install Aero Kernel Control from the Google Play store, which will allow you to tweak many settings to improve the performance of your phone. For starters, I recommend the following: In the Aero Control app, go to CPU Performance > Governor Settings, and select “ondemand”. The default is Interactive governor, which may be able to deliver slightly better performance if you know how to tweak its settings, but its default settings aren’t very good, so I recommend using On Demand at least initially.

If you want to try using Interactive governor, I recommend the following settings: open Aero Kernel Control, go to CPU Performance, select Interactive governor, then tap the little phone icon at the top right corner of the screen to open the settings for the Interactive governor. Set suspend_enabled to 0. That should help to reduce the call wakeup delay. Changing hispeed_freq and input_boost_freq to your maximum value (e.g. 1200000 if you've overclocked to 1200 MHz) will also boost performance, though you may see a slight drop in battery life. Note: Interactive governor is not recommended for CM11 builds prior to the 06-10 nightly, because the suspend/resume handler was missing. (See okij's note on bug #26 for more info.)​

Open the HWA Settings app (which is already installed as part of the rom) and disable HWA for all apps except ones that really need it. (Explanation: HWA requires more RAM, and the Defy is already short on RAM, so enabling HWA usually does more harm than good. That's why it's best to disable it whenever it's not really needed for an app to function properly.)

The following apps require HWA: Camera, Dialer (on CM11 only), Google Maps (version 7+), Chrome browser. Other apps may also require HWA. If an app doesn't display properly, try enabling HWA again to see if that solves the problem.​

Install Greenify, which you can use to “hibernate” any apps that you don’t want to run automatically at startup.

Other tips & suggestions:

You may wish to install Google Camera instead of the stock camera, for the reasons mentioned here.

For offline voice recognition, see here.

For better GPS performance, you may want to try flashing this zip and/or using this app. (Thanks to [MENTION=4526745]Male_zvire[/MENTION] and [MENTION=4916555]okij[/MENTION] for recommending these solutions.)

FAQ & what to do if something goes wrong

A freshly installed rom takes some time to "settle" while various services run in the background, so the phone may be a bit unstable at first. If you're still encountering errors or other problems after a few hours, first check the bug list and use the XDA forum search feature to see if the issue you are having has already been reported.

If you think you've found a new bug, don't just complain about it; try to help solve it by taking logs. [MENTION=3490474]measel[/MENTION] has provided a very helpful guide for taking logs.

What if the phone doesn't boot up properly?

If you can still access the custom recovery, just flash safewipe again and re-install the rom, or restore a backup. (To enter TeamWin recovery after installing SlimKat or CM11, press the menu button when you see the screen that tells you to either press the menu button to enter recovery or the search button to continue with normal bootup. That screen should appear just after the Motorola logo disappears, and before the boot animation begins.)

If you can't access the recovery, you may need to flash an sbf file using RSD Lite. Be careful! Flashing an sbf file improperly is one of the few things that can actually hard-brick the Defy, and if you flash the wrong sbf file for your phone, it may be impossible to restore your phone back to its original firmware. Read the All-in-One Defy Beginner's guide for more information about sbfs and RSD Lite. You can also check out the Motorola Defy wiki page for other tips and tutorials.

A special thanks to [MENTION=513620]Quarx[/MENTION], who has been faithfully updating our phone to newer and better firmwares since the beginning of Defy history, and has undoubtedly put more work into this project than anyone else. Thanks also to our many other developers, past and present: [MENTION=4148153]TJKV[/MENTION] (who uses Quarx's kernel sources to port SlimKat to the Defy), [MENTION=4855459]Blechd0se[/MENTION] (who has made significant contributions to the kernel development for the Defy and also developed the Aero Control app that we use to fine-tune the performance of our phones), [MENTION=4841764]SlugZero[/MENTION], [MENTION=1316716]YetAnotherForumUser[/MENTION], [MENTION=4572668]struq[/MENTION], [MENTION=5721362]htto[/MENTION], [MENTION=803131]Epsylon3[/MENTION], [MENTION=765758]maniac103[/MENTION], [MENTION=382340]walter79[/MENTION], [MENTION=4806452]czechop[/MENTION], [MENTION=2218140]kabaldan[/MENTION], and [MENTION=4173406]Kayant[/MENTION]. Many thanks to all of them, and to anyone I may have forgotten. Thanks also to [MENTION=4916555]okij[/MENTION] and other Defy users who have helped with testing new builds and identifying bugs for the developers to solve.