Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Last active December 16, 2015 00:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardBronosky/5348569 to your computer and use it in GitHub Desktop.
Save RichardBronosky/5348569 to your computer and use it in GitHub Desktop.
How I unbricked my T-Mobile Samsung Galaxy S III (S3) after a botched CyanogenMod update.

Note:

  1. When booting into Recovery or Download mode, it's okay/best to press power just a split second after Home+Up or Home+Down
  2. After reinserting the battery I find it safest to be patient and wait for the blocky battery icon to appear and disappear.
  3. When booting into Download mode, you have to let go of the buttons before the screen draws. Otherwise the Down button is interpreted as Cancel

So, your Samsung Galaxy S3 won't boot into recovery mode?

  • You are on a Mac and can't get any help from all these Odin posts.

  • You've heard horror stories of bricking a device and see warning screens saying... "Do not turn off target"

Scary huh?

Download mode

Well first of all, you have to just get used to that.

You are going to do a lot of scary rebooting and battery pulling.

Download ClockworkMod Recovery

Get the version for "Samsung Galaxy S3 (T-Mobile)" from here.

(cd ~/Downloads; curl -LO http://download2.clockworkmod.com/recoveries/recovery-clockwork-touch-6.0.3.0-d2tmo.img)

Install Heimdall

This is tricky because at the moment, the current "stable release" 1.3.2 (and all previous releases) do not support the Galaxy S3

So, you are going to have to build from source. Take a breath. You can do this.

Get the source

git clone https://github.com/Benjamin-Dobell/Heimdall.git
cd Heimdall

Read the README.txt

less OSX/README.txt

Ignore what it says about libusb (use homebrew not macports)

brew install libusb

Build and install...

cd libpit
./configure
make
cd ..

# This resolves the issue: https://github.com/Benjamin-Dobell/Heimdall/issues/99
export CC=/usr/bin/clang CXX=/usr/bin/clang++

cd heimdall
./configure
make
sudo make install
cd ..

# NOTICE: Don't be concerned when you see this...
## make[2]: Nothing to be done for `install-data-hook'.

cd OSX
sudo ./install-kext.sh
cd ..

Now you are ready to use Heimdall to save your recovery!

/usr/local/bin/heimdall flash --recovery ~Downloads/recovery-clockwork-touch-6.0.3.0-d2tmo.img --verbose --no-reboot

Pull the battery and the power cable (not scary anymore)

I chose to pass the --no-reboot option because we are not ready to boot the phone yet. However, this does mean that you have to hard power down the phone with that scary message on the screen.

Download a stable ROM

First of all, you may not have to do this step. I couldn't mount the External SD card after going through all the effort to locate and download the zips, but I found the original zip downloads in /sdcard/cmupdater/

I have been using CyanogenMod for quite some time.

(cd ~/Downloads; curl -LO http://get.cm/get/jenkins/12602/cm-10.0.0-d2tmo.zip)

You'll also want to get the Google Apps installer (cd ~/Downloads; curl -LO http://download.clockworkmod.com/gapps/gapps-jb-20121212-signed.zip)

Put all your zip files onto a MicroSD card and put it in your phone.

Boot into Recovery with Up+Home+Power

Install your zip files from the external SD card. If it complains that you can't mount it, you may have to format the card via CWM.

@gushags
Copy link

gushags commented Apr 15, 2013

Thanks for this. Everything worked for me up until sudo ./install-kext.sh at which point I get an error message:

sudo: unable to execute ./install-kext.sh: No such file or directory

But the file does exist. Any thoughts?

@multiplegeorges
Copy link

Hey there,

Thanks for writing this up.

Compilation fails on OSX with this error:

heimdall $ make
make all-am
depbase=echo source/BridgeManager.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';
/usr/bin/clang++ -DHAVE_CONFIG_H -I. -I/usr/local/Cellar/libusb/1.0.9/include/libusb-1.0 -std=c++0x -I../libpit/Source -g -O2 -MT source/BridgeManager.o -MD -MP -MF $depbase.Tpo -c -o source/BridgeManager.o source/BridgeManager.cpp &&
mv -f $depbase.Tpo $depbase.Po
source/BridgeManager.cpp:503:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_NONE'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_NONE);
^
source/BridgeManager.cpp:507:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_ERROR'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_ERROR);
^
source/BridgeManager.cpp:511:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_WARNING'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_WARNING);
^
source/BridgeManager.cpp:515:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_INFO'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_INFO);
^
source/BridgeManager.cpp:519:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_DEBUG'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_DEBUG);
^
source/BridgeManager.cpp:568:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_NONE'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_NONE);
^
source/BridgeManager.cpp:572:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_ERROR'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_ERROR);
^
source/BridgeManager.cpp:576:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_WARNING'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_WARNING);
^
source/BridgeManager.cpp:580:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_INFO'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_INFO);
^
source/BridgeManager.cpp:584:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_DEBUG'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_DEBUG);
^
source/BridgeManager.cpp:1354:37: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_NONE'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_NONE);
^
source/BridgeManager.cpp:1358:37: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_ERROR'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_ERROR);
^
source/BridgeManager.cpp:1362:37: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_WARNING'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_WARNING);
^
source/BridgeManager.cpp:1366:37: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_INFO'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_INFO);
^
source/BridgeManager.cpp:1370:37: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_DEBUG'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_DEBUG);
^
15 errors generated.
make[1]: *** [source/BridgeManager.o] Error 1
make: *** [all] Error 2

Thoughts?
I have brew install'd libusb.

@chadwpry
Copy link

Same here as @multiplegeorges

$ uname -a

Darwin a-computer.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64

$ make
make all-am
depbase=echo source/BridgeManager.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';
/usr/bin/clang++ -DHAVE_CONFIG_H -I. -I/usr/local/Cellar/libusb/1.0.9/include/libusb-1.0 -std=c++0x -I../libpit/Source -g -O2 -MT source/BridgeManager.o -MD -MP -MF $depbase.Tpo -c -o source/BridgeManager.o source/BridgeManager.cpp &&
mv -f $depbase.Tpo $depbase.Po
source/BridgeManager.cpp:503:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_NONE'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_NONE);
^
source/BridgeManager.cpp:507:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_ERROR'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_ERROR);
^
source/BridgeManager.cpp:511:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_WARNING'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_WARNING);
^
source/BridgeManager.cpp:515:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_INFO'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_INFO);
^
source/BridgeManager.cpp:519:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_DEBUG'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_DEBUG);
^
source/BridgeManager.cpp:568:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_NONE'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_NONE);
^
source/BridgeManager.cpp:572:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_ERROR'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_ERROR);
^
source/BridgeManager.cpp:576:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_WARNING'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_WARNING);
^
source/BridgeManager.cpp:580:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_INFO'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_INFO);
^
source/BridgeManager.cpp:584:36: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_DEBUG'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_DEBUG);
^
source/BridgeManager.cpp:1354:37: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_NONE'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_NONE);
^
source/BridgeManager.cpp:1358:37: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_ERROR'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_ERROR);
^
source/BridgeManager.cpp:1362:37: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_WARNING'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_WARNING);
^
source/BridgeManager.cpp:1366:37: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_INFO'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_INFO);
^
source/BridgeManager.cpp:1370:37: error: use of undeclared identifier 'LIBUSB_LOG_LEVEL_DEBUG'
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_DEBUG);
^
15 errors generated.
make[1]: *** [source/BridgeManager.o] Error 1
make: *** [all] Error 2

@jmjoyas
Copy link

jmjoyas commented May 25, 2013

I copied the contents of https://github.com/libusbx/libusbx/wiki/libusb.h to /usr/local/Cellar/libusb/1.0.9/include/libusb-1.0/libusb.h and got the compile going. The binary works too.

@mcchong
Copy link

mcchong commented Aug 16, 2013

homebrew installed libusbx to /usr/local/ and I had libusb at /opt/local/ .
I changed the Makefile to include the former, and managed to get it building.

@mcchong
Copy link

mcchong commented Aug 16, 2013

@gushhags. It's a short script, so I just ran each command individually, and it seems to have worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment