Quantcast
Channel: Amagob IT Blog
Viewing all articles
Browse latest Browse all 13

Changing ROM on Android phone using ADB with linux

$
0
0

Installing different OS on a PC is easy, get a CD, boot from it and just follow the wizard. How about your phone? Manufacturers and service providers don’t like when you mess with your phone OS (which is really called the ROM). The reality though, is that the cell phones today are more than just phones. Changing the ROM on your phone was always possible with most manufacturers but not always easy, with reason I must say. It is really bad when you cannot take a call or get your messages correctly on time on your work phone, because you nightly build you installed on your work phone has a bug and you have no idea when it will be fixed (or if it will). I rooted and installed Cyanogenmod on my first Android phone (Samsung S in 2009) using Odin within a few weeks I received it. I’ve always been a (satisfied) Samsung Android user and did the same with all the following phones I had except the last one. I figured I should have one fully functional phone at least once in my career. That said, I have a Galaxy Nexus phone (from 2011) that I get to play with. Having always used Odin (on Windows), that was the only way I knew how to push an image to an Android phone, whether its the ROM or ClockWorkMod ( cwm, is a recovery boot partition that can be used to install ROM and APPs in form of zip files on the SDCard). Of course, we’ve all heard about the Android being an open architecture with all kinds of programming tools (Java.. Uurrgg). At this point, I heard of adb (Android Debug Bridge) tool from a colleague but never really spent the time to investigate it.

So, yesterday I decided to see if there were any update for the Galaxy Nexus running Cyanogenmod. There was and when I did the update, the phone would boot into CWM and say it couldn’t find the autodeploy.zip file and get stuck. I tried to restart, clear the cache, wipe the device but nothing to do. I didn’t had the ROM on the sdcard to reinstall it. Since, the sd card is not actually an external sdcard in a slot (like all Samsung Ss) and there is no Odin for Galaxy Nexus, i had to find a way to load a new ROM into the phone. To be clear, I wasn’t the last person who flashed that phone. Since I’m very much into linux now, I thought “time to try adb!”. If you are a linux poweruser, you’ll probably know that thrills of learning a command line that can make something extremely tedious into something so simple that you question your whole existence.. Well, adb does that!!

I started here and understood that there’s really two pieces to it.
1.  fastboot – where you install cwm or twrp
2.  adb – where you install the ROM and/or (g)Apps

To install fastboot and adb on your ubuntu (linux) machine,

sudo add-apt-repository ppa:phablet-team/tools && sudo apt-get update

Once that’s done (or if you’re on Ubuntu), enter the following command:

sudo apt-get install android-tools-adb android-tools-fastboot

And you’re all set up! You can send commands to your device from any terminal window.

For Galaxy Nexus to start the phone in fastboot = Volume UP + Volume Down + Power.
(check if device properly connected on your linux machine with the followin command “fastboot devices” while usb cable is plugged in)

From the fast boot, you can use volume buttons to select Recovery mode then power button for “ok”.

If you need to install a new CWM or TWRP… if your zip doesn’t want to install and get error Status 6 when installing Open gApps, or set_metadata_recussive; some changes failed etc.. download the right recovery version of TWRP for your phone (.img) and run command like “fastboot flash recovery twrp-2.8.7.0-maguro.img“. When done, fastboot reboot.

Once you have the right recovery tool, boot into recovery mode and use your adb commands as below.
adb devices – check device detected on usb cable
adb push cm-11-20151004-NIGHTLY-maguro.zip /sdcard/cm11.zip  –  copy .zip file to sdcard
adb shell – enter phone shell command (most linux commands work, ex. df -h to check partition sizes, ls -R | grep *.zip to look for all zip files, etc.)
adb reboot bootloader (reboot phone to bootloader mode)
adb reboot recovery (reboot phone in recovery mode)

With these few commands, you can load an reload as many ROMs and Open gAPPs or PA_Apps or whatever, until you find what fits your phone right (make sure you use the right version of CWM though, lost hours with that..)

I finally got my old Galaxy Nexus running with Lollipop 5.1 with Open gApps (pico). (http://forum.xda-developers.com/galaxy-nexus/development/cyanogenmod-12-beta-builds-t2958865)

Not really my phone, but looks a lot like this..


Viewing all articles
Browse latest Browse all 13

Trending Articles