There are some instructions for building and testing
su on Github. The build procedure is:
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
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.
Change value of the LOCAL_MODULE variable to su-binary (from su) in su-binary/Android.mk. Alternatively, you may remove entire
system/extras/su directory or edit system/extras/su/Android.mk
$ make su-binary
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.
The last bit about it appearing "somewhere in the out directory" isn't very specific, but the build should tell you where it ends up. On my machine the binary is located at