Permalink
Browse files

Added includes/adb-arm-static - A statically compiled adb binary for …

…ARM phones.

This is only for testing purposes right now. Enable it in run.sh by setting tryStaticADB=1
  • Loading branch information...
kosborn committed Oct 8, 2012
1 parent a9085f0 commit db4289f4a45bf3ea236742c3a56fff826e8318e3
Showing with 36 additions and 16 deletions.
  1. +16 −13 functions.sh
  2. BIN includes/adb-arm-static
  3. +20 −3 run.sh
View
@@ -29,10 +29,9 @@ RTMP=/data/local/tmp/
# Let's just make sure ADB and busybox (or whatever) are available...
-if adb version >/dev/null 2>/dev/null; then
+if $adb version >/dev/null 2>/dev/null; then
# good to go
if busybox >/dev/null 2>/dev/null; then
- #adb root&
true
elif [ $IGNOREBUSYBOX -eq 1 ]; then
true
@@ -43,30 +42,34 @@ if adb version >/dev/null 2>/dev/null; then
fi
else
echo "${red}adb is not in your \$PATH"
- echo "Add it, or alias in adb${none}"
- exit
+ if [ $tryStaticADB -eq 1 ]; then
+ echo "We will try static arm adb... Results may vary${none}"
+ else
+ echo "Add it to \$PATH, or enable \$tryStaticADB in run.sh ${none}"
+ exit
+ fi
fi
-adb kill-server
+$adb kill-server
#either su, which helps afterwords for being root
#or just starting the server with root permissions, which would be: sudo adb start-server
-su -c 'adb start-server'
+su -c "${adb} start-server"
# ADB wrapper to easy root pain...
command(){
echo "$*" > $TMP/p2p-tmp
- adb push $TMP/p2p-tmp $RTMP/p2p-tmp 2>/dev/null
+ $adb push $TMP/p2p-tmp $RTMP/p2p-tmp 2>/dev/null
if [ "$ISROOT" -eq "1" ]
then
- adb shell "su -c 'sh $RTMP/p2p-tmp'" | tr -d "\r"
+ $adb shell "su -c 'sh $RTMP/p2p-tmp'" | tr -d "\r"
else
- adb shell "sh $RTMP/p2p-tmp" | tr -d "\r"
+ $adb shell "sh $RTMP/p2p-tmp" | tr -d "\r"
fi
- adb shell "rm $RTMP/p2p-tmp" 2>/dev/null
+ $adb shell "rm $RTMP/p2p-tmp" 2>/dev/null
}
@@ -77,7 +80,7 @@ isConnected(){
# $LINECOUNT =
# 2 if none
# >2 if yes
- LINECOUNT=$(adb devices|wc -l)
+ LINECOUNT=$($adb devices|wc -l)
if [ $LINECOUNT -gt 2 ]
@@ -93,8 +96,8 @@ isConnected(){
# Check to see if we're root on the device
isRoot(){
- WHOAMI=$(adb shell 'id' | tr -d "\r" )
- TRYROOT=$(adb shell 'su -c "id"' | tr -d "\r" )
+ WHOAMI=$($adb shell 'id' | tr -d "\r" )
+ TRYROOT=$($adb shell 'su -c "id"' | tr -d "\r" )
if echo $WHOAMI | grep 'uid=0' 2>&1 >/dev/null
then
View
Binary file not shown.
View
23 run.sh
@@ -10,6 +10,23 @@
# If you don't need busybox (i.e. laptop), set this to 1
IGNOREBUSYBOX=0
+# If you want to try adb-arm-static, then set this to 1
+# NOTE: THIS IS FOR TESTING PURPOSES ONLY.
+# I CAN NOT GUARANTEE IT WILL WORK
+# DO NOT ENABLE THIS ON x86/64 COMPUTERS
+tryStaticADB=0
+
+if [ $tryStaticADB -eq 0 ]; then
+ # assume it's in $PATH...
+ adb=$(which adb)
+else
+ adbTMP=$PWD/includes/adb-arm-static
+ su -c "cp ${adbTMP} /data/local/tmp/adb-arm-static"
+ adb=/data/local/tmp/adb-arm-static
+ su -c "chmod 777 ${adb}"
+fi
+
+
. ./functions.sh
@@ -27,7 +44,7 @@ prompt(){
#done
# Found it! Hopefully this won't cause issues
- adb wait-for-device
+ $adb wait-for-device
@@ -42,8 +59,8 @@ prompt(){
# Let's just push busybox, because screw making stock roms compatible
# (This will bite me in the ass when we get any non-ARM6/7 arch. proc.)
ourBBPath=/data/local/tmp/busybox
- adb push includes/busybox-static $ourBBPath
- adb shell "chmod 777 /data/local/tmp/busybox"
+ $adb push includes/busybox-static $ourBBPath
+ $adb shell "chmod 777 /data/local/tmp/busybox"
echo "Trying to push busybox..."
ISROOT=$(isRoot noinfo)

0 comments on commit db4289f

Please sign in to comment.