The main guide works well when everything works just fine, but some background knowledge is left out, possibly being assumed that the audiences following that guide would be familiar with this area already. This post documents some doubts or difficulty I encountered in the process of trying to install CM on my phone, which was purchased one and a half years ago, and was in the brink of becoming unusable (battery goes dead after one day of standby mode, most apps takes forever to start, etc.).

== Android SDK

Download the corresponding SDK from http://developer.android.com/sdk/index.html. I have no plan to do Android development, and my PC is running linux, so tgz file it is:

1
2
aunpack android-sdk_r24.4.1-linux.tgz
cd android-sdk-linux

Because the platform tools are distributed separately, we need to install them differently. (Read more in the README file in the current directory.)

1
./tools/andriod update sdk -u

When the whole process finishes, the android-sdk-linux directory goes up to 21G. The actually used commands/tools are only a small subset, platform-tools and tools specifically. You could remove the rest if your disk resource is scarce.

It’s recommended to add those two directories to your $PATH so that no prefix is needed. Now, you need to enable USB debugging (seven-tap the build number to show developer option and turn on the USB option), and connect your phone (when it’s on) to PC. Now, your phone should pop up with a window asking your approval of this debug session. Approve it, and check the checkbox so that future connection from this PC would not require manual intervention. (You have to check the checkbox, otherwise, it would not work in the sideload step.)

Now, issuing this command to ensure it’s working. To double check; disconnect the usb cable and reconnect it so that no window pops up in your phone asking for approval.

1
adb devices

== Image and Google App

Just download the image and google app as linked in the main guide, there’s nothing tricky about it. My image link is https://download.cyanogenmod.org/?device=huashan, and selected the nano package. More info about this nano package and other package could be found at https://github.com/opengapps/opengapps/wiki

== fastboot mode

This is the only mode we could flash various partitions. Read more on basic Android knowledge at <>.

Boot the phone into fastboot mode, and issue the following command. (You may encounter permission issues, and sudo could fix it. More solutions could be found https://wiki.cyanogenmod.org/w/Doc:_fastboot_intro

1
fastboot flash boot boot.img

Now, we have replace the old boot partition with boot.img from our image, and rebooting the phone would leave us in the recovery mode. I could follow the rest steps in the guide without any problems. (You would get a permission/authorization problem if the checkbox was not checked in previous steps, and this was the problem I had, for in the original guide, they didn’t mention this at all, and I had to restore my original boot partition, boot into Android, and add my PC to the trusted list for USB debugging.)

1
adb sideload cm*.zip open_gapps*.zip

== Postscript

It feels likes a totally new phone now, and daily operations don’t impose any significant delay. It seems that I have no reason to buy an iPhone any more.