Skip to content

Commit

Permalink
Add MIPS support
Browse files Browse the repository at this point in the history
Tested on:
 - Ainol Novo 7 Paladin (JZ4770 MIPS SoC) with ICS 4.0.3 and CWM
 - Nexus 5 (ARM) with KK 4.4 and TWRP

Not tested on x86.

I checked to make sure "uname -m" is standard in busybox (not a feature
flag).  "uname" doesn't seem to exist at all in AOSP, so without busybox,
the original script probably wouldn't have detected the architecture
correctly.
  • Loading branch information
cernekee committed Nov 7, 2013
1 parent 6b54004 commit 14102fc
Showing 5 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@ Outputs:
* bin/Superuser-release.apk - Superuser Android app
* libs/armeabi/su - ARM su binary
* libs/x86/su - x86 su binary
* libs/mips/su - MIPS su binary

## Building the su binary

11 changes: 6 additions & 5 deletions Superuser/assets/update-binary
Original file line number Diff line number Diff line change
@@ -7,12 +7,13 @@ echo -n -e 'ui_print Installing Superuser...\n' > /proc/self/fd/$2
echo -n -e 'ui_print\n' > /proc/self/fd/$2

# detect binary versions to install
X86=$(uname -a | grep x86)
I686=$(uname -a | grep i686)
I386=$(uname -a | grep i386)
if [ ! -z "$X86" -o ! -z "$I686" -o ! -z "$I386" ]
then
ARCH=$(uname -m)

# x86 needs to match: i486, i686, x86_64, ...
if echo "$ARCH" | grep -q 86; then
PLATFORM=x86
elif [ "$ARCH" = "mips" -o "$ARCH" = "mips64" ]; then
PLATFORM=mips
else
PLATFORM=armeabi
fi
1 change: 1 addition & 0 deletions Superuser/build.xml
Original file line number Diff line number Diff line change
@@ -99,6 +99,7 @@
<arg value="../bin/update.zip"/>
<arg value="armeabi"/>
<arg value="x86"/>
<arg value="mips"/>
</exec>
</target>

2 changes: 1 addition & 1 deletion Superuser/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
APP_ABI := x86 armeabi
APP_ABI := x86 armeabi mips
NDK_TOOLCHAIN_VERSION=4.7
APP_PIE = false
2 changes: 2 additions & 0 deletions Superuser/src/com/koushikdutta/superuser/MainActivity.java
Original file line number Diff line number Diff line change
@@ -72,6 +72,8 @@ private String getArch() {
String prop = System.getProperty("os.arch");
if (prop.contains("x86") || prop.contains("i686") || prop.contains("i386")) {
return "x86";
} else if (prop.contains("mips")) {
return "mips";
} else {
return "armeabi";
}

0 comments on commit 14102fc

Please sign in to comment.