Post Reply

[GUIDE] Compile CWM Recovery

OP Shaaan

2nd September 2012, 02:35 PM   |  #1  
Shaaan's Avatar
OP Recognized Contributor / Recognized Developer
Flag Mumbai
Thanks Meter: 4,686
 
2,349 posts
Join Date:Joined: May 2011
Donate to Me
More
Hi. I am creating this guide because i did not find any particular functional guide with details.

You must be running a 64 or 32 bit version of Ubuntu. Please note that i wont be going in the details on how to setup a build environment and sync sources as there are many guides for that.



Step 1 :
Install the required packages



Step 2 :
Setup the build environment and sync the sources for the required CWM. CWM source comes bundled with the CyanogenMod source.
Code:
CWM 5 - Gingerbread
CWM 6 - Jellybean





Step 3 :
Now we come to the actuall compiling part. Make sure you have synced the latest source using the "repo sync" command.
Change directory to your source.
Issue this command :
Code:
make -j4 otatools



Step 3.5 :
Do this step if your device is not officially supported by CM10.
Using terminal emulator on your device, issue the command
Code:
dump_image boot /sdcard/boot.img

This will dump the boot image to your sdcard. Transfer it to your home directory.

To build Android from source for a new device, you need to set up a board config and its makefiles. This is generally a long and tedious process. Luckily, if you are only building recovery, it is a lot easier. From the root of your Android source directory (assuming you've run envsetup.sh), run the following (substituting names appropriately):
Code:
build/tools/device/mkvendor.sh device_manufacturer_name device_name /your/path/to/the/boot.img

For example if you are having the Samsung Galaxy Ace device, the command will go as follows :
Code:
build/tools/device/mkvendor.sh Samsung cooper ~/boot.img

Please note that Cooper is the device name. Only use "~/boot.img" if you have the boot image in your home directory. Or else please specify the correct path.

You will receive the confirmation "Done!" if everything worked. The mkvendor.sh script will also have created the following directory in your Android source tree:

manufacturer_name/device_name

Step 3.5 ends here.




Step 4 :
Now that you have the device config ready, proceed.
Type the following code in your terminal in the source directory.
Code:
. build/envsetup.sh

This will setup the build environment for you to work.

Now launch the command
Code:
lunch full_device_name-eng


This will set the build system up to build for your new device. Open up the directory in a file explorer or IDE. You should have the following files: AndroidBoard.mk, AndroidProducts.mk, BoardConfig.mk, device_.mk, kernel, system.prop, recovery.fstab, and vendorsetup.sh.

The two files you are interested in are recovery.fstab and kernel. The kernel in that directory is the stock one that was extracted from the boot.img that was provided earlier. For the most part, recovery.fstab will work on most devices that have mtd, emmc, or otherwise named partitions. But if not, recovery.fstab will need to be tweaked to support mounts and their mount points. For example, if your /sdcard mount is /dev/block/mmcblk1p1, you would need the following lines in your BoardConfig.mk

/sdcard vfat /dev/block/mmcblk1p1


Once the recovery.fstab has been properly setup, you can proceed to the next step.




Step 5 :
Now we build the actual recovery.
Code:
make -j4 recoveryimage

This command builds the recovery image

You can use the command
Code:
make -j4 recoveryzip

to make a fakeflash recovery i.e. a temporary recovery to test out on the actual device.

Your recovery can then be found at "your_source_directory/OUT/target/product/device/recovery.img" and the temporary fakeflash zip in the utilities folder at the same location.

If everything works out well, you will have a working recovery.

Once you have working builds, notify "koush", on Github and he can build official releases and add ROM Manager support!


------------------------------------------------------------------------------------------------------------------------------------------------------------------------



Some tips :
  • If you want to compile CWM 6, sync the jellybean branch using the command :
    Code:
    repo init -u git://github.com/CyanogenMod/android.git -b jellybean
    
    repo sync


  • If you want to compile CWM 6 on a 32 bit system, you need to sync THIS source too. Instructions are given in the readme.

  • Run "make clobber" between builds if you change the BoardConfig.mk, or the change will not get picked up.


Credits :
Koush for this guide.
Last edited by Shaaan; 2nd September 2012 at 02:54 PM.
The Following 117 Users Say Thank You to Shaaan For This Useful Post: [ View ]
2nd September 2012, 03:17 PM   |  #2  
Senior Member
Flag Delhi
Thanks Meter: 89
 
165 posts
Join Date:Joined: Jun 2010
Donate to Me
More
Nice.
Will come in handy
The Following User Says Thank You to akshaybz For This Useful Post: [ View ]
3rd September 2012, 10:29 AM   |  #3  
evil_penguin's Avatar
Recognized Contributor
Thanks Meter: 698
 
1,622 posts
Join Date:Joined: Oct 2011
More
Excellent guide!
Thanks!
The Following User Says Thank You to evil_penguin For This Useful Post: [ View ]
7th September 2012, 04:53 AM   |  #4  
Member
Flag Lima
Thanks Meter: 18
 
69 posts
Join Date:Joined: Apr 2011
Donate to Me
More
I will try on my Motorola PRO+, wish me luck
10th September 2012, 03:19 PM   |  #5  
dany547's Avatar
Recognized Contributor
Flag Iași
Thanks Meter: 917
 
1,328 posts
Join Date:Joined: Feb 2008
Donate to Me
More
any ideeas how i can make the recovery font smaller? i read somewhere that i have to edit ui.c file, but what syntax? thanks
10th September 2012, 10:39 PM   |  #6  
Senior Member
Flag Birmingham
Thanks Meter: 62
 
212 posts
Join Date:Joined: Jun 2009
Donate to Me
More
thank you for this
i will try to compile this
i tried before using koush online builder but the cwm has bugs.
11th September 2012, 12:03 AM   |  #7  
dsb9938's Avatar
Recognized Developer
Flag Edison, NJ
Thanks Meter: 3,151
 
1,728 posts
Join Date:Joined: Sep 2010
Donate to Me
More
Okay, I'm problly stupid, but.

repo init -u git://github.com/CyanogenMod/android.git -b jellybean

seems to work fine, but

repo sync does this:

Code:
fatal: '../CyanogenMod/android_abi_cpp.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
error: Cannot fetch CyanogenMod/android_abi_cpp
What did I screw up, or not have prepared correctly?

I have built AOSP and currently build kernels on this box, so I know git and all that is setup correctly.

D

.
Last edited by dsb9938; 11th September 2012 at 12:28 AM.
11th September 2012, 12:33 AM   |  #8  
Member
Flag Lima
Thanks Meter: 18
 
69 posts
Join Date:Joined: Apr 2011
Donate to Me
More
edited
11th September 2012, 03:05 AM   |  #9  
dsb9938's Avatar
Recognized Developer
Flag Edison, NJ
Thanks Meter: 3,151
 
1,728 posts
Join Date:Joined: Sep 2010
Donate to Me
More
Got it. Needed an updated repo script.

D

.
11th September 2012, 06:07 AM   |  #10  
Account currently disabled
Thanks Meter: 1,933
 
509 posts
Join Date:Joined: Mar 2012
what's this ?

Quote:
Originally Posted by shaaan

Hey guys, i present to you a new updated version of CyanogenMod Recovery a.k.a CWM 6.0.1.3. The current version that we use is 5.0.2.6

Edit : As you guys know, i bricked my ace while trying to get CWM working. The bootloader is lost. So there is no way i can get it working back. This is the end of developing for me for now atleast. I will have to replace the motherboard or get a new device. Any dev wanting to take over the project, please feel free. Contact me for help and i will try my best. But if you use my sources, please give credits to me and TeamCooper.

My sources are here.

Edit : You can refer my guide on compiling a recovery here.

now afraid to do it on my own

The Following User Says Thank You to einstein.frat For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
build cwm, compile custom recovery, cwm 6, how to compile cwm recovery, shaaan
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android Software Development by ThreadRank