OSDN Git Service

Add MIPS support
authorKevin Cernekee <cernekee@gmail.com>
Thu, 7 Nov 2013 02:03:27 +0000 (18:03 -0800)
committerKevin Cernekee <cernekee@gmail.com>
Thu, 7 Nov 2013 04:39:53 +0000 (20:39 -0800)
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.

README.md
Superuser/assets/update-binary
Superuser/build.xml
Superuser/jni/Application.mk
Superuser/src/com/koushikdutta/superuser/MainActivity.java

index b43f38b..504b1ae 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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
 
index 1c960cb..e17fa7d 100644 (file)
@@ -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
index 2f7ec33..d85611b 100644 (file)
@@ -99,6 +99,7 @@
           <arg value="../bin/update.zip"/>
           <arg value="armeabi"/>
           <arg value="x86"/>
+          <arg value="mips"/>
         </exec>
     </target>
 
index c1f99eb..eefa617 100644 (file)
@@ -1,3 +1,3 @@
-APP_ABI := x86 armeabi
+APP_ABI := x86 armeabi mips
 NDK_TOOLCHAIN_VERSION=4.7
 APP_PIE = false
\ No newline at end of file
index ca50336..dc14acd 100644 (file)
@@ -72,6 +72,8 @@ public class MainActivity extends BetterListActivity {
         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";
         }