Cyanogenmod ROM ZTE Blade (blade)
Quick Info
Download (konstakang build)
CyanogenMod 10.2 (Android 4.3 (Jelly Bean))
Download (zeelogkang build)
CyanogenMod 11 (Android 4.4-4.4.4 (KitKat))
Download (0 build)
CyanogenMod cm.7 ()
Main sections for ZTE Blade (“blade”)
Note: Support Status
This device does not support the latest official release of CyanogenMod. This may be due to hardware limitations or simply because development is ongoing. The most recent version supported is based on the gingerbread branch of CyanogenMod.
Notes
The ZTE Blade is a touchscreen Android smartphone manufactured by ZTE. The device is manufactured in several variants, differing in aspects such as screen type (AMOLED/TFT), camera (3.2MP or 5.0MP), installed firmware (stock: Android 2.1 or 2.2), and bootloader variant (gen1/gen2). Greek and older Hungarian versions have their available RAM limited to 256MB in software. A custom update is available that makes the full 512MB available. Official CyanogenMod support for the ZTE Blade was added in CyanogenMod 7, although starting with 7.0.2, future builds will be generation 2 only.
Watch out for Gen3 versions, its very similar to Gen2, but the radio is not compatible, and does not work with CM7. (Check you version with Blade Checker as Mr. Pigfish will report Gen3 as a Gen2)
Source code
Device | http://www.github.com/cyanogenmod/android_device_zte_blade |
Codename: | blade |
---|---|
Vendor: | ZTE |
Manufacturer: | ZTE |
Type: | phone |
GSM freq: | 850 900 1800 1900 MHz GSM/GPRS/EDGE 900 2100 MHz UMTS/HSPA |
Platform: | Qualcomm MSM7227 |
CPU: | 600 MHz single-core Qualcomm MSM7227-1 |
GPU: | Qualcomm Adreno 200 |
RAM: | 512MB or 256MB |
Weight: | 110 g (3.9 oz) |
Dimensions: | 116 mm (4.6 in) (h)
57 mm (2.24 in) (w) |
Screen size: | 89 mm (3.5 in) |
Resolution: | 480×800 |
Screen type: | TFT LCD or AMOLED |
Internal storage: | 512 MB |
SD Card: | expandable up to 32 GB |
Bluetooth: | Bluetooth 2.1+EDR |
Wi-Fi: | Wi-Fi (802.11b/g) |
Main camera: | 3.2 or 5 megapixel |
Power: | 1250 mAh internal rechargeable removable lithium-ion battery |
Peripherals: | Micro-USB, A-GPS, FM Radio, capacitive touchscreen, headset controls, proximity and ambient light sensors, 3-axis accelerometer, digital compass |
CM supported: | 7 |
Latest CM version: | gingerbread |
Note: DISCLAIMER
Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.
Contents
Install a Custom Recovery on the Blade
Is it Gen1 or Gen2?
- Search for Ask Mr Pigfish in the Market and install the app.
- Open Ask Mr Pigfish.
- If the first line says “Mr Pigfish says you have a G1 model.”, then the ZTE Blade is Gen1 and you need to convert it to a Gen2, which also installs a recovery.
- If the first line says “Mr Pigfish says you have a G2 model.”, then the ZTE Blade is Gen2 and you can continue to the root and recovery portion.
Gen1 to Gen2 Conversion (Gen1 ONLY)
- Download the Gen1-to-Gen2 Total Phone Transfer:
- Gen1-to-Gen2 Total Phone Transfer v7: Download
- md5:
c10cd48bbfb8e2c16384ebb49e06eb5c
- md5:
- Gen1-to-Gen2 Total Phone Transfer v7: Download
- Unzip the Gen1-to-Gen2 Total Phone Transfer and copy (including the image folder) to the root on the SD card (NOT in any folders).
- Power off the ZTE Blade and pull the battery.
- Replace the battery. Boot into bootloader mode by holding down Volume Up, the Menu & the Power buttons.
- This process should take about a minute or so and once done, will automatically boot into the ClockworkMod Recovery.
- NOTE: It is recommended to delete the image directory on the root of the SD card, once the conversion has completed.
- Skip to last section to install CM.
Gen2 Root and Recovery (Gen2 ONLY)
- Download rageagainstthecage-arm5, the ZTE Drivers & the Superuser package:
- Windows Only: Install the ZTE device drivers.
- Unzip rageaginstthecage-arm5 & the Superuser package to the same folder as adb (the /platform-tools folder within the Android SDK folder).
- Connect the ZTE Blade to the computer via USB.
- On the computer, open terminal and run the following commands:
adb push rageagainstthecage-arm5.bin /data/local/tmp/
adb shell
chmod 777 /data/local/tmp/rageagainstthecage-arm5.bin
/data/local/tmp/rageagainstthecage-arm5.bin
- Once the exploit finishes, in terminal, run the following commands:
exit
adb kill-server
adb start-server
adb shell
- NOTE: You should see a “#”. If you see a “$”, then the exploit didn’t work, please repeat steps 4 & 5.
mount -o rw,remount /system
- NOTE: For Gen 2 ROM 2.2, the “mount” command above does not work. the /system is already writable to root. Hence the “mount” could be skipped. However, we need to create the /system/xbin folder manually:
mkdir /system/xbin
exit
adb push su /system/xbin/
adb shell chmod 4755 /system/xbin/su
adb push Superuser.apk /system/app/
- The ZTE Blade is now rooted, please continue to the next section.
Installing CyanogenMod from recovery
- Make sure your computer has working adb.
- Download the CyanogenMod build package for your device that you’d like to install to your computer.
- Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
- Boot to recovery mode, and connect the phone to your computer through USB.
- Vol Down & Power (In Case of Dell XCD35: Home & Vol Up & Power )
- In ClockworkMod Recovery, use the physical volume buttons to move up and down. On most devices, the power button is used to confirm a menu selection, but for some devices a physical home key acts as a selector. Some devices have touch enabled ClockworkMod Recovery, in which case you may be able to swipe to, or touch, menu selections.
- Optional (Recommended): Select backup and restore to create a backup.
- Select wipe data/factory reset.
- You have two options for transferring and installing the installation packages. The sideload method is more universal across devices, whereas the push and install method is more commonly used:
- Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
- Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see
/storage/sdcard0
or/sdcard
as a mountable volume, go ahead and mount it. If you do not see one of these partitions, then instead mount the/data
partition. Take note of which volume you mounted. Now, push the package(s) to your device (also, see tip below):
-
- – If you mounted /storage/sdcard0, then:
adb push update.zip /storage/sdcard0/
- – If you mounted /sdcard or /data, then:
adb push update.zip /sdcard/
- – If you mounted /storage/sdcard0, then:
- where
update.zip
should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
- Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.
Helpful Tip – SD card folders
CyanogenMod 10.1 and newer have multi-user support (introduced in Android 4.2). If your device has storage on the /data partition, then Android actually looks in /data/media/0/ for the first user’s /sdcard/ storage. ClockworkMod recovery symlinks /sdcard/ to /data/media/ though. So, if you are pushing files to internal storage in recovery and want them to be visible in Android, you should push them to /sdcard/0/ or /data/media/0/. Here’s the most frequent scenarios:
- If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10 or older:
adb push update.zip /sdcard/
- If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10.1 or newer:
adb shell "mkdir /sdcard/0/"
followed byadb push update.zip /sdcard/0/
- If you’re coming from a ROM with Android 4.2 or newer to CyanogenMod 10.1 or newer:
adb push update.zip /sdcard/0/
How To Build CyanogenMod For ZTE Blade (blade)
Contents
- 1 Introduction
- 2 Build CyanogenMod and CyanogenMod Recovery
- 2.1 Prepare the Build Environment
- 2.2 Create the directories
- 2.3 Install the repo command
- 2.4 Put the ~/bin directory in your path of execution
- 2.5 Initialize the CyanogenMod source repository
- 2.6 Download the source code
- 2.7 Get prebuilt Rom Manager
- 2.8 Prepare the device-specific code
- 2.9 Extract proprietary blobs
- 2.10 Turn on caching to speed up build
- 2.11 Start the build
- 2.12 If the build breaks…
- 3 Install the build
Introduction
These instructions will hopefully assist you to start with a stock Blade, unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.
It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.
Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.
What you’ll need
- A Blade
- A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
- A USB cable compatible with the Blade (typically micro USB, but older devices may use mini USB or have a proprietary cable)
- A decent internet connection & reliable electricity :)
- Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as
cd
for “change directory”, the concept of directory hierarchies, that in Linux they are separated by/
, etc.
If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.
Note:
You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set BUILD_HOST_32bit=1
in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.
Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)
So let’s begin!
Build CyanogenMod and CyanogenMod Recovery
Prepare the Build Environment
Note:
You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.
Install the SDK
- If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.
Helpful Tip
While the SDK contains lots of different things– the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools
directory.
Install the Build Packages
Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.
Helpful Tip
A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install
command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)
For both 32-bit & 64-bit systems, you’ll need:
bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev
In addition to the above, for 64-bit systems, get these:
g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
For Ubuntu 15.10 (wily) and newer, substitute:
-
lib32readline-gplv2-dev
→lib32readline6-dev
For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):
-
libwxgtk2.8-dev
→libwxgtk3.0-dev
-
openjdk-7-jdk
→openjdk-8-jdk
Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):
- CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
- CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
- CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
- CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
- CyanogenMod 14.1: OpenJDK 1.8
Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:
- Obtain OpenJDK 1.7 from the openjdk-r PPA
- Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your
$HOME/.bashrc
file:export EXPERIMENTAL_USE_JAVA8=true
.
Also see http://source.android.com/source/initializing.html which lists needed packages.
Create the directories
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
Install the repo
command
Enter the following to download the “repo” binary and make it executable (runnable):
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Put the ~/bin
directory in your path of execution
In recent versions of Ubuntu, ~/bin
should already be in your PATH. You can check this by opening ~/.profile
with a text editor and verifying the following code exists (add it if it is missing):
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Initialize the CyanogenMod source repository
Enter the following to initialize the repository:
- Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b gingerbread
Download the source code
To start the download of all the source code to your computer:
$ repo sync
The CM manifests include a sensible default configuration for repo
, which we strongly suggest you use (i.e. don’t add any options to sync
). For reference, our default values are -j 4
and -c
. The -j 4
part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3
or -j 2
. -c
will ask repo to pull in only the current branch, instead of the entire CM history.
Prepare to wait a long time while the source code downloads.
Helpful Tip
The repo sync
command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.
Get prebuilt Rom Manager
$ cd ~/android/system/vendor/cyanogen
then enter:
$ ./get-rommanager
You won’t see any confirmation- just another prompt. But this should cause the Rom Manager apps to be loaded and installed into the source code. Once completed, this does not need to be done again.
Prepare the device-specific code
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ lunch
You should see a list of devices, including something like cm_blade-userdebug
. Select it by typing its number. It is possible that lunch
does not display your device. In that case try
$ lunch cm_blade-userdebug
or
$ lunch full_blade-userdebug
If all goes well, you should see that blade-specific directories are downloaded automatically.
Helpful Tip
If you want to know more about what source build/envsetup.sh
does or simply want to know more about the breakfast
, brunch
and lunch
commands, you can head over to the Envsetup help page.
Helpful Tip
Instead of typing cd ~/android/system
every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot
. To use this command, you must first run source build/envsetup.sh
from ~/android/system
.
Extract proprietary blobs
Now ensure that your Blade is connected to your computer via the USB cable and that you are in the ~/android/system/device/zte/blade
directory (you can cd ~/android/system/device/zte/blade
if necessary). Then run the extract-files.sh
script:
$ ./extract-files.sh
You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the ~/android/system/vendor/zte
directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.
Note:
Your device should already be running a build of CyanogenMod for the branch you wish to build for the extract-files.sh
script to function properly.
Note:
It’s important that these proprietary files are extracted to the ~/android/system/vendor/zte
directory by using the extract-files.sh
script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!
Turn on caching to speed up build
You can speed up subsequent builds by adding
export USE_CCACHE=1
to your ~/.bashrc
file (what’s a .bashrc file?). Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:
prebuilt/linux-x86/ccache/ccache -M 50G
where 50G
corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.
Helpful Tip
If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples: export ANDROID_CCACHE_DIR="$HOME/android/.ccache"
and export ANDROID_CCACHE_SIZE="50G"
.
Start the build
Time to start building! So now type:
$ croot
$ brunch blade
The build should begin.
Helpful Tip
If the build doesn’t start, try lunch
and choose your device from the menu. If that doesn’t work, try breakfast
and choose from the menu. The command make blade
should then work.
Helpful Tip
A second, bonus tip! If you get a command not found error for croot
, brunch
, or lunch
, be sure you’ve done the source build/envsetup.sh
command in this Terminal session from the ~/android/system
directory.
Helpful Tip
A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here
If the build breaks…
- If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/blade/cm_blade-ota-eng.root.zip] Error 1
…you may want to make the following change to ~/android/system/build/tools/releasetools/common.py
:
Search for instances of -Xmx2048m
(it should appear either under OPTIONS.java_args
or near usage of signapk.jar
), and replace it with -Xmx1024m
or -Xmx512m
.
Then start the build again (with brunch).
- If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.
Install the build
Assuming the build completed without error (it will be obvious when it finishes), type:
$ cd $OUT
in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system
is in a folder called system
. The stuff that will become your ramdisk is in a folder called root
. And your kernel is called… kernel
.
But that’s all just background info. The two files we are interested in are (1) recovery.img
, which contains CyanogenMod Recovery, and (2) cm-7-20161224-UNOFFICIAL-blade.zip
, which is the CyanogenMod installation package.
Install CyanogenMod
Back to the $OUT
directory on your computer– you should see a file that looks something like:
cm-7-20161224-UNOFFICIAL-blade.zip
Note:
The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “KANG
” rather than UNOFFICIAL
version. Regardless, the file name will end in .zip
and should be titled similarly to official builds.
Now you can flash the cm...zip
file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.
Success! So….what’s next?
You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.
Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.
Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.
Congrats again!
Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.