Install on Android - entware/entware GitHub Wiki
⚡ Reference installation: ⚡ |
---|
The information on this page is based on a successful installation of Entware circa 2014 onto a Tronsmart CX-919 Android TV stick (Rockchip RK3188, Cortex-A9 quad core 32-bit processor; 2 GiB DDR3 RAM) running Finless ROM 1.6b (Android 4.2.2, Jelly Bean). All available evidence suggests that it is applicable to most other ARM A-Profile architecture-based, rooted Android devices as well. As always, Entware makes no claims about the safety of doing so and the possibility exists that rare types of catastrophic failure during installation may render the device inoperative. Proceed at your own risk. |
💡 Note: 💡 |
---|
If your device is rooted using Magisk, instead of following this guide you may find that it is more convenient to use the unofficial Entware Installer for Magisk module. Even so, we encourage you to finish reading this page and then review the available information regarding the module's device compatibility and installation requirements before making a decision. The module is not available through the official Magisk repository, so the process may be unlike experiences had with other Magisk modules. |
Mandatory
- Armv7-A (or newer) architecture-based device
- A rooted Android operating system with a
functioning
su
binary - Busybox
or a similar utility installed in a
PATH directory and compiled with
FEATURE_WGET_HTTPS=Y
so as to provide a workingwget
applet - At least one of the following, to provide access to root shell instances
running on the device:
- A working copy of the
Android Debug Bridge (
adb
)—located in a PATH directory, as above—and no older than the version of Android on the device - Either the Terminal Emulator for Android or ADB - Local&Remote ADB Shell apps (or their functional equivalent) installed and working as expected
- A running SSH server on the device, such as SSH/SFTP Server - Terminal or Simple SSHD
- A working copy of the
Android Debug Bridge (
Recommended
- Support for
init.d
/su.d
scripts, to start Entware services automatically after boot, or an Android application with this functionality such as Tasker
The installation itself is performed using a POSIX shell script, which makes two critical implicit assumptions about the environment it's executed on:
- The
/opt
directory must be writable (at least by theroot
user), and - A reasonably POSIX-compliant shell interpreter can be invoked by calling
/bin/sh
(typically a symlink to another binary such asash
,dash
orbash
, but it need not be).
Assuming all of the prerequisites are satisfied, all that remains is to open a shell on the device, download the appropriate installation script and execute it. For a user who had opted to use the Android Debug Bridge on their desktop computer to communicate to an Android device connected via a USB cable, the process would roughly follow this overall course:
Beginning from a terminal window on the computer with an open instance of the
computer's shell, begin by invoking a shell on the Android device by first
calling adb connect
, followed by adb shell
. If successful, the command
prompt will change in the terminal emulator to now display the device's
codename before each command prompt. (If
more than one Android device is connected, expand the collapsed section directly
below for more information about explicit device selection in ADB.)
Explicit device selection in Android Debug Bridge (click to expand)
In the event there is more than one Android device connected to your PC when
attempting to install Entware using ADB, it becomes necessary to declare a
target device for any commands. First, have ADB print out the list of the
devices it can detect with the command adb devices -l
. It will output a simple
table with serial numbers on the left margin and a string of concatenated
key/value pairs to their right describing the device's various properties. You
can use either the serial number or the value of transport_id
to identify your
target device, with serial numbers offering the additional possibility of using
the ANDROID_SERIAL
environment variable to declare them once for an entire
session, rather than having to include it with every adb shell
command that
may be needed. Here are examples of the commands needed to set that environment
variable in the most common shells found on modern computers:
Shells | Command |
---|---|
Bourne (bash ), Korn (ksh ) & Z (zsh ) |
typeset -gx ANDROID_SERIAL="<serial_number>" |
Windows CMD | set ANDROID_SERIAL=<serial_number> |
PowerShell | [System.Environment]::SetEnvironmentVariable('ANDROID_SERIAL','<serial_number>','User') |
Almquist (ash ), Dash & POSIX (sh ) |
export ANDROID_SERIAL="<serial_number>" |
Fish | set -Ux ANDROID_SERIAL "<serial_number>" |
C Shell (csh ) |
setenv ANDROID_SERIAL <serial_number> |
💡 Note: Replace
<serial_number>
with the serial number in the left column ofadb devices -l
's output
The alternative is to identify your target device by passing the relevant
identifier as an argument to the adb shell
command in the form of
adb -s <serial_number> shell
or adb -t <transport_id> shell
.
With all of the above concerns addressed, invoking the ADB shell in your computer's terminal emulator should result in (roughly) the following output:
> adb shell
* daemon not running; starting now at tcp:5037
* daemon started successfully
device_codename:/ $
The most straightforward (but most dangerous) approach to creating a filesystem location for the Entware environment would be to remount the rootfs in read/write mode and simply create the directories there, as in:
device_codename:/ $ su
Password:
device_codename:/ # /system/bin/mount -o rw,remount /
device_codename:/ # mkdir /opt /bin
device_codename:/ # ln -s /system/bin/sh /bin/sh
device_codename:/ # /system/bin/mount -o ro,remount /
However, it's much safer to keep the rootfs limited to read-only access and
instead use a bind mount to link the /opt
folder to another directory stored
on an external storage medium, like an SD card or USB flash drive:
💡 Note: Alternatively, you can bind
/opt
to a new subdirectory in the/data
directory, or mount a loopback device associated with a.img
raw disk image file.
mkdir /mnt/external_sd/entware.arm
mount -o bind /mnt/external_sd/entware.arm /opt
Next, run the installation script that corresponds to your device architecture.
- For armv7 (32-bit ARM) devices running Linux kernel v3.2 or newer:
wget -O- https://bin.entware.net/armv7sf-k3.2/installer/alternative.sh | sh
- For aarch64 (64-bit ARM) devices running Linux kernel v3.10 or newer:
wget -O- https://bin.entware.net/aarch64-k3.10/installer/alternative.sh | sh
- For armv7 (32-bit ARM) devices running a Linux kernel older than v3.2:
wget -O- https://bin.entware.net/armv7sf-k2.6/installer/alternative.sh | sh
Then you can install and run the Dropbear SSH server:
unset LD_LIBRARY_PATH LD_PRELOAD
/opt/bin/opkg install dropbear
/opt/sbin/dropbear -p 22 -a
For the initial SSH connection to your device, use the default password
(12345
) for Entware's root
user account. Once connected, it is strongly
recommended to change the root
account password using the passwd
command:
# /opt/bin/passwd
Changing password for root
New password:
Retype password:
passwd: password for root changed by root
After connecting to the device via SSH, install the desired packages using
opkg
. For instance, installing the Midnight Commander filesystem
browser/file editor is as simple as:
opkg update
opkg install mc
Click here to see a screenshot of Midnight Commander from Entware running on an Android device over SSH in PuTTY
It has been observed that some Entware binaries do not function correctly
without an /etc/resolv.conf
file, though the Android operating system itself
does not use this common Linux mechanism. Known possible workarounds are:
- As by default, the
/etc
directory on Android is a symlink to/system/etc
, remount the/system
volume in read/write mode and create a symlink at/system/etc/resolv.conf
that resolves to/opt/etc/resolv.conf
, where the file can be managed much easier. There can be defined your DNS service of choice following the format (shown in the example are the Google Public DNS server IPv4 addresses):nameserver 8.8.8.8 nameserver 8.8.4.4
- Script the replacement of the default
/etc
⇾/system/etc
symlink to one that instead resolves to/etc
⇾/data/local/etc
for execution each time the device boots. The suggestion of using/data/local/etc
is merely that, any other writeable directory would be just as effective, provided it contained symlinks for the contents of both/system/etc/*
and/opt/etc/*
:mkdir /data/local/etc chmod 0755 /data/local/etc chcon u:object_r:system_file:s0 /data/local/etc for i in $(ls /system/etc); do ln -s "/system/etc/${i}" "/data/local/etc/${i}"; done ln -s /opt/etc/resolv.conf /data/local/etc/resolv.conf
- Recompile the libc-package so that it reads DNS definitions from
/opt/etc/resolv.conf
rather than/etc/resolv.conf
. To effect this, download the libc source code and (after applying the current Entware patch set) patch all instances of filesystem objects located under/etc
to refer instead to the desired location by using thefind
andsed
commands:find -name "*.[ch]" -type f -execdir sed -Ei 's,/etc/,/opt/etc/,g' '{}' \; find -name "*.[ch]" -type f -execdir sed -Ei 's,/opt/opt/,/opt/,g' '{}' \;
To run Entware services automatically after the boot sequence is complete, provide for a script that follows the basic template below (with customizations to suit your device, of course) to be executed on startup:
#!/system/bin/sh
unset LD_PRELOAD LD_LIBRARY_PATH
/system/bin/mount -o rw,remount / && {
/system/bin/chmod 0777 /mnt/external_sd
/system/bin/mkdir /opt /bin
ln -s /system/bin/sh /bin/sh
}
/system/bin/mount -o ro,remount / && {
/system/bin/mount -t ext2 -o rw /dev/block/mmcblk0p1 /mnt/external_sd
/system/bin/mount -o bind /mnt/external_sd/entware.arm /opt
}
/opt/etc/init.d/rc.unslung start
exit 0