[APP][INFO|SUPPORT] SSHelper (The free Android SSH Server Application) - Android Software Development

SSHelper (The free Android SSH Server Application)
Date: 2014-06-02
Difficulty: Easy
This is the XDA SSHelper support thread for the only completely open
source, transparent, free and ad-less SSH daemon/server Application for
Android. Sure there are plenty other Android SSH server apps out there, but
you can try to find one that is both free, without any ads, where all
the sources are clearly available and documented, where their developer
can be reached and contacted, and that has its own website.
To make things even better, I decided to start this thread in honor of,
and with permission by the main developer and scientist, Paul Lutus.
He's been developing software for NASA since the 80's and wrote one of
the first word processors for Apple-I. You can read all about it on his
website.
Another important reason for this thread is that SSHelper was developed
under CyanogenMod which is an AOSP ROM. This may cause many unexpected
side effects since those devices behave very differently from stock
(out-of-the-box) firmwares. While AOSP ROM often adds many new features,
they also remove many other OEM features that are mostly unknown or not
understood by the ROM builders/developers. So basing your app
development on a custom ROM is really begging for support trouble. This
will become even more apparent with the recent moves by Godzilla to make
AOS SELinux Enforced by default.
If you just need an SSH server right away, you can download the APK
directly from his website HERE or indirectly from Google Play.
The minimum required AOS is Honeycomb 3.2 / API 13, and the
current version is: 6.3 (04.28.2014).
SSHelper Features
SSHelper is much more than just an SSH server, it also offers:
full Rsync support
full sshd_config file support
full shell profile support
HTTP server
SCP server
SFTP server
Detailed Debug info (via App and web server)
Detailed Logcat view
Terminal Shell with OTG keyboard
and a full Busybox implementation
The Support
However, as you can imagine, the more supported features, the more
potential for problems. As the developer is a wild-life adventurer he's
not constantly sitting in front of his computer waiting to solve other
peoples problems, but often extremely isolated in the Alaskan wilderness
or in a small boat in the middle of the pacific.
That's why we need this thread. Other users may be able to help you if
they have had similar or previous problems. And if those problems aren't
solvable here, hopefully Paul will be able to have an occasional look,
insight and update.
However, since this application is based on OpenSSL / OpenSSH and so on,
the best place to find solutions and ask general SSH related questions
is on any of the 5 StackExchange related Q&A sites:
http://stackoverflow.com/
http://android.stackexchange.com/
http://unix.stackexchange.com/
http://serverfault.com/
http://superuser.com/
You should also have a good read at the SSHelper main support site.
So before posting here, search there first!
Required Android Permissions
( in: ../SSHelper/AndroidManifest.xml )
Code:
[SIZE=2]android.permission.ACCESS_NETWORK_STATE[/SIZE]
[SIZE=2]android.permission.ACCESS_SUPERUSER[/SIZE]
[SIZE=2]android.permission.ACCESS_WIFI_STATE[/SIZE]
[SIZE=2]android.permission.BLUETOOTH[/SIZE]
[SIZE=2]android.permission.CHANGE_WIFI_MULTICAST_STATE[/SIZE]
[SIZE=2]android.permission.CHANGE_WIFI_STATE[/SIZE]
[SIZE=2]android.permission.INTERNET[/SIZE]
[SIZE=2]android.permission.RECEIVE_BOOT_COMPLETED[/SIZE]
[SIZE=2]android.permission.WRITE_EXTERNAL_STORAGE[/SIZE]
These will probably need to be updated in order to solve some issues
when used on devices running SEAndoid in Enforced mode.
Application File Locations
All the SSHelper related files are located in and below the base directory at:
/data/data/com.arachnoid.sshelper
Code:
[SIZE=2]bin Here are all the binary assets, such as busybox and sshd etc.[/SIZE]
[SIZE=2]cache [/SIZE]
[SIZE=2]databases [/SIZE]
[SIZE=2]dev [/SIZE]
[SIZE=2]etc [/SIZE]
[SIZE=2]files [/SIZE]
[SIZE=2]home Your home directory when using SSH[/SIZE]
[SIZE=2]lib Symlinked to: /data/app-lib/com.arachnoid.sshelper-1[/SIZE]
[SIZE=2]tmp [/SIZE]
[SIZE=2]var [/SIZE]
The APK Assets
Code:
[SIZE=2]busybox_gz[/SIZE]
[SIZE=2]rsync_gz[/SIZE]
[SIZE=2]scp_gz[/SIZE]
[SIZE=2]sftp_gz[/SIZE]
[SIZE=2]ssh_gz[/SIZE]
[SIZE=2]ssh_keygen_gz[/SIZE]
[SIZE=2]ssh_keyscan_gz[/SIZE]
[SIZE=2]sshd_gz[/SIZE]
[SIZE=2]favicon.ico[/SIZE]
[SIZE=2]profile[/SIZE]
[SIZE=2]server_page.html[/SIZE]
[SIZE=2]sshd_config[/SIZE]
Installed Binaries
From Busybox we have:
Code:
[SIZE=2]BusyBox v1.21.0 (2014-04-01 22:29:02 PDT) multi-call binary.[/SIZE]
[SIZE=2]BusyBox is copyrighted by many authors between 1998-2012.[/SIZE]
[SIZE=2]Licensed under GPLv2. See source distribution for detailed[/SIZE]
[SIZE=2]copyright notices.[/SIZE]
[SIZE=2]Usage: busybox [function [arguments]...][/SIZE]
[SIZE=2] or: busybox --list[-full][/SIZE]
[SIZE=2] or: busybox --install [-s] [DIR][/SIZE]
[SIZE=2] or: function [arguments]...[/SIZE]
[SIZE=2] BusyBox is a multi-call binary that combines many common Unix[/SIZE]
[SIZE=2] utilities into a single executable. Most people will create a[/SIZE]
[SIZE=2] link to busybox for each function they wish to use and BusyBox[/SIZE]
[SIZE=2] will act like whatever it was invoked as.[/SIZE]
[SIZE=2]Currently defined functions:[/SIZE]
[SIZE=2] [, [[, ar, arp, ash, awk, base64, basename, bbconfig, beep, blkid,[/SIZE]
[SIZE=2] blockdev, bootchartd, bunzip2, bzcat, bzip2, cal, cat, catv, chat,[/SIZE]
[SIZE=2] chattr, chgrp, chmod, chown, chpst, chroot, chrt, chvt, cksum, clear,[/SIZE]
[SIZE=2] cmp, comm, cp, cpio, crond, crontab, cttyhack, cut, dc, dd, deallocvt,[/SIZE]
[SIZE=2] depmod, devmem, diff, dirname, dmesg, dnsd, dnsdomainname, dos2unix,[/SIZE]
[SIZE=2] dpkg, dpkg-deb, du, dumpkmap, echo, ed, egrep, env, envdir, envuidgid,[/SIZE]
[SIZE=2] expand, expr, fakeidentd, false, fbset, fbsplash, fdflush, fdformat,[/SIZE]
[SIZE=2] fdisk, fgconsole, fgrep, find, findfs, flash_lock, flash_unlock,[/SIZE]
[SIZE=2] flashcp, flock, fold, free, freeramdisk, fsync, ftpd, ftpget, ftpput,[/SIZE]
[SIZE=2] fuser, getopt, grep, gunzip, gzip, halt, hd, hdparm, head, hexdump,[/SIZE]
[SIZE=2] hostname, httpd, hwclock, ifconfig, ifdown, ifup, init, inotifyd,[/SIZE]
[SIZE=2] insmod, install, iostat, ip, ipaddr, ipcalc, iplink, iproute, iprule,[/SIZE]
[SIZE=2] iptunnel, klogd, less, linuxrc, ln, loadkmap, losetup, lpd, lpq, lpr,[/SIZE]
[SIZE=2] ls, lsattr, lsmod, lsof, lspci, lsusb, lzcat, lzma, lzop, lzopcat,[/SIZE]
[SIZE=2] makedevs, makemime, man, md5sum, mdev, mesg, mkdir, mkfifo, mknod,[/SIZE]
[SIZE=2] mkswap, mktemp, modinfo, modprobe, more, mpstat, mv, nbd-client, nc,[/SIZE]
[SIZE=2] netstat, nice, nmeter, nohup, od, openvt, patch, pidof, ping,[/SIZE]
[SIZE=2] pipe_progress, pmap, popmaildir, poweroff, powertop, printenv, printf,[/SIZE]
[SIZE=2] ps, pscan, pstree, pwd, pwdx, raidautorun, rdev, readlink, readprofile,[/SIZE]
[SIZE=2] realpath, reboot, reformime, renice, reset, resize, rev, rm, rmdir,[/SIZE]
[SIZE=2] rmmod, route, rpm, rpm2cpio, rtcwake, run-parts, runsv, runsvdir, rx,[/SIZE]
[SIZE=2] script, scriptreplay, sed, sendmail, seq, setconsole, setkeycodes,[/SIZE]
[SIZE=2] setlogcons, setserial, setsid, setuidgid, sha1sum, sha256sum, sha3sum,[/SIZE]
[SIZE=2] sha512sum, showkey, sleep, smemcap, softlimit, sort, split,[/SIZE]
[SIZE=2] start-stop-daemon, strings, stty, sum, sv, svlogd, switch_root, sync,[/SIZE]
[SIZE=2] sysctl, tac, tail, tar, tcpsvd, tee, telnet, telnetd, test, tftp,[/SIZE]
[SIZE=2] tftpd, time, timeout, top, touch, tr, traceroute, true, ttysize,[/SIZE]
[SIZE=2] tunctl, tune2fs, udpsvd, uname, uncompress, unexpand, uniq, unix2dos,[/SIZE]
[SIZE=2] unlzma, unlzop, unxz, unzip, uptime, usleep, uudecode, uuencode,[/SIZE]
[SIZE=2] vconfig, vi, volname, watch, wc, wget, which, whoami, whois, xargs, xz,[/SIZE]
[SIZE=2] xzcat, yes, zcat[/SIZE]
In addition to that, in the $SSHELPER/bin we find:
Code:
[SIZE=2]rsync[/SIZE]
[SIZE=2]scp[/SIZE]
[SIZE=2]sftp[/SIZE]
[SIZE=2]ssh[/SIZE]
[SIZE=2]ssh-keygen[/SIZE]
[SIZE=2]ssh-keyscan[/SIZE]
[SIZE=2]sshelper_sshd[/SIZE]
References and Resources:
<WIP>
​

Some Application Options
When you start the application you will see a list of different
configuration settings. The detailed description of each one is found
HERE. The most important being:
Code:
SSH Server Port Number (Default: [B]2222[/B])
Server Password (Default: [B]admin[/B])
Some Environment Variables
When you use SSHelper to login via SSH, you end up in the temporary
mksh shell at the home location set by the environment variable $ENV
which is set to be:
/data/data/com.arachnoid.sshelper/home
This behavior is contrary to what is normally used on Linux machines
where you end up in the $HOME directory. A few other important shell
variables are:
Code:
[SIZE=2]ENV=/data/data/com.arachnoid.sshelper/home[/SIZE]
[SIZE=2] HOME=/[/SIZE]
[SIZE=2] LD_LIBRARY_PATH=/vendor/lib:/system/lib[/SIZE]
[SIZE=2] LOGNAME=u0_a202[/SIZE]
[SIZE=2] LOOP_MOUNTPOINT=/mnt/obb[/SIZE]
[SIZE=2] PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/data/data/com.arachnoid.sshelper/bin[/SIZE]
[SIZE=2] SHELL=/tmp-mksh/tmp-mksh[/SIZE]
[SIZE=2] SSHELPER=/data/data/com.arachnoid.sshelper[/SIZE]
[SIZE=2] USER=u0_a202[/SIZE]
And to get the whole set, use the command "set":
Code:
[SIZE=2]ANDROID_ASSETS=/system/app[/SIZE]
[SIZE=2] ANDROID_BOOTLOGO=1[/SIZE]
[SIZE=2] ANDROID_DATA=/data[/SIZE]
[SIZE=2] ANDROID_PROPERTY_WORKSPACE=8,66560[/SIZE]
[SIZE=2] ANDROID_ROOT=/system[/SIZE]
[SIZE=2] ANDROID_SOCKET_zygote=10[/SIZE]
[SIZE=2] ANDROID_STORAGE=/storage[/SIZE]
[SIZE=2] ASEC_MOUNTPOINT=/mnt/asec[/SIZE]
[SIZE=2] BOARD=MSM8960[/SIZE]
[SIZE=2] BOOTCLASSPATH=/system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework2.jar:/system/framework/telephony-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/sec_edm.jar:/system/framework/seccamera.jar:/system/framework/scrollpause.jar:/system/framework/stayrotation.jar:/system/framework/smartfaceservice.jar:/system/framework/secocsp.jar:/system/framework/abt-persistence.jar:/system/framework/sc.jar[/SIZE]
[SIZE=2] COLUMNS=80[/SIZE]
[SIZE=2] EMULATED_STORAGE_SOURCE=/mnt/shell/emulated[/SIZE]
[SIZE=2] EMULATED_STORAGE_TARGET=/storage/emulated[/SIZE]
[SIZE=2] ENV=/data/data/com.arachnoid.sshelper/home[/SIZE]
[SIZE=2] EXTERNAL_STORAGE=/storage/emulated/legacy[/SIZE]
[SIZE=2] HOME=/[/SIZE]
[SIZE=2] IFS='[/SIZE]
[SIZE=2] '[/SIZE]
[SIZE=2] KSHEGID=0[/SIZE]
[SIZE=2] KSHGID=0[/SIZE]
[SIZE=2] KSHUID=0[/SIZE]
[SIZE=2] KSH_VERSION='@(#)MIRBSD KSH R40 2011/10/07'[/SIZE]
[SIZE=2] LD_LIBRARY_PATH=/vendor/lib:/system/lib[/SIZE]
[SIZE=2] LINES=24[/SIZE]
[SIZE=2] LOGNAME=u0_a202[/SIZE]
[SIZE=2] LOOP_MOUNTPOINT=/mnt/obb[/SIZE]
[SIZE=2] MAIL=/var/mail/u0_a202[/SIZE]
[SIZE=2] OPTIND=1[/SIZE]
[SIZE=2] PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/data/data/com.arachnoid.sshelper/bin[/SIZE]
[SIZE=2] PGRP=333[/SIZE]
[SIZE=2] PIPESTATUS[0]=0[/SIZE]
[SIZE=2] PIPESTATUS[1]=0[/SIZE]
[SIZE=2] PPID=21382[/SIZE]
[SIZE=2] PS1='[email protected]$BOARD:$(basename $PWD) $( (($USER_ID)) && echo \$ || echo \#) '[/SIZE]
[SIZE=2] PS2='> '[/SIZE]
[SIZE=2] PS3='#? '[/SIZE]
[SIZE=2] PS4='+ '[/SIZE]
[SIZE=2] PWD=/data/data/com.arachnoid.sshelper/home[/SIZE]
[SIZE=2] RANDOM=20853[/SIZE]
[SIZE=2] SECONDARY_STORAGE=/storage/extSdCard:/storage/UsbDriveA:/storage/UsbDriveB:/storage/UsbDriveC:/storage/UsbDriveD:/storage/UsbDriveE:/storage/UsbDriveF[/SIZE]
[SIZE=2] SECONDS=20[/SIZE]
[SIZE=2] SHELL=/tmp-mksh/tmp-mksh[/SIZE]
[SIZE=2] SSHELPER=/data/data/com.arachnoid.sshelper[/SIZE]
[SIZE=2] SSH_CLIENT='192.168.xx.xx 14115 2222'[/SIZE]
[SIZE=2] SSH_CONNECTION='192.168.xx.xx 14115 192.168.yy.yy 2222'[/SIZE]
[SIZE=2] TMOUT=0[/SIZE]
[SIZE=2] TZ=GMT-3[/SIZE]
[SIZE=2] USER=u0_a202[/SIZE]
[SIZE=2] USER_ID=0[/SIZE]
[SIZE=2] VIBE_PIPE_PATH=/dev/pipes[/SIZE]
[SIZE=2] _=set[/SIZE]
(These may vary somewhat, depending on your device.)
The default profile and sshd_config
profile:
Code:
[SIZE=2]# place user customizations here[/SIZE]
[SIZE=2] uname -s -r -m[/SIZE]
[SIZE=2] alias ls="$SSHELPER/bin/ls"[/SIZE]
[SIZE=2] export PS1='[email protected]$BOARD:$(basename $PWD) $( (($USER_ID)) && echo \$ || echo \#) '[/SIZE]
If you are rooted and already have Busybox installed, it is highly
recommended to edit this file.
sshd_config:
Code:
[SIZE=2]# $OpenBSD: sshd_config,v 1.87 2012/07/10 02:19:15 djm Exp $[/SIZE]
[SIZE=2] # This is the sshd server system-wide configuration file. See[/SIZE]
[SIZE=2] # sshd_config(5) for more information.[/SIZE]
[SIZE=2] # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin[/SIZE]
[SIZE=2] # The strategy used for options in the default sshd_config shipped with[/SIZE]
[SIZE=2] # OpenSSH is to specify options with their default value where[/SIZE]
[SIZE=2] # possible, but leave them commented. Uncommented options override the[/SIZE]
[SIZE=2] # default value.[/SIZE]
[SIZE=2] #Port 22[/SIZE]
[SIZE=2] #AddressFamily any[/SIZE]
[SIZE=2] #ListenAddress 0.0.0.0[/SIZE]
[SIZE=2] #ListenAddress ::[/SIZE]
[SIZE=2] # The default requires explicit activation of protocol 1[/SIZE]
[SIZE=2] #Protocol 2[/SIZE]
[SIZE=2] # HostKey for protocol version 1[/SIZE]
[SIZE=2] #HostKey /etc/ssh/ssh_host_key[/SIZE]
[SIZE=2] # HostKeys for protocol version 2[/SIZE]
[SIZE=2] HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_rsa[/SIZE]
[SIZE=2] HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_dsa[/SIZE]
[SIZE=2] HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_ecdsa[/SIZE]
[SIZE=2] # Lifetime and size of ephemeral version 1 server key[/SIZE]
[SIZE=2] #KeyRegenerationInterval 1h[/SIZE]
[SIZE=2] #ServerKeyBits 1024[/SIZE]
[SIZE=2] # Logging[/SIZE]
[SIZE=2] # obsoletes QuietMode and FascistLogging[/SIZE]
[SIZE=2] #SyslogFacility AUTH[/SIZE]
[SIZE=2] #LogLevel INFO[/SIZE]
[SIZE=2] # Authentication:[/SIZE]
[SIZE=2] #LoginGraceTime 2m[/SIZE]
[SIZE=2] #PermitRootLogin yes[/SIZE]
[SIZE=2] #StrictModes yes[/SIZE]
[SIZE=2] #MaxAuthTries 6[/SIZE]
[SIZE=2] #MaxSessions 10[/SIZE]
[SIZE=2] #RSAAuthentication yes[/SIZE]
[SIZE=2] #PubkeyAuthentication yes[/SIZE]
[SIZE=2] # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2[/SIZE]
[SIZE=2] # but this is overridden so installations will only check .ssh/authorized_keys[/SIZE]
[SIZE=2] # AuthorizedKeysFile (path)[/SIZE]
[SIZE=2] #AuthorizedPrincipalsFile none[/SIZE]
[SIZE=2] # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts[/SIZE]
[SIZE=2] #RhostsRSAAuthentication no[/SIZE]
[SIZE=2] # similar for protocol version 2[/SIZE]
[SIZE=2] # HostbasedAuthentication no[/SIZE]
[SIZE=2] # Change to yes if you don't trust ~/.ssh/known_hosts for[/SIZE]
[SIZE=2] # RhostsRSAAuthentication and HostbasedAuthentication[/SIZE]
[SIZE=2] # IgnoreUserKnownHosts no[/SIZE]
[SIZE=2] # Don't read the user's ~/.rhosts and ~/.shosts files[/SIZE]
[SIZE=2] #IgnoreRhosts yes[/SIZE]
[SIZE=2] # To disable tunneled clear text passwords, change to no here![/SIZE]
[SIZE=2] # PasswordAuthentication no[/SIZE]
[SIZE=2] # PermitEmptyPasswords yes[/SIZE]
[SIZE=2] # Change to no to disable s/key passwords[/SIZE]
[SIZE=2] #ChallengeResponseAuthentication yes[/SIZE]
[SIZE=2] # Kerberos options[/SIZE]
[SIZE=2] #KerberosAuthentication no[/SIZE]
[SIZE=2] #KerberosOrLocalPasswd yes[/SIZE]
[SIZE=2] #KerberosTicketCleanup yes[/SIZE]
[SIZE=2] #KerberosGetAFSToken no[/SIZE]
[SIZE=2] # GSSAPI options[/SIZE]
[SIZE=2] #GSSAPIAuthentication no[/SIZE]
[SIZE=2] #GSSAPICleanupCredentials yes[/SIZE]
[SIZE=2] # Set this to 'yes' to enable support for the deprecated 'gssapi' authentication[/SIZE]
[SIZE=2] # mechanism to OpenSSH 3.8p1. The newer 'gssapi-with-mic' mechanism is included[/SIZE]
[SIZE=2] # in this release. The use of 'gssapi' is deprecated due to the presence of[/SIZE]
[SIZE=2] # potential man-in-the-middle attacks, which 'gssapi-with-mic' is not susceptible to.[/SIZE]
[SIZE=2] #GSSAPIEnableMITMAttack no[/SIZE]
[SIZE=2] # Set this to 'yes' to enable PAM authentication, account processing,[/SIZE]
[SIZE=2] # and session processing. If this is enabled, PAM authentication will[/SIZE]
[SIZE=2] # be allowed through the ChallengeResponseAuthentication and[/SIZE]
[SIZE=2] # PasswordAuthentication. Depending on your PAM configuration,[/SIZE]
[SIZE=2] # PAM authentication via ChallengeResponseAuthentication may bypass[/SIZE]
[SIZE=2] # the setting of "PermitRootLogin without-password".[/SIZE]
[SIZE=2] # If you just want the PAM account and session checks to run without[/SIZE]
[SIZE=2] # PAM authentication, then enable this but set PasswordAuthentication[/SIZE]
[SIZE=2] # and ChallengeResponseAuthentication to 'no'.[/SIZE]
[SIZE=2] # UsePAM no[/SIZE]
[SIZE=2] # AllowAgentForwarding yes # default[/SIZE]
[SIZE=2] # AllowTcpForwarding yes # default[/SIZE]
[SIZE=2] #GatewayPorts no[/SIZE]
[SIZE=2] #X11Forwarding yes[/SIZE]
[SIZE=2] #X11DisplayOffset 10[/SIZE]
[SIZE=2] #X11UseLocalhost yes[/SIZE]
[SIZE=2] #PrintMotd yes[/SIZE]
[SIZE=2] PrintLastLog no[/SIZE]
[SIZE=2] #TCPKeepAlive yes[/SIZE]
[SIZE=2] #UseLogin no[/SIZE]
[SIZE=2] UsePrivilegeSeparation no[/SIZE]
[SIZE=2] PermitUserEnvironment yes # allow ~/.ssh/environment to contain useful path and envs for logins[/SIZE]
[SIZE=2] Compression yes[/SIZE]
[SIZE=2] ClientAliveInterval 300 # 300 seconds of idle time[/SIZE]
[SIZE=2] ClientAliveCountMax 5 # after five queries, disconnect[/SIZE]
[SIZE=2] UseDNS no[/SIZE]
[SIZE=2] # PidFile[/SIZE]
[SIZE=2] #MaxStartups 10[/SIZE]
[SIZE=2] #PermitTunnel no[/SIZE]
[SIZE=2] #ChrootDirectory[/SIZE]
[SIZE=2] #VersionAddendum none[/SIZE]
[SIZE=2] # no default banner path[/SIZE]
[SIZE=2] #Banner none[/SIZE]
[SIZE=2] # override default of no subsystems[/SIZE]
[SIZE=2] Subsystem sftp internal-sftp[/SIZE]
[SIZE=2] # This enables accepting locale enviroment variables LC_* LANG, see sshd_config(5).[/SIZE]
[SIZE=2] AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES[/SIZE]
[SIZE=2] AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT[/SIZE]
[SIZE=2] AcceptEnv LC_IDENTIFICATION LC_ALL[/SIZE]
[SIZE=2] # Example of overriding settings on a per-user basis[/SIZE]
[SIZE=2] #Match User anoncvs[/SIZE]
[SIZE=2] # X11Forwarding no[/SIZE]
[SIZE=2] # AllowTcpForwarding no[/SIZE]
[SIZE=2] # ForceCommand cvs server[/SIZE]
[SIZE=2] #Match LocalAddress 127.0.0.1[/SIZE]
[SIZE=2] # X11Forwarding yes[/SIZE]
[SIZE=2] # AllowTcpForwarding yes[/SIZE]
[SIZE=2] # AllowUsers sshelper[/SIZE]

Some SELinux / SEAndroid related issues
< WIP: may contain inaccuracies! >
So you're rooted and you hope to use SSH to get a root shell,
like in the good old days (yesterday), and now you've got trouble!
Thanks to Godzilla and Samsung, we now have to deal with something called
SEAndroid which stands for "Security Enchanced Linux (SEL) for Android".
This would not have been so bad, if it wasn't because these companies now
want to enable the very strict Enforcing mode, by default.
That means that nothing you're once used to, when you have root access,
works and behaves as expected. In fact SEL restricts root user, just like
any other, so you have to spend some weeks trying to understand how that
is dealt with and managed from a Super-User's perspective.
So trying to get a root shell from an SSH session, is now likely to fail
because:
You have a Samsung KNOX enabled device. Samsung KNOX is deeply intertwined with SEL.
==> Remove all KNOX garbage.
Your SEL policy is not allowing SSHelper to allocate a pseudo-terminal (/dev/ptmx ) beacuse the /dev/pts directory is mounted as RO as type /devpts.
==> remount /dev/pts to enable RW: mount -o remount,rw -t devpts /dev/pts
Your SEL policy is still not allowing you to su from outside SE context "init_shell".
==> Temporarily set SEL to Permissive mode with: su 0 setenforce 0
Your SEL policy is not allowing you to ... period.
==> Unless you have a locked bootloader, disable SEL by flashing an insecure kernel/ROM that either doesn't have SEL, or at least not in Enforcing mode.
su is not working because:
a) your AOS version is not handling SEL policies right.
b) your su version is not handling SEL contexts right.
You got fooled into buying a locked Verizon or ATT phone with locked boot loader, and no way of rooting, and no one can help you. You cannot do any development with such a phone.
==> Return phone and cancel your contract.
< TBA >
The mksh Shell
< WIP >
The MirBSD™ Korn Shell, is better known as mksh and is now the default
shell on Androids since JB 4.1, instead of ash. I don't know why this
change was made, but I suspect it has something to do with having much
better documentation, better linux community support and therefore more
features and better compatibility.
The current available mksh version is:
R49 (11 Jan 2014)
NOTE: This is the sources version and is not necessarily available as
an Android binary, unless you compile your own. (Please share it here!)
You can check your own Android mksh version with:
Code:
[SIZE=2][email protected]:home $ echo $KSH_VERSION[/SIZE]
[SIZE=2] @(#)MIRBSD KSH [B][COLOR=Red]R40[/COLOR] 2011/10/07[/B][/SIZE]
[SIZE=2] [/SIZE]
The complete online man pages for mksh is found HERE.
The mksh ChangeLog is HERE.
The latest mksh sources are available HERE.
The latest statically linked ARM Android binary can be downloaded HERE.​

< Here be more Dragons 3 >

The (app) Terminal
SSHelper contain it's own terminal that can be better used with an external keyboard. However, the code that runs this terminal, is hard-coded in the Java file: ShellTerminal.java as this:
Code:
[SIZE=2]String[] com = new String[] { app.binDir + "/ssh", "-q", "-t", "-t", "-o UserKnownHostsFile /dev/null", "-o StrictHostKeyChecking no", host, "-p", port };[/SIZE]
With the effect that the local loopback IP is set to 127.0.0.1 and port as chosen in the UI.
Code:
[SIZE=2]ssh -q -t -t -o UserKnownHostsFile /dev/null -o StrictHostKeyChecking no 127.0.0.1 -p <port>[/SIZE]
Unfortunately this command will fail if there is no controlling tty allocated, or if <port> is used by, or IP 127.0.0.1 is blocked by other applications, such as firewall or SEAndroid/KNOX permissions and settings.
The sshelper_sshd binary
The binary as compiled have the following options enabled:
Code:
[SIZE=2]OpenSSH_6.6p1, OpenSSL 1.0.1g 7 Apr 2014
usage: sshd [-46DdeiqTt] [-b bits] [-C connection_spec] [-c host_cert_file]
[-E log_file] [-f config_file] [-g login_grace_time]
[-h host_key_file] [-k key_gen_time] [-o option] [-p port]
[-u len]
[/SIZE]
However, the built-in app command line is:
Code:
[SIZE=2]sshelper_sshd -D -p <port> -h <key_file> -o PidFile <pid_file> -f <sshd_config_file> <debug_level> -e [UI_options] -o StrictModes <yes/no> -o Banner <banner_text_file>
[/SIZE]
where:
Code:
[SIZE=2]<debug_level> = -d, -dd, -ddd, -dddd
<banner_text_file> = banner1.txt (with password) or banner2.txt (no password)
if (prefix.disablePasswords) { app.addToList(coms, "-o PasswordAuthentication no"); }
if (prefix.allowForwarding) { app.addToList(coms, "-o PermitTunnel yes"); }
[/SIZE]
This way, if you need more special features, you can run the server from a local shell command line.
The full details which you can find HERE, but the most important shown below.
From the sshd manual pages:
Code:
[SIZE=2] -D When this option is specified, sshd will not detach and does not
become a daemon. This allows easy monitoring of sshd.
-d Debug mode. The server sends verbose debug output to standard
error, and does not put itself in the background. The server
also will not fork and will only process one connection. This
option is only intended for debugging for the server. Multiple
-d options increase the debugging level. Maximum is 3.
-e Write debug logs to standard error instead of the system log.
-f config_file
Specifies the name of the configuration file. The default is
/etc/ssh/sshd_config. sshd refuses to start if there is no
configuration file.
-h host_key_file
Specifies a file from which a host key is read. This option must
be given if sshd is not run as root (as the normal host key files
are normally not readable by anyone but root). The default is
/etc/ssh/ssh_host_key for protocol version 1, and
/etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_ecdsa_key.
/etc/ssh/ssh_host_ed25519_key and /etc/ssh/ssh_host_rsa_key for
protocol version 2. It is possible to have multiple host key
files for the different protocol versions and host key
algorithms.
-o option
Can be used to give options in the format used in the
configuration file. This is useful for specifying options for
which there is no separate command-line flag. For full details
of the options, and their values, see sshd_config(5).
-p port
Specifies the port on which the server listens for connections
(default 22). Multiple port options are permitted. Ports
specified in the configuration file with the Port option are
ignored when a command-line port is specified. Ports specified
using the ListenAddress option override command-line ports.
-q Quiet mode. Nothing is sent to the system log. Normally the
beginning, authentication, and termination of each connection is
logged.
-t Test mode. Only check the validity of the configuration file and
sanity of the keys. This is useful for updating sshd reliably as
configuration options may change.
[/SIZE]

So after having updated SuperSU from 1.94 to 2.00, I've suddenly got some different SELinux errors in the AVC log, but did not resolve the issue. This partially confirm that this is a combined App + SELinux issue, due to several factors:
1) App is not performing the SU operation according to current (latest AOSP) standards. For example, from THIS issue on Stackoverflow, apparently AOS >4.3 (or more likely those using SELinux 4.2.2) are no longer using setuid(), and if you still wanna use it, it is suggested to do a fork() before. In addition su has to be made in the right context.
2) According to THIS article, SU is no longer allowed to execute files on the /data partition, although there are some workarounds. Please read Chainfire's blog about how to SU, for latest developments, and workarounds.
3) The current SELinux policy is restricting the use of /dev/pts|ptm|pty and the mounted devpts FS. Most likely some of the policy/behavior is wrong.
Useful links:
http://su.chainfire.eu/
http://www.xda-developers.com/andro...ak-compatibility-with-many-current-root-apps/
http://www.xda-developers.com/andro...he-android-l-developer-preview-the-right-way/

Another possible reason for this issue, could be that since AOS 4.3 (and possibly some 4.2.2 in Enforcing) versions, the WRITE_EXTERNAL_STORAGE permissions in /system/etc/permissions/platform.xml have been changed to a much more restrictive setting, where Apps can ONLY write to their own directory. For a good description of the problem and solution:
[APP][4.4][ROOT] SDFix: Modify device permissions to allow apps to write to MicroSD
http://forum.xda-developers.com/showthread.php?t=2684188
https://plus.google.com/+TodLiebeck/posts/gjnmuaDM8sn
This need to be checked.
=========================== EDIT =====================
On 4.2.2 Enforcing, we have:
Code:
[SIZE=2]...
<permission name="android.permission.READ_EXTERNAL_STORAGE" >
<group gid="sdcard_r" />
</permission>
<permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
<group gid="sdcard_rw" />
<group gid="media_rw" />
</permission>
...[/SIZE]
This seem OK, but perhaps SSHelper also need to set its GID to "sdcard_rw"?
Because on KK 4.4.2b4 we have:
Code:
[SIZE=2] <permission name="android.permission.READ_EXTERNAL_STORAGE" >
<group gid="sdcard_r" />
[COLOR=Red][B]<group gid="media_rw" />[/B][/COLOR]
</permission>
<permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
[COLOR=Red][B]<group gid="sdcard_r" />[/B][/COLOR]
<group gid="sdcard_rw" />
<group gid="media_rw" />
</permission>
<permission name="android.permission.ACCESS_ALL_EXTERNAL_STORAGE" >
<group gid="sdcard_r" />
<group gid="sdcard_rw" />
<group gid="sdcard_all" />
</permission>
<permission name="android.permission.WRITE_MEDIA_STORAGE" >
<group gid="media_rw" />
</permission>
[/SIZE]
Looking at the permissions in our AndroidManifest.xml file, and compare that to issue#315 in Android-Terminal-Emulator, it could that we also need to add the READ_EXTERNAL_STORAGE permission, which is not present in our manifest, and contrary to what Google said about WRITE_EXTERNAL_STORAGE as automatically including READ_ access.
To help troubleshoot permission problems when running on an AOS with enabled SELinux (>4.2.2), please provide the output of the following commands:
Code:
getprop |grep "ro.build.*"
getenforce
cat /data/misc/audit/audit.log

I have now found a work-around for the lost terminal job-control.
It's originally described in detail HERE.
---
EDIT: (Added 2014-11-23)
I've finally found a work-around for the crippled /dev/pts job-control and su combination. There are two small problems that combines to this issue.
1. The SELinux policy is screwed up by Samsung. And others?
2. The /dev/pts is mounted wrong by default.
The work-around:
Make sure you're device is already in Enforcing mode, so that you get the proper su prompt (#).
1. Open terminal session 1.
Code:
[SIZE=2]
## On Terminal 1
ssh -2 [email protected] -p 2222
$ su -c /system/bin/sh -i
# su 0 setenforce 0
# umount /dev/pts
# su -cn u:r:init:s0 -c "busybox mount -t devpts -o rw,seclabel,relatime,mode=620,gid=5 devpts /dev/pts"[/SIZE]
2. Now go to Terminal 2 and login:
Code:
[SIZE=2]## On terminal 2
ssh -2 [email protected] -p 2222
$
[/SIZE]
(You now have job-control but no su possibility.)
3. Now go back to Terminal 1 and enable Enforcing mode:
Code:
[SIZE=2]## On Terminal 1
# su 0 setenforce 1
[/SIZE]
4. Now go back to Terminal 2 and escalate to su:
Code:
[SIZE=2]## On terminal 2
$ su -c /system/bin/sh -i
# [/SIZE]
Unfortunately if you exit the su (#) shell, you'll have to repeat steps 2-4 of the procedure.

Any progress on a pty for lollipop users?
So now that Lollipop has landed, is there any progress on getting a pty for Lollipop users?
Ideally something that can work with something not too far from stock.

zelch said:
So now that Lollipop has landed, is there any progress on getting a pty for Lollipop users? Ideally something that can work with something not too far from stock.
Click to expand...
Click to collapse
Are you actually having any issues? Please post what. I've used this on a KK 4.4.4 MTK device, using SuperSU 2.16, and there are no problems with this on that device.

E:V:A said:
Are you actually having any issues? Please post what. I've used this on a KK 4.4.4 MTK device, using SuperSU 2.16, and there are no problems with this on that device.
Click to expand...
Click to collapse
In short, yes.
Currently on stack (unrooted) Lollipop on a Nexus 7 (2013), and while the ssh server works it can not allocate a pty, resulting in the shell not being all that usable.
While I expect that rooting will be a requirement to adjust things, I would rather avoid the option of completely disabiling selinux enforcement.
(Yes, it's a quick and easy way to solve the problem. But the selinux enforcement buys quite a lot in the way of security, so I'd rather limit things to say, a tweaked selinux policy.)

Okay noob question .... My rooted Nexus 5, with sshelper installed, changed listening port to 3333, set a new password
Logon from Windows server with putty gives ...
login as: admin
SSHelper Version 6.8 Copyright 2014, P. Lutus
[email protected]'s password:
Server refused to allocate pty
sh: /data/data/com.arachnoid.sshelper/home/.profile[2]: uname: not found
What cretinous thing have I omitted to notice?
Regards Marcus

I've been running your app for a few days with good results, thank you for that!
Would it be possible to implement a wifi lock only when there is a client connected? Wifi lock all the time is killing my battery and my standby wifi seems to be responsive enough to receive incoming connections (often after 2 or 3 attempts, but it still eventually works)

First of all let me clarify that I am not the developer and maintainer of this App. It is Paul Lutus, and you can message him on his website. I only started this thread to help him out and to help myself of having a place to post problems. I really like his app, but THESE are really annoying issues, and has proably nothing to do with his app but with the screwed up way that Google is changing device permissions.
The only solution I know about for problem devices is something like I re-posted in edited post #8:
http://forum.xda-developers.com/showpost.php?p=55779472&postcount=8
Good Luck.

Hi!
Is it possible to start sftp session as root user? If i try to reach /data for example i get permission denied error In terminal i must type su to gain root rights.
Thank you!

jumika said:
Hi!
Is it possible to start sftp session as root user? If i try to reach /data for example i get permission denied error In terminal i must type su to gain root rights.
Thank you!
Click to expand...
Click to collapse
I would like to know this as well.

Having a problem with SFTP ssh process almost immediately disconnecting. I get messages from my file manager (caja) such as "The connection is closed (the underlying SSH process exited)". This wasn't a problem until I did a factory reset on my OnePlus 5 and upgrade it to Oreo (8.1)
How can I keep the connection alive? I tried a keep alive ping on the PC side by editing SSH config files, but that was a bust.

How to run SSHelper from CLI/ADB - failed Phone's LCD/Screen
Hi everyone
Trying to start SSH helper on a phone with a defective screen
It is already installed, but not running... tried this:
Code:
[email protected]:/data/app # am start com.arachnoid.sshelper
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]pkg=com.arachnoid.sshelper }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.arachnoid.sshelper }
and many other creative combinations I somehow got from online searches:
Code:
# am start com.arachnoid.sshelper/android.intent.action.MAIN
it fails:
Code:
start com.arachnoid.sshelper/android.intent.action.MAIN <
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.L
AUNCHER] cmp=com.arachnoid.sshelper/android.intent.action.MAIN }
Error type 3
Error: Activity class {com.arachnoid.sshelper/android.intent.action.MAIN} does not exist.
This directory exists:
Code:
[email protected]:/data/app # ls -ld *arach*
drwxr-xr-x system system 2018-08-07 21:00 com.arachnoid.sshelper-2
maybe the "-2" needs to be accounted for somehow in the command to start?
pages like: http://learnandroid.blogspot.com/2008/01/run-android-application-from-command.html
says how to construct an "am start" command, but it requires info from the Manifest, except the file AndroidManifest.xml found in the ssh helper.apk seems binary
Until I get this working ADB is the only way to connect to the phone, it's rather limited in its abilities... like, no scp
Code:
C:\Android>adb shell
[email protected]:/ $ su
[email protected]:/ # scp
tmp-mksh: scp: not found
Any tips on how to start SSH Helper, maybe someone has the text Manifest xml file?
Stormy.

Terrible rsync transfer rates
I'm having trouble with transfer rates using rsync.
I use rsync to backup my phone to my computer but the transfer rates are always below 700kB/s which is unbearable.
My specs:
Phone: Samsung S9, rooted with custom rom.
Computer: MacOS 10.14.6
I had the same problem with SSHDroid but maybe some of you have an idea how to tackle this, or confirm the slow transfer speed.
By the way: When uploading music to my phone it is faster with 1.4MB/s (still not super great).

Related

[Guide] Debian on Android (rooted)

Hi, this is a guide to install a Linux image on your rooted Android phone with the debootstrap + chroot method.
In this guide, we'll install a Debian image, but the steps are practically the same, with a few tweaks.
If you need help to install a Linux image, feel free to ask on this thread.
For this guide, all credit goes to them:
http://linux-expert.net/?Trucs_et_astuces___Android___Tutoriel_%3A_Chroot_Debian (in french)
http://forum.xda-developers.com/showthread.php?p=45457799
http://forum.xda-developers.com/showthread.php?t=2312013
http://forum.xda-developers.com/showthread.php?t=631389
http://forum.xda-developers.com/showthread.php?t=1418546
http://forum.xda-developers.com/showpost.php?p=5671794&postcount=124
VNC
________________
I. On your PC
So first, you have to create the .img file that will contain the OS.
In a GNU/Linux environment (PC) and with the root permissions, type these commands:
Code:
# mkdir debian
# dd if=/dev/zero of=wheezy-armhf.img bs=1M count=0 seek=2048
[COLOR="Red"](NOTE: "of=" will be the name of our .img file and "seek=" the size of the file (MB). Here, we create a file named "wheezy-armhf.img" of 2 GB)[/COLOR]
# mkfs.ext4 -F wheezy-armhf.img
# mount -o loop wheezy-armhf.img /debian
Then we have to fill up the filesystem.
Code:
# debootstrap --foreign --arch=armhf wheezy debian/
# umount debian
Finally, move it to your SD Card. In my case, I moved it on /data/local/
II. On your phone
On your phone, in a terminal emulator and with the root permissions, type the following commands:
Code:
# mount -o rw,remount rootfs /
# export LINUXROOT=/linux
(NOTE: here we'll install Debian on the root of the internal memory, in "/", but we can also install Debian on the SD Card or in /data/loca/linux by changing the path after "LINUXROOT=")
# mkdir $LINUXROOT
# busybox mknod /dev/block/loop100 b 7 100
# losetup /dev/block/loop100 /sdcard/wheezy-armhf.img
# mount -t ext4 /dev/block/loop100 $LINUXROOT
# chroot $LINUXROOT /bin/sh
# export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# /debootstrap/debootstrap --second-stage
The debootstrap's second part should start. Grab a cup of coffee while it's working!
When it's finish, leave the chroot by typing
Code:
# exit
# su
Let's mount the filesystem. We're close!
Code:
# mount -t proc none /proc
# mount -t sysfs none /sys
# mount -o bind /dev /dev
# mount -t devpts none /dev/pts
Now, we have to set the environment variable. Ensure that you have set the correct path of LINUXROOT in case you've chosen another path than /linux.
Code:
# export LINUXROOT=/linux
# export TMPDIR=/tmp
# export USER=root
# export HOME=/root
# export SHELL=/bin/bash
# export TERM=linux
# export LC_ALL=C
# export LANGUAGE=C
# export LANG=C
And finally, chroot.
Code:
# chroot $LINUXROOT /bin/bash
su
Welcome on Debian!
III. DNS and Mirrors
Set a DNS. We'll set the free Google DNS but you can set yours if you want.
Code:
echo -e "domain local\nsearch local\n" >> /etc/resolv.conf
echo -e "# DNS Google\nnameserver 8.8.8.8\nnameserver 8.8.4.4\n" >> /etc/resolv.conf
You can add mirrors to your sources.list if you want. I'm french so I added french mirrors:
Code:
# echo -e "## Debian Wheezy sources.list\n\n" > /etc/apt/sources.list
# echo -e "## Debian.org FR mirror\ndeb http://ftp.fr.debian.org/debian/ wheezy main contrib non-free\ndeb-src http://ftp.fr.debian.org/debian/ wheezy main contrib non-free\n\n" >> /etc/apt/sources.list
# echo -e "## Debian security updates\ndeb http://security.debian.org/ wheezy/updates main contrib non-free\ndeb-src http://security.debian.org/ wheezy/updates main contrib non-free\n >> /etc/apt/sources.list
IV. VNC
To access your Debian in a graphical environment from your PC or your phone, you have to set up a VNC Server and install a Desktop Environment. Let's install VNC and LXDE.
We'll follow the steps described on the LXDE wiki:
Code:
su
# apt-get update
# apt-get install lxde
# apt-get install tightvncserver
Set up the VNC server by typing the following command, which will ask you to set two passwords (let the second password if you want):
Code:
# vncserver
Kill the session:
Code:
# vncserver -kill :1
Go to /root/.vnc/ and edit the xstartup file: comment out #/etc/X11/xsession and add these two lines:
icewm
lxsession
Click to expand...
Click to collapse
To start a VNC session, type "vncserver -geometry x". For the Nexus 4, we would type "vncserver -geometry 1184x768"
To access your Desktop Environment from your phone, download android-vnc-viewer and launch it.
In the password field, type your password. In the address field, type "127.0.0.1", in port type "5901" and select 24-bit color (4bpp).
V. Script
I've made three scripts to mount, launch and unmount Debian. Whenever you reboot your phone, you'll have to mount Debian, set the environment variables and chroot.
VI. Credit
All credit goes to them:
http://linux-expert.net/?Trucs_et_astuces___Android___Tutoriel_%3A_Chroot_Debian (in french)
http://forum.xda-developers.com/showthread.php?t=2312013
http://forum.xda-developers.com/showthread.php?t=631389
http://forum.xda-developers.com/showthread.php?t=1418546
http://forum.xda-developers.com/showpost.php?p=5671794&postcount=124
VNC
Sorry for my bad english, I hope this will help
EDIT: Feel free to correct me!
Hi, I have 2021 updates, if someone interested. Tested with rooted LineageOS 17 (selinux permissive - not sure if required, my ROM is permissive, didn't set it explicitly):
for 32-bit ARM, ext4 created by 64-bit Linux didn't work, obviously there is some 64-bit feature that was not supported at least with my kernel (3.14). I've in the end created the FS on the Android, but using "-O '^64bit'" could be sufficient in the Linux. UPDATE: I've in the end used F2FS instead of EXT4.
above mknod+losetup+mount didn't work for me (neither 'mount -o loop -t ext4 <img>'), I've used 'mount -t ext4 $(losetup -sf /sdcard/stable-armhf.img) $LINUXROOT' in the end (obviously the device name needs to be saved somewhere if one wants to cleanly umount)
there was issue with network access denied even if you are root, see here. I've fixed it by creating the group 'inet/3003' in the chroot and issuing 'newgrp inet' inside it (more details in the link).
Anyways, thanks a lot for the above instructions, it helped me much!

[REF][ServiceMode] How to make your Samsung perform dog tricks

Every time Samsung releases a new series of phones, they try to make
it just a little harder for us to find and enter the Service Mode (SM)
menus. Understandably the Service Mode menus allow you to access
functions on your phone directly related to its operation, from
selecting particular service providers, unlocking your SIM card,
changing default networks, bands and destroying your internal
non-volatile (NV) memory, that contain all your IMEI, RF, EFS
parameters, and to make a complete factory wipe and reset.
So this is not to play around with, randomly!
You have been warned.
On the other hand, it also provides extremely useful detailed
information about your mobile network, including all radio related
systems like GPS, WiFi, BlueTooth and NFC. Most of this information
is not available through the usual AOS Java API, and probably will
never be, as vendors consider this area as off-limits to users and
amateur developers.
Note:
All this info was obtained on a European
Samsung Galaxy S4-mini (GT-I9195 LTE)
But reported to work also on:
Samsung Galaxy S5 on US Cellular (SM-G900R4)
Code:
[SIZE=2]Baseband: I9195XXUBML4 [/SIZE]
[SIZE=2]Kernel: 3.4.0-2340422 [/SIZE]
[SIZE=2] [email protected] #1 [/SIZE]
[SIZE=2]Build: JDQ39.I9195XXUBML4 [/SIZE]
[SIZE=2]SE: SEPF_GT-I9195_4.2.2_0022[/SIZE]
Getting into Service Mode (SM)
On this particular model, you have to do this:
Go to dial pad and enter: *#0011#
This will initially take you to Service Mode and showing you
various signal status items, by default. But it's a locked
entry. So to unlock and go to the Main Menu do this:==> [MENU] + [Back]
==> [MENU] + [Key Input] + "Q0"
==> <wait ~5-10 seconds>​Now you can hit the thank you button below!
I have not seen this solution anywhere else, and
it required some reversing...
Understading the ServiceMode Menu
<WIP>
This will take some time to investigate, so anyone
who already knows, please post in this thread.
The ServiceMode Menu Structure (brief)
Go to Post#2 for formatted menu structure and items.
Code:
[SIZE=2]MAIN MENU[/SIZE]
[SIZE=2][1] UMTS [/SIZE]
[SIZE=2][2] CDMA [/SIZE]
[SIZE=2][3] LTE [/SIZE]
[SIZE=2][4] SIM- Not Used. --> <E>[/SIZE]
[SIZE=2][5] DOCOMO DEBUG SCREEN [/SIZE]
[SIZE=2][6] run EFS SYNC() [/SIZE]
[SIZE=2][7] DEBUG SCREEN [/SIZE]
Some Important Codes
9900 SysDump
This is an important hidden code is that for making a wide range
of system dumps and changing many unknown logging functions.
This will give you a list of the following functions:
Code:
[SIZE=2]Menu Item Setting Description[/SIZE]
[SIZE=2]---------------------------------------------------------------------[/SIZE]
[SIZE=2]Run dumpstate/logcat/modem log - logcat -v threadtime -b radio -d -f /data/log/radio_*.log[/SIZE]
[SIZE=2]Delete dumpstate/logcat [/SIZE]
[SIZE=2]Run dumpstate/logcat [/SIZE]
[SIZE=2]Copy Kernel Log to SD card [/SIZE]
[SIZE=2]Run CP based log [/SIZE]
[SIZE=2]Run Forced CP crash dump [/SIZE]
[SIZE=2]Copy to sdcard (include CP Ramdump) [/SIZE]
[SIZE=2]Debug Level Disabled/LOW - Change debug level [LOW/MID/HIGH][/SIZE]
[SIZE=2]CP Debugging Popup UI: Disabled [/SIZE]
[SIZE=2]Silent Log: Off dev.silentlog.on=(On,Off)[/SIZE]
[SIZE=2]Translation Assistant: Off persist.translation.assistant=(0,1)[/SIZE]
[SIZE=2]Low battery dump: Off [/SIZE]
[SIZE=2]Wakelock Monitoring: OFF [/SIZE]
[SIZE=2]TCP DUMP START ro.product_ship=(true,false) lucky_ril*.log[/SIZE]
[SIZE=2]Enable SecLog (currently disabled) persist.log.seclevel=(0,1)[/SIZE]
[SIZE=2]MTT Logging Setting: OFF persist.brcm.log=(sdcard,none) [Broadcom][/SIZE]
[SIZE=2]ACT data copy [/SIZE]
[SIZE=2]Exit [/SIZE]
9090 DIAG CONFIG
This is also important for changing the internal MUX used for
diagnostic debug output, to/from USB and UART.
Code:
[SIZE=2]DIAG CONFIG[/SIZE]
[SIZE=2][1] USB ( )[/SIZE]
[SIZE=2][2] UART (*)[/SIZE]
[SIZE=2][3] DBG MSG ON (*)[/SIZE]
[SIZE=2][4] DBG MSG OFF ( )[/SIZE]
Basically if you wanna use UART output, you will probably need
to build the MyWay box or use the correct resistance between
the USB ID and GND pins. (See my AnyWay thread.)
0808 USB Settings
This is by far the most important code to know, because it is used to determine,
what drivers are enumerated when connecting your phone to PC via USB cable.
Technically it is a multiplexer (MUX) switch which determine whether the USB
port is directly connected to the CP (Cellular/baseband Processor/modem),
or the AP (Application Processor). This also selects what device features will be
enabled once connected. Such as ADB, RNDIS, and DM (Diagnostic Mode) etc.
To change the mux settings on a Samsung S4/mini, use your dialpad
to get to the "USBSettings" menu, like this:
For AOS <= 4.2.2, without SELinux, use *#7284# or *#3424#.
For AOS >= 4.2.2, with SELinux, use *#0808#.
Code:
[SIZE=2]USB
( ) CP
( ) AP
USB Settings
( ) MTP
( ) MTP + ADB
( ) PTP
(o) PTP + ADB
( ) RNDIS + DM + MODEM
( ) RMNET + DM + MODEM
( ) DM + MODEM + ADB
[OK] [Reboot]
[/SIZE]
A few other service/secret codes
Similarly to my GT-I9300 "Secret Codes" thread, we find many of the
same codes present also in this phone. Do check that thread out, for
understanding how to find more codes relevant for your phone and AOS
version. Also note that most custom ROMs does not support all these,
as they are usually left out or forgotten about, since they are
vendor/modem specific.
Here I show only the most interesting & useful ones, and I have also
used the excellent website PhoneSpell to try to find sensible word
combinations for some of these numbers.
Now, many of these seem not to work at all, but they are present in
the ServiceMode application(s) code and rely on various other
properties being set before being available/activated. Another
type of block is is determined by the content of the EFS files:
/efs/FactoryApp/keystr
/efs/carrier/HiddenMenu
These can be set on a rooted phone by:
Code:
echo -n "OFF" > /efs/FactoryApp/keystr
echo -n "ON" >/efs/carrier/HiddenMenu
echo -n "ON" >/efs/FactoryApp/factorymode
(Somebody need to confirm the KeyString block boolean!)
Here is list of some particularly interesting properties that often
seem involved in blocking/enabling particular ServiceMenu
items/features.
Code:
[SIZE=2]property value/note[/SIZE]
[SIZE=2]---------------------------------------------------------------------[/SIZE]
[SIZE=2]ril.tcpdumping=On [On,Off][/SIZE]
[SIZE=2]ril.OTPAuth=true OTP Authentication key is 6 random digits long[/SIZE]
[SIZE=2]ro.build.type=eng [eng, user]][/SIZE]
[SIZE=2]ro.cp_debug_level= [0x5500,0x55FF] [/SIZE]
[SIZE=2]ro.csc.sales_code=CHM [NONE, <many otehrs> ][/SIZE]
[SIZE=2]ro.csc.country_code= [KOREA, Unknown, ...] KOREA allows extra menu item: "IMS"[/SIZE]
[SIZE=2]ro.product_ship=false [true,false][/SIZE]
[SIZE=2]ro.product.model= [/SIZE]
[SIZE=2]ro.factorytest=1
dev.silentlog.on= [0,1][/SIZE]
[SIZE=2]persist.radio.lteon=true [true,false][/SIZE]
And here are some of the codes:
Code:
[SIZE=2]code mnemonic description[/SIZE]
[SIZE=2]---------------------------------------------------------------------[/SIZE]
[SIZE=2]06 - IMEI[/SIZE]
[SIZE=2]00112 [/SIZE]
[SIZE=2]0228 0BAT Battery status (ADC, RSSI reading)[/SIZE]
[SIZE=2]0514 - [/SIZE]
[SIZE=2]0599 -[/SIZE]
[SIZE=2]1234 - FW Versions for AP,CP,CSC[/SIZE]
[SIZE=2]123456 -[/SIZE]
[SIZE=2]1575 - GPS test[/SIZE]
[SIZE=2]1111 - FTA SW Version [/SIZE]
[SIZE=2]2222 - FTA FW Version[/SIZE]
[SIZE=2]8888 - [/SIZE]
[SIZE=2]9090 - USB/UART MUX debug switch[/SIZE]
[SIZE=2]99007788 - [/SIZE]
[SIZE=2]197328640 - Service Mode[/SIZE]
[SIZE=2]22558463 CALLTIME Reset Total Call Time[/SIZE]
[SIZE=2]2263 BAND [/SIZE]
[SIZE=2]2580 <mid-col> [/SIZE]
[SIZE=2]268435456 ANTIFKILO "antenna IF kilo?? serviceModeApp_FB.apk / FTATDumpReceiver.class[/SIZE]
[SIZE=2]27663368378 CPMODEMTEST [/SIZE]
[SIZE=2]2767*2878 APOS*CUST Current firmware with factory default settings[/SIZE]
[SIZE=2]301279||279301 - [/SIZE]
[SIZE=2]3214789650 - Start Angry GPS Build.TYPE != "user"[/SIZE]
[SIZE=2]32489 - Ciphering Info[/SIZE]
[SIZE=2]4238378 ICE/GCFTEST GCF Settings?[/SIZE]
[SIZE=2]4387264636 GETRAMINFO [/SIZE]
[SIZE=2]58366 LTEON set persist.radio.lteon=true[/SIZE]
[SIZE=2]6201 - [/SIZE]
[SIZE=2]638732 NETSEC Build.TYPE != "user"[/SIZE]
[SIZE=2]66336 MODEM CP Ram Dump (On/Off) ro.cp_debug_level=[0x5500,0x55FF][/SIZE]
[SIZE=2]6984125* MYTH1A5? ? [/SIZE]
[SIZE=2]7284 PATH Set USB/UART path [/SIZE]
[SIZE=2]738767633 SETSOSOFF Turn OFF SOS*[/SIZE]
[SIZE=2]73876766 SETSOSON Turn ON SOS*[/SIZE]
[SIZE=2]7387677763 SETSOSPROF Set SOS* profile[/SIZE]
[SIZE=2]7387678378 SETSOSTEST Set SOS* test[/SIZE]
[SIZE=2]---------------------------------------------------------------------[/SIZE]
[SIZE=2]* SOS = Sell Out SMS[/SIZE]
[SIZE=2]<> = some kind of keypad pattern[/SIZE]
[SIZE=2]---------------------------------------------------------------------[/SIZE]
In addition to these numerical codes, there are also few alphanumeric ones.
These can be used from the command-line with the "am" command, like this:
Code:
[SIZE=2]am broadcast -a android.provider.Telephony.SECRET_CODE -d android_secret_code://CP_RAMDUMP[/SIZE]
This might also work when already in ServiceMode, by entering the string
after selecting "Key Input" or "Select", from menu. (I have not checked.)
Code:
[SIZE=2]LTE_ANT_PATH_NORMAL[/SIZE]
[SIZE=2]CP_RAMDUMP[/SIZE]
[SIZE=2]DUMP_SVCIPC[/SIZE]
[SIZE=2]DEBUG_SCR[/SIZE]
[SIZE=2]EI_DEBUG_SCR[/SIZE]
[SIZE=2]DATA_ADV[/SIZE]
[SIZE=2]NAMBASIC[/SIZE]
[SIZE=2]TESTMODE[/SIZE]
[SIZE=2]NAMSIMPLE[/SIZE]
[SIZE=2]TEST_CALL[/SIZE]
The Samsung Diagnostics Menu
One special secret code is that of the Samsung Dignostic
Test Menu. This particular menu exsists on pretty much all
Android based Samsung phones. (AFAIK) The code is simply:
*#0*#
It provides for testing things like the Screen, Sound, Vibrator,
all the sensors and more. One one the cooler features for phones
that include an IR transmitter, is that you can use it on most
modern Samsung TV's as a remote control. Thus even easier to use
than any of Samsung's own Remote Control Apps, which are often
bloated and containing spyware.
The available test items you will find on this particular model are:
Code:
[SIZE=2][Red] - screen pixel test[/SIZE]
[SIZE=2][Green] - screen pixel test[/SIZE]
[SIZE=2][Blue] - screen pixel test[/SIZE]
[SIZE=2][Receiver] - (Ear) Receiver test[/SIZE]
[SIZE=2][Vibration] -[/SIZE]
[SIZE=2][Dimming] -[/SIZE]
[SIZE=2][Mega cam] -[/SIZE]
[SIZE=2][Sensor] -[/SIZE]
[SIZE=2][Touch] -[/SIZE]
[SIZE=2][Sleep] - sleep mode (power button) test[/SIZE]
[SIZE=2][Speaker] - listen![/SIZE]
[SIZE=2][Sub key] - testing keys [/SIZE]
[SIZE=2][Front cam] - [/SIZE]
[SIZE=2][IR LED] - Samsung TV compatible IR remote control[/SIZE]
[SIZE=2][LOW FREQUENCY] - Listen 100/200/300 Hz[/SIZE]
[SIZE=2][Black] - screen darkness test[/SIZE]
For other S4 models, check this YouTube video:
"Galaxy S4 Diagnostics Menu *#0*#"
For the S3 GT-I9300 check out the thread:
[REF][INFO][R&D] "Secret Codes" and other hidden features​
The ServiceMode Menu Structure
This is really <WIP> as I don't have time to manually type in every damn menu
item for everyone else. So if you wanna help out filling in the blanks, please post
and I'll eventually add it here.
Code:
[SIZE=2]MAIN MENU[/SIZE]
[SIZE=2] [1] UMTS [/SIZE]
[SIZE=2] [2] CDMA [/SIZE]
[SIZE=2] [3] LTE [/SIZE]
[SIZE=2] [4] SIM- Not Used. --> <E>[/SIZE]
[SIZE=2] [5] DOCOMO DEBUG SCREEN [/SIZE]
[SIZE=2] [6] run EFS SYNC() [/SIZE]
[SIZE=2] [7] DEBUG SCREEN [/SIZE]
[SIZE=2] ---------------------------------------------------------------------[/SIZE]
[SIZE=2] [1] UMTS MAIN MENU[/SIZE]
[SIZE=2] [1] DEBUG SCREEN[/SIZE]
[SIZE=2] [2] VERSION INFORMATION[/SIZE]
[SIZE=2] [3] UMTS RF NV[/SIZE]
[SIZE=2] [4] GSM RF NV[/SIZE]
[SIZE=2] [5] AUDIO[/SIZE]
[SIZE=2] [6] COMMON[/SIZE]
[SIZE=2] [7] LTE BAND CONFIG CHECK[/SIZE]
[SIZE=2] [1] DEBUG SCREEN[/SIZE]
[SIZE=2] [1] BASIC INFORMATION[/SIZE]
[SIZE=2] [2] NAS INFORMATION[/SIZE]
[SIZE=2] [3] AS INFORMATION[/SIZE]
[SIZE=2] [4] NEIGHBOUR CELL[/SIZE]
[SIZE=2] [5] GPRS INFORMATION[/SIZE]
[SIZE=2] [6] SIM INFORMATION[/SIZE]
[SIZE=2] [7] HANDOVER[/SIZE]
[SIZE=2] [8] PHONE CONTROL[/SIZE]
[SIZE=2] [9] ANTENNA/ADC[/SIZE]
[SIZE=2] [2] VERSION INFORMATION[/SIZE]
[SIZE=2] [1] SW VERSION[/SIZE]
[SIZE=2] [2] HW VERSION[/SIZE]
[SIZE=2] [3] UMTS RF[/SIZE]
[SIZE=2] [1] RF NV READ[/SIZE]
[SIZE=2] [2] RF NV WRITE[/SIZE]
[SIZE=2] [3] UMTS DIVERSITY CONTROL[/SIZE]
[SIZE=2] [4] RF CALIBRATION CHECK[/SIZE]
[SIZE=2] [4] GSM RF[/SIZE]
[SIZE=2] [1] RF NV READ[/SIZE]
[SIZE=2] [2] RF NV WRITE[/SIZE]
[SIZE=2] [5] AUDIO Locked! ==> See Note (a)[/SIZE]
[SIZE=2] ...[/SIZE]
[SIZE=2] [6] COMMON[/SIZE]
[SIZE=2] [1] FTM[/SIZE]
[SIZE=2] [2] DEBUG INFO[/SIZE]
[SIZE=2] [3] RF SCANNING[/SIZE]
[SIZE=2] [4] DIAG CONFIG[/SIZE]
[SIZE=2] [5] WCDMA SET CHANNEL[/SIZE]
[SIZE=2] [6] NV REBUILD[/SIZE]
[SIZE=2] [7] FACTORY TEST[/SIZE]
[SIZE=2] [8] FORCE SLEEP[/SIZE]
[SIZE=2] [9] GPS[/SIZE]
[SIZE=2] [1] FTM : OFF Locked! ==> See Note (b)[/SIZE]
[SIZE=2] [1] NOT SUPPORT [/SIZE]
[SIZE=2] [2] FTM : OFF[/SIZE]
[SIZE=2] [2] DEBUG INFO[/SIZE]
[SIZE=2] [1] MM REJECT CAUSE[/SIZE]
[SIZE=2] [2] LOG DUMP[/SIZE]
[SIZE=2] [3] UI DEBUG POPUP - N/S[/SIZE]
[SIZE=2] [3] RF SCANNING [/SIZE]
[SIZE=2] [1] SETTING[/SIZE]
[SIZE=2] [2] START RF SCANNING[/SIZE]
[SIZE=2] [3] RESULT TO PC[/SIZE]
[SIZE=2] [4] RESULT TO SCREEN[/SIZE]
[SIZE=2] [4] DIAG CONFIG[/SIZE]
[SIZE=2] [1] USB ( )[/SIZE]
[SIZE=2] [2] UART (*)[/SIZE]
[SIZE=2] [3] DBG MSG ON (*)[/SIZE]
[SIZE=2] [4] DBG MSG OFF ( )[/SIZE]
[SIZE=2] [5] WCDMA SET CHANNEL ==> "WCDMA CHANNEL SET" NOT SUPPORT[/SIZE]
[SIZE=2] [6] NV REBUILD --> Not tested![/SIZE]
[SIZE=2] [7] FACTORY TEST --> Not tested![/SIZE]
[SIZE=2] [8] FORCE SLEEP --> Not tested![/SIZE]
[SIZE=2] [9] GPS[/SIZE]
[SIZE=2] co_gps_menu ==> unknown![/SIZE]
[SIZE=2] [7] LTE BAND CONFIG CHECK --> <E>[/SIZE]
[SIZE=2] ---------------------------------------[/SIZE]
[SIZE=2] [2] CDMA MAIN MENU[/SIZE]
[SIZE=2] [1] COMMON[/SIZE]
[SIZE=2] [2] DATA[/SIZE]
[SIZE=2] [3] RF[/SIZE]
[SIZE=2] [4] CONTROL[/SIZE]
[SIZE=2] [5] DEBUG SCREEN[/SIZE]
[SIZE=2] [6] SUSPEND (001)[/SIZE]
[SIZE=2] [7] TEST SYS(012)[/SIZE]
[SIZE=2] [1] COMMON MENU (1/3) [/SIZE]
[SIZE=2] [1] READ RAW RSSI (018)[/SIZE]
[SIZE=2] [2] MODEL ID (019)[/SIZE]
[SIZE=2] [3] SNDNAM (020)[/SIZE]
[SIZE=2] [4] SNDVERSION (021)[/SIZE]
[SIZE=2] [5] SNDESN (022)[/SIZE]
[SIZE=2] [6] DATASVC ON (023)[/SIZE]
[SIZE=2] [7] DATASVC OFF (024)[/SIZE]
[SIZE=2] [8] VERSION (025)[/SIZE]
[SIZE=2] [9] NEXT PAGE >[/SIZE]
[SIZE=2] COMMON MENU (2/4)[/SIZE]
[SIZE=2] [1] REBUILD (026)[/SIZE]
[SIZE=2] [2] PHONE RESET (027)[/SIZE]
[SIZE=2] [3] FS RESET (029)[/SIZE]
[SIZE=2] [4] SIO TO DM (032)[/SIZE]
[SIZE=2] [5] MSL KEY(245)[/SIZE]
[SIZE=2] [6] MSL (246)[/SIZE]
[SIZE=2] [7] F3 MSG (249)[/SIZE]
[SIZE=2] [8] CUR BAND (253)[/SIZE]
[SIZE=2] [9] NEXT PAGE >[/SIZE]
[SIZE=2] COMMON MENU (3/4)[/SIZE]
[SIZE=2] [1] ERR LOG CLR (252)[/SIZE]
[SIZE=2] [2] SIM IN OUT CHECK (89)[/SIZE]
[SIZE=2] [3] MEMORY CHECK (90)[/SIZE]
[SIZE=2] [4] ACTIVATION_DATE (99)[/SIZE]
[SIZE=2] [5] SIO_MODE (032)[/SIZE]
[SIZE=2] [6] MOB CAI REV (110)[/SIZE]
[SIZE=2] [7] RECONDITIONED STATUS (200)[/SIZE]
[SIZE=2] [8] PREF MODE SET[/SIZE]
[SIZE=2] [9] NEXT PAGE >[/SIZE]
[SIZE=2] COMMON MENU (4/4)[/SIZE]
[SIZE=2] [1] RTRE CONFIG[/SIZE]
[SIZE=2] [2] SMS FORMAT SET[/SIZE]
[SIZE=2] [3] (UN)BLOCK VOICE MT[/SIZE]
[SIZE=2] [4] CHECK FACTORY CMD[/SIZE]
[SIZE=2] [2] DATA[/SIZE]
[SIZE=2] [1] WRITE NV (031) [/SIZE]
[SIZE=2] [2] MRU2 TABLE (033)[/SIZE]
[SIZE=2] [3] NAI SET (034)[/SIZE]
[SIZE=2] [4] INFORMATION[/SIZE]
[SIZE=2] [5] VBATT[/SIZE]
[SIZE=2] [6] THERMISTER[/SIZE]
[SIZE=2] [7] eHRPD e/disable[/SIZE]
[SIZE=2] [3] RF[/SIZE]
[SIZE=2] [1] CALIBRATION [/SIZE]
[SIZE=2] [2] COMMON [/SIZE]
[SIZE=2] [3] PCS [/SIZE]
[SIZE=2] [4] CDMA --> WLAN etc[/SIZE]
[SIZE=2] [5] GPS --> Nice![/SIZE]
[SIZE=2] [4] CONTROL --> Not tested![/SIZE]
[SIZE=2] [5] DEBUG SCREEN --> Not tested![/SIZE]
[SIZE=2] [6] SUSPEND (001) --> Not tested![/SIZE]
[SIZE=2] [7] TEST SYS(012) --> Not tested![/SIZE]
[SIZE=2] ---------------------------------------[/SIZE]
[SIZE=2] [3] LTE MAIN MENU [/SIZE]
[SIZE=2] [1] DEBUG SCREEN [/SIZE]
[SIZE=2] [2] LTE RF [/SIZE]
[SIZE=2] [3] Reserved --> <E>[/SIZE]
[SIZE=2] [4] BACKOFF PLMN TIMER (T3402) [/SIZE]
[SIZE=2] [4] SIM- Not Used. --> <E>[/SIZE]
[SIZE=2] [5] DOCOMO DEBUG SCREEN --> See Note (c)[/SIZE]
[SIZE=2] [6] run EFS SYNC() --> Not tested![/SIZE]
[SIZE=2] [7] DEBUG SCREEN --> Not tested![/SIZE]
Special Notes for the above:
Code:
[SIZE=2]// = The end point/window where the info is displayed
(This usually doesn't have a title.)
<E> = A "Dead End" that take you into an oo-loop page or back
to a locked *#0011# state.
(a) For accessing this sub-menu you may need to:
1. Unblock the KeyString file with:
echo -n "OFF" > /efs/FactoryApp/keystr
2. Enable the carrier HiddenMenu file with:
echo -n "ON" >/efs/carrier/HiddenMenu
3. Set the device shipping property: ro.product_ship=FALSE
(b) For "FTM" (Factory Test Mode) you probably need to set:
1. Enable the FactoryMode file with:
echo -n "ON" >/efs/FactoryApp/factorymode
2. Set the factory test property: ro.factorytest=1
(c) Not available for non-DOCOMO devices, need correct property(ies).
[/SIZE]
Some Useful Examples
Example-1: Removing SIM network lock
Code:
[SIZE=2]UMTS MAIN MENU[/SIZE]
[SIZE=2][1] DEBUG SCREEN.[/SIZE]
[SIZE=2][6] PHONE CONTROL.[/SIZE]
[SIZE=2][6] NETWORK LOCK[/SIZE]
[SIZE=2][3] PERSO SHA256 OFF[/SIZE]
[SIZE=2]Go Back to Main Menu[/SIZE]
[SIZE=2]UMTS MAIN MENU[/SIZE]
[SIZE=2][6] COMMON[/SIZE]
[SIZE=2][6] NV REBUILD.[/SIZE]
[SIZE=2][4] Restore Back-up.[/SIZE]
[SIZE=2]Reboot[/SIZE]
This has not been tested by me, since I don't use SIM locked providers.
So make sure you have a complete NANDroid backup of your phone in case something
goes wrong. I do not take any responsibility for damaged phone due to this procedure.
Please confirm if this method works for this phone.
​
This is bul****!
I don't see the possibility to do a simple "Boby, sit!"
You should be able to get into service mode directly by using the code *#27663368378#
Sent from my SCH-I435 using XDA Free mobile app
LTE BAND CONFIG CHECK don't work
[7] LTE BAND CONFIG CHECK
it still doesn't work after I -------------------------------------------------------
<E> = A "Dead End" that take you into an oo-loop page or back
to a locked *#0011# state.
(a) For accessing this sub-menu you need two things:
1. KeyString file unblocked: /efs/FactoryApp/keystr: "OFF"
2. Property: ro.product_ship=FALSE
--------------------------------------------------------------------------------------------
Actually I want to check if it support bands change. In China, CMCC seems to only support band41.
wiisixtyfour said:
You should be able to get into service mode directly by using the code *#27663368378#
Sent from my SCH-I435 using XDA Free mobile app
Click to expand...
Click to collapse
Doesn't work on GT-I9195
ladislav.heller said:
Doesn't work on GT-I9195
Click to expand...
Click to collapse
It works for me on the Verizon version. Make sure you set /efs/carrier/HiddenMenu to 'ON'.
Sent from my SCH-I435 using XDA Free mobile app
How to trigger the Nfc Test application?
Package name is com.sec.android.app.nfctest.
Decompiled NfcTestBroadcastReceiver.java file:
Code:
package com.sec.android.app.nfctest;
import android.content.*;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.util.Log;
// Referenced classes of package com.sec.android.app.nfctest:
// NfcTestMain
public class NfcTestBroadcastReceiver extends BroadcastReceiver
{
public NfcTestBroadcastReceiver()
{
}
public void onReceive(Context context, Intent intent)
{
String s = intent.getAction();
if(!s.equals("android.provider.Telephony.SECRET_CODE")) goto _L2; else goto _L1
_L1:
Intent intent1 = new Intent("android.intent.action.MAIN");
if(intent.getData().getHost().equals("[COLOR="Red"]6328378[/COLOR]"))
intent1.setClass(context, com/sec/android/app/nfctest/NfcTestMain);
intent1.setFlags(0x10000000);
context.startActivity(intent1);
_L4:
return;
_L2:
if("android.intent.action.BCS_REQUEST".equals(s))
{
Log.i("NfcTestBroadcastReceiver", "BCS_REQUEST receive");
if("AT+NFCVALUE".equalsIgnoreCase(intent.getStringExtra("command")))
{
NfcAdapter nfcadapter = NfcAdapter.getDefaultAdapter(context);
Log.i("NfcTestBroadcastReceiver", "AT+NFCVALUE!!!");
if(nfcadapter.isEnabled())
{
Log.i("NfcTestBroadcastReceiver", "NFC STATE ON!!!");
context.sendBroadcast((new Intent("android.intent.action.BCS_RESPONSE")).putExtra("response", "ON"));
} else
{
Log.i("NfcTestBroadcastReceiver", "NFC STATE OFF!!!");
context.sendBroadcast((new Intent("android.intent.action.BCS_RESPONSE")).putExtra("response", "OFF"));
}
}
}
if(true) goto _L4; else goto _L3
_L3:
}
}
Tried the secret code *#6328378# in phone dialer but nothing happened.
Update:
But it works from commandline:
Code:
am broadcast -a android.provider.Telephony.SECRET_CODE -d android_secret_code://6328378
jmzwcn said:
[7] LTE BAND CONFIG CHECK
it still doesn't work after I ...Actually I want to check if it support bands change. In China, CMCC seems to only support band41.
Click to expand...
Click to collapse
Does you phone actually support LTE?
What model?
wiisixtyfour said:
It works for me on the Verizon version. Make sure you set /efs/carrier/HiddenMenu to 'ON'.
Click to expand...
Click to collapse
Thank you! Can you find out if there are there other files we should look out for. Can you post the output of "busybox ls -alR" for the /efs directory?
ladislav.heller said:
How to trigger the Nfc Test application?
Package name is com.sec.android.app.nfctest.
Decompiled NfcTestBroadcastReceiver.java file:
Tried the secret code *#6328378# in phone dialer but nothing happened.
Click to expand...
Click to collapse
Great Job! Thanks. BTW. "6328378" = "NFCTEST".
also see if there are some other related files in /efs/ that need to be "enabled".
Make sure to backup you EFS folder, and don't try to add delete files in there, it doesn't work as a normal directory... EFS is more like a solid part of memory. You can change values, but not the number of values (size).
E:V:A said:
Thank you! Can you find out if there are there other files we should look out for. Can you post the output of "busybox ls -alR" for the /efs directory?
Click to expand...
Click to collapse
Here is the output from that command on my SCH-I435:
Code:
.:
drwxrwxr-x root root 1969-12-31 15:00 .files
drwxrwxr-x system system 2013-11-09 01:57 FactoryApp
drwx------ system system 2012-12-31 16:00 U0BwJo4kmkmm-BgyzUZgoEY7pn8_
-rw------- radio radio 212 2013-12-01 16:25 apn-changes.xml
drwxr-xr-x radio radio 2013-11-09 01:49 bluetooth
drwxr-xr-x system system 2012-12-31 16:02 carrier
drwx------ system system 2012-12-31 16:00 drm
-rw------- system system 12 2013-11-09 01:58 gyro_cal_data
-rw-r--r-- root root 16 2012-12-31 16:00 h2k.dat
drwxrwxr-x radio radio 2013-11-09 01:49 imei
-rw------- root root 0 2014-05-01 11:17 log
drwx------ root root 1969-12-31 15:00 lost+found
drwxrwx--- radio system 2013-11-09 01:49 prov
drwx------ system system 2012-12-31 16:00 prov_data
drwxrwxr-x system system 2013-11-09 01:49 wifi
./.files:
drwxrwxr-x media system 1969-12-31 15:00 .dm33
drwxrwxr-x media system 1969-12-31 15:00 .dx1
drwxrwxr-x media system 1969-12-31 15:00 .mp301
./.files/.dm33:
./.files/.dx1:
./.files/.mp301:
./FactoryApp:
-rwxr--r-- system system 1 1970-01-01 15:00 baro_delta
-rw------- system system 5 2014-05-01 06:18 batt_cable_count
-rwxrwxr-x media system 2 2014-04-26 21:12 earjack_count
-rwxr--r-- system system 2 2013-11-09 01:49 factorymode
-rwxrwxr-x system radio 4 1969-12-31 15:00 fdata
-rwxrwxr-x system radio 0 2012-12-31 08:00 hist_nv
-rwxr--r-- system system 10 1970-01-01 15:00 hw_ver
-rwxr--r-- system system 2 2013-11-09 01:49 keystr
-rwxr--r-- system system 5 1970-01-01 15:00 prepay
-rwxr--r-- system system 11 1970-01-01 15:00 serial_no
-rwxrwxr-x system radio 270 2012-12-31 08:00 test_nv
./U0BwJo4kmkmm-BgyzUZgoEY7pn8_:
-rwx------ system system 1072 2012-12-31 16:00 qen2gEqW2A+OTDT0KpoESJiYnrk_
-rwx------ system system 1072 2012-12-31 16:00 zm0WY4lY7rpx3kcVTTDWeh8VFRU_
./bluetooth:
-rw-r--r-- radio radio 17 2013-11-09 01:49 bt_addr
./carrier:
-rwxr--r-- system system 2 2014-04-29 12:42 HiddenMenu
./drm:
drwx------ system system 2012-12-31 16:00 h2k
./drm/h2k:
drwx------ system system 2012-12-31 16:00 8tjfX-7nJB21LtUUWIMbdlUfZTU_
./drm/h2k/8tjfX-7nJB21LtUUWIMbdlUfZTU_:
-rwx------ system system 1072 2012-12-31 16:00 HAv-sOqL1pMh2jiAzRoeKCzAmhE_
-rwx------ system system 1072 2012-12-31 16:00 SNbX8rtYWzaqdrnXa79HbAt5OFM_
./imei:
-rwxrwxr-x radio radio 3 2013-12-23 03:38 mps_code.dat
./lost+found:
./prov:
-rw-rw---- radio system 0 2013-11-09 01:49 libdevkm.lock
./prov_data:
drwx------ system system 2013-11-09 01:49 G+8IRqTrHDIvQWyDjPjJkVB5u6o_
drwx------ system system 2012-12-31 16:00 bG5QQZ77nDjI2757PvvQ3rPPrVg_
./prov_data/G+8IRqTrHDIvQWyDjPjJkVB5u6o_:
-rwx------ system system 1072 2013-11-09 01:49 3mvhJJQ5lPk1G+yj67Y71hI3inI_
-rwx------ system system 1072 2013-11-09 01:49 I0jYBKhtBZN0Rru2UXWB+UZ7Vc0_
-rwx------ system system 1072 2013-11-09 01:49 MHkfmzQg-bRYZzQ4Dc1M+rgodfA_
-rwx------ system system 1072 2013-11-09 01:49 iaBl+cROT4fwHRANIx6tIUgBqSA_
-rwx------ system system 1072 2013-11-09 01:49 qOk21RBBYMeZqVYofK+oU09QG2o_
./prov_data/bG5QQZ77nDjI2757PvvQ3rPPrVg_:
-rwx------ system system 1072 2012-12-31 16:00 4OV1KOT1hf21qdU1tnH6b8mOYLI_
-rwx------ system system 1072 2012-12-31 16:00 CuWlydrYrNFsWwuO0IaVlUQVxEg_
-rwx------ system system 1072 2012-12-31 16:00 gh8lZ2gd7MCgXAgHEgG7apFzmR0_
-rwx------ system system 1072 2012-12-31 16:00 pYEZlsu8egNLf3z5mqguGPyhE2Q_
-rwx------ system system 1072 2012-12-31 16:00 z-yiAOMWDX7wyfLCg5VIl-fyXus_
./wifi:
-rw------- system system 17 2013-11-09 01:49 .mac.cob
-rw-rw-r-- system system 17 2013-11-09 01:49 .mac.info
E:V:A said:
Great Job! Thanks. BTW. "6328378" = "NFCTEST".
also see if there are some other related files in /efs/ that need to be "enabled".
Make sure to backup you EFS folder, and don't try to add delete files in there, it doesn't work as a normal directory... EFS is more like a solid part of memory. You can change values, but not the number of values (size).
Click to expand...
Click to collapse
The NFC test did not work for me either but I am not sure if anything else in EFS should be changed.
Sent from my SCH-I435 using XDA Free mobile app
@wiisixtyfour : Can you edit your post and wrap that output in "CODE" tags (the # icon in advanced editor) please. It formats much better and thus easier to read.
E:V:A said:
@wiisixtyfour : Can you wrap that output in "CODE" tags (the # icon in advanced editor) please.
Click to expand...
Click to collapse
Yeah, sorry I'm on the XDA app and it doesn't have all the tags.
Sent from my SCH-I435 using XDA Free mobile app
my model is i9195
i9195 BTU,have rooted
wiisixtyfour said:
The NFC test did not work for me either but I am not sure if anything else in EFS should be changed.
Click to expand...
Click to collapse
Yeah, not sure what they did, but you can play with the other properties, but first try this:
Code:
[SIZE=2]echo -n "OFF" >/efs/FactoryApp/keystr
echo -n "ON" >/efs/FactoryApp/factorymode
echo -n "ON" >/efs/carrier/HiddenMenu
[/SIZE]
(You may also need to chmod these files before changing. And don't forget to change back after your done playing. It could be that factory mode disables some network functionality.)
Second, all the codes I mentioned in OP, are normally entered by "*#<code>#*", but some phones require this: "*#*#<code>#*#*" before working, so try that as well.
PreConfig application can be started using following command:
Code:
am broadcast -a android.provider.Telephony.SECRET_CODE -d android_secret_code://83052020100812173552301071192687
Serial number, FCC ID and logo screen:
Code:
am broadcast -a android.provider.Telephony.SECRET_CODE -d android_secret_code://737425
heres one for the sch-i435 users
ladislav.heller said:
Serial number, FCC ID and logo screen:
Code:
am broadcast -a android.provider.Telephony.SECRET_CODE -d android_secret_code://737425
Click to expand...
Click to collapse
So im on att currently and had not been happy with the lack of lte due to this being a verizon branded phone (hspa+ was getting me 4.5 mbps at best ,which I owe major thanks to this thread for even getting me that far ) so after tearing through stacks of codes listed in the android manifest xml files attached to he system keystring apps and such (many of which I couldnt get to do much of anything ) I found one that I havent seen listed that goes Into some ims and lte functions which got me 11.5-12+ mbps ranges pretty darn consistantly. The hiddenkeystring for me is ( *#467# ) I am not saying these are great lte speeds but quite a bit better than I was pulling down before and as I said quite consistantly. Hope this helps
oh also I forgot to mention also gives some nice choices for native flash media as well as some various codecs for audio. oh and some tethering options kindof nice as I had recently lost the ability to hotspot and couldnot find a workaround app that was successful. Dam one other set of options regarding the e-9 won won stuff as far as the network I guess maybe
dp929 said:
...The hiddenkeystring for me is ( *#467# ) ...
Click to expand...
Click to collapse
That doesn't work for the 9195, although they seem very similar.
What's your stock ROM and MODEM FW? Perhaps some getprops please.
@dp929 Can you post a screenshot?
Does anyone know how to stop the fm radio from asking for headphones?
I know it uses it as antenna but with an older samsung phone I disabled it, I just don't remember how, and the reception wasn't that bad
thanks

TWRP Flags for BoardConfig.mk

Check out this script by @yuweng to auto(matically|magically) compile TWRP for your device!
Lately the TWRP Compiling guide, has been seeing a lot of newbies who were struggling with TWRP flags to ensure they compile a usable build. So without delay, here we go!
If no input has been suggested, assume true/false
CREDITS :
@Android-Andi for some explanations here
@SdtBarbarossa for some more explanations here
@yuweng for HUGE amount of explanations provided through PM!
# Automatically implies these:
BOARD_HAS_NO_REAL_SDCARD := true
TW_USE_TOOLBOX := true
TW_EXCLUDE_SUPERSU := true
TW_EXCLUDE_MTP := true
TW_OEM_BUILD := true
# Add EXT4 support
TARGET_USERIMAGES_USE_EXT4 := true
# Disable/enable SELinux. Only suggested when you want to enable SELinux support
TWHAVE_SELINUX := true
# Remove MTP support
TW_EXCLUDE_MTP := true
# No screen timeout
TW_NO_SCREEN_TIMEOUT := true
# disables things like sdcard partitioning and may save you some space if TWRP isn't fitting in your recovery patition
BOARD_HAS_NO_REAL_SDCARD := true
# this enables proper handling of /data/media on devices that have this folder for storage (most Honeycomb and devices that originally shipped with ICS like Galaxy Nexus
RECOVERY_SDCARD_ON_DATA := true
# HTC Dumlock for those devices which need it
TW_INCLUDE_DUMLOCK := true
Partition defines
Code:
TW_INTERNAL_STORAGE_PATH
TW_INTERNAL_STORAGE_MOUNT_POINT
TW_EXTERNAL_STORAGE_PATH
TW_EXTERNAL_STORAGE_MOUNT_POINT
# If your device has recovery as a second ramdisk of boot.img
TW_HAS_NO_RECOVERY_PARTITION := true
# To prevent /boot partition not found error
TW_HAS_NO_BOOT_PARTITION := true
# Removes the 'Reboot bootloader' button
TW_NO_REBOOT_BOOTLOADER := true
# Removes the 'Reboot recovery' button
TW_NO_REBOOT_RECOVERY := true
# Disable the battery percentage for devices where it doesn't work properly
TW_NO_BATT_PERCENT := true
# Same as above, for CPU Temperature
TW_NO_CPU_TEMP := true
# Allows you to map a custom keycode for power button, takes in a number, usually three digits
TW_CUSTOM_POWER_BUTTON := 107
# Always use rm -rf to wipe
TW_ALWAYS_RMRF := true
# Prevent TWRP from unmounting /system
TW_NEVER_UNMOUNT_SYSTEM := true
# Removes USB Storage capability
TW_NO_USB_STORAGE := true
# Inject TWRP as a second ramdisk for Samsung devices, which keep recoveries that way.
TW_INCLUDE_INJECTTWRP := true
TW_INCLUDE_BLOBPACK -- NEED HELP
# Specify a path to the lun file on device
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/class/android_usb/android0/f_mass_storage/lun0/file"
# Not very sure, I guess it allows you to simply pop in the lunfile itself
BOARD_UMS_LUNFILE :=
TW_HAS_DOWNLOAD_MODE -- For Samsung devices
TW_NO_SCREEN_BLANK -- NEED HELP
TW_SDEXT_NO_EXT4 -- Blocks EXT4 FS for SD-EXT partitions
# Forces use of /proc/cpuinfo for determining device id. Look here : https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/data.cpp#l183-l184
TW_FORCE_CPUINFO_FOR_DEVICE_ID := true
# For older devices. See here :https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/Android.mk#l383
TW_NO_EXFAT_FUSE := true
# Decryption support for /data
TW_INCLUDE_CRYPTO -- General decryption modules
# On some device, TWRP backup folder name will show 0000000000 bcos cpuinfo has no serial number. Using this flag then it will use ro.product.model as the folder name instead of all 0000000000
TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID := true
# Set the path to the sysfs entry which controls the brightness
TW_BRIGHTNESS_PATH := /sys/devices/platform/s3c24xx-pwm.0/pwm-backlight.0/backlight/pwm-backlight.0/backlight
# A seconday path for the above
TW_SECONDARY_BRIGHTNESS_PATH :=
# Max brightness to prevent display damage
TW_MAX_BRIGHTNESS := 255
# Default brightness for TWRP
TW_DEFAULT_BRIGHTNESS := 150
# Custom battery readout path, don't use the given path though, it is intended to be used for a full diagnostic.
TW_CUSTOM_BATTERY_PATH := /sys/class/power_supply/battery/batt_attr_text
# CPU temp sysfs path, if it is zero all the time.
TW_CUSTOM_CPU_TEMP_PATH := true
# Remove the ability to encrypt backups with a password
TW_EXCLUDE_ENCRYPTED_BACKUPS := true
# Timezone fixes for some Qcom devices.
TARGET_RECOVERY_QCOM_RTC_FIX
TW_NO_LEGACY_PROPS -- NEED HELP
# Supply a custom init.rc for the recovery
TARGET_RECOVERY_INITRC := device/htc/pico/ramdisk/recovery/init.recovery.rc
# Set the default language, if not english
TW_DEFAULT_LANGUAGE := en-US
# Specify architecture
TARGET_ARCH := arm
# For people who would want to have ToyBox rather than Busybox
TW_USE_TOOLBOX := true
# Remove exFAT formatting binaries
TW_NO_EXFAT := true
# Remove SuperSU and stop TWRP prompts to install it
TW_EXCLUDE_SUPERSU := true
# An awesome way to take screenshots. Back-end improvement, no noticeable user side changes. Screenshots work without it too
TW_INCLUDE_FB2PNG := true
BOARD_USES_BML_OVER_MTD -- NEED HELP
# include Logcat daemon for help in debugging
TWRP_INCLUDE_LOGCAT := true
# See here : https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/Android.mk#L435
TARGET_RECOVERY_DEVICE_MODULES := true
TARGET_USERIMAGES_USE_F2FS -- Include mkfs.f2fs for formatting partitions as F2FS
# Include a custom hardwarekeyboard.cpp . Can't see the point though.
TWRP_CUSTOM_KEYBOARD := device/lge/hammerhead/recovery/hardwarekeyboard.cpp
# Log touch input
TWRP_EVENT_LOGGING := true
# @yuwneg :My experience on MTK tablet, typical is RECOVERY_TOUCHSCREEN_SWAP_XY & RECOVERY_TOUCHSCREEN_FLIP_Y is use is pair as MTK vendor tend to use landscape LCD but a normal portrait Touch Screen !
TW_X_OFFSET -- X-Axis offset for borked displays
TW_Y_OFFSET -- Y-Axis offset for borked displays
# Smartwatch optimisation
TW_ROUND_SCREEN := true
TW_THEME -- New flag, takes in the following : portrait_mdpi, landscape_mdpi, portrait_hdpi,landscape_hdpi,watch_mdpi . It should be caps but when I was compiling a minute ago, it threw me an error and asked to de-caps it. So, see for yourself what works
TW_CUSTOM_THEME -- Use a custom theme like materialised by @z31s1g . Give the path to the contents here.
TWRP_NEW_THEME -- Old is gold. Put false to use the old one.
TW_EXTRA_LANGUAGES -- Set to true and enable localisation
TW_MTP_DEVICE -- Specify a custom device name for MTP
TW_TARGET_USES_QCOM_BSP -- Qcom specific enhancements
TARGET_PREBUILT_KERNEL -- Use a prebuilt kernel rather than building from source
TARGET_RECOVERY_PIXEL_FORMAT -- Use RGBA,RGBX,ARGB and whatever, I don't remember, see the main thread for that info.
TARGET_RECOVERY_OVERSCAN_PERCENT -- Defines the padding to leave around the screen edges
BOARD_USE_CUSTOM_RECOVERY_FONT -- Specify a .ttf file to use as default font
BOARD_CUSTOM_GRAPHICS -- include customised graphics backends if 3.0.0-0 broke stuff for you
TARGET_CUSTOM_KERNEL_HEADERS -- NEED HELP
TW_NEW_ION_HEAP -- NEED HELP
Self Explanatory
Code:
RECOVERY_TOUCHSCREEN_SWAP_XY
RECOVERY_TOUCHSCREEN_FLIP_X
RECOVERY_TOUCHSCREEN_FLIP_Y
RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH -- Fixes slanty graphics
TW_DISABLE_DOUBLE_BUFFERING -- NEED HELP
TARGET_RECOVERY_FORCE_PIXEL_FORMAT -- NEED HELP FOR POSSIBLE INPUTS
BOARD_HAS_FLIPPED_SCREEN -- For people whose screens were mounted the wrong side across
TW_IGNORE_MAJOR_AXIS_0 -- NEED HELP
TW_IGNORE_MT_POSITION_0 -- NEED HELP
TW_IGNORE_ABS_MT_TRACKING_ID -- NEED HELP
TW_INPUT_BLACKLIST -- NEED HELP
TW_WHITELIST_INPUT -- NEED HELP
TARGET_HW_DISK_ENCRYPTION -- NEED HELP
TW_HAVE_X86_ACCELERATED_PIXELFLINGER -- Improvements for x86 based devices
ARCH_ARM_HAVE_NEON -- Take advantage of ARM-NEON optimisations
# remove TrueType fonts
TW_DISABLE_TTF:= true
# building of an OEM friendly TWRP. excludes SuperSu, uses Toolbox instead busybox, disables themeing. MORE INFOS TO BE ADDED
TW_OEM_BUILD := true
# Adds EXT4 formatting binaries
TARGET_USERIMAGES_USE_EXT4 := true
# exclude mtp from twrp (disable if you are not able to fix it device/kernel side, safes some space)
TW_EXCLUDE_MTP := true
# screen will stay awake
TW_NO_SCREEN_TIMEOUT := true
# needed on devices without a recovery partition (some devices have recovery included im boot.img)
TW_HAS_NO_RECOVERY_PARTITION := true
# removes the reboot option to boot into boooader, needed e.g. on samsung devices which use Download mode instead
TW_NO_REBOOT_BOOTLOADER := true
# add an option in reboot menu to reboot into Download Mode
TW_HAS_DOWNLOAD_MODE := true
# some devices don't have a temp sensor, disable in such case to stop spamming recovery.log
TW_NO_CPU_TEMP := true
# recursive delete by default instead fotmatting (available optional inside recovery settings too)
TW_ALWAYS_RMRF := true
# system won't be unmounted,
TW_NEVER_UNMOUNT_SYSTEM := true
# don't blank screen (available optional inside recovery settings too)
TW_NO_SCREEN_BLANK := true
# deprecated, use TW_INCLUDE_CRYPTO instead
TW_INCLUDE_JB_CRYPTO := true
# add support for encryption
TW_INCLUDE_CRYPTO := true
# use a custom init.rc in recovery, add the path. Example:
TARGET_RECOVERY_INITRC := device/samsung/p3100/rootdir/init.twrp.rc
# ToyBox (disables busybox?)
TW_USE_TOOLBOX := true
# exclude SuperSu e.g. to save some space or for different other reasons (supersu still included bx default?)
TW_EXCLUDE_SUPERSU := true
# include f2fs support (make sure your kernel supports f2fs!)
TARGET_USERIMAGES_USE_F2FS := true
# device resolution - deprecated, use TW_THEME instead
DEVICE_RESOLUTION :=
# define the theme for your device resolution, note: you can also use smaller/bigger themes because the theme get scaled for your deviceresolution anyway):
# 240x240 280x280 320x320
TW_THEME := watch_mdpi
# 320x480 480x800 480x854 540x960
TW_THEME := portrait_mdpi
# 720x1280 800x1280 1080x1920 1200x1920 1440x2560 1600x2560
TW_THEME := portrait_hdpi
# 800x480 1024x600 1024x768
TW_THEME := landscape_mdpi
# 1280x800 1920x1200 2560x1600
TW_THEME := landscape_hdpi
# auto copy files placed in device/$VENDOR/$DEVICENAME/recovery/root inside recovery ramdisk (e.g. init.recivery*.rc which get removed from recoveryramdisk by default). example:
TARGET_RECOVERY_DEVICE_DIRS += device/samsung/espresso-common
# path to a prebuild kernel (can be used if you are unable to compile a kernel yourself, e.g. if no kernel source available)
TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/prebuilt/zImage
# swap x anf y axis for touch
RECOVERY_TOUCHSCREEN_SWAP_XY := true
# flip x axis for touch
RECOVERY_TOUCHSCREEN_FLIP_X := true
# flip y axis for touch,
RECOVERY_TOUCHSCREEN_FLIP_Y := true
Gesendet von meinem LG-H815 mit Tapatalk
---------- Post added at 05:23 PM ---------- Previous post was at 05:19 PM ----------
# don't include default init.recovery.usb.rc, provide your own or use needed defines inside init.recovery.$DEVICE.rc
TW_EXCLUDE_DEFAULT_USB_INIT := true
Gesendet von meinem LG-H815 mit Tapatalk
Android-Andi said:
...
Gesendet von meinem LG-H815 mit Tapatalk
Click to expand...
Click to collapse
Thanks sir for the suggestions. I can see I've included the descriptions for most of them already, but I'll be sure to attribute to and add the rest tomorrow. I would be grateful if you could shed some light on the ones I've marked "NEED HELP"
MSF Jarvis said:
Thanks sir for the suggestions. I can see I've included the descriptions for most of them already, but I'll be sure to attribute to and add the rest tomorrow. I would be grateful if you could shed some light on the ones I've marked "NEED HELP"
Click to expand...
Click to collapse
I've done those stuff offline from your gist[emoji14]have seen this thread after that but maybe you like the way i showed the defines as it's setup the way you would do in your BoardConfig.mk.
Haven't done those flags i am not sure about myself, maybe @_that or @Dees_Troy can bring light to some of them.
Gesendet von meinem LG-H815 mit Tapatalk
This thread is a great idea.
Especially with the update to twrp 3.0 with new flags.
I've been lucky enough to be able to guess/puzzle out/grab from other device trees enough to build and use the recovery on my personal devices, but information like this is very helpful to have consolidated.
Thanks for sharing.
Android-Andi said:
I've done those stuff offline from your gist[emoji14]have seen this thread after that but maybe you like the way i showed the defines as it's setup the way you would do in your BoardConfig.mk.
Haven't done those flags i am not sure about myself, maybe @_that or @Dees_Troy can bring light to some of them.
Gesendet von meinem LG-H815 mit Tapatalk
Click to expand...
Click to collapse
Yeah, I just didn't have enough time to beautify it. Will gradually do so.
TW_CUSTOM_THEME := /path/to/theme/
this one is used to replace the stocktheme with a different one (like material-play)
the theme will be directly in ramdisk
TW_INCLUDE_INJECTTWRP := true — adds ability to inject TWRP into some Samsung boot images for Samsung devices that have recovery as a second ramdisk in the boot image
the second flag is quotes by dees_troy!
TW_NEW_ION_HEAP
this has sonething to do with 3.10 kernels and a different naming in /include/linux/ion.h ... like a switch between old heap_mask and new heap_id_mask
Sent from my Xperia T using XDA Free mobile app
Nice initiative with this thread, this has been oh say 2 years too long in the making haha.
TARGET_RECOVERY_FORCE_PIXEL_FORMAT
Not sure but I would imagine it overrides what TWRP detects nor do I see the difference between it and TARGET_RECOVERY_PIXEL_FORMAT. The only possible varible right now is RGB_565. BGRA_8888, RGBA_8888 and RGBX_8888 are not yet implemented.
TW_INPUT_BLACKLIST
Black list input devices that interfere with touch. For multiple input devices the delimiter is \x0a. You would basically build a special TWRP with TWRP_EVENT_LOGGING := true. Put it on the device and read the more verbose log to see what inputs you want to blacklist.
EDIT: Ah here is a copy of the wording I had in one of my xda posts about the subject and the commit link https://github.com/omnirom/android_bootable_recovery/commit/5742a40b87dfdc26df3bd9fe94197ae414ece546
Usage:
TW_INPUT_BLACKLIST := accelerometer
TW_INPUT_BLACKLIST := "accelerometer\x0agyroscope"
This can be used to fix touch input on devices where an input
device is breaking touch processing in TWRP.
We are using new line chars to separate multiple devices and in
the make file you specify the new line character with \x0a which
is the hex code in ASCII for a new line.
The new line character might be a bit of a pain to use as a
delimeter, but it is highly unlikely that an OEM will ever name
an input device with a new line character in the name.
Change-Id: I255136b7a686909a23e649918c661843153c2853
Click to expand...
Click to collapse
and here is an example from my BoardConfig
TW_INPUT_BLACKLIST := "accelerometer\x0admard06\x0alis3dh_acc\x0alis3de_acc"
On a side note is there a link somewhere to fixing graphics issues induced in 3.0? I see a lot of talk about it but nothing substantial.
aicjofs said:
On a side note is there a link somewhere to fixing graphics issues induced in 3.0? I see a lot of talk about it but nothing substantial.
Click to expand...
Click to collapse
Not really. Slanty graphics can be fixed with linelength, but as such there's nothing on that front. You might wanna slap a recovery.log onto Dees_Troy at #twrp on webchat.freenode.net though.
Every version has new flags introduced & also flags deprecated...
TARGET_USES_LOGD => Source
TW_SCREEN_BLANK_ON_BOOT ( Deprecated on android-6.0 => Source, on some legacy devices, TWRP will not boot without this flag)
Dees_Troy said:
There are other build flags which you can locate by scanning the Android.mk files in the recovery source. Most of the other build flags are not often used and thus I won't document them all here.
Source
Click to expand...
Click to collapse
Use the_silver_searcher, its extremely fast ! :good:
Code:
cd ~/cm/bootable
ag -ia "[URL="https://gerrit.omnirom.org/#/c/16610/"]TW_INCLUDE_JPEG[/URL]" recovery/
recovery/minuitwrp/resources.cpp
34:#ifdef TW_INCLUDE_JPEG
256:#ifdef TW_INCLUDE_JPEG
361:#ifdef TW_INCLUDE_JPEG
367:#ifdef TW_INCLUDE_JPEG
recovery/minuitwrp/Android.mk
61:ifneq ($(TW_INCLUDE_JPEG),)
64: LOCAL_CFLAGS += -DTW_INCLUDE_JPEG
176:ifneq ($(TW_INCLUDE_JPEG),)
recovery/prebuilt/Android.mk
126:ifneq ($(TW_INCLUDE_JPEG),)
Code:
ag -ia "[COLOR="Blue"]TW_FLASH_FROM_STORAGE[/COLOR]" recovery/
recovery/Android.mk
262:#ifeq ($(TW_FLASH_FROM_STORAGE), true) [COLOR="Blue"]Making this the default behavior[/COLOR]
263: LOCAL_CFLAGS += -DTW_FLASH_FROM_STORAGE
As the code says, its already the default therefore you don't need to specify it again on BoardConfig.mk
Code:
ag -ia "[URL="https://gerrit.omnirom.org/#/c/14099/"]TW_INCLUDE_NTFS_3G[/URL]" recovery/
recovery/Android.mk
440:ifeq ($(TW_INCLUDE_NTFS_3G),true)
recovery/prebuilt/Android.mk
201:ifeq ($(TW_INCLUDE_NTFS_3G),true)
At the omnirom gerrit, you'll find all commits though you gotta search for it or try this or this for TWRP related
Code:
ag -ia "[COLOR="blue"]TW_BOARD_CUSTOM_GRAPHICS[/COLOR]" recovery/
recovery/minuitwrp/Android.mk
14:ifneq ($(TW_BOARD_CUSTOM_GRAPHICS),)
16: $(warning * TW_BOARD_CUSTOM_GRAPHICS support has been deprecated in TWRP. *)
Code:
ag -ia "[COLOR="Blue"]TW_DISABLE_TTF[/COLOR]" recovery/
recovery/minuitwrp/Android.mk
165:ifeq ($(TW_DISABLE_TTF), true)
167: $(warning * TW_DISABLE_TTF support has been deprecated in TWRP. *)
recovery/prebuilt/Android.mk
192:ifneq ($(TW_DISABLE_TTF), true)
Code:
BOARD_SUPPRESS_SECURE_ERASE := true
BOARD_SUPPRESS_EMMC_WIPE := true
Source, further explanation here
Code:
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixr!
Fix tzdata on recovery.log => Source
AIO-TWRP-Compiler on BBQLinux
First step
Refer to here on how to setup BBQLinux either native boot, dual-boot or on VBox... :good:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Download the script & extract it to your HOME or if you are 100% sure that you have already setup a fully working Build Environment on Ubuntu or any other linux distro then remark these lines.
Start Terminal => Edit => Profile Preferences => Colors => unchecked => Use colors from system theme => Built-in schemes => White on Black => Close
BBQLinux => Menu => Administration => BBQLinux Python Switcher => Python 2
BBQLinux => Menu => Administration => BBQLinux Java Switcher => OpenJDK 7
Start the script with below command
Code:
sh twrp
Menu 1
You can use either OmniROM or Cyanogenmod repo to build TWRP
Choose either to use TWRP branch android-5.1 or android-6.0. Typically, for legacy devices with ICS or JB doesn't support TTF so if TWRP android-6.0 doesn't boot then you'll have to use android-5.1 branch.
You can either choose to use Full-Source or Part-Source. Compiled out recovery.img will have exactly the same size & files on ramdisk.
Yes, Part-Source is only using 41 of the projects to build a fully working TWRP. Syncing in progress. After syncing, you can refer to ~/AIO-TWRP-Compiler/sync.log for any error
Typically, when you have already downloaded the base repo, re-syncing it will only take a few seconds
Menu 2
Copy either your boot or recovery.img to ~/AIO-TWRP-Compiler folder
Key-in your vendor name
Key-in your device name
This step is extracting the ro.product.device & ro.product.model from your device directly which is typically require for identification when flashing update.zip from your vendor
Credits to RD osm0sis, the script will auto download osm0sis's unpackbootimg for mkbootimg arguments required for repacking recovery.img . . . :good:
mkbootimg arguments will be display & auto updated to the BoardConfig.mk
Part of the original mkvendor.sh script is adapted for the extraction of boot or recovery.img which also does the git initialization. If the ramdisk can be unpack then the recovery.fstab will be copied to the device tree folder, if not then it will create a basic MTK recovery.fstab, boot.mk & also BOARD_CUSTOM_BOOTIMG_MK. If you're not building for MTK then remove that line from BoardConfig.mk
You will need to add/ remove TWRP flags accordingly & manual edit on the TARGET_CPU_VARIANT either cortex-a7 or cortex-a9 for older MTK, refer to your device spec. Possible values are cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a15, krait, scorpion. Use generic for devices that do not have a CPU similar to any of the supported cpu variants
You will need to manual edit on the recovery.fstab to suit your device or TWRP-ify the extracted stock recovery.fstab
Menu 3
omni.dependencies is only a warning, will continue to build when you choose OmniROM repo
Make 4.1 is only a warning, will continue to build
Java 1.7 is only a warning, will continue to build
When you have build earlier, subsequent build will only take few minutes bcos of CCACHE... :good:
Menu 4
Updated Menu 4 support for Others. Or you can use Flashify or Rashr or above Others to install compiled recovery.img to your device, do check if they are compatible or it will brick your recovery or worse, whole device !
Key-in your device recovery partition path. Above is typical for LG
Done, test TWRP on your device to make sure it is working properly if not then add or remove flags accordingly & use Menu 3 to build again
Menu 5
Choose either Option 1 or 2, Option 2 is recommended & it won't take long if you are using Part-Source.
Menu 6
The script will auto open up a new browser for you to register a new account on github
Your device tree on github
AIO-TWRP-Compiler
bash script itself is self-explanatory. Thanks to the OP, he has offer to take over the maintenance of this script so hit your Thanks button to him... :good: If you found any error/ bug or have any new ideas/ features for this script then pm the OP or do a git pull request... :good:
Above is the detail explanation on the script GUI front-end, here i'll explained what the script actually does.
Menu 1
This menu will create a local_manifest.xml to remove unwanted projects based on your selection. When select Full-Source, it will also create local_manifest.xml to remove existing recovery & replace it with TWRP based on your selection.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remove-project name="android_bootable_recovery" />
<project path="bootable/recovery" name="omnirom/android_bootable_recovery" revision="[COLOR="Blue"]android-6.0[/COLOR]" />
</manifest>
Part-Source
It is normal that OmniROM & CM will consistently add new projects to their repo when they introduce new features or functions to it. The beauty of this Part-Source is that even when projects grows, this script will grep -v only the needed projects for building TWRP on any base repo.
This Part-Source is the extreme minimal for building TWRP therefore some of the additional projects are needed when you use particular TWRP flags. As of today ( March 2016 ), it will build a fully working TWRP with only 44 projects on both OmniROM 4.4 & CM 11 base repo. In the future, Teamwin may also add a new feature or function then you will also need to add additional projects to it too or OP will update it based on your feedback. Refer to compile.log for details.
Code:
# Optional => TARGET_USERIMAGES_USE_F2FS := true
[COLOR="Red"]#[/COLOR]grep -v f2fs-tools ~/x > ~/x.tmp;mv ~/x.tmp ~/x
If you use TARGET_USERIMAGES_USE_F2FS := true then remove the remark #
Code:
# Optional => TW_INCLUDE_NTFS_3G := true
[COLOR="Red"]#[/COLOR]grep -v external/ntfs-3g ~/x > ~/x.tmp;mv ~/x.tmp ~/x
if you use TW_INCLUDE_NTFS_3G := true then remove the remark #
Code:
# Optional => TW_USE_TOOLBOX := true
[COLOR="red"][B]#[/B][/COLOR]grep -v external/toybox ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="Red"]#[/COLOR]grep -v external/mksh ~/x > ~/x.tmp;mv ~/x.tmp ~/x
If you use TW_USE_TOOLBOX := true then remove the remark #. toybox available on android-6.0/ cm-13.0 only, don't have such projects on android-4.4 but it'll work, refer to the end for more info.
Code:
# un-remark the below required for x64
[COLOR="Red"]#[/COLOR]grep -v linux-x86/aarch64/aarch64-linux-android-4.8 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/aarch64/aarch64-linux-android-4.9 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
Code:
TARGET_ARCH := arm64
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 := armeabi-v7a
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_VARIANT := generic
TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv7-a-neon
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := cortex-a7
If you are building x64 TWRP then remove the remark # & update BoardConfig.mk accordingly. Take note, not available on android-4.4/ cm-11.0 base repo, use later base repo.
Code:
# un-remark the below required for kernel compiling if not using TARGET_PREBUILT_KERNEL
[COLOR="red"]#[/COLOR]grep -v linux-x86/arm/arm-eabi-4.6 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/arm/arm-eabi-4.7 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/arm/arm-eabi-4.8 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
if you are building your own kernel then remove the remark #
Code:
# Optional for x86 SoC
[COLOR="Red"]#[/COLOR]grep -v linux-x86/x86/i686-linux-android-4.7 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/x86/x86_64-linux-android-4.8 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/x86/x86_64-linux-android-4.9 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
Code:
TARGET_ARCH := [COLOR="blue"]x86[/COLOR]
TARGET_CPU_ABI := armeabi
TARGET_ARCH_VARIANT := [COLOR="blue"]x86[/COLOR]
TARGET_CPU_VARIANT := [COLOR="blue"]x86[/COLOR]
if you are building for Intel SoC then remove the remark # & edit the BoardConfig.mk accordingly
This script has been tested & it works on any base repo from OmniROM android-4.4, 5.0, 5.1 & 6.0 & Cyanogenmod cm-11.0, cm-12.0, cm12.1 & cm13.0 using Full-Source or Part-Source but why use Full-Source to build TWRP when Part-Source works, most importantly, you are not building OmniROM or Cyanogenmod but TWRP.... Using android-4.4/ cm-11.0 base repo has its advantage, compiled TWRP size will be smaller & it can build all version.
If you use android-6.0/ cm-13.0 then obviously you can only build TWRP android-6.0 only, just edit the line 62, 63 for OmniROM or 72, 73 for CM accordingly. Building TWRP android-4.4 on cm-13.0 or on OmniROM android-6.0 will result in a build error ! Later base repo won't build TWRP older version !
Many newbies doesn't know that OmniROM/ CM repo are incremental updates & they create a separate cm11, cm12, cm12.1, cm13 each & sync individually to each of these folders.
Above syncing cm-13.0 & as you can see, it is also using source from cm-10.1, 10.2 & 11. Syncing all to the same ~/omni or ~/cm folder will do.
Sometimes on certain devices, OmniROM android-4.4 or Cyanogenmod cm-11.0 base repo just won't boot then you can try by editing this line to android-5.0 or cm-12.0 & updating it will only take a very short time if you use Part-Source.
Menu 2
Device tree
This script will create a barebone minimal device tree for building TWRP. Anything less will result in a build error. It will create five files which is just sufficient to build a fully working TWRP using prebuilt kernel. It will build kernels too, just update the correct kernel config to BoardConfig.mk & remove the remark # needed projects for building kernels. However, i don't see the needs to build the same kernel with every TWRP new build, it will take a longer time to build, most importantly, you are not building a ROM.
Code:
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/cm_[COLOR="blue"]device name that you have key-in[/COLOR].mk
AndroidProduct.mk
Code:
TARGET_ARCH := arm
TARGET_CPU_ABI := armeabi
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_CPU_VARIANT := [COLOR="blue"]cortex-a9[/COLOR] [COLOR="Red"]<= You only need to change this to suit your device[/COLOR]
BOARD_RECOVERYIMAGE_PARTITION_SIZE := [COLOR="Red"]0x105c0000[/COLOR] [COLOR="red"]<= You need to update this so that build will error out when the size exceed your recovery partition size[/COLOR]
BOARD_FLASH_BLOCK_SIZE := 131072
TARGET_PREBUILT_KERNEL := device/TD2/9300/kernel
BOARD_MKBOOTIMG_ARGS := --base 10000000 --pagesize 2048 --kernel_offset 00008000 --ramdisk_offset 01000000 --tags_offset 00000100
[COLOR="Blue"]#MTK common twrp flags[/COLOR] [COLOR="Red"]<= You only need to change the below flags to suit your device[/COLOR]
TW_NO_EXFAT := true
TWHAVE_SELINUX := true
TW_DISABLE_TTF := true [COLOR="red"]<= Will error out on TWRP android-6.0[/COLOR]
[COLOR="red"]#[/COLOR]TW_USE_TOOLBOX := true [COLOR="red"]<= You'll need extra projects for this flag, edit the script accordingly[/COLOR]
TW_NO_EXFAT_FUSE := true
TW_THEME := [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/gui/Android.mk#l96-L100"]portrait_mdpi[/URL]
[COLOR="red"]#[/COLOR]RECOVERY_SDCARD_ON_DATA := true [COLOR="red"]<= For [URL="https://twrp.me/faq/datamedia.html"]data/media[/URL] device[/COLOR]
TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID := true
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/platform/mt_usb/gadget/lun%d/file"
BoardConfig.mk
Code:
# Inherit device configuration
$(call inherit-product, device/[COLOR="blue"]TD2[/COLOR]/[COLOR="blue"]9300[/COLOR]/device_[COLOR="blue"]9300[/COLOR].mk)
## Device identifier. This must come after all inclusions
PRODUCT_DEVICE := [COLOR="blue"]9300[/COLOR]
PRODUCT_NAME := cm_[COLOR="blue"]9300[/COLOR]
PRODUCT_BRAND := [COLOR="blue"]TD2[/COLOR]
PRODUCT_MODEL := [COLOR="blue"]9300[/COLOR]
PRODUCT_MANUFACTURER := TD2
Code:
$(call inherit-product, build/target/product/[URL="https://github.com/CyanogenMod/android_build/blob/cm-11.0/target/product/full_base_telephony.mk"]full_base_telephony.mk[/URL])
# Time Zone data [COLOR="red"]<= This have been disable as some device will not boot, to enable it just remove the remark [B]#[/B] below[/COLOR]
[COLOR="red"]#[/COLOR]PRODUCT_COPY_FILES += \
[COLOR="Red"]#[/COLOR]bionic/libc/zoneinfo/tzdata:recovery/root/system/usr/share/zoneinfo/tzdata
PRODUCT_BUILD_PROP_OVERRIDES += \
PRODUCT_MODEL="i9300" \ [COLOR="Red"]<= This is where Menu 2 will get the ro.product.device & ro.product.model info[/COLOR]
TARGET_DEVICE="bird77_a_cu_ics2"
PRODUCT_NAME := full_[COLOR="Blue"]9300[/COLOR]
PRODUCT_DEVICE := [COLOR="blue"]9300[/COLOR]
device_(device-name).mk & cm.mk will be auto-created based on what you have key-in for the vendor & device name at Menu 2
For building recovery, you don't need to use full.mk, using it will result in need of extra projects on the Part-Source & it will also copy the extra fstab.goldfish & ueventd.goldfish.rc to the root of the ramdisk
Code:
# mount point fstype device [device2]
/boot emmc /dev/bootimg
/recovery emmc /dev/recovery
/system ext4 /dev/block/mmcblk0p3
/cache ext4 /dev/block/mmcblk0p4
/data ext4 /dev/block/mmcblk0p5
/emmc vfat /dev/block/mmcblk0p6 flags=display="Phone Storage";settingsstorage
/sdcard vfat /dev/block/mmcblk1p1 flags=display="SD Card";storage;removable
/sd-ext auto /dev/block/mmcblk1p2
/nvram emmc /dev/nvram flags=display="Nvram";backup=1
/uboot emmc /dev/uboot flags=display="Uboot";backup=1
#/boot emmc /dev/block/platform/mtk-msdc.0/by-name/boot flags=display="Boot";backup=1
#/recovery emmc /dev/block/platform/mtk-msdc.0/by-name/recovery flags=display="Recovery";backup=1
#/system ext4 /dev/block/platform/mtk-msdc.0/by-name/system flags=display="System";backup=1
#/cache ext4 /dev/block/platform/mtk-msdc.0/by-name/cache flags=display="Cache"
#/data ext4 /dev/block/platform/mtk-msdc.0/by-name/userdata flags=encryptable=/dev/block/platform/mtk-msdc.0/by-name/metadata
#/nvram emmc /dev/block/platform/mtk-msdc.0/by-name/nvram flags=display="Nvram";backup=1;flashimg=1
#/external_sd auto /dev/block/mmcblk1p1 flags=display="External SDcard";storage;wipeingui;removable;backup=0
#/usbotg auto /dev/block/sda1 flags=display="Usb-Otg";storage;removable;backup=0
#/boot mtd boot
#/recovery mtd recovery
#/cache yaffs2 cache
#/data yaffs2 userdata
#/misc mtd misc
#/system yaffs2 system
#/sdcard vfat /dev/block/mmcblk0p1
#/sd-ext ext4 /dev/block/mmcblk0p2
recovery.fstab - Edit or delete whatever that is not relevant to your device. Use osm0sis AIK to unpack your stock recovery.img & TWRP-ify the recovery.fstab... :good:
Code:
#
# Copyright (C) 2013 Intel Mobile Communications GmbH
#
# Sec Class: Intel Confidential (IC)
#
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
#
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID068 /system ext4 defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID069 /data ext4 defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID070 /cache ext4 defaults defaults
/dev/block/mmcblk1p1 /sdcard vfat defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID076 /nvm_fs_partition ext4 defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID074 /misc emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID071 /boot emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID119 /recovery emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID120 /recoverym emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID001 /mobilevisor emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID013 /splash_screen emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID115 /mvconfig emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID118 /secvm emmc defaults defaults
Most latest Android devices are using fstab version 2 AKA fstab 2 while TWRP is using fstab 1. Eg. Above is my Intel X3 stock recovery.fstab
Code:
# mount point fstype device [device2]
/boot emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID071
/recovery emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID119 flags=display=recovery;backup=1
/imei emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID022 flags=display=imei;backup=1
/mobilevisor emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID001 flags=display=mobilevisor;backup=1
/mvconfig emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID115 flags=display=mvconfig;backup=1
/secvm emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID118 flags=display=secvm;backup=1
/system ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID068
/data ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID069
/cache ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID070
/nvm_fs_partition ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID076
/external_sd vfat /dev/block/mmcblk1p1 flags=display="Micro SDCard";storage;removable
/usbotg auto /dev/block/sda1 flags=display=USB-OTG;storage;removable
My TWRP-ify recovery.fstab. Typically, for ext4 partition, you don't need to specify flags=display= & backup=1, it will be taken care of by TWRP, for more info regarding fstab flags then refer to Main Thread for *RECOVERY.FSTAB*... :good:
RD osm0sis's unpackbootimg is able to extract --second <2ndbootloader-filename> & also --second_offset <address>
The repack arguments will be auto-updated to the BoardConfig.mk Thanks to RD osm0sis. Some TWRP flags ref taken from here... :good:
osm0sis's unpackbootimg also support --dt <filename> :good:
Some devices require additional info for factory update.zip then add it accordingly to the device tree, typically is your device_(device-name).mk. Look at other device tree here & here & here for reference. On CM base repo, you can also use mkvendor.sh... :good: However, you will need to manually edit certain files as no DEV has been updating it, currently it will result in a build error even when using Full-Source !
Do take note that even an extra space on some of the lines at BoardConfig.mk will result in a build error !
Menu 3
Below are the commands to build TWRP, thats it !
Code:
cd ~/omni
[COLOR="blue"]OR[/COLOR]
cd ~/cm
prebuilts/misc/linux-x86/ccache/ccache -M 25G
export USE_CCACHE=1
export LC_ALL=C
source build/envsetup.sh
lunch [COLOR="blue"]omni[/COLOR]_S939-eng [COLOR="blue"]<= S939 is the device name[/COLOR]
[COLOR="Blue"]OR[/COLOR]
lunch [COLOR="blue"]cm[/COLOR]_S939-eng
make -j4 recoveryimage
Menu 4
Below command generically will work on most Android devices. Updates : Has updated this menu to support this, just key-in /path-to-your-device-recovery-partition
Code:
adb push [COLOR="blue"]$OUT[/COLOR]/recovery.img /data/local/tmp
adb shell su -c "dd if=/data/local/tmp/recovery.img of=/[COLOR="blue"]path-to-your-device-recovery-partition[/COLOR]"
To use the $OUT path, you must first source it then lunch your device name, refer to previous Menu 3 for info.
Menu 5
Option 1 is make clean
Option 2 is wipe the whole repo base folder except the hidden .repo folder. As mention on the script GUI front-end, after that, use Menu 1 will have all the files extracted out.
Menu 6
This menu is using curl to create github repo.
It is for you to publish your device tree either for diagnostic & debugging when you ask for help. It is also for you to share a working build so that others can refer to it when they make a build of their own or git clone yours & build it themselves.
Preface & Credits
Many newbies make mistake by using other DEV's device tree which is normally meant for building ROMs, using it to build TWRP therefore will result in alot of build errors !
Above script can also be use to build TWRP for any Android devices that uses standard Android header, except for Menu 4 which is specifically for MTK devices only. Just edit the script to add support for your device... :good: Updated support for other devices
This project was actually started way back at 2013 & this is the main reason why TWRP doesn't build is bcos of the tedious, confusing & wrong Build Environment setup, it is all so different on so many different linux distros & OSes version, i went on to developed Easy Magic TWRP.... Now i use Intel device & this script did build a working TWRP for it too.... :laugh:
That's why i strongly recommends BBQLinux for beginners, Thanks to RD codeworkx, i can guarantee that any Build Error is not cause by wrong BE setup as its already built-in on BBQLinux... :good:
The other reason TWRP doesn't boot is bcos of wrong mkbootimg repack arguments, Thanks to RD osm0sis for his awesome unpackbootimg... :good:
Since many newbies are having problems with building TWRP & flooding the TWRP thread here
Dees_Troy said:
This guide isn't going to be a step-by-step, word-for-word type of guide. If you're not familiar with basic Linux commands and/or building in AOSP then you probably won't be able to do this.
Click to expand...
Click to collapse
Which is actually meant for intermediate users, i've offered to share this script when OP decided to open up a new thread here for TWRP flags.... :good:
Credits Updates
Hacker432 for testing & feedbacks on this script, now it uses the ATC folder so that it'll support other languages other than English & TWRP will boot now when build on cm-12.1 base repo... :good:
OP for giving this script a glamour name ATC aka AIO-TWRP-Compiler... :laugh: :highfive: :good:
My TWRP doesn't boot
Try unpack/ repack your stock 3e recovery.img with AIK, push it to your device & if it doesn't boot then obviously your device is not using standard Android header & so does this script will not build a bootable TWRP. Try google your device info on how they did it, Eg. Sony devices uses BOARD_CUSTOM_BOOTIMG_MK for repacking boot & recovery.img & update it accordingly to your BoardConfig.mk
Code:
adb shell cat /proc/last_kmsg
[COLOR="Blue"]OR[/COLOR]
adb shell cat /proc/last_kmsg > kmsg.txt
[U][COLOR="blue"]On Android-6.0 Marshmallow[/COLOR][/U]
adb shell cat /sys/fs/pstore/console-ramoops
[COLOR="blue"]OR[/COLOR]
adb shell cat /sys/fs/pstore/console-ramoops > kmsg.txt
Source
Extreme minimal, TWRP require this only one flag TW_THEME := to build or it will error out. You will also need other flags as well, refer to the OP. Some devices won't boot when certain TWRP flag is used or not used bcos its not compatible with your device kernel ! Most legacy device doesn't support TTF & TWRP won't boot so you have to build with TWRP android-5.1 with TW_DISABLE_TTF := true flag
Code:
[URL="https://github.com/TeamWin/android_device_kazam_thunder_q45/blob/cm-10.2/BoardConfig.mk#l49"]TW_NO_EXFAT := true[/URL] [COLOR="Red"]<= To disable exfat[/COLOR]
[URL="https://github.com/TeamWin/android_device_kazam_tornado_348/blob/android-4.4/BoardConfig.mk#l50"]TW_NO_EXFAT_FUSE := true[/URL] [COLOR="Red"]<= To disable exfat[/COLOR]
[URL="https://github.com/carliv/device_elephone_p6000/blob/cm-11.0/BoardConfig.mk#l110"]TW_USE_TOOLBOX := true[/URL] [COLOR="red"]<= Using this flag will use toolbox instead of busybox[/COLOR]
Above are some of the flags that can cause TWRP not to boot up. If you are using Part-Source then you need to add additional projects to support these flags as most of them are disabled on the script. Just remove the remarks # from the script for that particular projects. More detail info refer to above post #11 Part-Source.
Refer to the most bottom Bug Report on how to obtain recovery.log, without it nobody is able to help you.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#l122-l130"]TARGET_RECOVERY_PIXEL_FORMAT := ABGR_8888[/URL]
TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888
TARGET_RECOVERY_PIXEL_FORMAT := BGRA_8888
The other reason it doesn't boot is that it actually does boot up but the screen is blank ! Try adb shell & it should work on this scenario.
Try different pixel format one at a time, one of them should work.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#l114-l116"]TARGET_RECOVERY_FORCE_PIXEL_FORMAT := RGB_565[/URL]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#l79"]RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH := true[/URL]
[URL="https://gerrit.omnirom.org/#/c/13948/"]TW_DISABLE_DOUBLE_BUFFERING := true[/URL]
When not setting any pixel format, the default is RGB565 & it should work on most Android devices. You can also try the above when non of them works.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#L14-L19"]TW_BOARD_CUSTOM_GRAPHICS[/URL]
If your existing device tree uses this & all the above doesn't work then drop by at TWRP IRC channel to get further help.
Source
Miscellaneous Tips
As mentioned many times, most of the time build error is bcos of wrong BE setup, use BBQLinux & you'll get over it. If you have already build on other distro then refer to here on how to use this script or migrate the source code .repo to BBQLinux.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/variables.h#l173"]TARGET_USE_CUSTOM_LUN_FILE_PATH[/URL]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l828"]TW_BRIGHTNESS_PATH[/URL] [COLOR="blue"]<= If not define, TWRP will look for it [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l840-l841"]here[/URL][/COLOR]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l855"]TW_SECONDARY_BRIGHTNESS_PATH[/URL]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l1076"]TW_MAX_BRIGHTNESS[/URL] [COLOR="blue"]<= If not define, TWRP will [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l56-l58"]set it[/URL][/COLOR]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l967"]TW_CUSTOM_BATTERY_PATH[/URL] [COLOR="Blue"]<= If not define, TWRP will use [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l972"]this[/URL] or [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l986"]this[/URL] [/COLOR]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l937"]TW_CUSTOM_CPU_TEMP_PATH[/URL] [COLOR="blue"]<= if not define, TWRP will use [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l942"]this[/URL][/COLOR]
TWRP has everything specified to standard Android path unless when it doesn't work then you'll need to find that out yourself. Do take note that some device doesn't support certain feature such as CPU temperature, battery level, mount USB storage & etc then refer to the OP for flags to disable it.
Code:
adb shell su -c "ls -R" > [COLOR="Blue"]myAndroid.txt[/COLOR]
Above command will list out everything on your device.
Code:
adb shell su -c cat /sys/class/power_supply/battery/capacity
[COLOR="blue"]88[/COLOR]
Eg. Say the battery capacity doesn't work then look for that path at myAndroid.txt for something that says battery/capacity & specify it at BoardConfig.mk
Code:
adb shell cat /sys/class/thermal/thermal_zone0/temp
[COLOR="Blue"]27516[/COLOR]
If CPU temperature doesn't work then look for thermal/temp
Code:
adb shell
su
echo 0 > /sys/devices/platform/i2c-gpio.24/i2c-24/24-002c/backlight/lcd-backlight/brightness
echo 255 > /sys/devices/platform/i2c-gpio.24/i2c-24/24-002c/backlight/lcd-backlight/brightness
If brightness doesn't work, look for lcd-backlight/brightness, Eg. above command should be able to change the level of brightness if that is the correct path as indicated at myAndroid.txt.
Sync corruption
git & repo is like a Super Intelligent Source Code Auto-Resume Downloader when working together . . . :good:
You can stop it at any time, restart it back & it will auto-resume. cm repo & source code is located at ~/cm/.repo, omni at ~/omni/.repo it is a hidden folder & to view hidden folder via File Manager, you need to press Ctrl + h
Sometimes you have corruption then repo sync wouldn't work & normally you just need to delete manifests, manifests.git, manifests.xml with a repo init & repo sync then you'll be back to normal.
If still this doesn't solve the problem then delete everything EXCEPT the folder project-objects & projects, both of this is the actual source code folder.
After this a repo init then repo sync & everything will be back to normal, i guarantee, done this many times, no worries . . . :laugh:
Sometimes when you have severe data corruption, above technique will not work then manually cd ~/cm or ~/omni then repo init then repo sync & see what repo & git has to say then follow the on-screen instructions to remove the corrupted projects.
Scroll back up & see what the error was, remove the corrupted project then repo sync. In this case is rm -rf ~/cm/.repo/projects/prebuilts/clang/linux-x86/host/3.5.git
Subsequent sync show above error. rm -rf ~/cm/.repo/project-objects/CyanogenMod/android_external_icu.git
rm -rf ~/cm/.repo/projects/external/jemalloc.git
rm -rf ~/cm/.repo/projects/system/extras/su.git
rm -rf ~/cm/.repo/projects/external/libcxx.git
rm -rf ~/cm/.repo/projects/external/libcxxabi.git
rm -rf ~/cm/.repo/projects/external/libunwind.git
rm -rf ~/cm/.repo/project-objects/CyanogenMod/android_external_busybox.git
And finally all corrupted projects has been removed, subsequent repo sync & all files will be auto-extracted out.
Corrupted .repo folder
i've make a back up of my .repo folder using tar.gz compression years ago & when extracting out, normally will end with data corruptions except if you use lrzip... :good: You will need to manually remove all the text files such as hooks, pre-auto-gc & commit-msg which is supposed to be a symlink files.
After you force overwrite extraction, a repo init & repo sync will end with above message.
You will need to manually delete all the hooks.txt file found at .repo folder
You will need to manually delete all the commit-msg.txt file
You will need to manually delete all the pre-auto-gc.txt file. You might need to repo sync --force-sync many times to overwrite all the corrupted projects & after that, you won't be getting any of these error messages again.
Syncing work tree error - Doesn't check out all files
This operation must be run in a work tree
Run the below command will give you hint
Code:
repo --trace sync -l
Above hints the corrupted projects so remove it => rm -rf /home/yuweng/cm/.repo/projects/frameworks/ex.git
repo sync still it doesn't extract out all the files so you need to run repo --trace sync -l again. Delete the hinted project => rm -rf /home/yuweng/cm/.repo/projects/frameworks/webview.git
When all error has been fixed, a repo sync & all the files will be extracted out correctly
Source
Bug report
Zip & attach the ~/AIO-TWRP-Compiler/compile.log to your post when replying.
Refer to here on how to submit a proper TWRP bug report . . . :good:
How to obtain recovery log
adb pull /tmp/recovery.log -> Attach to your post
At TWRP -> BackUp -> After Backup go to Advanced -> Copy Log to SDCard
Typically you will find the recovery.log at
Typical Internal SdCard
/emmc/TWRP/BACKUPS/ [Your Device Name] / [Backup date] [ro.mediatek.version.release]
/data/media
/data/media/0
or
Typical External SdCard
/sdcard/TWRP/BACKUPS/ [Your Device Name] / [Backup date] [ro.mediatek.version.release]
Attach it to your post.
At TWRP console (Square button at button) -> You can view the log
If TWRP crash when executing certain menu/ function/ feature then you can use My Master Shifu _that gdb technique for debugging & submit the back trace to Teamwin so that they can fix it... :good:
Try IRC channel to get help directly, prepare all required info such as recovery.log, compile.log & android log, refer to here for the best timing . . .
TWRP FAQ
@yuweng the script has really been thought over for a long time and you also have put in tons of work in it. Thanks for it man!
Thanks bro... :highfive: The script initially includes BE setup for Ubuntu that includes setting up of Python, Java, Make, Git, build packages, adb rules & etc, now its half the size bcos we don't need to do all that on BBQLinux... It has went thru alot of revision, i lost track, one has PhilZ Touch on it, one revision will detect the device info such as graphics resolution, emmc or /data/media device & etc, you can actually do wonders with adb shell, automated alot of stuff for BoardConfig.mk, all in all, this script has about 4 years of work in it...
yuweng said:
Thanks bro... :highfive: The script initially includes BE setup for Ubuntu that includes setting up of Python, Java, Make, Git, build packages, adb rules & etc, now its half the size bcos we don't need to do all that on BBQLinux... It has went thru alot of revision, i lost track, one has PhilZ Touch on it, one revision will detect the device info such as graphics resolution, emmc or /data/media device & etc, you can actually do wonders with adb shell, automated alot of stuff for BoardConfig.mk, all in all, this script has about 4 years of work in it...
Click to expand...
Click to collapse
4 YEARS!!!! @Dees_Troy, @bigbiff, @_that this guy deserves a medal! And about the BE Setup, my good friend @thewisenerd had made an Android compiler which included a rather fancy dependencies check in a python program. I'll include it into AIO-TWRP-COMPILER as soon as I finish my school work for the week
Haha, they are all my Master Shifu's & they all have more experience than me on TWRP... :laugh: You are most welcome to add-in new features to it... :good:
yuweng said:
Haha, they are all my Master Shifu's & they all have more experience than me on TWRP... :laugh: You are most welcome to add-in new features to it... :good:
Click to expand...
Click to collapse
Experience?? They're encyclopedias on TWRP. But it's worthless if every humbug on the planet wants to compile it and doesn't even know what "ls -R " is supposed to do You're being a great help to everyone. I'll try and get them to try this when I can make it compatible for people who have already downloaded the source
Actually its quite easy but then again any wrong BE setup will result in build error that's why i strongly recommends BBQLinux for starters, its as easy as Ubuntu to setup, i can guarantee many will like the UI, Thanks to RD codeworkx.... :good:
Code:
mkdir ~/omni
cp -[COLOR="Blue"]R[/COLOR]f /path-to-your-existing-omnirom-folder/.repo ~/omni
[COLOR="blue"]OR[/COLOR]
mkdir ~/cm
cp -[COLOR="blue"]R[/COLOR]f /path-to-your-existing-cm-folder/.repo ~/cm
Remark or delete these lines & it'll work...
Updates - Migrating source code .repo to BBQLinux
So far my experience is that only lrzip is able to compress & extract source code .repo folder without data corruption... :good: Just open Ubuntu Nautilus File Manager & delete everything on your cm or omnirom except the hidden folder .repo
This hidden .repo folder is where the actual source code are, zipping it will be enough for migration, a repo init & repo sync will have all the files extracted out on BBQLinux ...
Code:
sudo apt-get install lrzip
cd /path-to-your-existing-[COLOR="Blue"]omnirom[/COLOR]-or-[COLOR="blue"]cm[/COLOR]-folder
lrztar -l .repo [COLOR="Blue"]<= Will take 10 to 20 minutes depending on your PC CPU, RAM & HDD[/COLOR]
[COLOR="blue"][U]To unzip it[/U][/COLOR]
copy [COLOR="Blue"].repo.tar.lrz[/COLOR] to [COLOR="Blue"]~/omni[/COLOR] or [COLOR="blue"]~/cm[/COLOR] folder accordingly
cd [COLOR="Blue"]~/omni[/COLOR] or [COLOR="blue"]~/cm[/COLOR]
lrzuntar .repo.tar.lrz
MSF Jarvis said:
Experience?? They're encyclopedias on TWRP. But it's worthless if every humbug on the planet wants to compile it and doesn't even know what "ls -R " is supposed to do[emoji14]You're being a great help to everyone. I'll try and get them to try this when I can make it compatible for people who have already downloaded the source
Click to expand...
Click to collapse
I don't know what it does but I compiled twrp(2.8.7.0 because twrp 3 doesn't want to work with my phone)In one month of work xD
yuweng said:
Actually its quite easy but then again any wrong BE setup will result in build error that's why i strongly recommends BBQLinux for starters, its as easy as Ubuntu to setup, i can guarantee many will like the UI, Thanks to RD codeworkx.... :good:
Code:
mkdir ~/omni
cp -rf /path-to-your-existing-omnirom-repo/.repo ~/omni
[COLOR="blue"]OR[/COLOR]
mkdir ~/cm
cp -rf /path-to-your-existing-cm-repo/.repo ~/cm
Remark or delete these lines & it'll work...
Click to expand...
Click to collapse
I use Ubuntu and I had several issues
Luckily I can compile without problems now
Thanks for your work
Inviato dal mio HUAWEI Y550-L03 utilizzando Tapatalk
AIO TWRP Compiler wiki
@yuweng, I have started writing down the wiki for this script at the Github repository. Would be grateful if you started writing the things you have mentioned here in that as well, and I'll proof-read it later on and also keep writing things myself

LiME - Loadable Kernel Module (LKM)

Hi guys.
I have been trying to dump the memory ram of a Galaxy S5 (Au version).
I have a problem on the final step.
When I try to run insmod, it reports as follows:
insmod lime.ko “path=tcp:9999 format=lime”
insmod: init_module 'lime.ko' failed (Function not implemented)
The phone details:
- Galaxy S5
- Android version 5.0
- Baseband version: G900IDVU1BOJ2
- Chipset: MSM8974PRO-AC
I am using two platforms of Linux , neither of them work, (Kali Sana 2.0 and Ubuntu 15.10 Willy)
The version of the tools are as follows:
- Java = java-8-openjdk-amd64
- NDK = android-ndk-r11c
- SDK = Android Studio 2.0
- Cross Compiler = arm-linux-androideabi-4.9 (It comes with NDK) and I have tried with arm-eabi-4.6
The phone does not contain the /proc/config.gz, instead I found on the Samsung's website two versions for the same chipset in Australia, but neither with the same baseband (I don not if that affects). So the generate .config using the code source I ran:
make msm8974_sec_defconfig VARIANT_DEFCONFIG=msm8974pro_sec_klte_eur_defconfig SELINUX_DEFCONFIG=selinux_defconfig
#
# configuration written to .config
#
The makefile for Lime that I have been using is:
obj-m := lime.o
lime-objs := main.o tcp.o disk.o
KDIR_GOLD := /home/osboxes/workspace/Kernel
KVER := $(shell uname -r)
PWD := $(shell pwd)
CCPATH := /home/osboxes/workspace/arm-eabi/arm-eabi-4.6/bin
default:
# cross-compile for Android emulator
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-eabi- -C $(KDIR_GOLD) M="$(PWD)" modules
$(CCPATH)/arm-eabi-strip --strip-unneeded lime.ko
# compile for local system
$(MAKE) -C /lib/modules/$(KVER)/build M="$(PWD)" modules
strip --strip-unneeded lime.ko
mv lime.ko lime-$(KVER).ko
$(MAKE) tidy
tidy:
rm -f *.o *.mod.c Module.symvers Module.markers modules.order \.*.o.cmd \.*.ko.cmd \.*.o.d
rm -rf \.tmp_versions
clean:
$(MAKE) tidy
rm -f *.ko
I appreciate any help in this matter.
PS. I will be trying more options

[EXE] Static Linux binaries for ARM/Android (Cryptsetup, EncFS, F2FS-Tools, Testdisk, PhotoRec,..)

Native ARM/static Linux binaries
(for all ARMv7+ compatible platforms)
Open-source Linux binaries that are either not available on Android (e.g. in Termux)
or make sense to be statically compiled (e.g. to run in TWRP/recovery for data recovery).
These are root tools and might damage your device severely. Use at your own risk. I take no responsibility whatsoever. If in doubt don't use them.​
Minimum CPU: ARMv7/vfpv3-d16. Compiled against musl-libc/Android Kernel 3.4. Binaries are static, bionic/libc independent and should run on Android, TWRP, emulator or any other compatible ARM device. Musl is patched (info)(info2)(patch file: patch -p0 -u -b -i musl-android-smp.patch) to iterate CPU cores by /proc/stat instead of _SC_NPROCESSORS_CONF/sched_getaffinity to prevent false detection due to ARM cpu core powersaving (permanently turning cores on/off). This should report CPU cores more reliably to multithreading apps.
Example instructions how to build EncFS can be found here.
Some Cryptsetup compile recipes are here.
Changelog:
20190923 - f2fs-tools added
20190915 - dislocker, ntfs-3g, mount.exfat-fuse added
20190910 - VeraCrypt v1.24-b5 added
20191215 - musl smp patch added
20191224 - hstr v2.2.0 updated
20191225 - Testdisk, PhotoRec v7.2-wip-dec2019 updated
20200103 - tar v1.32 updated (with selinux, acl, xattr support)
20200513 - Cryptsetup v2.3.2 added
20200518 - fscrypt 0.2.7, strace56(aarch64) added
20200525 - p7zip v17.01 added
20200603 - parted v3.3 added
20200606 - fxz v1.1.0alpha added
20201212 - ddrescue v1.25 added
20201212 - Cryptsetup v2.3.4 updated
20210113 - f2fs-tools updated to v1.14.0
20210125 - Several tools compiled by @Borovets. See 'Misc' tools.
20210413 - Cryptsetup v2.3.5 updated
20210916 - Cryptsetup v2.4.1 updated. Thx to @misterhsp.
20211108 - rsync v3.2.3 updated
20211118 - Cryptsetup v2.4.2 updated. Thx to @misterhsp.
20220103 - mmc-utils added
20220106 - More tools from @Borovets. See spoiler.
Spoiler
bash-5.1.16-[1]-[2022.01.05].tar.gz
openssl3-3.0.1-[2021.12.14]-static.tar.gz
tree-2.0.0-[2021.12.23]-static.tar.gz
e2fsprogs-1.46.5-[2021.12.31]-static.tar.gz
openssl-1.1.1-m-[2021.12.15]-static.tar.gz
libsqlite-3.37.1-[2021.12.30]-static.tar.gz
ldns-host-1.7.1-[2021.12.30]-static.tar.gz
bootimg-info-2.0-[2021.12.18]-static.tar.gz
bc-5.2.1-[2021.12.29]-static.tar.gz
openssl3-tool-3.0.1-[2021.12.14]-static.tar.gz
openssl-tool-1.1.1-m-[2021.12.15]-static.tar.gz
sqlite-3.37.1-[2021.12.30]-static.tar.gz
stunnel-5.61-[2021.12.17]-static.tar.gz
toybox-0.8.6-borovets-295-applets-[2021.12.30]-static.tar.gz
unrar-6.10-beta-3-[2021.12.11]-static.tar.gz
zstd-1.5.1-[2021.12.22]-static.tar.gz
20220107 - parted v3.4 updated
20220113 - cryptsetup v2.4.3 updated. Thx to @misterhsp.
20220114 - gptfdisk v1.0.8 added
20220212 - tar v1.34 updated
20220622 - gptfdisk v1.0.9 (armv7) added
20220724 - dialog v1.3 added
20220728 - f2fs tools v1.15.0 updated
20220730 - cryptsetup v2.5.0 updated. Thx to @misterhsp.
20220806 - 7z-zstd v22.01 added. Thx to @xenosaur
20220910 - rsync v3.2.6 updated
20220913 - htop v3.2.1 added
20220913 - gocryptfs v2.3 updated. Thx to @misterhsp
20220922 - veracrypt v1.25.9 updated
20220924 - fdisk v2.38.1 and file v5.43 added
20221129 - cryptsetup v2.6.0 updated. Thx to @misterhsp
20221213 - f2fs tools v1.15.0 fixed (uuid.h missing)
20230215 - cryptsetup v2.6.1 updated. Thx to @misterhsp
20230307 - gocryptfs v2.3.1. Thx to @misterhsp
Data recovery tools:
- PhotoRec 7.2 - PhotoRec is file data recovery software designed to recover lost files including video, documents and archives from hard disks, CD-ROMs, and lost pictures (thus the Photo Recovery name) from digital camera memory. PhotoRec ignores the file system and goes after the underlying data, so it will still work even if your media's file system has been severely damaged or reformatted.
- Testdisk 7.2 - Recover lost partitions and partition tables. For external sdcards. Never use it on internal mmc unless you know what you're doing.
- ext4magic 0.3.2 (with supplementary gnu date binary that can handle relative time like 'date -d "-20minutes" +%s')
- fidentity - A little utility sharing PhotoRec signature database. It identifies the type of data contained in a file and reports the extension as seen by PhotoRec.
- debugfs - Might be helpful on ext2 systems or other stuff.
- strace 4.20 - For debugging. Mainly to catch syslog messages (as Android has no traditional /dev/log buffer).
- strace 5.6 - For aarch64.
- ddrescue v1.25 - Data recovery tool for block devices with errors.
Compression tools:
p7zip v17.01 (fork) - (Download) A new p7zip fork with additional codecs and improvements
pixz - Parallel, indexed xz compressor
xz - Multicore aware version of xz/lzma (use --thread=0)
tar v1.32 - Tar provides the ability to create tar archives, as well as various other kinds of manipulation. Download below. More builds from @mirfatif here.
fxz - (Download) FXZ Utils is a fork of XZ Utils. It adds a multi-threaded radix match finder and optimized encoder.
Misc:
- hexcurse v1.60.0 - Hexcurse is a curses-base hex editing utility that can open, edit, and save files, editing both the hexadecimal and decimal values. 'ncurses' ui layout depends on TERM env variable. Change temporary with eg. 'TERM=xterm-256color hexcurse <file>'. See /system/etc/terminfo for possible terminals (xterm-256color, linux..).
- nethogs v0.8.5 - ncurse/nettop-like per-app separated speedmeter and traffic counter supporting high refresh rate. Try 'nethogs -d0' (speedmeter) or 'nethogs -v1' (traffic counter).
- rsync v3.2.3 - rsync is an open source utility that provides fast incremental file transfer. (--with-rsyncd-conf=/data/etc/rsyncd.conf)
- smbnetfs v0.6.1 - SMBNetFS is a Linux/FreeBSD filesystem that allow you to use samba/microsoft network in the same manner as the network neighborhood in Microsoft Windows. More info see below.
- progress v0.14 - Linux tool to show progress for cp, mv, dd, ... (formerly known as cv). Download here.
- archivemount (20180801) - A fuse filesystem for mounting archives in formats supported by libarchive. Download here.
- squashfuse v0.1.103 - FUSE filesystem to mount squashfs archives Download here.
- FuseISO - FuseISO is a FUSE module to mount ISO filesystem images (.iso, .nrg, .bin, .mdf and .img files). It currently support plain ISO9660 Level 1 and 2, Rock Ridge, Joliet, and zisofs. Download here.
- HSTR v2.2.0 - HSTR (HiSToRy) is a command line utility that brings improved Bash/zsh command completion from the history. It aims to make completion easier and more efficient than Ctrl-r. (If history is empty try setting HISTFILE in /system/etc/bash/bashrc e.g. export HISTFILE=/data/.bash_history).
- GNU screen, tmux - Thanks to @mirfatif.
- dislocker, ntfs-3g, mount.exfat-fuse - Thanks to @mirfatif.
- f2fs-tools - Thanks to @mirfatif. Update: v1.14.0 here.
- parted v3.3 - GNU Parted (the name being the conjunction of the two words PARTition and EDitor) is a free partition editor, used for creating and deleting partitions. Note: It might be useful to partition external sdcards (e.g. to limit adoptable storage). I do not recommend to use it on internal memory. It might brick your phone.
- Several tools compiled by @Borovets
Spoiler: Borovets tools
Borovets tools 2021.01.25
arptables-0.0.5-[2021.01.17]-static.zip
autoflushtest-1.0-[2021.01.14]-static.zip
btrfs-compsize-1.3-[build-2]-[2020.12.27].zip
btyacc-3.0-[2021.01.18]-static.zip
c-blosc-1.21.1-development-[2020.12.22].zip
c-blosc2-2.0.0-beta-6-development-[2020.04.21].zip
cabextract-1.9.1-[2021.01.08]-static.zip
compsize-1.3-[2021.01.07]-static.zip
convert-color-space-0.1-[2021.01.18]-static.zip
cpustat-0.02.13-[2021.01.13]-static.zip
doxygen-1.9.2-[2021.01.17]-static.zip
ed-1.17-[2021.01.11]-static.zip
hello-2.10-[2021.01.08]-static.zip
htop-3.0.5-[2021.01.13]-static.zip
ipcalc-ng-1.0.0-[2020.12.28]-static.zip
iw-5.9-[2021.01.08]-static.zip
libsqlite-3.34.1-[2021.01.20].zip
libtar-1.2.20-[2021.01.16]-static.zip
m5-1.0-[2020.12.31]-static.zip
sqlite-3.34.1-[2021.01.20]-static.zip
Borovets tools 2021.01.27
lcab-1.0-beta-12-[2021.01.17].zip
memdump-1.01-[2021.01.25].zip
memdumper-0.4-[2021.01.25].zip
memtester-4.5.0-[2021.01.09].zip
tcpdump-4.99.0-[libcap-1.9.1]-[2021.01.05].zip
wget2-1.99.2-[2020.12.12].zip
wolfssl-4.5.0-[2020.12.12].zip
xfsprogs-5.10.0-[2021.01.01].zip
Crypttools:
(These crypttools are mostly frontend tools for the main backend that resides in the kernel. If your kernel hasn't been configured accordingly at compile time you might not be able to use all features.)
Cryptsetup v2.3.5 - (Download) Cryptsetup is an utility used to conveniently setup disk encryption based on DMCrypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES and TrueCrypt (including VeraCrypt extension) format.
eCryptfs-utils v111 - Frontend tools for the enterprise cryptographic filesystem for Linux. That's what Android/Google use for encryption. It's file-based (no container) and mounting can be automated by Termux widget. Needs shared libraries but is still portable. See notes below.
EncFS v1.9.5 - EncFS provides an encrypted filesystem in user-space. It runs in userspace, using the FUSE library for the filesystem interface.
gocryptfs - An encrypted overlay filesystem written in Go. Download here. Thanks to @mirfatif.
VeraCrypt - VeraCrypt is a free open source disk encryption software. Download here. Thanks to @mirfatif.
fscrypt 0.2.7 - (Download) fscrypt is a high-level tool for the management of Linux filesystem encryption. Needs at least kernel 4.1.
Crypttools info:
Cryptsetup:
General Notes:
- Features like TrueCrypt, VeraCrypt and LUKS2 need 'userspace crypto api' enabled in kernel. Most Android kernels are probably not configured for that and you have to recompile your kernel or contact your kernel maintainer. For kernel 3.4 you need this:
Code:
CONFIG_CRYPTO_USER=y
CONFIG_CRYPTO_USER_API=y
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_USER_API_SKCIPHER=y
- If 'cryptsetup benchmark' is incomplete and says 'userspace crypto api not available' you might be affected. You can still use LUKS1 though. A full benchmark looks like this:
Code:
# cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1 249186 iterations per second for 256-bit key
PBKDF2-sha256 327680 iterations per second for 256-bit key
PBKDF2-sha512 58829 iterations per second for 256-bit key
PBKDF2-ripemd160 227555 iterations per second for 256-bit key
PBKDF2-whirlpool 33539 iterations per second for 256-bit key
argon2i 4 iterations, 208288 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
argon2id 4 iterations, 207817 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
# Algorithm | Key | Encryption | Decryption
aes-cbc 128b 77.8 MiB/s 88.4 MiB/s
serpent-cbc 128b N/A N/A
twofish-cbc 128b 58.5 MiB/s 61.9 MiB/s
aes-cbc 256b 61.5 MiB/s 68.4 MiB/s
serpent-cbc 256b N/A N/A
twofish-cbc 256b 58.5 MiB/s 61.8 MiB/s
aes-xts 256b 95.1 MiB/s 86.9 MiB/s
serpent-xts 256b N/A N/A
twofish-xts 256b 60.0 MiB/s 61.8 MiB/s
aes-xts 512b 74.1 MiB/s 67.2 MiB/s
serpent-xts 512b N/A N/A
twofish-xts 512b 60.3 MiB/s 62.0 MiB/s
LUKS:
Code:
** 10MB test image (luks.img) **
dd if=/dev/zero of=luks.img bs=1M count 10M
cryptsetup luksFormat luks.img
cryptsetup open luks.img myluks
mke2fs -t ext4 /dev/mapper/myluks
mkdir luks
mount /dev/mapper/myluks luks
** luks folder is ready here **
umount luks
cryptsetup close myluks
- If standard luksFormat cipher (aes-xts-plain64) doesn't work (not supported by your kernel) you can try one of the more compatible ciphers:
Code:
cryptsetup luksFormat -c cbc-essiv:sha256 luks.img myluks
cryptsetup luksFormat -c aes-plain luks.img myluks
- For LUKS2 (experimental) use:
Code:
cryptsetup luksFormat --type luks2 luks.img
- Use "cryptsetup -v --debug" for more verbose output (debugging). In case of errors.
Veracrypt:
Code:
cryptsetup open --type tcrypt --veracrypt veracrypt.tc myvera
cryptsetup status myvera
mkdir /data/myvera
mount /dev/mapper/myvera /data/myvera
umount /data/myvera
cryptsetup close myvera
- Use container from desktop system (created with real Veracrypt)
- "veracrypt.tc" is the veracrypt container name
- "myvera" is an arbitrary name (handle)
- Use "cryptsetup -v --debug" for more verbose output (debugging). In case of errors.
eCryptfs-utils:
General Notes:
These tools are not built statically as they explicitly rely on 'dlopen' (plugin system). Instead they are compiled with relative rpaths (./libs). That means dependencies (libraries in subfolders) must be present in the binaries folder and you have to be in the binaries folder itself (with 'cd') before invoking any binary. By this the binaries are still portable (system independent) as long as the subfolders are present. I've put the files into a tar.gz archive so permissions should be set +x already. Extract the archive into /data/local/bin for 'Example' below.
Code:
mkdir -p /data/local/bin
cd /data/local/bin
tar xf crypttools.armv7.20180204.tar.gz
cd ecryptfs
./ecryptfs-stat --help
More info: ArchLinux Wiki
Example:
Tested on /sdcard based on FUSE filesystem. sdcardfs untested. Might need selinux permissive.
We create a folder /sdcard/pics that can be enabled (files present) or disabled (no files present) by a click on a widget button (Termux script) and entering our password. The encryption is done on a per-file basis. The actual files are stored encrypted in /sdcard/efs/pics.
- You might need SuperSU or Magisk Superuser for 'su -mm'. That makes sure that all apps can see the mounted folder (mount namespace separation).
- Busybox needed
- Install Termux and Termux:Widget from F-Droid or Playstore
- Start it and enter:
Code:
pkg upgrade
pkg install tsu
exit
- Create script /data/data/com.termux/files/home/.shortcuts/efs-pics.sh and make sure permissions(700) and owner (take from parent folder) are correct.
Code:
#!/system/xbin/bash
su -mm -c "/system/xbin/bash -c /data/local/scripts/$(basename "$0")"
- Create script /data/local/scripts/efs-pics.sh (770/root):
Code:
#!/system/xbin/bash
set -e
PATH=$PATH:/data/data/com.termux/files/usr/bin
# Necessary because rpaths are relative
cd /data/local/bin/ecryptfs
# /data/myefskey contains the salted key.
# Don't forget to make a backup.
# Without it encrypted data is lost.
function enter_passphrase {
read -p "Enter passphrase: " passphrase
sig=$(printf "%s" "$passphrase" | ./ecryptfs-insert-wrapped-passphrase-into-keyring /data/myefskey -) || exit
sig=$(echo $sig | cut -d "[" -f2 | cut -d "]" -f1)
}
CPATH1="/data/media/0/efs/pics"
CPATH2="/data/media/0/pics"
if ! mountpoint -q ${CPATH2}; then
enter_passphrase
echo ""
mount -t ecryptfs -o ecryptfs_sig=$sig,ecryptfs_fnek_sig=$sig,ecryptfs_cipher=aes,ecryptfs_key_bytes=16 ${CPATH1} ${CPATH2} || (echo "$(basename "$0") mount failed!"; exit)
./keyctl clear @u
echo "$(basename "$0") mount successful! :)"
else
umount ${CPATH2} || (echo "$(basename "$0") umount error $? :("; exit)
echo "$(basename "$0") umount successful :)"
fi
# uncomment to force-close Termux window
# killall com.termux
- If your rom uses encryption already (/data/data) beware the './keyctl clear @u' command. It might flush *all* keys in the kernel including the Android encryption one (i'm not sure). This might lead to unpredicted behavior. Either comment it out (then your once injected key remains in the kernel keystore and someone could simply remount your folder without passphrase) or make yourself familiar with the keyctl command and handle it yourself. My phone is not encrypted so i cannot help here.
- Create random keyfile (/data/myefskey) and wrap it with passphrase. This might need 1-2 minutes depending on your devices entropy pool (/dev/random). Backup this key (/data/myefskey). Without it your encrypted data is lost. And don't forget the trailing '-' (minus) at the end of the line, it's important.
Code:
cd /data/local/bin/ecryptfs
read -p "Enter passphrase: " passphrase; printf "%s\n%s" $(busybox od -x -N 100 --width=30 /dev/random | head -n 1 | busybox sed "s/^0000000//" | busybox sed "s/[[:space:]]*//g") "${passphrase}" | ./ecryptfs-wrap-passphrase /data/myefskey -
- Create folders:
Code:
mkdir -p /sdcard/efs/pics /sdcard/pics
- Create Widget (Termux) and select 'efs-pics.sh'.
- Start it and enter your passphrase (you used above). If everything goes well (it will tell you) you can place files into /sdcard/pics and scrambled files should come up in /sdcard/efs/pics. Never write into /sdcard/efs/pics directly.
- Activate widget again. /sdcard/pics should get emptied.
- Optional: You can set /data/media/0/efs/pics to 700/root so no one can access/see the encrypted data.
SMBNetFS info:
Note: The library paths are relative. You need to be in the folder (with 'cd') to spawn the executable (./smbnetfs). You can extract the archive wherever you want though as far as the file/folder structure remains intact.
Example:
Code:
mount -o remount,rw /
mkdir -p /data/local/bin /mnt/cifs
mount -o remount,ro /
tar xf smbnetfs.tar.gz -C /data/local/bin
cd /data/local/bin/smbnetfs
export HOME=/data/local/bin/smbnetfs/home
* enter your smb credentials into smbnetfs/home/.smb/smbnetfs.auth (eg. auth "192.168.1.2" "${user}" "${pass}")
./smbnetfs /mnt/cifs
cd /mnt/cifs/192.168.1.2/${share}
I think it usually should list the samba environment in /mnt/cifs but i'm not sure which prerequisites are necessary for that (edit: maybe it needs real workgroup/hostname instead of IPs). If nothing comes up this should work:
The folder 192.168.1.2/${share} is unreachable by Androids folder picker (unless you can enter the path manually). So either pre-create the folder structure beforehand (mkdir -p /mnt/cifs/192.168.1.2/${share}) and add/register the folder to your app by folder picker (eg. MXPlayer) and then overmount that with the actual ${share}. Or bindmount the folder:
Code:
mount --bind /mnt/cifs/192.168.1.2/${share} /mnt/cifs2
Edit: Another option is to let smbnetfs create a static link (actually a symbolic link) to the share in the mountpoint root (/mnt/cifs). Its not as robust as the bindmount though. MXPlayer doesn't find any files (even though the folder picker shows the folders properly).
Code:
echo "link myfiles 192.168.1.2/${share}" > /data/local/bin/smbnetfs/home/.smb/smbnetfs.host
chmod 700 /data/local/bin/smbnetfs/home/.smb/smbnetfs.host
I've noticed that MXPlayer shows the samba folders just for a glimpse of a second. But if you enter one of the local folders and then go back all samba folders are there. Not sure why this is happening or maybe its just my system.
Edit2: Not yet tested but.. check the permissions. Its possible that SMBNetFS mounts with 755 or something. That's inaccessible for Android apps. Try this:
Code:
./smbnetfs -o umask=000,noatime,noexec,nodev,nosuid /mnt/cifs
Samba 4.8.3 configuration:
Code:
_idmap_modules=idmap_rid,idmap_hash,idmap_tdb2
_pdb_modules=pdb_tdbsam,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4
_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4
waf configure --prefix=/tmp/myout \
-C \
--sysconfdir=./conf/etc/samba \
--with-configdir=./conf/etc/samba \
--localstatedir=./conf/var \
--libexecdir=./conf/usr/lib \
--enable-fhs \
--with-lockdir=./conf/var/cache/samba \
--with-piddir=./conf/run/samba \
--with-logfilebase=./conf/var/log/samba \
--without-pam \
--without-systemd \
--without-ads \
--with-shared-modules=$_idmap_modules,$_pdb_modules,$_auth_modules \
--disable-cups \
--without-gettext \
--bundled-libraries=NONE,com_err,ldb,uid_wrapper,resolv_wrapper,socket_wrapper,nss_wrapper,ntdb,roken,wind,hx509,asn1,heimbase,hcrypto,krb5,gssapi,heimntlm,hdb,kdc,cmocka,talloc,tdb,pytdb,ldb,pyldb,tevent,pytevent \
--disable-rpath-install \
--disable-python --without-ad-dc --without-acl-support --without-ldap \
--hostcc=/usr/bin/gcc \
--cross-compile --cross-execute='qemu-arm -L /media/devpart/qemu/root'
waf build -j4
waf install
Compression tools added.
Next are crypttools (ecryptfs-utils, cryptsetup).
DualJoe said:
Compression tools added.
Next are crypttools (ecryptfs-utils, cryptsetup).
Click to expand...
Click to collapse
Please add ecryptfs-simple
xyne.archlinux.ca/projects/ecryptfs-simple
Thanks.
Ecryptfs-simple is not POSIX compliant. It relies on an argv interface (to parse command-line parameters) that is a GNU extension that musl doesn't support.
The original eCryptFS is simple enough anyway (and its the upstream project). I will provide a quickstart example and a one button GUI controlled solution (Termux widget) to handle it.
Please to add gifsicle,
http://github.com/kohler/gifsicle
Thanks.
I only have gifsicle. The other ones are too complex for my setup atm.
DualJoe said:
I only have gifsicle. The other ones are too complex for my setup atm.
Click to expand...
Click to collapse
Thank you very much.
Please help me again to build giflossy (fork of gifsicle).
I really need it to compress (--lossy=N) the Gif file to be smaller.
https://github.com/kornelski/giflossy
Thanks.
Do you use them directly on your phone for web postings or something? What's your use case to not prefer a desktop system for this?
DualJoe said:
Do you use them directly on your phone for web postings or something? What's your use case to not prefer a desktop system for this?
Click to expand...
Click to collapse
I use it directly on the phone, for learning purposes.
Using it on the phone is so handy that it can be easily used anywhere.
Thanks.
Please help me again to build lbzip2
http://lbzip2.org/
Thanks.
Here it is.
DualJoe said:
Compression tools added.
Next are crypttools (ecryptfs-utils, cryptsetup).
Click to expand...
Click to collapse
When will Crypttools be released.
I've waited for the major update of cryptsetup. Its out now indeed. I should get it up this week.
Crypttools and quickstart tutorials added.
Mountpoint is not writable (eCryptfs)
DualJoe said:
Crypttools and quickstart tutorials added.
Click to expand...
Click to collapse
Can't write to mountpoint.
# touch /sdcard/pics/test
touch: /sdcard/pics/test: Permission denied
# cp file /sdcard/pics
cp: can't create '/sdcard/pics/file': Permission denied
buengeut said:
touch: /sdcard/pics/test: Permission denied
Click to expand...
Click to collapse
What are your permissions?
Code:
# stat /data/media/0/pics
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
# stat /data/media/0/efs
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
# stat /data/media/0/efs/pics
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
How does your mount look like?
Code:
# mount |grep pics
/data/media/0/efs/pics on /data/media/0/pics type ecryptfs (rw,relatime,ecryptfs_fnek_sig=56b1f3c519fb3412,ecryptfs_sig=56b1f3c519fb3412,ecryptfs_cipher=aes,ecryptfs_key_bytes=16)
Is /sdcard linked?
Code:
# ls -l /sdcard
lrwxrwxrwx 1 root root 21 May 10 1973 /sdcard -> /storage/self/primary
What Android version and kernel do you have?
DualJoe said:
What are your permissions?
Code:
# stat /data/media/0/pics
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
# stat /data/media/0/efs
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
# stat /data/media/0/efs/pics
Access: (775/drwxrwxr-x) Uid: (1023/media_rw) Gid: (1023/media_rw)
How does your mount look like?
Code:
# mount |grep pics
/data/media/0/efs/pics on /data/media/0/pics type ecryptfs (rw,relatime,ecryptfs_fnek_sig=56b1f3c519fb3412,ecryptfs_sig=56b1f3c519fb3412,ecryptfs_cipher=aes,ecryptfs_key_bytes=16)
Is /sdcard linked?
Code:
# ls -l /sdcard
lrwxrwxrwx 1 root root 21 May 10 1973 /sdcard -> /storage/self/primary
What Android version and kernel do you have?
Click to expand...
Click to collapse
Android 6.0 kernel 3.18.14
/sdcard is symlink to /mnt/sdcard, i changed /sdcard to /mnt/sdcard
Code:
# mount -t ecryptfs
/mnt/sdcard/efs/pics on /mnt/sdcard/pics type ecryptfs (rw,relatime,ecryptfs_fnek_sig=1b77138d91206e66,ecryptfs_sig=1b77138d91206e66,ecryptfs_cipher=aes,ecryptfs_key_bytes=16)
Code:
# stat /mnt/sdcard/pics
Access: (775/drwxrwxr-x) Uid: (1000/ system) Gid: (1015/sdcard_rw)
# stat /mnt/sdcard/efs
Access: (775/drwxrwxr-x) Uid: (1000/ system) Gid: (1015/sdcard_rw)
# stat /mnt/sdcard/efs/pics
Access: (775/drwxrwxr-x) Uid: (1000/ system) Gid: (1015/sdcard_rw)
Code:
# touch /mnt/sdcard/pics/test
touch: /mnt/sdcard/pics/test: Permission denied
What about the permissions of /data/media/0 folders? That's the most important part.
If your sdcard is not at /data/media/0 you probably don't have a multiuser environment (older phone?) and /mnt/sdcard is probably a real partition. This is early Kitkat partition layout (/sdcard and /data have separate partitions). On later systems both are on /data partition and /sdcard is abstracted by a FUSE file system that would automatically set the proper permissions whenever you write something to it (even as root).
In case you are on an old layout you would need to set proper permissions to /sdcard/pics and /sdcard/efs yourself. Just take a look at the other folders with 'ls -l /mnt/sdcard' and set accordingly. You would also need to change /data/media/0 to /mnt/sdcard in the script.
What do you get with this?
Code:
# mount |grep sdcard
# mount |grep storage
What phone is it? Kernel 3.18 doesn't sound all too old.
Edit: Another theory is your internal sdcard is scardfs or something. If so, it might break "stacking" folders (mount over). Try to use /data/pics and /data/efs/pics as a test.
It works in Permissive mode (setenforce 0)
I need Busybox with SELinux-enabled and use it to set it to Permissive mode
Code:
# busybox getenforce
Enforcing
# busybox setenforce 0
# busybox getenforce
Permissive
And then execute the efs-pics.sh and test it
Code:
# cp file /mnt/sdcard/pics ; echo $?
[b]0[/b]
# ls /mnt/sdcard/pics
[b]file[/b]
Horreee.... it Works.

Categories

Resources