Rooting: there are some fine guides like this. The first step, unlock bootloader, resets the phone to factory: backup data first. (To see developer options on the phone: settings / about / tap 7 times on the last line / build number). In developer options: activate oem-unlock to unlock the boot loader and later usb debug mode to allow adb shell access.

  • fastboot and adb shell (reference): windows installer (=minimal fastboot and adb; tested: flashing with fastboot needs cmd window with admin rights); linux: apt-get install fastboot; osx: google mfastboot-v2 download.
  • twrp for moto e 2nd 4g: reference; download (version 2015-03-08)
  • supersu 2.46 (2015-03-29) from chainfire.eu: download
  • search for moto e 2nd logo.bin to hide the unlocked bootloader warning (fastboot flash logo logo.bin)

USB OTG: moto e 2nd 4G (xt1524) does support usb on the go (check settings / storage with attached usb storage device)

Tools (from google playstore):

  • Android Terminal Emulator (even tapping works with mc, if enabled in settings, using terminal type xterm). On first start run
    su -c ” supolicy –live ‘allow untrusted_app untrusted_app_devpts chr_file setattr’ “
  • sshelper ssh daemon (comes with busybox)
  • Midnight Commander Installer (installation requires busybox in /system/xbin/)
    Use terminal emulator to copy busybox to system app directory /system/xbin/:
    su; mount -o remount,rw /system
    cd /data/data/com.arachnoid.sshelper/bin; cp -a * /system/xbin/
    Then edit shell script /system/xbin/mc (e.g. with mc editor)
    export TERM=xterm
    /system/xbin/mc.real $@
  • juicessh ssh client
    currently needs a policy modification
    su -c ” supolicy –live ‘allow untrusted_app untrusted_app_devpts chr_file setattr’ ”
    (or permissive selinux mode) to access /dev/pts. Run in terminal emulator:
    su; setenforce 0 (and reenable with setenforce 1; getenforce shows status)
    or  with ssh:
    su -c sh -i; setenforce 1
    then logout and login again
  • Root Explorer: file manager

Screencast:

  • YouMap: duplicates screen to rplay software on raspberry pi
  • with raspberry pi configured as wlan access point and connected to the internet by ethernet both screencast and internet access use the same wlan connection
  • transmission is very stable and efficient in terms of battery life. But the first connection might have to be tried multiple times: turn on server, connect to rplay device (stop server, disconnect device, repeat from beginning). – Much better than google chromecast app and stick (phone not in list of supported devices, 2015-03).

Compiler

  • C4droid with gcc and sdl plugin
  • recommended to use bluetooth keyboard
  • working directory is:
    /data/data/com.n0n3m4.droidc/files/
    and uses temp.c and temp as compiled binary
  • storage directory is
    /storage/emulated/legacy/
  • in depth tutorial for qt app
  • selinux support:
    copy libselinux.so from /system/lib/ to
    /data/data/com.n0n3m4.droidc/files/gcc/arm-linux-androideabi/lib/
  • download selinux header files from android.googlesource.com: platform/external/libselinux: include (e.g. android-5.1.0_r3)
  • create directory selinux inside
    /data/data/com.n0n3m4.droidc/files/gcc/arm-linux-androideabi/include
  • copy the header files into this directory
  • In C4droid settings / G++ arguments add after -lz: -lselinux; stored in
    /data/data/com.n0n3m4.droidc/shared_prefs/com.n0n3m4.droidc_preferences.xml
  • test selinux with (idea from serverfault.com)
    #include <stdio.h>
    #include <stdlib.h>
    #include <selinux/selinux.h>
    int main() {
    security_context_t con;
    if (getcon(&con) < 0) {
    perror(“Cannot getcon”);
    return 1;
    }
    printf(“%s\n”, con);
    freecon(con);
    return 0;
    }
  • this program should compile and run with output:
    u:r:untrusted_app:s0
  • if and only if enforcing mode of selinux is active
    su -cn u:r:system_app:s0 test
    allows to run the program test in a different security context (su is part of supersu)

Android build environment:

 

 

Leave a Reply