Android Linux Desktop Installtion (Xorg Framebuffer , no vnc)

This Article explains how to get xorg working on top of Android devices.
Miner changes is required for configuration to fit your own device.

  • How do we run Linux on top of android ?

    Android kernel is very much like linux kernel. By setting up a chroot environment, most linux programs can run without problem. Even Xorg can run on it with usb keyboard , touchscreen and hw button fully functioning. However, because the absence of sysv-rpc. Some programs such as Network Manager won’t work. (Wicd with dbus is okay). Stuffs like Nfs or tun.ko won’t work unless these modules comes with your android ROM or you’re using CM mod with custom built kernel (In that case, building a kernel with sysv-rpc enabled will gives you a complete linux environment capable of running Ubuntu touch.)

  • Step 1, create linux chroot.
    See also : Arch linux ARM chroot installtion

    The first step is to choose a linux distribution that support arm-v7h (Debian/Ubuntu armhf)  unless your android device is a HTC ARIA or something before 2009. For Arch Linux ARM v7h, download rootfs image and extract it to your SD card. For Debian-armhf, do a debootstrap. I made a archlinuxarm sd card by creating a second ext4 partition and extract rootfs onto it using my desktop computer.Root your android devices. Access android terminal to begin chroot setup. Using adb shell via a USB cable is generally a good idea. For the sake of convenience, I installed Dropbear and ssh into it. The above link of Arch linux Forum post is using a loopback devices. (dd and mke2fs command) This is because android use vfat on sd card partition. If you don’t want to reformat your sd card. You can use the loopback device method as well. Because I’ve prepare a sd card with its second partition already in ext4 format, I just need to mount it. I mount my card /dev/block/vold/179\:2 at /arch. You’ll need to find a appropriate mount point and determine the actual path of your card.

    adb shell

    mount -w -t ext4 /dev/block/vold/179\:2 /arch
    mount -o bind /dev /arch/dev
    mount -o bind /dev/pts /arch/dev/pts
    mount -o bind /dev/shm /arch/dev/shm
    mount -o bind /sys /arch/sys
    mount -o bind /proc /arch/proc

    Login to your linux environment.
    (Of course you’ll want to install Xorg and your favorite program)

    busybox chroot /arch /bin/bash

    Don’t forget to configure your .xinitrc

  • Step 2, edit xorg configurationThe most tricky part !
    You’ll need to determine the fbdev path of your device.

    ##  /etc/X11/xorg.conf.d/99-fbdev.conf
    Section “Device”
    Identifier “Allwinner A10/A13 FBDEV”
    Driver “fbdev”
    Option “fbdev” “/dev/graphics/fb0”


    To get hw button and touchscreen working
    The Mouse Section is how I get touch screen working.
    I download mtev driver from
    apply patches from xda forum to make it  compatible with newer version of Xorg.
    make command will give you a
    copy it to /usr/lib/xorg/modules/input/

    ## /etc/X11/xorg.conf.d/07-input.conf

    Section “ServerLayout”
    Identifier “Layout0”
    InputDevice “Mouse0” “CorePointer”
    InputDevice “Keyboard0” “CoreKeyboard”
    InputDevice “Keyboard1” “CoreKeyboard”

    Section “InputDevice”
    Identifier “Keyboard0”
    Driver “evdev”
    Option “Device” “/dev/input/event0”
    Option “Protocol” “auto”

    Section “InputDevice”
    Identifier “Mouse0”
    # Driver “evdev”
    Driver “mtev”
    Option “Device” “/dev/input/event1”
    Option “Protocol” “auto”

    Section “InputDevice”
    Identifier “Keyboard1”
    Driver “evdev”
    Option “Device” “/dev/input/event3”
    Option “Protocol” “auto”


  • Step 3, kill Android and run linux

    To disable Android’s own graphical interface.adb shell
    setprop ctl.stop media;setprop ctl.stop zygote;setprop ctl.stop surfaceflinger;setprop ctl.stop drm

    and now we can start our xorg

    busybox chroot /arch /bin/bash -c startx

  • Step 4, To switch back to Android

    killall every chrooted process (using android shell)
    setprop ctl.start media;setprop ctl.start zygote;setprop ctl.start surfaceflinger;setprop ctl.start drm

  • Other improvement

    Because xorg can’t make use of egl . There is no hardware acceleration available. (unless it is a Asus TF700t with NATIVE Linux install and Nvidia driver) We can still compile custom version of mplayer/libvpx/libpng/pixman/libjpeg-turbo to enable neon instruction set support.

    p.s. If your android ssh server make use of any graphical stuff, It will stop when surfaceflinger stop. Be sure to install a appropriate dropbear server from Google Play.

Leave a Reply

Your email address will not be published. Required fields are marked *