[Raspberry Pi General] trevd:
Hi Folks,

LINK: adb_fastboot_pi.7z - 1.14 MB

TROUBLE SHOOTING: If you receive the message "No such file or directory" when attempting to run either program you will need to symlink the dynamic linker in your root lib directory or install the hard-float toolchain. I'll probably recompile it to use the standard linker now that I've got "bare-metal" to use

sudo ln -s /lib/ld-linux.so.3 /lib/ld-linux-armhf.so.3

Here's the new version of adb ( v1.0.31 ) built for the RaspPi, I figure there's no reason the Pi should be a second class citizen when it comes to tools :laugh: and with that in mind I've also built fastboot as well.

My Pi has arrived however I compiled this on Raspbian using qemu, I've built it with FORCE_STATIC_EXECUTABLE := true [ EDIT: Which looking at it now did SweetFA :D ] and all the android related libraries are statically linked, It should be good to go on any linux pi distro but if you run into problems let me know,

Apart from commenting out the Target Building side of the android build system and only taking the AOSP directories I needed, I decided to keep things simple and leave the individual modules ( libzipfile , libz etc ) intact although building libcutils required a little coercion, probably because I was only building specific modules. It is a lot less of an Hack-Oddity compared to the 1.0.29 Build

This is my own extended version of adb (github sources here ) which contains command line pre-processing, it basically add shortcuts to many adb native and shell commands ( full list below ) and often removes the need for typing the shell keyword altogether. There's some single letter commands and if you symlink the adb executable to just an "a" then you can drop into an adb shell by typing "a s" , because yes, I am that lazy :D , I've also added lspart as a special treat for Mr Outler ;).

Apart from the couple of extras I've added it's just a normal adb which comes with the AOSP 4.2.1 code and can be used as such. apart from the remount command which must include the path, but adds the ability to remount more than just the system.

I've think google have fixed the race condition which allowed temp root through backups. They've also added a new dependency to libcrypto, There's probably some other changes but I haven't had a proper route around the code.

I really should master the art of cross compiling, Compiling on the PI took an absolute age, libcrypto especially.

Here's a copy-pasta of the adb shortcuts command_struct, for those that don't read c basically the first column is the shortcut keyword and the last column is the command it will execute. :good:

struct command_shortcut {
char * short_version;
int token_total;
int process_args;
int is_shell;
char * full_version[MAX_TOKENS];
} shortcuts[] = {
{ "ver",0,COMMAND_HAS_ARGS ,COMMAND_TYPE_ADB,{"version"}},
{ "remount",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"mount","-orw,remount"}},
{ "dev",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_ADB,{"devices"}},
{ "d",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_ADB,{"devices"}},
{ "kill",COMMAND_HAS_ARGS ,COMMAND_NO_ARGS ,COMMAND_TYPE_ADB,{"kill-server"}},
{ "sh",0,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{}},
{ "s",0,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{}},
{ "st",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"start"}},
{ "ks",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"stop"}},
{ "dmesg",COMMAND_HAS_ARGS ,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"dmesg"}},
{ "mount",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"mount"}},
{ "umount",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"umount"}},
{ "lspart",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"mount | grep"}},
{ "uname",2,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"cat","proc/version"}},
{ "gp",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"getprop"}},
{ "du",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"du"}},
{ "df",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"df"}},
{ "dfh",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"df","-h"}},
{ "sp",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"setprop"}},
{ "cat",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"cat"}},
{ "c",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"cat"}},
{ "echo",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"echo"}},
{ "ps",1 ,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"ps"}},
{ "mv",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"mv"}},
{ "cp",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"cp"}},
{ "rm",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"rm"}},
{ "rmf",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"rm","-f"}},
{ "symlink",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"ln","-s"}},
{ "netcfg",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"netcfg"}},

{ "touch",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"touch"}},
{ "lsusb",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"lsusb"}},
{ "mkdir",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"mkdir"}},
{ "grp",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"getprop | grep"}},
{ "wp",1,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"watchprops"}},
{ "chmod",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"chmod"}},
{ "insmod",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"insmod"}},
{ "gevt",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"getevent"}},
{ "sevt",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"sendevent"}},
{ "lsmod",1,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"lsmod"}},
{ "pl",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_ADB,{"pull"}},
{ "pu",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_ADB,{"push"}},
{ "wfd",1,COMMAND_NO_ARGS ,COMMAND_TYPE_ADB,{"wait-for-device"}},
// reboot commands, some device specific
{ "recovery",2,COMMAND_NO_ARGS ,COMMAND_TYPE_ADB,{"reboot","recovery"}},
{ "fastboot",2,COMMAND_NO_ARGS ,COMMAND_TYPE_ADB,{"reboot","bootloader"}},
{ "rec",2,COMMAND_NO_ARGS ,COMMAND_TYPE_ADB,{"reboot","recovery"}},
// archos specialness
{ "kdf",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"kd_flasher"}},
{ "updaterd",1,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"updaterd"}},
{ "sde",2,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"reboot_into","sde"}},
{ "into",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"reboot_into","-s"}},
{ "arec",2,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"reboot_into","recovery"}},
{ "android",2,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"reboot_into","android"}},
// samsung download mode
{ "download",2,COMMAND_NO_ARGS ,COMMAND_TYPE_ADB,{"reboot","download"}},
{ "ll",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"ls","-l"}},
{ "l",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"ls","-la"}},
{ "lha",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"ls","-lha"}},
{ "lca",9,COMMAND_NO_ARGS ,COMMAND_TYPE_ADB,{"logcat","-b","system","-b","radio","-b","events","-b","main" }},
{ "lc",1,COMMAND_HAS_ARGS ,COMMAND_TYPE_ADB,{"logcat"}},
{ "temp-root",1,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"echo 'ro.kernel.qemu=1'>/data/local.prop"}},
{ "un-root",1,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"echo '#'>/data/local.prop"}},
// Input
{ "key",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"input","keyevent"}},
{ "tw",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"input","text"}},
{ "tap",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"input","tap"}},
{ "swipe",2,COMMAND_HAS_ARGS ,COMMAND_TYPE_SHELL,{"input","swipe"}},
// Activity Manager Startups
{ "vending",6,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"am", "start","-a" ,"android.intent.action.MAIN","-n","com.android.vending/.AssetBrowserActivity"}},
{ "settings",6,COMMAND_NO_ARGS ,COMMAND_TYPE_SHELL,{"am", "start","-a" ,"android.intent.action.MAIN","-n","com.android.settings/.Settings"}}
} ;