carlos$ cd /Volumes/android/cyanogenmod
carlos$ make CC=gcc CXX=g++ -j4 otatools
Hopefully, everything should have executed properly and a new set of files have been created in
{android_source_dir}/out/host/darwin-x86/bin:
carlos$ ls-ltr out/host/darwin-x86/bin
total 3640
-rwxr-xr-x 1 carlos staff 784 May 31 10:49 mkuserimg.sh
-rwxr-xr-x 1 carlos staff 82688 May 31 14:04 zipalign
-rwxr-xr-x 1 carlos staff 14088 May 31 14:04 unpackbootimg
-rwxr-xr-x 1 carlos staff 25988 May 31 14:04 mkyaffs2image
-rwxr-xr-x 1 carlos staff 18884 May 31 14:04 mkbootimg
-rwxr-xr-x 1 carlos staff 15164 May 31 14:04 mkbootfs
-rwxr-xr-x 1 carlos staff 96880 May 31 14:04 minigzip
-rwxr-xr-x 1 carlos staff 149220 May 31 14:04 make_ext4fs
-rwxr-xr-x 1 carlos staff 157892 May 31 14:04 imgdiff
-rwxr-xr-x 1 carlos staff 13516 May 31 14:04 fs_config
-rwxr-xr-x 1 carlos staff 77864 May 31 14:04 bsdiff
-rwxr-xr-x 1 carlos staff 19568 May 31 14:04 acp
-rwxr-xr-x 1 carlos staff 1160624 May 31 14:04 aapt
It’s very important to add that directory into your existing PATH environment variable. This is needed by other files that we will be executing later on. Add this PATH like so:
carlos$ export PATH={android_source_dir}/out/host/darwin-x86/bin:${PATH}
In my particular environment, it looks like this:
carlos$ export PATH=/Volumes/android/cyanogenmod/out/host/darwin-x86/bin:${PATH}
At this point, we’ll need one more item,
the recovery image tools. Feel free to download them even though I originally found
them here but, for whatever the reason, they’re no longer available. In any event, I don’t take credit for them, just provide them for usage. With that said, unzip them into their own directory and we’re ready to work on our recovery image. Let’s create our own vendor/device directory by executing the following:
carlos$ cd /Volumes/android/cyanogenmod
carlos$ . build/envsetup.sh
carlos$ build/tools/device/mkvendor.sh device_manufacturer_name device_name /your/path/to/the/boot.img
In my case, it was:
carlos$ build/tools/device/mkvendor.sh huawei U8652 /Volumes/android/huawei/U8652/system_images/recovery.img
The resulting output would be:
Output will be in /Volumes/android/cyanogenmod/device/huawei/u8652
4287 blocks
Done!
Use the following command to set up your build environment:
lunch full_U8652-eng
And use the follwowing command to build a recovery:
. build/tools/device/makerecoveries.sh full_u8652-eng
So far, so good! We’ve been diligent in following directions, so why let up now?
carlos$ lunch full_u8652-eng
The system replies back with a banner of the selected device we’re going to work on:
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.7
TARGET_PRODUCT=full_u8652
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=
HOST_ARCH=x86
HOST_OS=darwin
HOST_BUILD_TYPE=release
BUILD_ID=GINGERBREAD
============================================
At this point, we can now build our custom recovery image with the following command:
carlos$ make CC=gcc CXX=g++ -j4 recoveryimage
A few, short minutes of compilation, the system will return with:
----- Made recovery filesystem -------- out/target/product/u8652/recovery/root
----- Making uncompressed recovery ramdisk ------
out/host/darwin-x86/bin/mkbootfs out/target/product/u8652/recovery/root > out/target/product/u8652/ramdisk-recovery.cpio
----- Making recovery ramdisk ------
out/host/darwin-x86/bin/minigzip < out/target/product/u8652/ramdisk-recovery.cpio > out/target/product/u8652/ramdisk-recovery.img
----- Making recovery image ------
out/host/darwin-x86/bin/mkbootimg --kernel out/target/product/u8652/kernel --ramdisk out/target/product/u8652/ramdisk-recovery.img --cmdline "console=ttyDCC0 androidboot.hardware=huawei" --base 0x10200000 --pagesize 2048 --output out/target/product/u8652/recovery.img
----- Made recovery image -------- out/target/product/u8652/recovery.img
out/target/product/u8652/recovery.img total size is 4474880
For verification, traverse over to our
{android_source_dir}/out/target/product/u6852 directory and we should have the following:
carlos$ ls -ltr
total 28616
-rw-r--r-- 1 carlos staff 3136384 Jun 3 11:07 kernel
-rw-r--r-- 1 carlos staff 425 Jun 3 11:11 previous_build_config.mk
-rw-r--r-- 1 carlos staff 11141 Jun 3 11:11 clean_steps.mk
drwxr-xr-x 11 carlos staff 374 Jun 3 11:12 obj
drwxr-xr-x 4 carlos staff 170 Jun 3 11:12 symbols
drwxr-xr-x 8 carlos staff 476 Jun 3 11:12 root
-rw-r--r-- 1 carlos staff 148754 Jun 3 11:12 ramdisk.img
-rw-r--r-- 1 carlos staff 3289088 Jun 3 11:12 boot.img
drwxr-xr-x 4 carlos staff 170 Jun 3 11:12 system
drwxr-xr-x 3 carlos staff 136 Jun 3 11:12 recovery
-rw-r--r-- 1 carlos staff 2244608 Jun 3 11:12 ramdisk-recovery.cpio
-rw-r--r-- 1 carlos staff 4474880 Jun 3 11:12 recovery.img
-rw-r--r-- 1 carlos staff 1334940 Jun 3 11:12 ramdisk-recovery.img
We are more concerned about the
second to last line item, recovery.img. This is the image file we will now take and flash back into the Huawei U8652 and, hopefully, have a working CWM in our hands. Let’s put our hard work and flash our phone. Head on over to the Android SDK you, hopefully, downloaded earlier and execute “flashboot”:
carlos$ cd ~/Android/android-sdk-macosx/platform-tools
carlos$ ./fastboot flash recovery /path/to/your/recovery.img
In my case, it is:
carlos$ ./fastboot flash recovery /Volumes/android/cyanogenmod/out/target/product/u8652/recovery.img
If everything went well, you’ll be greeted with:
sending 'recovery' (4370 KB)...
OKAY [ 1.095s]
writing 'recovery'...
OKAY [ 0.832s]
finished. total time: 1.927s
Hazzah! Now, it’s time for the moment of truth. Power off your phone and once it’s powered off, proceed to hold VOLUME UP and POWER BUTTON at the same time. Keep holding this button combination until you get to the CWM-based Recovery v5.0.2.8 screen (see left).
To cycle through the menu choices, use the VOLUME UP and VOLUME DOWN buttons. To commit a selected choice, use the POWER button. If for some reason your POWER button doesn’t do what you want it to do,
read up on this thread to enable/disable the “Back Menu Button”.
If you made it this far, congratulations! After a few tests, it seems that v5.0.2.8 works well right out of the box. Feel free to perform a backup of your device for extra, extra added measure. Other than that, we’re well on our way to installing a custom ROM and this is the first step. In the next series of STEPs, I’ll go through the motions of installing a vanilla CM7 build on our U8652. Yeah, I know, there are already some out there but this is, once again, a discovery session from someone outside the Android root/ROMing scene. It’s very entertaining and rewarding, to say the least. Stay tuned.
Last, but not least, none of this stuff could be made possible without a few references, specifically
Does this help make a recovery?