AnX11 Phone Project

method #1

the d4cm installer

After you have partitioned the SD card, you can install Debian with the d4cm installer (documented on this page). The d4cm installer is based on Sven-Ola's mk-debian installation script, so I hope that it will work on a wide range of devices (like his did).

If you have any trouble with the installer or if you would prefer to know exactly what the installer is doing, you can also use the step-by-step method (documented on the next page) to install Debian.

You can also explore the installer on your desktop computer:

c$ mkdir d4cm_1-7
c$ bash d4cm_1-7.shar d4cm_1-7

...

After you have partitioned the SD card and inserted it into your phone, download d4cm 1.7. On my device, the Android web browser downloads the file to /sdcard/Download/. So to start the installer, I would run the following commands:

a$ su
a# cd /sdcard/Download/
a# sh d4cm_1-7.shar

After confirming that you want to extract the shell archive to /data/local/deb/, the autorun wizard will start. At this point, you may want to just watch it create a 512 MB Wheezy installation just to get a basic sense of how the installer works. If you do, a loop disk image will be created at /sdcard/debian.img and the debootstrap installation will begin. After it finishes, it will ask if you want to remove files that are not needed to make the image work after installation.

You can then enter deb root at the Android prompt. This will mount the Debian directories and take you to a Debian root shell where you can browse the installation.

a$ deb root
d# ls -l /
d# df -h

After you're done browsing, exit the Debian installation:

d# exit

Then get rid of the loop disk installation and prepare to install to the SD card. To do that, first unmount the Debian directories by running deb u at the Android prompt, then run the uninstall script (/data/local/deb/uninstall).

a$ deb u
a$ su
a# cd /data/local/deb
a# ./uninstall

You may also want to remove the loop disk image that you just created:

a# rm /sdcard/debian.img

Because our next step is to install Debian onto a partition on the SD card, let's take a moment to review the layout of the SD card:

partition file system size



/dev/block/vold/179:32 (none) 4.00 MB
/dev/block/vold/179:33 VFAT 8.00 GB
/dev/block/vold/179:34 EXT2 15.72 GB
/dev/block/vold/179:35 EXT2 6.00 GB

Now, let's install the real thing. As before, we need to unpack the shell archive.

a# cd /sdcard/Download/
a# sh d4cm_1-7.shar

Once again, the autorun wizard will start. This time enter nothing at the prompt (i.e. do NOT enter "0w"), so that a loop disk installation is NOT created. Instead, we'll perform a simple two-step manual installation. In my case, I wanted to install to the partition at /dev/block/vold/179:35, so I ran:

a# cd /data/local/deb
a# ./mk-debian -i /dev/block/vold/179:35

If you wish to use a loop disk device that is larger than 2047 MB (and if you have enough space to hold it on an internal EXT4 partition), you can create the loop disk image on your Debian desktop, then push it to Android. For example:

c$ dd if=/dev/zero of="4GB-image.img" bs=1048576 count=4096
c$ adb push 4GB-image.img /data/local/img/4GB-image.img

Then, to start the installation, you would run:

a# cd /data/local/deb
a# ./mk-debian -i /data/local/img/4GB-image.img

Either way, the installer then formats the partition and the debootstrap installation begins. It exits after it finishes extracting the DEBs. You then begin the second stage of the installation with the command deb stage2.

a$ deb stage2

After Debian's debootstrap completes the bootstrapping process, deb stage2 calls Sven-Ola's andromize script, which adds Android group IDs to the Debian system.

Of particular importance are groups that allow access to the SD card and groups that allow access to the network. On my devices, membership in the media_rw (GID: 1023) and sdcard_r (GID: 1028) groups allows access to the SD card, while membership in the inet (GID: 3003) group allows me to use VNC.

After the installation finishes, inspect the sources list in /etc/apt/sources.list and:

a$ deb root
d# apt-get update

The core installation is now complete. You can now mount and unmount the Debian directories with the deb and deb u commands. So let's exit and unmount:

d# exit
a$ deb u


Eryk Wdowiak
last updated: 18 October 2016