SlackwareOnMt6582Tablet: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 229: Line 229:
Procedure:
Procedure:


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


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


configure:
configure:
<pre>
<pre>
export PKG_CONFIG_PATH=/opt/local/sw/share/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/opt/local/sw/share/pkgconfig:$PKG_CONFIG_PATH
Line 243: Line 243:
export LD_LIBRARY_PATH=/opt/local/sw/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/local/sw/lib:$LD_LIBRARY_PATH
export PATH=/opt/local/sw/bin:$PATH
export PATH=/opt/local/sw/bin:$PATH
# autoreconf --force -v --install || exit 1
# 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
./configure --prefix=/opt/local/sw --enable-kdrive --enable-kdrive-evdev --disab
le-libdrm --disable-record --with-xkb-path=/opt/local/sw/share/X11/xkb --with-xk
le-aiglx --disable-glx --disable-dri --disable-dri2 --disable-libdrm --disable-r
b-output=/var/lib/xkb --with-xkb-bin-directory=/opt/local/sw/bin --with-default-
ecord --with-xkb-path=/opt/local/sw/share/X11/xkb --with-xkb-output=/var/lib/xkb
xkb-rules=xorg --with-default-xkb-model=pc104 --with-default-xkb-layout=us  --di
--with-xkb-bin-directory=/opt/local/sw/bin --with-default-xkb-rules=xorg --with
sable-xorg --enable-xnest --disable-dmx --disable-xquartz --disable-xwin --disab
-default-xkb-model=pc104 --with-default-xkb-layout=us  --disable-xorg --enable-x
le-xephyr --disable-config-udev
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 -j 3
make install
make install
</pre>


Also install
Also install xkeyboard-config-2.11.


xkeyboard-config-2.11
 
Once it is installed:
 
<pre>
cd  /opt/local/sw/share/X11/xkb/rules/
cd  /opt/local/sw/share/X11/xkb/rules/
ln -s base /opt/local/sw/share/X11/xkb/rules/base xorg
ln -s base /opt/local/sw/share/X11/xkb/rules/base xorg
If this is not done, you will get:
If this is not done, you will get error:
         XKB: Failed to compile keymap
         XKB: Failed to compile keymap
</pre>


Once installed, run X:


Once installed, run:
<pre>
         startx -- ./Xfbdev -fb /dev/graphics/fb0
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,
it will disappear.
 
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>
</pre>


Line 278: Line 298:
<pre>
<pre>


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


KdOsFuncs LinuxFuncs = {
</pre>
</pre>

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

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 ( As first step, basically make most of the functions just empty, so that no tty open etc are done.) 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 --disab
le-aiglx --disable-glx --disable-dri --disable-dri2 --disable-libdrm --disable-r
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

Also install xkeyboard-config-2.11.


Once it is installed:

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

Once installed, run X:

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,
it will disappear.

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

See the frame grab with scrot

x.png x2.png


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


--- 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 = {