SlackwareOnMt6582Tablet: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(21 intermediate revisions by the same user not shown)
Line 2: Line 2:
== Specifications of the Tablet PC which was used here ==
== Specifications of the Tablet PC which was used here ==


<pre>
 
Processor : Arm Cortex A7, 1.3 GHz dual core.
  Processor : Arm Cortex A7, 1.3 GHz dual core.
  : ARMv7 Processor rev 3 (v7l),
            : ARMv7 Processor rev 3 (v7l),
Hardware  : MT8312
  Hardware  : MT8312
SOC      : mt6582.
  SOC      : mt6582.
Memory    : 512MB RAM
  Memory    : 512MB RAM
Storage  : 4GB Built in storage.
  Storage  : 4GB Built in storage.
Micro SD  : Slot for upto 32GB
  Micro SD  : Slot for upto 32GB
Display  : 7" WVGA 800x480
  Display  : 7" WVGA 800x480
OS        : Android 4.2 Jelly Bean
  OS        : Android 4.2 Jelly Bean
        GPU      : Mali?
  GPU      : Mali?
</pre>
 
== External Links ==
 
Get [http://arm.slackware.com/getslack/ Slackware] for arm
 
[http://s7.postimg.org/fww1ibfdn/image.png Screenshot] of X windows with fluxbox and wbar. And [http://s15.postimg.org/izdxddkqj/image.png another one].
 
[http://www.techverse.net/fastest-root-android-phone-computer/ Framaroot-1.9.3.apk]
 
[https://github.com/gv1/SlackwareOnMT6582/releases SlackwareOnMT6582] page at github, includes [https://github.com/gv1/SlackwareOnMT6582/releases StartX] apk.
 


== Rooting the Tablet PC ==
== Rooting the Tablet PC ==


I used [http://www.techverse.net/fastest-root-android-phone-computer/ Framaroot-1.9.3.apk] to root the device.  
A tablet with root access is required. I used [http://www.techverse.net/fastest-root-android-phone-computer/ Framaroot-1.9.3.apk] to root the device.  


== Installing Linux - Slackware 14.1 - sort of. ==
== 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.
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. Please not that you can try command line stuff with [http://proot.me/ proot] ( which requires no root access). Xorg however requires root permission since /dev/graphics/fb0 requires root permission.


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.
So far, X windows using Xorg, and 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.


=== Preparing SD Card on host computer ===
=== Preparing SD Card on host computer ===
Line 29: Line 39:
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,
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,


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


If you don't have Slackware installation files, [http://arm.slackware.com/getslack/ Get Slackware Arm] first.  
If you don't have Slackware installation files, [http://arm.slackware.com/getslack/ Get Slackware Arm] first.  
<pre>
        mkdir slackware14.1
        cd slackware14.1
(cd /path..to../slackware14.1 ; tar cfz - *) | (tar xfz - )


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


[http://sourceforge.net/projects/slackwareonapc8750/files/initrd-kirkwood.cpio.gz/download 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.
[http://sourceforge.net/projects/slackwareonapc8750/files/initrd-kirkwood.cpio.gz/download 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.
<pre>
 
cpio -id < initrd-kirkwood.cpio
 
sync
    cpio -id < initrd-kirkwood.cpio
umount slack
    sync
    umount slack


Now that the sd card is ready for installation:
Now that the sd card is ready for installation:


eject sdc
    eject sdc
</pre>
and plug it into the device. Once that is done,
and plug it into the device. Once that is done,


=== chroot to installer: ===
=== 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 ====


Now plug the card in tablet pc, boot, from host computer,
    cd /data/local/tmp
<pre>
    mkdir slackware
adb shell
    mount /dev/block/mmcblk1p1 slackware
su
    cd slackware/sl
cd /data/local/tmp
    export PATH=/data/local/tmp/bin:$PATH
mkdir slackware
    mountpoint proc || mount -t proc none proc/
mount /dev/block/mmcblk1p1 slackware
    mountpoint sys || mount -t sysfs sys sys/
cd slackware/sl
    mountpoint dev || mount -o bind  /dev dev/
export PATH=/data/local/tmp/bin:$PATH
    export PATH=/usr/bin:/bin:/usr/lib/setup:$PATH
mountpoint proc || mount -t proc none proc/
    pushd /dev
mountpoint sys || mount -t sysfs sys sys/
    ln -s /dev/block/mmc1blk* .
mountpoint dev || mount -o bind  /dev dev/
    popd
export PATH=/usr/bin:/bin:/usr/lib/setup:$PATH
    chroot . /bin/bash
pushd /dev
    mount -t ext4 /dev/mmcblk1p1 mnt
ln -s /dev/block/mmc1blk* .
popd
chroot . /bin/bash
mount -t ext4 /dev/mmcblk1p1 mnt
</pre>


=== Running setup ===
=== Running setup ===
Line 88: Line 99:
Install Slackware onto mmcblk1p1, from pre mounted directory, sdc1 : /slackware14.1/slackware
Install Slackware onto mmcblk1p1, from pre mounted directory, sdc1 : /slackware14.1/slackware


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


=== Complete installation, and configuration ===
=== Complete installation, and configuration ===
Line 99: Line 108:
Once the complete installation is done,
Once the complete installation is done,


<pre>
    umount proc
umount proc
    umount sys
umount sys
    umount dev
umount dev
    sync
sync
    cd ../..
cd ../..
    umount slackware
umount slackware
</pre>


== Getting into installed Slackware: ==
== Getting into installed Slackware: ==


<pre>
==== Running slackware su shell ====
mount /dev/block/mmcblk1p1 slackware
 
cd slackware
    adb shell
mountpoint proc || mount -t proc none proc/
    su
        mountpoint sys || mount -t sysfs sys sys/
    mount /dev/block/mmcblk1p1 slackware
        mountpoint dev || mount -o bind  /dev dev/
    cd slackware
        export PATH=/usr/bin:/bin:/usr/lib/setup:$PATH
    mountpoint proc || mount -t proc none proc/
chroot . /bin/bash
    mountpoint sys || mount -t sysfs sys sys/
</pre>
    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
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 were ok. I ran couple of frame buffer tests too. Fortunately, removing the VT requirement from Xorg was pretty simple. Here is how it was done.
were VTs (ttys). Compiling programs and running programs that require no X windows worked fine. I ran
couple of frame buffer tests too.  
== Testing the framebuffer ==


For these tests, I stopped android "SurfaceFlinger" and freed up /dev/graphics/fb0. by running "stop"
== Getting Xorg up and running - kind of ==
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
=== Getting Xorg compiled ===
chrooted slackware shell. SurfaceFlinger was stopped from su shell, and tests from Slackware shell.
 
Please not Slackware shell is also running as user root.
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.
 
 
==== lnx_init.c patch ====
 
[https://github.com/gv1/SlackwareOnMT6582/blob/master/lnx_init.patch lnx_init.patch]
 
==== Compiling xorg-server-1.12.2 ====
 
Download [http://www.x.org/releases/X11R7.7/src/everything/xorg-server-1.12.2.tar.bz2  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.
 
 
    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 ====


<pre>
    xf86-video-fbdev-0.4.2
adb shell
    export PKG_CONFIG_PATH=/opt/local/sw/lib/pkgconfig:$PKG_CONFIG_PATH
su
    ./configure --prefix=/opt/local/sw
stop
 
</pre>
In src/fbdev.c xf86-video-fbdev-0.4.2/src/fbdev.c, comment:
 
    // #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
 
[https://github.com/gv1/SlackwareOnMT6582/blob/master/xorg.conf xorg.conf]
 
 
=== Running X ===
 
In the final setup, these manual steps to switch between X and Android is
not required, StartX app and wbar button "Back to Android" does these tasks.
 
make sure display is on,
From slackware chroot environment in adb shell [ see section ]:
 
    /system/bin/stop
    startx -- /opt/local/sw/bin/Xorg :0
 
    Try disown / nohup to keep X running when disconnected from PC.
 
Or
    Touch and run "StartX" app.
 
Once Finished,
 
run:
 
    /system/bin/start
 
 
Or touch the "back to android" icon on wbar. to return to Android.
 
=== Virtual Keyboard ===
 
==== xvkbd ====
 
Download [http://homepage3.nifty.com/tsato/xvkbd/ xvkbd] from [http://homepage3.nifty.com/tsato/xvkbd/xvkbd-3.5.tar.gz xvkbd-3.5.tar.gz], and install:
 
    xmkf
    make
    make install
 
Run:
 
    xvkbd
 
=== An application launcher ===
 
==== wbar ====
 
Download [https://github.com/warlockcc/wbar wbar] from [https://code.google.com/p/wbar/downloads/detail?name=wbar-2.3.4.tgz&can=2&q= wbar-2.3.4.tgz] at [https://code.google.com/p/wbar/downloads/list wbar downloads at code.google.com]
 
==== .wbar ====
 
Copy this file to /root/.wbar :
 
[https://github.com/gv1/SlackwareOnMT6582/blob/master/wbar .wbar]
 
== Android app to launch X Windows directly from Android ==


Now the display goes blank, with backlight on.
=== Install apk ===


Get one of these tests.
Install [https://github.com/gv1/SlackwareOnMT6582/releases/download/v0.1-alpha/StartXActivity-release.apk StartXActivity-release.apk] for starting X
[https://gist.githubusercontent.com/rafalrusin/1482697/raw/32c6c0d79b870ffb618aa7b7c664736ca5e150fe/fbtest.c  fbtest] or
windows from Android. You may use adb to install StartX after downloading it.
[http://stackoverflow.com/questions/4996777/paint-pixels-to-screen-via-linux-framebuffer Paint-pixels-to-screen-  via-linux-framebuffer] or
   
[http://cep.xray.aps.anl.gov/software/qt4-x11-4.2.2/qtopiacore-testingframebuffer.html qtopiacore-testingframebuffer] All these tests worked on the Tablet. Transfer the tests to tablet using adb push
    adb install ./StartXActivity-release.apk
command.


from Slackware shell, running under adb shell:
Or if you prefer,


<pre>
=== Create StartX project ===
  gcc fbtest.c
  ./a.out
</pre>


once done, go back to android su shell from adb, and:
To build the the apk from scratch, check [https://github.com/gv1/SlackwareOnMT6582 SlackwareOnMT6582] project at github


<pre>
Create a project:
start
</pre>


After few seconds android display will be back on.  
    android create project -n StartX -k com.startx.android -a StartXActivity -t 1 -p .


== Failed test of running an Xorg session ==
Copy [https://github.com/gv1/SlackwareOnMT6582/blob/master/StartXActivity.java StartXActivity.java] to  src/com/startx/android


=== Getting Mali driver for Xorg ===
If required,


All these compilations are done under the chrooted Slackware environment on the Tablet PC, using gcc
    keytool -genkey -v -keystore gv.keystore \
    -alias gv_ks -keyalg RSA -keysize 2048 -validity 10000


<pre>
Add to project properties:
gcc version 4.8.2 (GCC) ( arm-slackware-linux-gnueabi-gcc )
    key.store=./gv.keystore
</pre>
    key.alias=gv_ks


[http://malideveloper.arm.com/downloads/drivers/DX910 Open Source Mali-200/300/400/450 GPU Kernel Dev]
Build and install:
[http://malideveloper.arm.com/develop-for-mali/drivers/open-source-mali-gpus-linux-exadri2-and-x11-display-drivers/ Open Source Mali GPUs Linux EXA/DRI2 and X11 Display Drivers]
    ant release install


Get [http://malideveloper.arm.com/downloads/drivers/DX910/r4p1-01rel0/DX910-SW-99003-r4p1-01rel0.tgz DX910-SW-99003-r4p1-01rel0] or choose another version
==== StartXActivity.java ====
Copy this file to StartX/src/com/startx/android before build.


Once downloaded, and adb pushed to tablet:
[https://github.com/gv1/SlackwareOnMT6582/blob/master/StartXActivity.java StartXActivity.java]


<pre>
==== chroot2slackware.sh ====
tar xf DX910-SW-99003-r4p1-01rel0.tgz
cd DX910-SW-99003-r4p1-01rel0/x11/xf86-video-mali-0.0.1
./autogen.sh
in src/Makefile:
# mali_drv_la_LDFLAGS = -module -avoid-version -L$(MALI_DDK)/lib -lMali -lUMP -lpthread
for now.
mali_drv_la_LDFLAGS = -module -avoid-version -L$(MALI_DDK)/lib -lUMP -lpthread
</pre>


also get [http://malideveloper.arm.com/develop-for-mali/drivers/open-source-mali-gpus-ump-user-space-drivers-source-code-2 ump]
Copy [https://github.com/gv1/SlackwareOnMT6582/blob/master/chroot2slackware.sh chroot2slackware.sh] to /data/local/tmp/ along with


<pre>
==== exitfromslackware.sh ====
make and install
</pre>


Once make/install is done for both,
This file is called when "Back to Android" wbar button is touched.  
<pre>
cp src/.libs/mali_drv.* /usr/lib/xorg/modules/drivers/
ldconfig
</pre>


=== Run Xorg ===
Copy [https://github.com/gv1/SlackwareOnMT6582/blob/master/exitfromslackware.sh exitfromslackware.sh] to /data/local/tmp/


And run startx, which fails with the following error.
Thse files are used by StartX app to launch X windows.


<pre>
== Running some tests ==
[  9131.458] (II) LoadModule: "mali"
[  9131.461] (II) Loading /usr/lib/xorg/modules/drivers/mali_drv.so
[  9131.461] (II) Module mali: vendor="X.Org Foundation"
[  9131.462]    compiled for 1.14.3, module version = 0.4.2
[  9131.462]    ABI class: X.Org Video Driver, version 14.1
[  9131.462] (II) MALI: driver for Mali Framebuffer: mali
[  9131.462] (EE)
Fatal server error:
[  9131.462] (EE) xf86OpenConsole: Cannot open /dev/tty0 (No such file or direct
ory)
[  9131.463] (EE)
[  9131.463] (EE)
</pre>


=== Testing the framebuffer ===


== Compiling and getting Xfbdev running! - Partially ==
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 ).


Finally I found that the X VT requirement can be removed.
==== Stopping android - sort of ====
In the first test, No keyboard and mouse, but startx opens a nice fluxbox window.
I can set DISPLAY=:0, and run xterm and other applications from adb shell onto the
X windows running on LCD. Here is what I did:


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


Get xorg-server-1.12.2 and required files from :  
From Slackware shell in adb:
http://xorg.freedesktop.org/archive/X11R7.7/


Apply patch to hw/kdrive/linux/linux.c ( As first step, basically make most of the functions
    stop
just empty, so that no tty open etc are done.) Refer to the patch at the end.


configure:
Now the display goes blank, with backlight on.


<pre>
Get one of these tests.
export PKG_CONFIG_PATH=/opt/local/sw/share/pkgconfig:$PKG_CONFIG_PATH
[https://gist.githubusercontent.com/rafalrusin/1482697/raw/32c6c0d79b870ffb618aa7b7c664736ca5e150fe/fbtest.c  fbtest] or
export PKG_CONFIG_PATH=/opt/local/sw/lib/pkgconfig:$PKG_CONFIG_PATH
[http://stackoverflow.com/questions/4996777/paint-pixels-to-screen-via-linux-framebuffer Paint-pixels-to-screen-  via-linux-framebuffer] or
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
[http://cep.xray.aps.anl.gov/software/qt4-x11-4.2.2/qtopiacore-testingframebuffer.html qtopiacore-testingframebuffer] All these tests worked on the Tablet. Transfer the tests to tablet using adb push
export LD_LIBRARY_PATH=/opt/local/sw/lib:$LD_LIBRARY_PATH
command.
export PATH=/opt/local/sw/bin:$PATH


# autoreconf --force -v --install || exit 1
from Slackware shell, running under adb shell:


./configure --prefix=/opt/local/sw --enable-kdrive --enable-kdrive-evdev --disab
    gcc fbtest.c
le-aiglx --disable-glx --disable-dri --disable-dri2 --disable-libdrm --disable-r
    ./a.out
ecord --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-xorg --enable-x
nest --disable-dmx --disable-xquartz --disable-xwin --disable-xephyr --enable-co
nfig-udev --enable-tslib LDFLAGS=-L/opt/local/sw/lib CFLAGS=-I/opt/local/sw/incl
ude


make -j 3
make install
</pre>


Also install xkeyboard-config-2.11.


==== Getting back to android ====
 
Once done, go back to Slackware shell in adb, and:


Once it is installed:
    start


<pre>
After few seconds android display will be back on.
cd  /opt/local/sw/share/X11/xkb/rules/
ln -s base /opt/local/sw/share/X11/xkb/rules/base xorg
If this is not done, you will get error:
        XKB: Failed to compile keymap
</pre>


Once installed, run X:
=== Running evtest ===


<pre>
Download [http://cgit.freedesktop.org/~whot/evtest/tree/evtest.c evtest.c].
Makesure the display is on.
Stop Surfaceflinger from adb shell ( as root ):
        stop


If "stop" step is not done, X will show up, but as soon as the screen is touched,
  gcc -o gcc -o evtest evtest.c
it will disappear.
  ./evtest
  see evtest.log for sample outpu


From Slackware shell ( as root ), run:
        startx -- /opt/local/sw/bin/Xfbdev -fb /dev/graphics/fb0
Once done, restart Surfaceflinger from adb shell ( as root ):
        start
</pre>


See the frame grab with scrot
==== evtest.log ====


x.png
[https://github.com/gv1/SlackwareOnMT6582/blob/master/doc/evtest.log evtest.log]
x2.png


=== Running xinput ===


=== /hw/kdrive/linux/linux.c patch: ===
    xinput --list


<pre>
<pre>
â¡ 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)]
</pre>


--- linux.c.org 2012-05-17 22:39:03.000000000 +0530
+++ linux.c 2014-09-03 08:29:11.000000000 +0530
@@ -65,6 +65,7 @@
static void
LinuxCheckChown(char *file)
{
+#ifdef GV
    struct stat st;
    __uid_t u;
    __gid_t g;
@@ -75,11 +76,13 @@
    g = getgid();
    if (st.st_uid != u || st.st_gid != g)
        chown(file, u, g);
+#endif
}
static int
LinuxInit(void)
{
+#ifdef GV
    int fd = -1;
    char vtname[11];
    struct vt_stat vts;
@@ -127,13 +130,14 @@
    if (ioctl(LinuxConsoleFd, VT_GETSTATE, &vts) == 0) {
        activeVT = vts.v_active;
    }
-
+#endif
    return 1;
}
static void
LinuxSetSwitchMode(int mode)
{
+#ifdef GV
    struct sigaction act;
    struct vt_mode VT;
@@ -164,6 +168,7 @@
    if (ioctl(LinuxConsoleFd, VT_SETMODE, &VT) < 0) {
        FatalError("LinuxInit: VT_SETMODE failed\n");
    }
+#endif
}
static void
@@ -176,6 +181,7 @@
static void
LinuxApmWakeup(pointer blockData, int result, pointer pReadmask)
{
+#ifdef GV
    fd_set *readmask = (fd_set *) pReadmask;
    if (result > 0 && LinuxApmFd >= 0 && FD_ISSET(LinuxApmFd, readmask)) {
@@ -213,6 +219,7 @@
            ioctl(LinuxApmFd, cmd, 0);
        }
    }
+#endif
}
#ifdef FNONBLOCK
@@ -224,6 +231,7 @@
static void
LinuxEnable(void)
{
+#ifdef GV
    if (enabled)
        return;
    if (kdSwitchPending) {
@@ -257,12 +265,14 @@
    if (ioctl(LinuxConsoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
        FatalError("LinuxInit: KDSETMODE KD_GRAPHICS failed\n");
    }
+#endif
    enabled = TRUE;
}
static void
LinuxDisable(void)
{
+#ifdef GV
    ioctl(LinuxConsoleFd, KDSETMODE, KD_TEXT);  /* Back to text mode ... */
    if (kdSwitchPending) {
        kdSwitchPending = FALSE;
@@ -275,11 +285,13 @@
        close(LinuxApmFd);
        LinuxApmFd = -1;
    }
+#endif
}
static void
LinuxFini(void)
{
+#ifdef GV
    struct vt_mode VT;
    struct vt_stat vts;
    int fd;
@@ -327,6 +339,7 @@
        close(fd);
    }
    return;
+#endif
}
void
@@ -352,9 +365,11 @@
static void
LinuxBell(int volume, int pitch, int duration)
{
+#ifdef GV
    if (volume && pitch)
        ioctl(LinuxConsoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff) |
              (((unsigned long) duration * volume / 50) << 16));
+#endif
}
KdOsFuncs LinuxFuncs = {


==== xinput log ====
    xinput test 6
<pre>
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
</pre>
</pre>

Latest revision as of 13:14, 7 September 2014

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

Get Slackware for arm

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

Framaroot-1.9.3.apk

SlackwareOnMT6582 page at github, includes StartX apk.


Rooting the Tablet PC

A tablet with root access is required. 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. Please not that you can try command line stuff with proot ( which requires no root access). Xorg however requires root permission since /dev/graphics/fb0 requires root permission.

So far, X windows using Xorg, and 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.

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 were ok. 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.


lnx_init.c patch

lnx_init.patch

Compiling xorg-server-1.12.2

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.


   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

In src/fbdev.c xf86-video-fbdev-0.4.2/src/fbdev.c, comment:

   // #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

In the final setup, these manual steps to switch between X and Android is not required, StartX app and wbar button "Back to Android" does these tasks.

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

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

Or

   Touch and run "StartX" app. 

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

Install apk

Install StartXActivity-release.apk for starting X windows from Android. You may use adb to install StartX after downloading it.

   adb install ./StartXActivity-release.apk

Or if you prefer,

Create StartX project

To build the the apk from scratch, 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 before build.

StartXActivity.java

chroot2slackware.sh

Copy chroot2slackware.sh to /data/local/tmp/ along with

exitfromslackware.sh

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

Copy exitfromslackware.sh to /data/local/tmp/

Thse files are used by StartX app to launch X windows.

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

Stopping android - sort of

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

From Slackware shell in adb:

   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


Getting back to android

Once done, go back to Slackware shell in adb, and:

   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

evtest.log

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