Updated Linux-Android HOWTO from Guido Gonzato

Hello Martin,

I've been lurking on the discuss list and have fixed the text following some
suggestions I received.

Please find attached the final version of my proposed Howto; I hope it's going
to be accepted.

All the best,
Guido =8-)
This commit is contained in:
Martin A. Brown 2016-03-15 09:53:48 -07:00
parent c7e81953c1
commit 189cff2fe3
1 changed files with 84 additions and 25 deletions

View File

@ -55,14 +55,31 @@ OS X only, but a GNU/Linux system is perfectly capable of interacting
with Android devices. With a bit of hacking, as usual. with Android devices. With a bit of hacking, as usual.
<p> <p>
In the following, I will share a few tricks I have collected. I work In the following, I will share a few tricks I have collected:
on a GNU/Linux Mint box, but I'll try and be distribution-agnostic.
I'll concentrate on Free and Open Source Software (FOSS) whenever
possible, and I'll take standard, unrooted Android devices into
account. By the way: ``rooting'' means tweaking your Andbox to gain
root permissions, as you would do in Linux with <tt>sudo</tt>.
``Unrooted'' means ``not tweaked''.
<itemize>
<item> using the Android Debug Bridge;
<item> understanding and using the Android file system;
<item> installing programs from other markets;
<item> copying and syncing files and directories;
<item> backing up stuff;
<item> using a terminal emulator;
<item> compiling native command-line programs;
<item> remote control to/from Android;
<item> and more.
</itemize>
<p>
I work on a GNU/Linux Mint box, but I'll try and be
distribution-agnostic. I'll concentrate on Free and Open Source
Software (FOSS) whenever possible, and I'll take standard, unrooted
Android devices into account. By the way: ``rooting'' means tweaking
your Andbox to gain root permissions, as you would do in Linux with
<tt>sudo</tt>. ``Unrooted'' means ``not tweaked''.
<p>
Since Android is very fragmented (hey, it's Linux after all!) and Since Android is very fragmented (hey, it's Linux after all!) and
several versions are available, I'll just provide information that is several versions are available, I'll just provide information that is
applicable to what I own: Android 4.0.4, 4.1.1, and 5.0.1 on ARM applicable to what I own: Android 4.0.4, 4.1.1, and 5.0.1 on ARM
@ -207,6 +224,7 @@ edit the file:
/etc/udev/rules.d/50-android.rules /etc/udev/rules.d/50-android.rules
</verb></tscreen> </verb></tscreen>
<p>
(create a new file if it's missing) and add this line: (create a new file if it's missing) and add this line:
<tscreen><verb> <tscreen><verb>
@ -525,7 +543,8 @@ suggestions are:
<p> <p>
is a ``real'' keyboard that provides arrow keys, Esc, Alt, Ctrl, and is a ``real'' keyboard that provides arrow keys, Esc, Alt, Ctrl, and
so on. Released under the Apache License 2.0. so on; you really can't do without it if you plan to use a terminal
emulator. Released under the Apache License 2.0.
<item>Ghost Commander: <item>Ghost Commander:
@ -553,7 +572,8 @@ emulator and BusyBox, <htmlurl url="http://www.busybox.net/"
name="http://www.busybox.net/">. The latter is a single executable name="http://www.busybox.net/">. The latter is a single executable
that provides the functionality of several commands that you normally that provides the functionality of several commands that you normally
expect to find in any self-respecting Unix box, but that are missing expect to find in any self-respecting Unix box, but that are missing
in Android. in Android. <tt>cp</tt> and <tt>tar</tt> are the first that spring to
mind.
<p> <p>
In Section <ref id="terminals" name="Terminal Emulators and Shells"> In Section <ref id="terminals" name="Terminal Emulators and Shells">
@ -628,18 +648,20 @@ An Andbox can easily share its installed programs with another
device, provided that the Android versions are compatible. All you device, provided that the Android versions are compatible. All you
need is Ghost Commander. need is Ghost Commander.
<p>
From the ``Home'' position, select ``Applications'' to get a list of From the ``Home'' position, select ``Applications'' to get a list of
installed <tt>.apk</tt>s ; click on the one you want and copy it to a installed <tt>.apk</tt>s ; click on the one you want and copy it to a
standard folder (say, <tt>/mnt/sdcard</tt>.) From this location, long standard folder (say, <tt>/mnt/sdcard</tt>.) From this location, long
press on the program <tt>.apk</tt> and select ``Send To...''. Now press on the program <tt>.apk</tt> and select ``Send To...''. Now
select Bluetooth, which is probably the easiest way to send the APK to select Bluetooth, which is probably the easiest way to send the APK to
Alice; or choose another method from Section <ref id="copying" Alice; or choose another method from Section <ref id="copying"
name="Copying Files"> below. name="Copying Files"> below. If your device refuses to send a
<tt>.apk</tt> file via Bluetooth, just rename or zip it before sending
it, then unpack it or rename it back on the new device.
<p> <p>
If your device refuses to send a <tt>.apk</tt> file via Bluetooth, From within the Ghost Commander, tap on the <tt>.apk</tt> file to
just rename or zip it before sending it, then unpack it or rename it install the program. When done, you can delete the <tt>.apk</tt>.
back on the new device.
<!-- - - - --> <!-- - - - -->
@ -1057,8 +1079,8 @@ the same.
<p> <p>
If you need a more complete command-line experience, you will also If you need a more complete command-line experience, you will also
want to install a command-line environment like KBOX, ZShaolin or want to install a command-line environment like KBOX, ZShaolin,
Terminal IDE: Terminal IDE, or Termux:
<itemize> <itemize>
@ -1091,12 +1113,13 @@ Terminal IDE:
<htmlurl url="http://www.spartacusrex.com/terminalide.htm" <htmlurl url="http://www.spartacusrex.com/terminalide.htm"
name="http://www.spartacusrex.com/terminalide.htm"> name="http://www.spartacusrex.com/terminalide.htm">
<p>
It's a very complete Linux-like command-line environment. It's It's a very complete Linux-like command-line environment. It's
focused on development, providing Vim, <tt>gcc</tt>, <tt>mc</tt>, focused on development, providing Vim, <tt>gcc</tt>, <tt>mc</tt>,
<tt>ssh</tt>, and loads of software. Once installed, it gives you <tt>ssh</tt>, and loads of software. Once installed, it gives you
the option ``Install System'' to install additional components, the option ``Install System'' to install additional components,
including the <tt>bash</tt> shell. including the <tt>bash</tt> shell.
</itemize> </itemize>
<p> <p>
@ -1110,6 +1133,31 @@ that you install Terminal IDE: it provides a very Linux-like
experience. If you're short on storage, I suggest that you install experience. If you're short on storage, I suggest that you install
KBOX: it's a very good compromise. KBOX: it's a very good compromise.
Users of Android 5 and later versions may want to install an
alternative terminal emulator called Termux:
<p>
<htmlurl url="https://termux.com/" name="https://termux.com/">
<p>
It's very nice and self-contained, i.e. it does not need KBOX or
another command-line environment. Additional software can be installed
simply using apt (Debian users, does that ring a bell?):
<tscreen>
<verb>
$ gcc
The program 'gcc' is not installed. Install it by executing:
apt install gcc
$ ...
</verb>
</tscreen>
<p>
Termux is released under GPLv3, but some add-ons are available for a
small fee.
<!-- - - - --> <!-- - - - -->
<sect1>Installing KBOX <sect1>Installing KBOX
@ -1316,9 +1364,9 @@ url="http://arachnoid.com/android/SSHelper/"
name="http://arachnoid.com/android/SSHelper/"> name="http://arachnoid.com/android/SSHelper/">
<p> <p>
Since it runs on Since it runs on unrooted devices, it uses the port 2222 instead of
unrooted devices, it uses the port 2222 instead of the standard port the standard port 22; i.e., to connect to it from the Linux terminal
22; i.e., to connect to it from the Linux terminal you will do: you will do:
<tscreen> <tscreen>
<verb> <verb>
@ -1386,6 +1434,7 @@ toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86/bin/
contains prebuilt binaries: include that directory in the contains prebuilt binaries: include that directory in the
<tt>$PATH</tt>. <tt>$PATH</tt>.
<p>
The compiler is called <tt>arm-linux-androideabi-gcc</tt>. You use it The compiler is called <tt>arm-linux-androideabi-gcc</tt>. You use it
instead of <tt>gcc</tt> to compile Android binaries. In general, all instead of <tt>gcc</tt> to compile Android binaries. In general, all
binutils have a <tt>arm-linux-androideabi-</tt> prefix. binutils have a <tt>arm-linux-androideabi-</tt> prefix.
@ -1441,7 +1490,12 @@ Linux:~$ _
Beware: Android 5.* has better security policies and will not allow Beware: Android 5.* has better security policies and will not allow
running programs from <tt>/data/local/tmp</tt>, or even accessing that running programs from <tt>/data/local/tmp</tt>, or even accessing that
directory. From the terminal, you'll have to copy the compiled directory. From the terminal, you'll have to copy the compiled
programs elsewhere. For instance, using KBOX: programs to a directory where you have write and execute permissions.
Beware: you will have to copy files in the blind, specifying their
exact names, no wildcards allowed!
<p>
For instance, using KBOX:
<tscreen> <tscreen>
<verb> <verb>
@ -1451,13 +1505,13 @@ kbox$ cp /android_root/data/local/tmp/hello .
kbox$ ls kbox$ ls
hello hello
kbox$ ./hello kbox$ ./hello
hello, workd! hello, world!
kbox$ _ kbox$ _
</verb> </verb>
</tscreen> </tscreen>
<p> <p>
A remarkable list of command-line programs can be compiled for A remarkable list of command-line programs can be easily compiled for
Android. Among others, I ported the Bywater BASIC interpreter: Android. Among others, I ported the Bywater BASIC interpreter:
<p> <p>
@ -1465,7 +1519,13 @@ Android. Among others, I ported the Bywater BASIC interpreter:
name="http://sourceforge.net/projects/bwbasic/"> name="http://sourceforge.net/projects/bwbasic/">
<p> <p>
the C version of the e3 text editor: (minor tweaks were needed: I added <tt>-DHAVE_ISNAN=1</tt> to the DEFS
in the <tt>Makefile</tt>, and also <tt>#define uint64_t unsigned
long</tt> at the top of <tt>bwbasic.h</tt>)
<p>
The C version of the e3 text editor (version 2.7.1) can be compiled
with no tweaks at all:
<p> <p>
<htmlurl <htmlurl
@ -1473,7 +1533,7 @@ url="https://sites.google.com/site/e3editor/"
name="https://sites.google.com/site/e3editor/"> name="https://sites.google.com/site/e3editor/">
<p> <p>
and the ABC music tools: same for the ABC music tools:
<p> <p>
<htmlurl url="http://abcplus.sourceforge.net/" <htmlurl url="http://abcplus.sourceforge.net/"
@ -1488,7 +1548,6 @@ Android are available here:
<htmlurl url="http://kevinboone.net/android_native.html" <htmlurl url="http://kevinboone.net/android_native.html"
name="http://kevinboone.net/android_native.html">. name="http://kevinboone.net/android_native.html">.
<p> <p>
Compile the programs you need, copy them to <tt>/data/local/tmp/</tt>, Compile the programs you need, copy them to <tt>/data/local/tmp/</tt>,
and make sure this directory is included in the <tt>$PATH</tt> of your and make sure this directory is included in the <tt>$PATH</tt> of your