1 ## Why another Superuser?
2 * Superuser should be open source. It's the gateway to root on your device. It must be open for independent security analysis. Obscurity (closed source) is not security.
3 * Superuser should be NDK buildable. No internal Android references.
4 * Superuser should also be AOSP buildable for those that want to embed it in their ROM.
5 * Superuser should also be AOSP _embeddable_, meaning a ROM can easily embed it into their Settings app.
6 * Maintenance and updates on both the market and source repositories should be timely.
7 * I want to be able to point users of my app to a Superuser solution that I wrote, that I know works, and that I can fix if something is wrong. Yes, this is selfish: Carbon does not work with some versions of Chainsdd's Superuser. SuperSU works great, but I am not comfortable pointing a user to a closed source su implementation.
8 * Handle multiuser (4.2+) properly
9 * Handle concurrent su requests properly
11 ## Checking out the source
13 You'll need the "Widgets" dependency.
15 * $ mkdir /path/to/src
17 * $ git clone git://github.com/koush/Superuser
18 * $ git clone git://github.com/koush/Widgets
20 These repositories do not keep the actual projects in the top level directory.
21 This is because they contain tests, libs, and samples.
25 In Eclipse, import Widgets/Widgets and Superuser/Superuser. It should Just Work (TM).
29 * $ mkdir /path/to/src
31 * $ cd Superuser/Superuser
33 In this directory, create a file called local.properties. This file is used by ant for custom properties. You need to specify the location of the ndk directory:
36 ndk.dir=/Users/koush/src/android-ndk
44 * bin/update.zip - Recovery installable zip
45 * bin/Superuser.apk - Superuser Android app
46 * libs/armeabi/su - ARM su binary
47 * libs/x86/su - x86 su binary
49 ## Building the su binary
51 You can use ant as shown above, to build the binary, but it can also be built without building the APK.
53 Make sure you have the android-ndk downloaded with the tool "ndk-build" in your path.
56 * $ cd Superuser/Superuser
59 The su binary will built into Superuser/Superuser/libs/armeabi/su.
63 ## Building with AOSP, CyanogenMod, etc
65 ROM developers are welcome to distribute the official Superuser APK and binary that I publish. That will
66 allow them to receive updates with Google Play. However, you can also build Superuser as part of your
67 build, if you choose to.
69 There are two ways to include Superuser in your build. The easiest is to build the APK as a separate app.
70 To do that, simply add the local_manifest.xml as described below. The second way is by embedding it
71 into the native Android System Settings.
74 Add the [local_manifest.xml](https://github.com/koush/Superuser/blob/master/local_manifest.xml) to your .repo/local_manifests
76 #### Configuring the Package Name
77 The Superuser distributed on Google Play is in the package name com.koushikdutta.superuser.
78 To prevent conflicts with the Play store version, the build process changes the package
79 name to com.thirdparty.superuser. You can configure this value by setting the following
80 in your vendor makefile or BoardConfig:
83 SUPERUSER_PACKAGE := com.mypackagename.superuser
86 #### Advanced - Embedding Superuser into System Settings
88 You will not need to change the package name as described above. Superuser will simply go
89 into the com.android.settings package.
91 First, in a product makefile (like vendor/cm/config/common.mk), specify the following:
94 SUPERUSER_EMBEDDED := true
97 To modify packages/apps/Settings, you will need this [patch](https://gist.github.com/koush/5069228).
98 The patch simply references the sources checked out to external/koush and makes changes
99 to XML preference files and the AndroidManifest.xml. It is a very minimal change.