SlackwareOnMt6582Tablet

From SlackWiki
Revision as of 07:36, 3 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?

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,

chroot to installer:

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

	adb shell
	su
	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:

	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/
        export PATH=/usr/bin:/bin:/usr/lib/setup:$PATH
	chroot . /bin/bash

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

	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:

	start

After few seconds android display will be back on.

Failed test of running an Xorg session

Getting Mali driver for Xorg

All these compilations are done under the chrooted Slackware environment on the Tablet PC, using gcc

	gcc version 4.8.2 (GCC) ( arm-slackware-linux-gnueabi-gcc )

Open Source Mali-200/300/400/450 GPU Kernel Dev Open Source Mali GPUs Linux EXA/DRI2 and X11 Display Drivers

Get DX910-SW-99003-r4p1-01rel0 or choose another version

Once downloaded, and adb pushed to tablet:

	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

also get ump

	make and install

Once make/install is done for both,

	cp src/.libs/mali_drv.* /usr/lib/xorg/modules/drivers/
	ldconfig

Run Xorg

And run startx, which fails with the following error.

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


Compiling and getting Xfbdev running! - Partially

Finally I found that the X VT requirement can be removed. 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:

Get xorg-server-1.12.2 and required files from : http://xorg.freedesktop.org/archive /X11R7.7/

Apply patch to hw/kdrive/linux/linux.c ( basically make most of the functions just e mpty, so that no tty open etc are done - first step to test :-) ) refer to the patch at the end.

configure:

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 PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/opt/local/sw/lib:$LD_LIBRARY_PATH
export PATH=/opt/local/sw/bin:$PATH
# autoreconf --force -v --install || exit 1
./configure --prefix=/opt/local/sw --enable-kdrive --enable-kdrive-evdev --enabl
e-config-udev --disable-aiglx --disable-glx --disable-dri --disable-dri2 --disab
le-libdrm --disable-record --with-xkb-path=/opt/local/sw/share/X11/xkb --with-xk
b-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  --di
sable-xorg --enable-xnest --disable-dmx --disable-xquartz --disable-xwin --disab
le-xephyr --disable-config-udev

make -j 3
make install

Also install

xkeyboard-config-2.11
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:
        XKB: Failed to compile keymap


Once installed, run:
        startx -- ./Xfbdev -fb /dev/graphics/fb0

See the frame grab with scrot

x.png x2.png


/hw/kdrive/linux/linux.c patch:


--- linux.c     2014-09-03 08:29:11.000000000 +0530
+++ linux.c.org 2012-05-17 22:39:03.000000000 +0530
@@ -65,7 +65,6 @@
 static void
 LinuxCheckChown(char *file)
 {
-#ifdef GV
     struct stat st;
     __uid_t u;
     __gid_t g;
@@ -76,13 +75,11 @@
     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;
@@ -130,14 +127,13 @@
     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;

@@ -168,7 +164,6 @@
     if (ioctl(LinuxConsoleFd, VT_SETMODE, &VT) < 0) {
         FatalError("LinuxInit: VT_SETMODE failed\n");
     }
-#endif
 }

 static void
@@ -181,7 +176,6 @@
 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)) {
@@ -219,7 +213,6 @@
             ioctl(LinuxApmFd, cmd, 0);
         }
     }
-#endif
 }

 #ifdef FNONBLOCK
@@ -231,7 +224,6 @@
 static void
 LinuxEnable(void)
 {
-#ifdef GV
     if (enabled)
         return;
     if (kdSwitchPending) {
@@ -265,14 +257,12 @@
     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;
@@ -285,13 +275,11 @@
         close(LinuxApmFd);
         LinuxApmFd = -1;
     }
-#endif
 }

 static void
 LinuxFini(void)
 {
-#ifdef GV
     struct vt_mode VT;
     struct vt_stat vts;
     int fd;
@@ -339,7 +327,6 @@
         close(fd);
     }
     return;
-#endif
 }

 void
@@ -365,11 +352,9 @@
 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 = {