0

I manually rooted my emulator using following commands

adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock03 /system
adb push su /system/xbin/su
adb shell chmod 06755 /system
adb shell chmod 06755 /system/xbin/su
adb install superuser.apk

It is successfully rooted and working su command but while closing emulator and again opening emulator then su command is not working. To overcome this one I want to create a sample app for execute above commands programmaticaly using

Runtime.getRuntime().exec();

Please can one help me how to execute above commands programmatically.

1
  • I noticed that most of your questions have grammatical errors. No CAPS for example i, start of sentences or space after punctuation's. All your sentences start with a small alphabets instead of caps. Please be more careful with your questions. I have edited a few for your reference.
    – Siddharth
    Commented Feb 5, 2013 at 7:48

1 Answer 1

1

The emulator is rooted out of the box in that the ADB shell runs as root.

What you've done is not "rooted" it, but rather used that pre-existing root shell to install a common hack which will then let application programs run helper tasks as root.

But you cannot do this from an application on the device which does not already have the ability to launch a helper as root - so you are stuck with a circular dependency or chicken-and-egg problem of needing root in order to install a root helper.

You will not be able to do this on the device or even emulator without finding a security hole (or pre-existing intentional privilege escalation mechanism) to exploit.

However:

  • you could read up on how to make the emulator's state persistent, and do it manually only once

  • you could issue the commands from a script running on the develpment machine, rather than on the device/emulator

2
  • while close and open emulator then su command is not working can you please how to root the device permanently
    – raju
    Commented Feb 5, 2013 at 6:17
  • I believe the documentation will tell you how to make the emulator's state persistent, if not a web search definitely will. Commented Feb 5, 2013 at 6:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.