SlackwareOnMt6582Tablet

From SlackWiki
Revision as of 11:11, 7 September 2014 by Gv (talk | contribs)
Jump to navigation Jump to search

Specifications of the Tablet PC which was used here

  Processor : Arm Cortex A7, 1.3 GHz dual core.
            : ARMv7 Processor rev 3 (v7l),
  Hardware  : MT8312
  SOC       : mt6582.
  Memory    : 512MB RAM
  Storage   : 4GB Built in storage.
  Micro SD  : Slot for upto 32GB
  Display   : 7" WVGA 800x480
  OS        : Android 4.2 Jelly Bean
  GPU       : Mali?

External Links

Screenshot of X windows with fluxbox and wbar. And another one.

SlackwareOnMT6582 page at github, includes StartX apk.

Rooting the Tablet PC

I used Framaroot-1.9.3.apk to root the device.

Installing Linux - Slackware 14.1, sort of.

With the problem of not having kernel source for the SOC, and no no bootloader unlock possible yet, next best option was to use a chroot environment.

So far, command line mode works fine. Here is the description of how Slackware was installed on to external micro SD Card. Was able to do some basic tests on the frame buffer display. Since there is no VTs available was not able to test Xorg, though could get Mali module compiled and loaded. More details below.

Preparing SD Card on host computer

Use fdisk to create one or two partitions, one for ext4 and other ( optional ) swap partition. Once these are created, assuming the device on host is /dev/sdc,

   mkfs.ext4 /dev/sdc1
   sync
   eject sdc
   eject -t sdc
   mkdir slack
   mount /dev/sdc1 slack
   cd slack
   mkdir sl
   cd sl

If you don't have Slackware installation files, Get Slackware Arm first.

   mkdir slackware14.1
   cd slackware14.1
   (cd /path..to../slackware14.1 ; tar cfz - *) | (tar xfz - )


initrd-kirkwood.cpio contains the setup program, but since I couldn't boot with custom initrd, sdc1 /sl area is prepared to have the installation files.


   cpio -id < initrd-kirkwood.cpio
   sync
   umount slack

Now that the sd card is ready for installation:

   eject sdc

and plug it into the device. Once that is done,

Getting installer ready

Now plug the card in tablet pc, boot, from host computer,

starting a adb shell with su

   adb shell
   su


chroot to installer

   cd /data/local/tmp
   mkdir slackware
   mount /dev/block/mmcblk1p1 slackware
   cd slackware/sl
   export PATH=/data/local/tmp/bin:$PATH
   mountpoint proc || mount -t proc none proc/
   mountpoint sys || mount -t sysfs sys sys/
   mountpoint dev || mount -o bind  /dev dev/
   export PATH=/usr/bin:/bin:/usr/lib/setup:$PATH
   pushd /dev
   ln -s /dev/block/mmc1blk* .
   popd
   chroot . /bin/bash
   mount -t ext4 /dev/mmcblk1p1 mnt

Running setup

Install Slackware onto mmcblk1p1, from pre mounted directory, sdc1 : /slackware14.1/slackware

   setup
       Proceed and select /dev/mmcblk1p1 as target, no format
       For source, select pre mounted directory option, /slackware14.1/slackware


Complete installation, and configuration

Once the complete installation is done,

   umount proc
   umount sys
   umount dev
   sync
   cd ../..
   umount slackware

Getting into installed Slackware:

Running slackware su shell

   adb shell
   su
   mount /dev/block/mmcblk1p1 slackware
   cd slackware
   mountpoint proc || mount -t proc none proc/
   mountpoint sys || mount -t sysfs sys sys/
   mountpoint dev || mount -o bind  /dev dev/
   test -d system || mkdir system
   mountpoint system || mount -o bind /system system
   export PATH=/usr/bin:/bin:/usr/lib/setup:$PATH
   chroot . /bin/su -	


From here you can do "normal" Slackware activities, sort of. Main things that were lacking in my case were VTs (ttys). Compiling programs and running programs. I ran couple of frame buffer tests too. Fortunately, removing the VT requirement from Xorg was pretty simple. Here is how it was done.


Getting Xorg up and running - kind of

Getting Xorg compiled

Ecept for Pointer ( touchscreen ) failure, Xorg seems to be working fine. evtest, xinput tests are showing touchscreen activity, but the cursor seems to be not moving. But if a window like xvkbd or xterm or so is launched, you can move the window using the touch screen!. And kvkbd input also works.

Download xorg-server-1.12.2,


tar xf xorg-server-1.12.2.tar.bz2

Also make changes to xorg-server-1.12.2/hw/xfree86/os-support/linux/lnx\_init.c so that VT / console related code is disabled. See the patch section.

lnx_init.c patch

lnx_init.patch

Compiling xorg-server-1.12.2

cd xorg-server-1.12.2 export PKG_CONFIG_PATH=/opt/local/sw/share/pkgconfig:$PKG_CONFIG_PATH export PKG_CONFIG_PATH=/opt/local/sw/lib/pkgconfig:$PKG_CONFIG_PATH export LD_LIBRARY_PATH=/opt/local/sw/lib:$LD_LIBRARY_PATH export PATH=/opt/local/sw/bin:$PATH ./configure --prefix=/opt/local/sw --enable-kdrive --enable-kdrive-evdev --with-xkb-path=/opt/local/sw/share/X11/xkb --with-xkb-output=/var/lib/xkb --with-xkb-bin-directory=/opt/local/sw/bin --with-default-xkb-rules=xorg --with-default-xkb-model=pc104 --with-default-xkb-layout=us --disable-xnest --disable-dmx --disable-xquartz --disable-xwin --disable-xephyr --disable-config-udev --enable-tslib --disable-docs --disable-devel-docs LDFLAGS=-L/opt/local/sw/lib CFLAGS=-I/opt/local/sw/include make -j 3

If all required packages are not on the system, compilation will fail. Download each of the requiered packags , untar, configure and install.

./configure --prefix=/opt/local/sw make -j 3 install

Once xorg-server-1.12.2 compilation is succesfull, make install

Compiling additional drivers required

fbdev

xf86-video-fbdev-0.4.2 export PKG_CONFIG_PATH=/opt/local/sw/lib/pkgconfig:$PKG_CONFIG_PATH ./configure --prefix=/opt/local/sw

src/fbdev.c xf86-video-fbdev-0.4.2/src/fbdev.c // #include "mibstore.h"

make -j 3 make install

evdev

   xf86-input-evdev-2.7.0
   ./configure --prefix=/opt/local/sw
   src/Makefile:
   evdev_drv_la_LIBADD = $(MTDEV_LIBS) $(UDEV_LIBS)
   ( if not done, causes evdev_drv.so: undefined symbol: udev_new when Xorg is ran)
   make -j 3 
   make install

Once installed make an xorg.conf [ see xorg.conf section ] in /etc/X11/ and run startx as described below.

xorg.conf

Copy this file to /etc/X11


xorg.conf


Running X

make sure display is on, From slackware chroot environment in adb shell [ see section ]:

   /system/bin/stop
   startx -- /opt/local/sw/bin/Xorg -pointer mytouchscreen :0
 
   Try disown / nohup to keep X running when disconnected from PC.

Once Finished,

run:

   /system/bin/start

Or touch the "back to android" icon on wbar. to return to Android.

Virtual Keyboard

xvkbd

Download xvkbd from xvkbd-3.5.tar.gz, and install:

   xmkf
   make 
   make install

Run:

   xvkbd

An application launcher

wbar

Download wbar from wbar-2.3.4.tgz at wbar downloads at code.google.com

.wbar

Copy this file to /root/.wbar :

.wbar

Android app to launch X Windows directly from Android

Create StartX projec

Check SlackwareOnMT6582 project at github

Create a project:

   android  create project -n StartX -k com.startx.android -a StartXActivity -t 1 -p .

Copy StartXActivity.java to src/com/startx/android

If required,

  keytool -genkey -v -keystore gv.keystore \
    -alias gv_ks -keyalg RSA -keysize 2048 -validity 10000

Add to project properties:

    key.store=./gv.keystore
    key.alias=gv_ks

Build and install:

    ant release install

StartXActivity.java

Copy this file to StartX/src/com/startx/android

StartXActivity.java

chroot2slackware.sh

Copy this file to /data/local/tmp/

chroot2slackware.sh


exitfromslackware.sh

This file is called when "Back to Android" wbar button is touched.

Copy this file to /data/local/tmp/

exitfromslackware.sh


Running some tests

Testing the framebuffer

For these tests, I stopped android "SurfaceFlinger" and freed up /dev/graphics/fb0. by running "stop" command. Before running stop, make sure that the display is on ( not blank ). For these tests, I had two terminals up on the host PC with one of them running just adb shell with su, and other running chrooted slackware shell. SurfaceFlinger was stopped from su shell, and tests from Slackware shell.

Please not Slackware shell is also running as user root.

Stopping android - sort of

Here is how to stop the SurfaceFlinger and get framebuffer free:

   adb shell
   su
   stop

Now the display goes blank, with backlight on.

Get one of these tests. fbtest or Paint-pixels-to-screen- via-linux-framebuffer or qtopiacore-testingframebuffer All these tests worked on the Tablet. Transfer the tests to tablet using adb push command.

from Slackware shell, running under adb shell:

   gcc fbtest.c
   ./a.out


once done, go back to android su shell from adb, and:

Getting back to android

   start


After few seconds android display will be back on.

Running evtest

Download evtest.c.

  gcc -o gcc -o evtest evtest.c
  ./evtest
  see evtest.log for sample outpu


evtest.log

No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:	mtk-kpd
/dev/input/event1:	ACCDET
/dev/input/event2:	hwmdata
/dev/input/event3:	mtk-tpd
Select the device event number [0-3]: Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "mtk-tpd"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value      0
      Min        0
      Max      800
      Resolution     800
    Event code 1 (ABS_Y)
      Value      0
      Min        0
      Max      480
      Resolution     480
    Event code 24 (ABS_PRESSURE)
      Value      0
      Min        0
      Max      255
    Event code 48 (ABS_MT_TOUCH_MAJOR)
      Value      0
      Min        0
      Max      100
    Event code 49 (ABS_MT_TOUCH_MINOR)
      Value      0
      Min        0
      Max      100
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max      800
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max      480
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max        0
Properties:
  Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)
Event: time 1409845467.116675, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1409845467.116682, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 1
Event: time 1409845467.116687, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 115
Event: time 1409845467.116691, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 96
Event: time 1409845467.116695, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 1
Event: time 1409845467.116699, ++++++++++++++ SYN_MT_REPORT ++++++++++++
Event: time 1409845467.116703, -------------- SYN_REPORT ------------
Event: time 1409845467.133145, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 1
Event: time 1409845467.133151, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 115
Event: time 1409845467.133155, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 96
Event: time 1409845467.133160, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 1
Event: time 1409845467.133164, ++++++++++++++ SYN_MT_REPORT ++++++++++++
Event: time 1409845467.133167, -------------- SYN_REPORT ------------

...

Event: time 1409845469.216857, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 1
Event: time 1409845469.216863, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 207
Event: time 1409845469.216867, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 376
Event: time 1409845469.216871, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 1
Event: time 1409845469.216875, ++++++++++++++ SYN_MT_REPORT ++++++++++++
Event: time 1409845469.216878, -------------- SYN_REPORT ------------
Event: time 1409845469.230419, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1409845469.230423, ++++++++++++++ SYN_MT_REPORT ++++++++++++
Event: time 1409845469.230426, -------------- SYN_REPORT ------------

Running xinput

xinput --list

â¡ Virtual core pointer                         id=2    [master pointer  (3)]
â   â³ Virtual core XTEST pointer               id=4    [slave  pointer  (2)]
â   â³ mytouchscreen                            id=6    [slave  pointer  (2)]
⣠Virtual core keyboard                        id=3    [master keyboard (2)]
    â³ Virtual core XTEST keyboard              id=5    [slave  keyboard (3)]


xinput log

xinput test 6

motion a[0]=53 a[1]=58 a[2]=0 a[3]=1 a[4]=0 
button press   1 a[0]=53 a[1]=58 a[2]=0 a[3]=1 a[4]=0 
button release 1 a[0]=53 a[1]=58 
motion a[0]=513 a[1]=91 a[2]=0 a[3]=1 a[4]=0 
button press   1 a[0]=513 a[1]=91 a[2]=0 a[3]=1 a[4]=0 
button release 1 a[0]=513 a[1]=91 
motion a[0]=659 a[1]=436 a[2]=0 a[3]=1 a[4]=0 
button press   1 a[0]=659 a[1]=436 a[2]=0 a[3]=1 a[4]=0 
button release 1 a[0]=659 a[1]=436 
motion a[0]=624 a[1]=152 a[2]=0 a[3]=1 a[4]=0 
button press   1 a[0]=624 a[1]=152 a[2]=0 a[3]=1 a[4]=0 
motion a[0]=577 a[1]=174 
motion a[0]=501 a[1]=203 
motion a[0]=457 a[1]=219 
motion a[0]=411 a[1]=232 
motion a[0]=371 a[1]=240 
motion a[0]=341 a[1]=245 
button release 1 a[0]=341 a[1]=245