About the d4cm Scripts
AnX11 Phone Project
table of contents
The goal of this project is to run Debian on an Android phone (or tablet).
To achieve that goal, we will need a "rooted" Android phone or tablet. Recent improvements in Android security have made it more difficult to root such devices however. In such cases, one option may be to replace the device's stock operating system with CyanogenMod.
The installer that we will use should work on (rooted) Android devices with BusyBox installed, but the name of the installer -- d4cm 1.7 ("Debian for CyanogenMod" 1.7) -- assumes that your device is running CyanogenMod.
A comparison of installers is outside the scope of this project. The references section lists several that we could alternatively use. As the basis d4cm, I have chosen "Debian Kit" by Sven-Ola Tuecke.
Sven-Ola's work is notable for two reasons. First, because he wrote a simple installer that worked across on a wide range of (rooted) Android devices. And second, because his bootdeb script bind-mounted Debian to the root of the Android file system, generating a beautiful fusion of the two systems.
Fusing the two systems worked on most devices when Sven-Ola released the last version of his kit in Sept. 2012, when Android 4.1 (Jelly Bean) was Google's new product. Starting with Android 4.4 (KitKat) however, SELinux ("Security-Enhanced Linux") strictly confines Android applications to their sandboxes. In the case of Sven-Ola's kit, SELinux denies Debian permission to operate in Android's root directory, so the only way to use Sven-Ola's kit on newer phones is to compile (and install) a kernel that disables SELinux.
Leaving SELinux in place seems sensible, so I have replaced Sven-Ola's bootdeb with a script called d4cmdeb. The new script confines Debian to a sandbox by running it inside a proper chroot environment. This allows Debian to run smoothly with SELinux enforcement, but it prevents Debian from accessing the Android system (so the two can no longer run side-by-side).
In another departure from Sven-Ola's work, I have made d4cmdeb depend on your system's version of BusyBox (not the version that ships with the installer). This may require you to modify the d4cmdeb script, but your modifications will help you customize your Debian installation and better integrate it with your device.
Although "d4cm" is a fork of Sven-Ola's work, it also continues his work in several ways. Most notably, I have merged his andromize tools into the installer itself.
One reason for merging his andromize tools was necessity. Because Debian will not have access to the root of the Android file system Sven-Ola's androresolvd daemon will no longer work. As a workaround, the d4cmdeb script now passes nameservers to Debian's /etc/resolv.conf.
A second reason for merging his andromize tools was convenience. Instead of installing a Debian package for the purpose of adding a list of Android groups to the Debian system, it was just easier to tack that script onto the end of the installation routine.
My modifications to Sven-Ola's mk-debian installer script should ensure that it continues to work on a wide range of devices. To handle any cases where the installer does not work, this project also provides a step-by-step installation method.
Just like Sven-Ola's original work, d4cm also allows you to install Debian to either a loop disk image or to an external SD card, but for the moment the installer will not create images larger than 2047MB. If you wish to set up a (larger) loop disk image on an internal EXT4 partition, you can create the image on a desktop computer, push it to your device and then run the installer.
Most newer phones will meet the minimum hardware requirements. The installer works on the ARM and i386 processors, only requires 128 MB of RAM and support for the EXT3 file system. If there is any doubt, a quick way to test your hardware's compatibility is to install Sven-Ola's Debian Kit app.
And then ... have fun running Debian on your phone or tablet!
Copyright © 2014-2020 Eryk Wdowiak