-
Notifications
You must be signed in to change notification settings - Fork 5
Home
-
Usually su-binary is compiled against AOSP tree. If you're gonna compile it yourself, you have to follow first two steps described in the AOSP Getting Started page: initialize a build environment and download the source tree.
Note: su-binary doesn't require any Java for successful compilation, so you don't have to install a JDK if you're planning to build su-binary only. Unfortunately, AOSP does check the presence of Sun's JDK even if no Java code are going to be compiled. Well, you have to just fool standard AOSP build procedure, look at the Successful compilation without JDK section I'll tell how to do it a bit later. -
After download of the entire AOSP tree is completed, follow first two steps described in the AOSP Building the System page, namely Initialize and Choose a Target.
-
Clone su-binary repository in the AOSP tree. Top of the tree is a good choice.
-
Build
su-binary
$ make su-gc
The compilation procedure will check all prerequisites, calculate all dependencies for su-binary, compile calculated dependencies, and, finally, compile su-binary
itself. When the procedure finishes, su-binary
is left somewhere in the out
directory as an executable file named su-gc
.
Before replacing /system/bin/su
with a fresh compiled copy, you have to ensure that newer su
works somehow, haven't you? If you don't like to pollute internal memory (flash) of your phone, you may put su-binary
executable into the /dev
directory, which is on tmpfs. Don't forget to set 06755 permissions (i.e. suid and sgid bits). After that, you can invoke /dev/su
for testing purposes.
- Create an empty
lib/tools.jar
file somewhere. For example,
$ touch ~/fake/lib/tools.jar
- Set the
ANDROID_JAVA_HOME
environment variable pointing to "somewhere":
$ export ANDROID_JAVA_HOME=~/fake
- Create a wrapper script for
java
andjavac
:
$ cat > ~/fake/bin/java
#!/bin/sh
echo java version \"1.6\"
<Ctrl+D>
(Don't forget to make it executable)
$ ln -s java ~/fake/bin/javac
- Add the directory which contains the wrapper script in the
PATH
environment variable
$ export PATH=~/fake/bin:$PATH