Powered By Blogger

30 December 2011

Next time I upgrade android on my Nexus S

So, its taken me a while to realise this, but I can just do the following, using ROMManager:

  1. Backup phone - optionally, copy backup off phone to store safely.
  2. Boot into custom recovery from ROMManager.
  3. Install update.zip - this will be the installer for the "next" android ROM.
  4. Install super user zip from sdcard.
  5. Reboot phone.
  6. (Re)connect USB to PC.
  7. adb shell and rename the install-recovery.sh so android won't keep replacing the custom recovery (see earlier posts).
  8. Reboot to test that previous step is good.
  9. Marvel at latest set of goodies.

29 December 2011

Nexus S : Root Ice Cream Sandwich after upgrade from Gingerbread

Assumptions being made here:
  1. You have ClockworkMod's ROM Manager installed.
  2. You installed ICS 4 .
  3. You have Android SDK installed.
  4. You have a fastboot program and have set up the USB rules on Ubuntu (see earlier posts).
  5. You have a custom recovery image such as ClockworkMod.
  6. You have a copy of the superuser program in ZIP format installed on the root of your SDCard.
Procedure:
  1. Put the phone into the bootloader - power off, power on whilst pressing volume up. Or use adb:

    adb boot bootloader

    Either way when it is in the bootloader, confirm your connected properly:

    fastboot devices

    Which *should* list your device else review the settings in the earlier post.
  2. Run fastboot to boot the recovery image:

    fastboot boot path to recovery image
  3. Phone will boot to the recovery image.
  4. Use the recovery image tool to locate the superuser zip and install it.
  5. Boot phone and enter ClockworkMod ROM Manager to re-flash the recovery image to make it permanent. If you do not have ROM Manager, refer to the earlier post on making the recovery image permanent.

4 April 2011

Rooting Nexus S

Follow guidance here - you will want the stunningly simple to use ROM Manager from Android Market to make it a simple process to install an alternative recovery image.

30 January 2011

Android Nexus S - flashing a custom recovery image and making it permanent

Each time Gingerbread reboots it recovers the stock recovery image by running a shell script in the /system/etc directory.

This means if you have installed a custom recovery image e.g. clockwork it will get overwritten and you have re-flash each time you want to use it.

If you have rooted your phone, e.g. installed superuser, you can use adb to rename the shell script and so retain the custom recovery image.

Boot phone and connect via USB:

adb shell
#
# now you have a shell on the phone
#
su
#
# super user app on phone will ask if this ok, press appropriate button, you are now root
#
# now make file system writable
#
mount -o remount,rw /dev/null /system
#
# rename unwanted script such that you can get it back if you really need it
#
mv /system/etc/install-recovery.sh /system/etc/install-recovery.sh.orig
#
# leave root and leave the shell
#
exit
exit

Now reflash your custom recovery image using fastboot, power down the phone, and re-power holding down volume-up and the power button to enter the boot loader.

New (re)flash the recovery image, either directly with fastboot :

sudo fastboot flash recovery recovery.img

or using an app like ROMManager.

Now reboot phone to bootloader (adb reboot bootloader or volume-up-and-power methods) and confirm you can enter the custom recovery image.


From there reboot the phone, again enter bootloader and again confirm the custom recovery image can be entered - this proves the shell script rename has worked.


Unlocking my Nexus S - on Ubuntu

WARNING - unlocking will wipe your user data - settings, apps, all the stuff you lovingly created "just so" on your groovy new phone. If you have not done so already, back it up all that good stuff with one of the many backup tools out there and/or create a google account to ensure all your useful data (contacts, email, etc) are safely sync'd to the cloud.

I have used these instructions on Ubuntu 10 and 11, they probably work on earlier versions (why haven't you upgraded?!) but make use of google and the man pages to see what "bumps in the road" you may hit.

I assume you have previously installed adb as part of the Android SDK - note it has moved to platform-tools now

Get fastboot from http://android-dls.com/files/linux/fastboot

Connect phone to Ubuntu via USB cable

su

lsusb

will show a list including these identities  - but, oddly, no description/name information, it may be another set of values entirely, I noticed it sometimes appeared as one of these two:
:
:
Bus 001 Device 044: ID 18d1:4e22
Bus 001 Device 044: ID 18d1:4e20
:
:

I now know 18d1:4e22 is the identity when android has booted, and 18d1:4e20 is the identity when in the boot loader. Doh!

Now edit this information a rules file:

vi /etc/udev/rules.d/51-android.rules 

Many posts suggested differing prefixes 70, 90 instead of 51, but it seemed to make no odds - man udev to explore options

Edit in two lines :

SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", ATTRS{idProduct}=="4e22", MODE="0666", OWNER="user", GROUP="plugdev"

SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", ATTRS{idProduct}=="4e20", MODE="0666", OWNER="user", GROUP="plugdev"

Replace user with your uid.


plugdev is a group of which you need to have membership - type groups from command line, as your uid, to see what groups you have - man groups for help

18d1  - vendor id from lsusb
4e22/4020 - product id from lsusb

Other vendor codes are documented here

Now ensure correct perms on the rules file we made earlier:

chmod a+rx /etc/udev/rules.d/51-android.rules 

Restart adb server as root - I made a simple init.d service to make adb daemon restart easier but the 
basic commands (if running as root and in the directory where you installed adb) will be:

./adb kill-server
./adb start-server

output something like:

* daemon not running. starting it now on port 5037 *
* daemon started successfully *

then try 

./adb devices

should get something like:

List of devices attached 
3931B6CB90EC00EC device

if you get output like:

List of devices attached
????????????    no permissions 

you need to check the permissions on the rules file are like:

-rwxr-xr-x 1 root root   111 2011-01-30 15:50 /etc/udev/rules.d/51-android.rules

and that you started the adb server as root

so now we can set the phone to the bootloader and try to run fastboot - this one you can do as your own user id

./adb reboot bootloader 

should give a basic screen with an android logo and some details about the phone, version etc 
and some choices that can be actioned via the hard keys. Should be saying FASTBOOT MODE at the top of the screen.

as root issue:

./fastboot devices

should see:

3931B6CB90EC00EC fastboot

if nothing happens you have configured incorrectly, and no results will return.

Now you can unlock, do this as root:

./fastboot oem unlock

The phone will prompt you to check this is really what you want, and then will do you bidding.

Reboot the phone and set it up as require.

If you subsequently reboot to the bootloader you will see the lock state as:

LOCK STATE - UNLOCKED