How to root Nexus S with Ice Cream Sandwich (ICS)

From Yggenyk
Revision as of 12:58, 7 December 2016 by WikiSysop (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<google>ENGELSK</google>

How to root Nexus S with Ice Cream Sandwich (ICS) manually

First get a backup of your existing boot image
  1. You can download ClockWorkMod from here:
  2. Power the Nexus S down, and hold Volume Up & the Power button until booted into the bootloader
  3. Verify your phone is connected with yout PC:
    >fastboot.exe devices
  4. Boot your phone with fastboot and the ClockworkMod image on a PC.
    >fastboot.exe boot recovery-clockwork-5.0.2.0-crespo.img
  5. Make a backup to the of the phone with ClockworkMod
    - backup and restore
    - backup
  6. Boot your phone to Android again, and copy the ClockworkMod backup to your PC.
    It is loccated in \clockworkmod\backup...
  7. Locate boot.img in the backup and put it in an empty folder on an Ubunto system
On Ubunto
  1. Download split_bootimg.pl
  2. Download The superuser app from here: androisu.com
  3. copy split_bootimg.pl and mkbootimg to the same folder
  4. $ chmod +x split_bootimg.pl
  5. $ chmod +x mkbootimg
  6. $ ./split_bootimg.pl boot.img
    Page size: 4096 (0x00001000)
    Kernel size: 2858444 (0x002b9dcc)
    Ramdisk size: 143086 (0x00022eee)
    Second size: 0 (0x00000000)
    Board name:
    Command line: console=ttyFIQ0 no_console_suspend
    Writing boot.img-kernel ... complete.
    Writing boot.img-ramdisk.gz ... complete
  7. Now you have
    boot.img-kernel
    boot.img-ramdisk.gz
  8. $ gzip -d boot.img-ramdisk.gz (extract the ramdisk)
  9. $ mkdir tmp
  10. $ cd tmp
  11. $ cpio -i -F ../boot.img-ramdisk (extract the ramdisk in the tmp folder to have a clean environment)
  12. Edit the file init.rc and find the line ## Daemon processes to be run by init.
    After the second ##
    Insert the folowing four lines:
    service superboot /system/bin/sh /superboot/superboot.sh
    class main
    user root
    group root
    oneshot
  13. Save the file and quit
  14. $ mkdir superboot
  15. Create the files:
    superboot/superboot/su
    superboot/su
    superboot/superboot.sh
    superboot/Superuser.apk
  16. $ find . | cpio -o -H newc | gzip > ../newramdisk.gz
  17. $ cd ..
  18. $ ./mkbootimg --kernel boot.img-kernel --ramdisk newramdisk.gz --cmdline 'console=ttyFIQ0 no_console_suspend' --base 0x30000000 --pagesize 4096 --output newboot.img

Content of superboot.sh should be:

mount -o rw,remount -t ext4 /dev/block/platform/s3c-sdhci.0/by-name/system /system
rm /system/bin/su
rm /system/xbin/su
mkdir /system/xbin
cat /superboot/su>/system/xbin/su
chmod 6755 /system/xbin/su
cat /superboot/Superuser.apk>/system/app/Superuser.apk
mount -o ro,remount -t ext4 /dev/block/platform/s3c-sdhci.0/by-name/system /system

To verify that ext4 /dev/block/platform/s3c-sdhci.0/by-name/system is the right filesystem on future versions of Android you can type:

  1. > adb shell
  2. shell@android:/ $ mount

This will show a list of al all filesystems on your phone.

Flash the new image to your phone

On Windows:

Verify it works before flashing

>fastboot.exe boot newboot.img

Flash image

>fastboot.exe flash boot newboot.img
>fastboot.exe reboot

Additional information

How to compile mkbootimg
  1. Get Android source code: http://source.android.com/source/downloading.html
  2. $ cd /path/to/android-src
  3. $ cd system/core/libmincrypt/
  4. $ gcc -c *.c -I../include
  5. $ ar rcs libmincrypt.a *.o
  6. $ cd ../mkbootimg
  7. $ gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a
  8. $ cd ../cpio
  9. $ gcc mkbootfs.c -o mkbootfs -I../include

copy system/core/mkbootimg/mkbootimg, system/core/cpio/mkbootfs to a directory in your path. location: tools/mkbootimg/mkbootimg.c


Additional links

Fastboot
Commandline parameters

cpio command line parameters


<google>ENGELSK</google>

id=siteTree