[GUIDE] Booting an Android System when only Recovery is at your disposal

Search This thread

catherall

Member
Jan 15, 2012
48
52
This guide and the linked ZIP package are for use with the HTC Desire Z.
Version 1.0.1
Provided by Catherall


== Boot CyanogenMod 7.1 from Recovery ==

Your phone may be in a state where Android cannot start any more, even restoring a system backup might be impossible. Then it would be great to have a handy way to boot a full CyanogenMod system anyway.

With the simple to follow commands in this guide you can boot CyanogenMod 7.1 from recovery.

What you need:
  • Custom recovery like one of the following:
    --- ClockworkMod Recovery version 5.0.2.7
    --- 4EXT Recovery TOUCH v1.0.0.4 RC3
    --- Other recovery with similar kernel might work
  • SD card (~ 800MB free)
  • CyanogenMod 7.1 system and boot files on SD card


All needed files are contained in the zip package:
Boot_from_SD_v1.0.1.zip (md5: d8d3332dda267fd3f6f03ba7023c6d72)
http://dl.dropbox.com/u/64675947/android/Boot_from_SD_v1.0.1.zip

Extract all files from the downloaded zip file to your SD card.
The resulting directory structure looks like this:

Code:
SD card --+-- update.zip
          |
          '-- BootManager --+-- README.txt
                            |
                            '-- rom8 --+-- boot.img
                                       +-- data.img
                                       +-- log.img
                                       +-- name
                                       +-- system.img
                                       '-- .android_secure


Boot into Recovery:
Shutdown your phone completely and remove battery for about 3 seconds.
Boot your phone into HBOOT by pushing Volume down and Power at the same time for about 5 seconds.
In the HBOOT" menu use Volume down to select Recovery and engage with Power.
You are in Recovery now.

Start Android system from Recovery:
Use Volume down and Volume up to select "apply update from sd card" and engage with Trackpad button. Confirm "install" by selecting "Yes - Install .." and engage with trackpad.
Installing update.zip only starts the Android system from the SD card, nothing will be installed on your phone!

When CyanogenMod is starting the CyanogenMod logo appears.
If you have a black screen then push Power once or twice until the screen is visible.

The default language of the system is "German". Select another language using "menu" button / "Einstellungen" / "Sprache & Tastatur" / "Sprache auswählen" - change to your prefered language and hit the home button.


Congratulations, you have a full working CyanogenMod 7.1, rooted, with terminal emulator and working network.


For installing new applications:
* Put the according APK file on the SD card
* Install the app by opening the APK file with the installed app "File Manager"


== Technical Remarks and Background Information ==

Testing for a fried ROM:
(as provided by amidabuddha in http://xdaforums.com/showthread.php?p=18016711 ):
Connect your phone to the computer, boot into recovery and use the following adb commands:
Code:
adb shell
dmesg | grep mmc0
If the output contains the following strings then your emmc (internal memory) is corrupted, your "chip is fried":
mmc0: failed to get card ready
mmc0: reinit card
mmc0: Starting deferred resume
mmc0: Deferred resume failed


Files contained in the ZIP package:
  • update.zip: Flashable "install" file that can be used in custom recoveries. It contains the kernel boot files and uses chroot to initialze the Android system by executing /init from the boot files
  • system.img, data.img, log.img, cache.img: Loop files of system, data, devlog and cache partition of CyanogenMod 7.1

When you "install" update.zip in recovery then the contained /META-INF/com/google/android/updater-script starts up. All necessary files are copied to the boot RAM disk and the shell script startsystem.sh is executed.
The script startsystem.sh mounts the Android partitions from SD card and starts up Android using the following command:
Code:
chroot /tmp/boot.img-ramdisk /init

This starts the android system (using init) with the new root on the path /tmp/boot.img-ramdisk.

Side effects of using chroot:
  • The phone appears as "recovery" when using "adb devices".
  • Using adb shell connects to /bin/sh of recovery.
  • You cannot use adb to install apps. As a workaround put the apk file on the SD card and install it simply by opening it with the app "File Manager"

This guide has been tested on the following Recoveries so far:
  • ClockworkMod Recovery 5.0.2.7 (kernel 2.6.35.14-cyanogenmod-g9e5cdf1)
  • ClockworkMod Recovery 3.0.2.4 (kernel 2.6.32.28-cyanogenmod-g4f4ee2e)
  • 4EXT Recovery TOUCH v1.0.0.4 RC3 (kernel 2.6.35.13-cyanogenmod-g4dc0bbe)
  • 4EXT Recovery v2.2.7 RC5 (kernel 2.6.35.13-cyanogenmod-g4dc0bbe)

As chroot is used to boot up the Android system it is important that the recovery kernel is compatible to CyanogenMod 7.1.

You can find your recovery kernel version by booting into recovery and using adb with the following command:
Code:
adb shell uname -r


== Feedback and Questions ==

For feedback and questions visit Freenode IRC channel #G2ROOT.
You can use the web interface at http://webchat.freenode.net/ .
After login change channel using "/join #G2ROOT".

When there is real need for the linked zip package and this guide then both will be improved.
Packages for other phones can be provided. When you have another phone then get in touch with me.


== Credits ==

Guhl (inital idea and support)
#G2ROOT freenode IRC channel ("These guys are awesome!")
Inioch (testing on a HTC Desire Z phone with a "fried" / read-only emmc)
karsten95 and coldsun15 (testing)
Nipqer (testing)
amidabuddha (fried rom check)

== Thanks ==

During my work I was supported by
#virtuousrom freenode IRC channel ("Excellent!")
Many other people, you know who you are!


P.S. If this guide does not work for you then follow the advice of Ego_UK:
"Jump three times, then turn around and say abracadabra. Maybe this helps" :rolleyes:
 
Last edited:

xT4Z1N4TRx

Senior Member
Apr 13, 2011
1,973
1,872
Wolverhampton
I had the exact same idea as this, I knew it would work well, I just couldn't be arsed to do it

Well done man, so many people would find this helpful, this should be sticked in the development forum!

Sent from my HTC Vision using XDA
 

PJ.C

Senior Member
Feb 21, 2012
64
5
shenzhen
well done, but how can i boot to the normal system? and when i want to boot to this system, should i do this again?
 

nickeedoo

Senior Member
May 12, 2010
461
88
Could this be used to have tons of free ram? Boot from the SD card and not have anything installed in the ROM of the phone? As in, format all the phone's partitions (everything under "/" ) and have, say, 368mb of ram? That'd be sick nasty.
 

steviewevie

Retired Forum Moderator
Oct 28, 2009
5,333
616
UK
Nice guide !




Boot into Recovery:
Shutdown your phone completely and remove battery for about 3 seconds.
Boot your phone into HBOOT by pushing and at the same time for about 5 seconds.
In the HBOOT" menu use to select Recovery and engage with .
You are in Recovery now.


That bit should be "Volume Down" instead of "Power Down" :)


Sent from my Desire Z running CM7.
 
  • Like
Reactions: catherall

cjward23

Senior Member
Sep 26, 2010
3,389
2,295
Peterborough
Could this be used to have tons of free ram? Boot from the SD card and not have anything installed in the ROM of the phone? As in, format all the phone's partitions (everything under "/" ) and have, say, 368mb of ram? That'd be sick nasty.

02df0bbc-c306-1306.jpg


Sent from my Galaxy Nexus using Tapatalk 2 Beta-4
 

catherall

Member
Jan 15, 2012
48
52
Booting to phone system: Just power on your phone.

well done, but how can i boot to the normal system? and when i want to boot to this system, should i do this again?

Just boot your mobile phone as usual (power on your phone) and you are in your Android system as installed in /system partition. update.zip does not install anything permanently, it just uses init from a modified kernel, mounts partitions from SD card and boots CyanogenMod 7.1 :eek:

When you want to boot again from SD card you have to go into Recovery and "install" update.zip to boot. :cool:

Best regards,
Catherall
 

catherall

Member
Jan 15, 2012
48
52
Do not use /system ROM as ram

Could this be used to have tons of free ram? Boot from the SD card and not have anything installed in the ROM of the phone? As in, format all the phone's partitions (everything under "/" ) and have, say, 368mb of ram? That'd be sick nasty.

First, I do not recommend to use the ROM as ram. Some emmc might get stuck in "read only" mode when used that way :eek:
When you need more "RAM" for system you could use a swap partition or file.

However, with booting from SD card you can have a system partition with more than say 368MB. If you want to use that on a full working phone I recommend to use the app "BootManager" from Google Play. They have done a good job to boot from SD card on phones with working ROM partitions.
In fact I used their applications have 9 different ROMs on my phone installed (8 on SD card) ready to boot when ever I want. :rolleyes:

Best regards,
Catherall
 

cjward23

Senior Member
Sep 26, 2010
3,389
2,295
Peterborough
Could this be used to have tons of free ram? Boot from the SD card and not have anything installed in the ROM of the phone? As in, format all the phone's partitions (everything under "/" ) and have, say, 368mb of ram? That'd be sick nasty.

02df0bbc-c306-1306.jpg

Sent from my Galaxy Nexus using Tapatalk 2 Beta-4
Sorry about that Catherall. @nickeedoo this is for people with phones that have the dreaded EMMC issue. If your phone works there is no advantage or performance gains when using this method.


Sent from my Galaxy Nexus using Tapatalk 2 Beta-4
 

catherall

Member
Jan 15, 2012
48
52
Porting to another HTC phone

Can this be ported to be used with EVO 4G?

Yes, this should be possible within an hour when I have somebody to test it together with me. :D
When you have a phone where you want to port the software then just come over to the freenode IRC channel G2ROOT and we will do it together. Then we can also make a posting on the according XDA section. :cool:
Web interface: http://webchat.freenode.net - channel #G2ROOT

Best regards, Catherall
 

nickeedoo

Senior Member
May 12, 2010
461
88
Lol at the picture. Alright, I'm not totally sure how all this works yet, so this is me learning!
 

crestofawave

Senior Member
Dec 17, 2011
474
119
Heraklion
Samsung Galaxy Tab A series
Lol at the picture. Alright, I'm not totally sure how all this works yet, so this is me learning!

I don't have much grasp of how this works, but I'll put my little linux knowledge to best use.

So...recovery shares the same build blocks of a full-fledged linux operating system, like Android. It has it's own kernel, ramdisk, yadda yadda. "chroot" is a unix (also a linux) command that changes the apparent root directory for a given process. This is very useful for a number of cases, like testing an app in a virtualized environment which in other cases would have been sub-optimal, or for compatibility. As such, in our case the "given process" is the Android system itself. You basically change the root directory of the linux system (recovery) and then initialize Android on top of it.

If anyone knows more about how this works, then please do tell as I'm quite interested myself!
 
  • Like
Reactions: catherall

catherall

Member
Jan 15, 2012
48
52
How it works

I don't have much grasp of how this works, but I'll put my little linux knowledge to best use. ...
If anyone knows more about how this works, then please do tell as I'm quite interested myself!

You pretty got the picture. The script update.zip uses the underlying kernel to chroot the new Android system. This is "simply" done by calling init (the starting point of the Android system) in the kernel files of the new booting system, which are contained in update.zip. They mount all partitions from SD card and boot the system.

Furthermore all interfering processes from recovery are set on hold using
Code:
kill -STOP <process id>
Otherwise recovery would respond on key strokes and block the screen. ;)
 
Last edited:
  • Like
Reactions: crestofawave

ngh55

Senior Member
Dec 8, 2007
270
29
Yes, this should be possible within an hour when I have somebody to test it together with me. :D
When you have a phone where you want to port the software then just come over to the freenode IRC channel G2ROOT and we will do it together. Then we can also make a posting on the according XDA section. :cool:
Web interface: http://webchat.freenode.net - channel #G2ROOT

Best regards, Catherall

I like that idea, I'm going to #g2root tomorrow to see if the newest cm nightly can be ported for this.

EVO-4G powered by FherraZ-Mod
 

Top Liked Posts

  • There are no posts matching your filters.
  • 22
    This guide and the linked ZIP package are for use with the HTC Desire Z.
    Version 1.0.1
    Provided by Catherall


    == Boot CyanogenMod 7.1 from Recovery ==

    Your phone may be in a state where Android cannot start any more, even restoring a system backup might be impossible. Then it would be great to have a handy way to boot a full CyanogenMod system anyway.

    With the simple to follow commands in this guide you can boot CyanogenMod 7.1 from recovery.

    What you need:
    • Custom recovery like one of the following:
      --- ClockworkMod Recovery version 5.0.2.7
      --- 4EXT Recovery TOUCH v1.0.0.4 RC3
      --- Other recovery with similar kernel might work
    • SD card (~ 800MB free)
    • CyanogenMod 7.1 system and boot files on SD card


    All needed files are contained in the zip package:
    Boot_from_SD_v1.0.1.zip (md5: d8d3332dda267fd3f6f03ba7023c6d72)
    http://dl.dropbox.com/u/64675947/android/Boot_from_SD_v1.0.1.zip

    Extract all files from the downloaded zip file to your SD card.
    The resulting directory structure looks like this:

    Code:
    SD card --+-- update.zip
              |
              '-- BootManager --+-- README.txt
                                |
                                '-- rom8 --+-- boot.img
                                           +-- data.img
                                           +-- log.img
                                           +-- name
                                           +-- system.img
                                           '-- .android_secure


    Boot into Recovery:
    Shutdown your phone completely and remove battery for about 3 seconds.
    Boot your phone into HBOOT by pushing Volume down and Power at the same time for about 5 seconds.
    In the HBOOT" menu use Volume down to select Recovery and engage with Power.
    You are in Recovery now.

    Start Android system from Recovery:
    Use Volume down and Volume up to select "apply update from sd card" and engage with Trackpad button. Confirm "install" by selecting "Yes - Install .." and engage with trackpad.
    Installing update.zip only starts the Android system from the SD card, nothing will be installed on your phone!

    When CyanogenMod is starting the CyanogenMod logo appears.
    If you have a black screen then push Power once or twice until the screen is visible.

    The default language of the system is "German". Select another language using "menu" button / "Einstellungen" / "Sprache & Tastatur" / "Sprache auswählen" - change to your prefered language and hit the home button.


    Congratulations, you have a full working CyanogenMod 7.1, rooted, with terminal emulator and working network.


    For installing new applications:
    * Put the according APK file on the SD card
    * Install the app by opening the APK file with the installed app "File Manager"


    == Technical Remarks and Background Information ==

    Testing for a fried ROM:
    (as provided by amidabuddha in http://xdaforums.com/showthread.php?p=18016711 ):
    Connect your phone to the computer, boot into recovery and use the following adb commands:
    Code:
    adb shell
    dmesg | grep mmc0
    If the output contains the following strings then your emmc (internal memory) is corrupted, your "chip is fried":
    mmc0: failed to get card ready
    mmc0: reinit card
    mmc0: Starting deferred resume
    mmc0: Deferred resume failed


    Files contained in the ZIP package:
    • update.zip: Flashable "install" file that can be used in custom recoveries. It contains the kernel boot files and uses chroot to initialze the Android system by executing /init from the boot files
    • system.img, data.img, log.img, cache.img: Loop files of system, data, devlog and cache partition of CyanogenMod 7.1

    When you "install" update.zip in recovery then the contained /META-INF/com/google/android/updater-script starts up. All necessary files are copied to the boot RAM disk and the shell script startsystem.sh is executed.
    The script startsystem.sh mounts the Android partitions from SD card and starts up Android using the following command:
    Code:
    chroot /tmp/boot.img-ramdisk /init

    This starts the android system (using init) with the new root on the path /tmp/boot.img-ramdisk.

    Side effects of using chroot:
    • The phone appears as "recovery" when using "adb devices".
    • Using adb shell connects to /bin/sh of recovery.
    • You cannot use adb to install apps. As a workaround put the apk file on the SD card and install it simply by opening it with the app "File Manager"

    This guide has been tested on the following Recoveries so far:
    • ClockworkMod Recovery 5.0.2.7 (kernel 2.6.35.14-cyanogenmod-g9e5cdf1)
    • ClockworkMod Recovery 3.0.2.4 (kernel 2.6.32.28-cyanogenmod-g4f4ee2e)
    • 4EXT Recovery TOUCH v1.0.0.4 RC3 (kernel 2.6.35.13-cyanogenmod-g4dc0bbe)
    • 4EXT Recovery v2.2.7 RC5 (kernel 2.6.35.13-cyanogenmod-g4dc0bbe)

    As chroot is used to boot up the Android system it is important that the recovery kernel is compatible to CyanogenMod 7.1.

    You can find your recovery kernel version by booting into recovery and using adb with the following command:
    Code:
    adb shell uname -r


    == Feedback and Questions ==

    For feedback and questions visit Freenode IRC channel #G2ROOT.
    You can use the web interface at http://webchat.freenode.net/ .
    After login change channel using "/join #G2ROOT".

    When there is real need for the linked zip package and this guide then both will be improved.
    Packages for other phones can be provided. When you have another phone then get in touch with me.


    == Credits ==

    Guhl (inital idea and support)
    #G2ROOT freenode IRC channel ("These guys are awesome!")
    Inioch (testing on a HTC Desire Z phone with a "fried" / read-only emmc)
    karsten95 and coldsun15 (testing)
    Nipqer (testing)
    amidabuddha (fried rom check)

    == Thanks ==

    During my work I was supported by
    #virtuousrom freenode IRC channel ("Excellent!")
    Many other people, you know who you are!


    P.S. If this guide does not work for you then follow the advice of Ego_UK:
    "Jump three times, then turn around and say abracadabra. Maybe this helps" :rolleyes:
    8
    Could this be used to have tons of free ram? Boot from the SD card and not have anything installed in the ROM of the phone? As in, format all the phone's partitions (everything under "/" ) and have, say, 368mb of ram? That'd be sick nasty.

    02df0bbc-c306-1306.jpg


    Sent from my Galaxy Nexus using Tapatalk 2 Beta-4
    6
    Booting when only HBOOT is at your disposal

    Hello everybody,

    I am preparing a guide for people that only can boot into HBOOT to boot a full Android system from SD card. :eek:

    Remark:
    Version 1 is available at http://www.thinkthinkdo.com/trac/project1/wiki/boot_sdcard.


    This will work for the HTC Desire Z / G2 when an Engineering HBOOT is installed.
    Without Engineering HBOOT you cannot use fastboot boot boot.img which is necessary to boot. :rolleyes:

    Best regard,
    Catherall
    3
    Could this be used to have tons of free ram? Boot from the SD card and not have anything installed in the ROM of the phone? As in, format all the phone's partitions (everything under "/" ) and have, say, 368mb of ram? That'd be sick nasty.

    02df0bbc-c306-1306.jpg

    Sent from my Galaxy Nexus using Tapatalk 2 Beta-4
    Sorry about that Catherall. @nickeedoo this is for people with phones that have the dreaded EMMC issue. If your phone works there is no advantage or performance gains when using this method.


    Sent from my Galaxy Nexus using Tapatalk 2 Beta-4
    1
    Can this be ported to be used with EVO 4G?