[GUIDE] How To Compile TWRP Recovery for QVGA And Other Unsupported Devices.

Search This thread

maximik1980

Member
Feb 18, 2013
14
2
Minsk
TWRP Recovery 2.6.1.0 for Huawei Ascend Y101 (8186)

The difference is no on the source dude so relax. You have to modify your kernel and change the compression method to lzma. Contact Dees_Troy for this because i dont know how to change it. You can chat with him through IRC. :)
OK, I've got it.
I've finally managed to compile a TWRP Recovery for my Huawei Ascend Y101 u8186 (240x320).
I've used a TWRP 2.6.1.0 tree on GitHub and CM7.2 source code to make it. It took me two weaks, but now I have a full working recovery! So thanks for your GUIDE, it's really useful.
I don't now why, but I have yellow color instead of blue... :eek: But I'm not the first who deal with this "bug" :laugh: : http://www.xda-developers.com/andro...oject-port-available-for-lg-optimus-one-p500/
 
Last edited:

Aadi

Senior Member
May 27, 2012
468
290
infinityhacks.wordpress.com
OK, I've got it.
I've finally managed to compile a TWRP Recovery for my Huawei Ascend Y101 u8186 (240x320).
I've used a TWRP 2.6.0.1 tree on GitHub and CM7.2 source code to make it. It took me two weaks, but now I have a full working recovery! So thanks for your GUIDE, it's really useful.
I don't now why, but I have yellow color instead of blue... :eek: But I'm not the first who deal with this "bug" :laugh: : http://www.xda-developers.com/andro...oject-port-available-for-lg-optimus-one-p500/

Use TARGET_RECOVERY_PIXEL_FORMAT := RGBX ????

Replace the question mark with the colour code you want. Colour codes are available in Dees_Troy's Rootzwiki guide. Happy to help and also dont forget to upload the theme files on github so that i can merge that in my guide here :) :D

Sent from my LG-P350 using Tapatalk 2
 

maximik1980

Member
Feb 18, 2013
14
2
Minsk
Use TARGET_RECOVERY_PIXEL_FORMAT := RGBX ????
Replace the question mark with the colour code you want. Colour codes are available in Dees_Troy's Rootzwiki guide. Happy to help and also dont forget to upload the theme files on github so that i can merge that in my guide here :) :D
Sent from my LG-P350 using Tapatalk 2
OK, thanks, I'll try this "TARGET..." (hmmm, I've spent days in Google trying to solve this "colour problem" :D)
I'm not an experienced user of GitHub... But I think I'll upload my theme files on GitHub as soon as possible.:cowboy:
 

maximik1980

Member
Feb 18, 2013
14
2
Minsk
TWRP Recovery 2.6.1.0 Theme for 240x320 devices

Hi again.
Here is my TWRP's theme (works with CM7.2 source code, but I think it'll work with CM9 too).:cowboy:
https://github.com/maximik1980/TWRP-2.6.1.0-u8186
I think it would help some people to compile their own TWRP Recovery.
I've slightly edited the original TWRP's ui.xml (select by ascending and by descending are eliminated and some other little changes...).
A screenshot is avialaible in the attachement. :eek:
 

Attachments

  • 2013-09-19_231314.png
    2013-09-19_231314.png
    8.8 KB · Views: 74

mathm2013

Senior Member
Jan 1, 2013
943
889
Rio de Janeiro
Hello, on Dees_Troy's thread i saw i should test the recovery on a android emulator. Could anyone tell me how can i do that?

EDIT: Oh, nevermind. I was too dumb to read the whole op :p
 
Last edited:

Qeemi

Senior Member
May 31, 2012
512
335
Rieti
My devices hasn't a recovery partition instead the recovery is inside the boot.img.

How can I extract the twrp from recovery.img and places it in boot.img?
 

erikasnoske

Senior Member
Aug 22, 2013
195
110
Vilnius
www.linkedin.com
Nope it won't make any difference it is just the same even if your device is ARMv6 or ARMv7. Make sure your device is supported by CM ;)

For those who want to work on Kali linux (mine is 64bit as default OS on my computer)

Java auto install script
http://www.youtube.com/watch?v=yq5ySksM6SE

Sublime 2 text editor (better then GEDIT)
http://www.youtube.com/watch?v=heZS--e5CHE
(not sure if it works on 32bit (32bit version) but works very well on 64bit! (64bit version))
 

Aadi

Senior Member
May 27, 2012
468
290
infinityhacks.wordpress.com
For those who want to work on Kali linux (mine is 64bit as default OS on my computer)

Java auto install script
http://www.youtube.com/watch?v=yq5ySksM6SE

Sublime 2 text editor (better then GEDIT)
http://www.youtube.com/watch?v=heZS--e5CHE
(not sure if it works on 32bit (32bit version) but works very well on 64bit! (64bit version))

I would suggest you install ubuntu as a dual boot or removing your existing OS and installing ubuntu in its place... Ubuntu is development friendly no much hassle and clutters... :)
 

Bhargav97

Senior Member
Mar 10, 2013
578
588
Gandhinagar - INDIA
Hi bro,
I seriously need your help. My LDPI (QVGA) device: Galaxy 5
We have a working cm11 already. I have already downloaded the source and I was successful in compiling a fully working Stock CWM from it. Now, I want to go for TWRP...but the only problem is a missing 240x320 folder. TWRP supports upto mdpi only. I want you to help me make a 240x320 folder for the latest twrp source (v2.6.00) or anything else which can solve my problem. You can find the twrp source at Github.

Will you be able to help me?...please.
Any help will be much appreciated.

Btw, awesome guide....Keep up the good work. :)
 

Aadi

Senior Member
May 27, 2012
468
290
infinityhacks.wordpress.com
Hi bro,
I seriously need your help. My LDPI (QVGA) device: Galaxy 5
We have a working cm11 already. I have already downloaded the source and I was successful in compiling a fully working Stock CWM from it. Now, I want to go for TWRP...but the only problem is a missing 240x320 folder. TWRP supports upto mdpi only. I want you to help me make a 240x320 folder for the latest twrp source (v2.6.00) or anything else which can solve my problem. You can find the twrp source at Github.

Will you be able to help me?...please.
Any help will be much appreciated.

Btw, awesome guide....Keep up the good work. :)

Yea sure but it may take some time because Dees_Troy made some changes in the 2.6 version... But i will update you regarding this as soon as possible....

Sent from my C5302 using Tapatalk
 

Bhargav97

Senior Member
Mar 10, 2013
578
588
Gandhinagar - INDIA
I see try using
RECOVERY_GRAPHICS_USE_LINELENGTH:= TRUE

If already enabled delete that line and try again...

Sent from my C5302 using Tapatalk

He has fixed it. Now, we have a user interface (fit for ldpi) with a touch fully working. Only problem left out is mounting. Partitions' name even is not shown. In logs, constantly an error is recurring... "Unable to find...blah blah...at blah blah". We checked the fstab but it's all fine. What is wrong and what can be done now?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 14
    Compiling Recovery

    Step 4:- Compiling Recovery

    Finally you have come to the final part of the guide which is compiling recovery.

    1. Open Terminal.
    2. Execute these commands in Terminal
    Code:
    . build/envsetup.sh
    lunch (Again select your device)
    make -j4 recoveryimage
    .

    That's it when it is finished grab recovery.img from:
    out/target/product/your_product_name/recovery.img

    Flash it in your device test it fix the bugs and release it.

    Wait if you don't want flash and just see how it looks so that you can flash another recovery if it is not working do these
    I am not resposible if your device gets bricked in fastboot mode but mostly it won't happen though :p
    1. Copy the recovery.img to sdk/platform-tools
    2. Boot your device into fastboot mode.
    3. Open Terminal
    4. Execute these commands one by one in Terminal
    Code:
    fastboot devices (wait for your device to show up int terminal)
    fastboot boot recovery.img

    You can test out all the features except flash zip, backup and restore.

    Victory :victory: you have successfully compiled TWRP recovery for your device go ahead have fun and enjoy.

    If you really like my work express your gratitude by pressing the Thanks button. See you soon in another thread :D ;) :victory: :laugh: :fingers-crossed: :cool:
    11
    How To Compile TWRP Recovery For QVGA And Other Unsupported Devices

    Guys a humble request don't spam this thread. If you face any error reply to this thread or PM me i will help :D and after you build it please don't post your bugs here this thread is only for compiling and not for resolving bugs in your build. I can only help with the errors you face during compilation because i faced a lot ;).

    I thank XDA members cybojenix, kD as i got an idea of how to make guides from them ;)
    I would also thank Dees_troy for the sources.

    I have worked hard in creating this guide so when you release your build please give proper credits :).

    Minimum Requirements:-
    1. RAM:- 4GB
    2. HDD Space:- More than 18GB required for CM7 source code (I am going to use CM7 for this guide as CM9 is not yet supported for many devices).
    3. Processor:- Equal to Core 2 Duo or Anything above it.
    4. Internet Speed:- Minimum of 2 Mbps as we will be downloading files of large size.
    5. Patience:- A lots of it needed to get success ;)

    Ok Lets Start With Step 1:- Setting Up Your Computer For Development.

    Getting Linux

    Please note your PC/Laptop must satisfy the minimum requirements to continue. If it doesn't contact any person who is developing for your device to develop this.

    For compiling you need Linux the most common and free Linux available for development is Ubuntu. Go ahead choose your version and download it.

    If you wish to use Ubuntu 10.04 64-Bit for Development use this link

    If you wish to use Ubuntu 10.10 64-Bit for Development use this link

    If you wish to use Ubuntu 11.04 64-Bit for Development use this link

    If you wish to use Ubuntu 11.10 64-Bit for Development use this link

    If you wish to use Ubuntu 12.04 64-Bit for Development use this link

    After downloading install it in a Virtual Machine or dual boot it alongside another OS you are using now. If you are using a Virtual Machine make sure you allocate more than 50GB of HDD space.

    So far so good now that you have Linux installed :victory: you can proceed to the next step of setting up which is followed in the second post.
    9
    Modding Files And Stuff

    Step 3:- Modding Files And Folders To Make Your Device Supportable.

    First up is to compile a build of ClockworkMod.

    Building ClockworkMod:-

    1. Open Terminal
    2. Type these commands one by one in Terminal
    Code:
    . build/envsetup.sh
    lunch (it should show you list of devices select your device with their serial number select your device by typing the serial number)
    make clean
    make -j4 recoveryimage

    If you didn't receive an error you are ready to compile TWRP for your device.
    If you do receive and error reply to the post I will help you.

    Modifying Files And Folder:-

    The original Dees_Troy's build folder isn't gonna work as your device resolution doesn't support it. So I have patched the build folder with some extra libs added to prelink map and patched recovery folder with gui changes for smooth compilation.

    If you have experience with using git you can clone the repo or you can download it directly from github.

    If you are going to clone execute these commands in terminal. (Thanks to cybojenix for this so that there will no manual copying).
    Code:
    cd source
    rm -rf build/
    rm -rf bootable/recovery/
    git clone git://github.com/chainhacker/TWRP_Build -b 2.3 build
    git clone git://github.com/chainhacker/TWRP_Recovery -b 2.3 bootable/recovery

    If you are going to download directly use the following link make sure you are downloading 2.3 branch and extract it.
    Here is the link for the patched build folder------>TWRP_Build
    Here is the link for the patched recovery folder------>TWRP_Recovery
    After you have done downloading from the above two files.
    Replace the contents of source/build folder with the patched one.
    Similarly replace the contents of source/bootable/recovery folder with the patched one.

    I have 240x320 resolution already in the patched ones but if your device is not 240x320 and also not supported by TWRP download a theme made by other members which has your device's resolution or create a theme. I didn't create the theme though I resized the images and made changes in ui.xml. If you are interested in theming follow the official TWRP theming guide in their website.

    If you did find a theme or created it rename the theme folder to your device resolution folder for e.g. If your device resolution is 320x240 you would rename the folder as 320x240.

    Copy the theme folder into source/bootable/recovery/gui/devices.

    That's it finished the basic requirements next up is configuring BoardConfig.mk.

    Editing BoardConfig.mk:-

    1. Navigate to source/device/your_vendor/your_device.
    your_vendor:- Vendor of your device e.g for me it is lge.
    your_device:- Your device name.
    2. Find BoardConfig.mk and open it in a text editor.
    3. Come to the last and add these line
    Code:
    #twrp
    DEVICE_RESOLUTION:= [I]your_device_resolution[/I] (e.g If your resolution is 240x320 type it)
    RECOVERY_GRAPHICS_USE_LINELENGTH := true
    2. Save it and close it.

    Yay you have finished everything only thing left out is compiling :D which is carried out in the next post.

    Psssst.......
    After you have compiled your first successful build here are few other things that you could add to BoardConfig.mk
    Note:- You can add this after finishing first successful build of recovery till then avoid these.
    Code:
    RECOVERY_SDCARD_ON_DATA := true -- this enables proper handling of /data/media on devices that have this folder for storage (most Honeycomb and devices that originally shipped with ICS like Galaxy Nexus)
    BOARD_HAS_NO_REAL_SDCARD := true -- disables things like sdcard partitioning
    TW_INCLUDE_DUMLOCK := true -- includes HTC Dumlock for devices that need it
    TARGET_RECOVERY_GUI := true -- uses gui format instead of ui.xml
    TARGET_RECOVERY_PIXEL_FORMAT := "RGB_565" -- to change the colour
    TARGET_USE_CUSTOM_LUN_FILE_PATH :=/sys/devices/platform/usb_mass_storage/lun0/file 
    TW_CUSTOM_POWER_BUTTON := 107 -- to get a power button on the home screen of recovery
    TW_EXTERNAL_STORAGE_PATH := "/sdcard" -- default external storage path
    TW_EXTERNAL_STORAGE_MOUNT_POINT := "sdcard" -- default external mount point
    TW_FLASH_FROM_STORAGE := true -- enables you to flash zips form the sdcard (You don't neeed o add this it is activated by default)
    TW_HAS_DOWNLOAD_MODE := false -- to enable download or more precisely enabling usb mass storage
    TW_HAS_NO_RECOVERY_PARTITION := true -- do this only if you device has no partion to recovery
    TW_INCLUDE_CRYPTO := false
    TW_INCLUDE_JB_CRYPTO := false
    TW_NEVER_UNMOUNT_SYSTEM := true -- always keeps the system mounted
    TW_NO_BATT_PERCENT := false -- shows battery percentage
    TW_NO_REBOOT_BOOTLOADER := true --- disables rebooting into bootloader
    TW_NO_USB_STORAGE := false -- disabled usb storage
    TW_SDEXT_NO_EXT4 := false
    6
    Setting Up Your Laptop/PC For Development.

    Note:- You may be asked for a password when using sudo command.

    Installing Python-2.7.5:-
    First and foremost is installing Python. For those who are wondering what Python is well here is the answer Python is a language like C,C++,Java which primarily centers around Linux.

    1. Open Terminal by hitting Ctrl+Alt+T.
    2. Type or copy paste these codes into terminal (I prefer typing though ;))
    Code:
    sudo apt-get install build-essential gcc
    cd Downloads
    wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
    tar -xvzf Python-2.7.5.tgz
    cd Python-2.7.5
    ./configure --prefix=/usr/local/python2.7
    make
    sudo make install
    sudo ln -s /usr/local/python2.7/bin/python /usr/bin/python2.7
    3. Python is now installed to make sure type this code in terminal
    Code:
    python
    and it should produce an output like this
    Code:
    Python 2.7.2+ (default, Jul 20 2012, 22:15:08)
    [GCC 4.6.1] on linux2
    Type "help", "copyright", "credits" or " lincense" for more information.
    >>>
    4. If it shows something like that you are good to go.
    5. Press Ctrl+D, close the terminal and proceed to install Java 6 JDK.

    Installing Java 6 JDK:-
    I have to thank cybojenix and kD for this part :D as it is theirs and i didn't write this part :D.

    If you are using Ubuntu 12.04 follow these commands others skip this set of commands.

    1. Download Java 6 JDK from here.
    2. After Downloading copy that to the Downloads folder.
    3. Open Terminal.
    4. Type these commands one by one in the terminal
    Code:
    cd Downloads
    
    chmod +x jdk-6u34-linux-x64.bin
    sudo ./jdk-6u34-linux-x64.bin
    sudo mv jdk1.6.0_34 /usr/lib/jvm/
    
    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_34/bin/java 1
    sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_34/bin/javac 1
    sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_34/bin/javaws 1
    
    sudo update-alternatives --config java
    sudo update-alternatives --config javac
    sudo update-alternatives --config javaws

    If you are not using Ubuntu 12.04 follow these commands:-

    1. Open terminal
    2. Type these commands one by one in the Terminal.
    Code:
    sudo add-apt-repository ppa:ferramroberto/java
    sudo apt-get update
    sudo apt-get install sun-java6-jre sun-java6-bin sun-java6-jdk

    If you had done those steps correctly then you must now have Java installed.
    To check and make sure it is installed type this command in terminal.
    Code:
    java -version
    and the output should be
    Code:
    java version "1.6.0_34"
    Java(TM) SE Runtime Environment (build 1.6.0_34-b04)
    Java HotSpot(TM) 64-Bit Server VM (build 20.9-b04, mixed mode)

    If the output was some thing similar you are now ready to install GNU Make.
    Close the Terminal and proceed.

    Installing GNU Make 3.81

    Note:- Any other version of make either lower or higher won't work for compiling TWRP.
    1. Open Terminal
    2. Type these codes in terminal.
    Code:
    wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
    tar -xvzf make-3.81.tar.gz
    cd make-3.81
    ./configure
    sudo make install
    3. That's it now you got make installed.
    To check and make sure that Make is installed type this command in Terminal.
    Code:
    make -v
    and it shoud give the output
    Code:
    GNU Make 3.81
    Copyright (C) 2006 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.
    There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    This Program built for x86_64-unknown-linux-gnu

    If it was something smiliar to that you can close the terminal and proceed to the next step.

    Ok now we got the big guns rolling it's now time for small guns without whom we can't compile yes I mean't the dependencies.

    Open Terminal and apply these commands:-
    Code:
    sudo apt-get install git-core gnupg flex bison gperf  build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev  ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev  libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown  libxml2-utils xsltproc gedit git schedtool
    export USE_CCACHE=1

    If you are using Ubuntu 10.10 apply this:-
    Code:
    sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so

    If you are using Ubuntu 11.04 apply this:-
    Code:
    sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
    sudo apt-get install libx11-dev:i386

    If you are using Ubuntu 12.04 apply this:-
    Code:
    sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
    sudo apt-get install libx11-dev:i386
    sudo apt-get install libncurses5-dev:i386 libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 zlib1g-dev:i386
    sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

    Good now you will have dependencies installed.

    It is now time for SDK and ADB which will be continued in the next post.
    6
    Installing SDK and ABD

    Installing SDK:-

    1. Download Android SDK from here.
    2. Extract it to your home folder.
    3. Rename the folder to sdk.
    4. Open the Terminal and type these commands
    Code:
    cd sdk/tools
    ./android sdk
    5. A window should popup and there will will be a list of Packages.
    6. Install Android SDK Tools and Android SDK Platform-Tools.

    Checking ADB:-

    Since you installed Android SDK Tools and Android SDK Platform-Tools ADB must now be checked and configured.
    1. Enable USB Debugging in your device and connect your phone to computer.
    2. Now execute these commands in Terminal
    Code:
    cd sdk/platform-tools
    ./adb devices

    It should give the output as
    Code:
    List of devices attached 0123456789ABCDEF device-name (Note the number-letter combination may vary)
    If it does give like that skip Adding Permissions.

    Or if it gives the output as
    Code:
    List of devices attached ????????????????? no permissions
    Don't worry we have add permission to your device that's it.

    Adding Permissions:-

    1. Open Terminal
    2. Execute this command.
    Code:
    sudo gedit /etc/udev/rules.d/51-android.rules
    3. It should open text editor
    4. Paste this line
    Code:
    SUBSYSTEM=="usb", ATTR{idVendor}=="xxxx", MODE="0666"
    5. Replace Vendor ID with your Vendor id given in the list.
    For e.g if your vendor is Acer you will replace "xxxx" with "0502"

    Here is a list of Vendor ID's
    Code:
    Acer - 0502
    ASUS - 0b05
    Dell - 413c
    Foxconn - 0489
    Fujitsu - 04c5
    Fujitsu Toshiba - 04c5
    Garmin-Asus - 091e
    Google - 18d1
    Hisense - 109b
    HTC - 0bb4
    Huawei - 12d1
    K-Touch - 24e3
    KT Tech - 2116
    Kyocera - 0482
    Lenovo -17ef
    LG - 1004
    Motorola - 22b8
    MTK - 0e8d
    NEC - 0409
    Nook - 2080
    Nvidia - 0955
    OTGV - 2257
    Pantech - 10a9
    Pegatron - 1d4d
    Philips - 0471
    PMC-Sierra - 04da
    Qualcomm - 05c6
    SK Telesys - 1f53
    Samsung - 04e8
    Sharp - 04dd
    Sony - 054c
    Sony Ericsson -	0fce
    Teleepoch -	2340
    Toshiba - 0930
    ZTE - 19d2

    6. Save and close the editor.
    7. Execute this command in Terminal.
    Code:
    sudo gedit /etc/udev/rules.d/99-android.rules
    8. Again paste this line
    Code:
    SUBSYSTEM=="usb", ATTR{idVendor}=="xxxx", MODE="0666"
    Replace "xxxx" with Vendor ID.
    9. Save it and close the file.
    10. Execute these commands one by one in the Terminal
    Code:
    sudo chmod a+r /etc/udev/rules.d/99-android.rules
    sudo chmod a+r /etc/udev/rules.d/51-android.rules

    Now RESTART your Ubuntu and type these codes in the Terminal.
    Code:
    cd sdk
    ./adb devices

    You must not get the output with ???????????????? no permission still if you get it please reply below I will help.

    Now we need to edit .bashrc so that we can access adb from anywhere
    Execute these codes in the Terminal.
    Code:
    cd
    sudo gedit .bashrc
    It should open text editor copy paste this line at the end.
    Code:
    export PATH=${PATH}:~/sdk/tools
    export PATH=${PATH}:~/sdk/platform-tools

    Save it and close it.
    Now in terminal type adb devices it should give output List of devices attached.

    That's it you got Ubuntu, Python, Java 6 JDK, GNU Make-3.81, SDK and ADB ready.

    Now you are ready to start development go on to the next step to download source code.