Category Archives: Linux

Linux stuff

Don’t buy anything comes with Bay Trail cpu if you’re a linux user. [ Linux on Teclast X80H Baytrail Tablet ]

It has been almost three years since Bay Trail is launched, yet linux support is still terrible and glitchy.

Seriously, bay trail is already out dated, discontinued, and always sucks in performance. There is no point buying it if linux can’t run perfectly on it. It have been two months since I got a Teclast X80H. Booting linux is fairly simple if you got the correct bootloader. Because most (if not all) bay trail tablet shipped with a 32bit UEFI BIOS despite the cpu is 64bit, you need a true 32bit UEFI shell and a kernel with CONFIG_EFI_MIXED=y enable to boot 64bit linux. Most 32bit uefi shells shipped by modern distributions won’t work but a few do. SD slot is sdio and unbootable, but usb slot/hub/keyboard/storage works. Entering BIOS and setting up external usb boot is a child’s trick, period.

The fun doesn’t end here. To defect glithes you need:

CONFIG_PINCTRL_BAYTRAIL                           enable mmc reader
rtl8723bs                                                                 wifi driver
(It would be wise to disable btcoex and use network manager instead of wpa_supplicant if you don’t like strange stuffs popping up in dmesg and very long associating time)
CONFIG_TOUCHSCREEN_GOODIX=m          touchscreen (3.19+ required)
rpmb patch                                                            fix annoying lock up
CONFIG_INPUT_SOC_BUTTON_ARRAY        enable volume keys but not power button
triggerhappy daemon                                        xdotool when volume key is pressed
CONFIG_BMG160=m                                          orientation sensor
iio-sensor-proxy                                                   orientation sensor bridge

Not yet working but will be needed:

AXP288_ADC=y
XPOWER_PMIC_OPREGION=y
CONFIG_JSA1212=m
CONFIG_SND_SST_IPC=m
CONFIG_SND_SST_IPC_ACPI=m
CONFIG_SND_SOC_INTEL_SST=m
CONFIG_SND_SOC_INTEL_SST_ACPI=m
CONFIG_SND_DESIGNWARE_I2S=m

That’s it !
Hardware acceleration works partially in some kernel (3.19) because tsc/refined-jiffies clocksource will affect the playback speed. You might get a blank screen but xrandr  rotate right  command would unblank it. I915 in kernel 4.0 will only work if KMS is disabled. There isn’t any working clocksource yet. BTW, tsc clocksource would lead to touchscreen constantly clicking itself.

ACPI/ALSA won’t work. Bluetooth/Camera possibly won’t work ever.
Charging won’t work in linux. (windows is just okay)

EDIT: 2015 Apr 23 :   charging driver entered linux-next-git  ( linux 4.1 )
CONFIG_AXP288_FUEL_GAUGE=y

WIFI support is mediocre. Backlight won’t work.

Don’t buy this tablet !! It’ doesn’t worth it.

Native Linux Installation on Bay Trail tablet ?

Cheap chinese win8 tablets are prevailing recently. Native linux install seems possible on EVERY tablet this year.

It has been a year since I finished my linux on-top-of android project. Although a user-mode linux is a great addition to android tablet, a lots of applications are problematic in chroot environment. Buggy firefox audio, poor performance, segfault due to lacks of sysv-ipc, not functional usb device unless connected under android environment in advance…. TF700t & HP touch Pad were the only tablets supported by Arch Linux ARM community ( and with NVIDIA proprietary driver fully working ) until the end of 2014.

Devices with Intel’s Z3775 Soc are incredibly cheap. This company literally spent 1 billion on tablet chip subsides. Linux has been installed on Bay Trail laptop such as Asus transformer book T100 two years ago. It’s 2015 now. Low-end tablet with X86-64 cpu such as Z3735 emerged. And they shipped with UNLOCKED UEFI bootloader. Of course there are problems such as unbootable sd slot, unsupported yet bootable usb port, and buggy 32bit only bootloader. Boot from usb by manually going through UEFI shell is very possible.

Currently, a cheap Chinese tablet isn’t on top of my shopping list due to inconvenient oversea shipping. I would definitely get my hands dirty if I get one of these. Maybe I’ll buy one this summer. Probably a Cherry Trail tablet, eh ?

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”
    EndSection


     

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

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

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

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

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

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


     

  • 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.