Friday, January 15, 2016

Wandboard: Linux.

Ubuntu - Linux distribution - Unity



Click here to get back home.

Linux

There is important thing that one needs to know about ARM. There are two versions: with hardware floating point (HF) math co-processor and without (old-timers flick teardrops of their cheek remembering 286 CPUs). IMX6 CPU is based on arm v.7 architecture that has HF support, but if you use distribution compiled for HF emulation (usually has armel suffix) you loose 5-50% of processing power, because instead of working CPU emulates HF unit even though it has one.

You should choose armhf distribution form the beginning (almost all linaro distros are such).

I recommend to use WB SDK script to build kernel, for it automatically applies all the Freescale patches. Never the less, you'll need to configure and enable most patches and fixes in menuconfig. I recommend to make a copy of kernel config for further tuning.

Useful utilities

'Must have' are:
lshw - displays list of all hardware.
lsusb - displays list of all USB devices.

Xorg

IMPORTANT! Current version of GPU drivers works only with X.org 1.11.*, for now there are no vivante drivers for X.org 1.13.* and up. Thank you vivante! Since my LCD display is pretty old, it has no HDMI input on it, so I used HDMI->DVI cable to connect WB, this resulted fault in correct resolution autodetection. This problem was resolved by adding old fashion Modelines to xorg.conf. Well, I'm not sure about good of VideoRam setting, but you can safely comment it out. 

Section "Device"
 Identifier "i.MX Accelerated Framebuffer Device"
 Driver  "vivante"
 Option  "fbdev"  "/dev/fb0"
 Option  "vivante_fbdev" "/dev/fb0"
 Option  "HWcursor" "false"
 VideoRam 65536
EndSection

Section "Monitor"
 Identifier "Sony HDMI"
 VendorName "SONY"
 ModelName "MFM-HT95"
 HorizSync 28.0 - 64.0
 VertRefresh 56.0 - 76.0
 Modeline "640x480_60.00"  23.86  640 656 720 800  480 481 484 497  -HSync +Vsync
 Modeline "800x600_60.00"  38.22  800 832 912 1024  600 601 604 622  -HSync +Vsync
 Modeline "1024x768_60.00"  64.11  1024 1080 1184 1344  768 769 772 795  -HSync +Vsync
 Modeline "1280x1024_60.00"  108.88  1280 1360 1496 1712  1024 1025 1028 1060  -HSync +Vsync 
EndSection

Section "Screen"
 Identifier "Default Screen"
 Monitor  "Sony HDMI"
 Device  "i.MX Accelerated Framebuffer Device"
 DefaultDepth 24
 SubSection "Display"
  Depth  24
  Modes  "1280x1024" "1024x768" "800x600" "640x480"
 EndSubSection
EndSection

Section "ServerLayout"
 Identifier "Default Layout"
 Screen  "Default Screen"
EndSection

Vivante GPU drivers

IMPORTANT! 
The Vivante GPU driver is divided into two parts, the kernel part and the userspace part. The kernel part is found in /drivers/mxc/gpu-viv/ and is open source. While the userspace part is closed sourced, and is libGAL.so and the associated files. The open source Xorg Vivante Driver, xorg-drv-vivante, accesses the GPU through libGAL.so. 
  • To assemble the userspace part of the GPU drivers you need to unpack gpu-viv-bin-mx6q (get from freescale website),
  • You'll need to ensure that the version of the userspace part and the kernel part is the same. They'll refuse to work by leaving a message ( i.e. in Xorg log ) if their version differs. Note that there was once that the ABI interface between kernel and user space part changed, thus even if their version differs, no message will be left, it'll simply SEGFAULT Xorg.
  • Also, you should assemble and install libdrm package (the one from freescale).
  • Last but not least, HYPER MEGA important tip, the one can save you from having brain damage. if during driver assembly you get.
./configure: line 10956: syntax error near unexpected token `RANDR,'
./configure: line 10956: `XORG_DRIVER_CHECK_EXT(RANDR, randrproto)' 

error, then just install xorg-dev. Believe me, by reading this you just saved at least a couple hours (days?) of internet browsing.

Needless to say, that "auto" packages should be installed, automake and likes.
UPD. If you install Ubuntu 14.04 and higher from official website then you'll have GPU up and runnign out of the box.

fstab

On WB forum I often see "rootfs" mentioned. I haven't looked into it deeply for now, so I do everything in old fashioned way, via /etc/fstab.

It's quite simple: first of we get UUID of disks with blkid (it's done on stationary PC) and then we add to /mnt/root/etc/fstab (in terms of above example) following lines: 
UUID= / ext4 noatime,errors=remount-ro 0 1
UUID= /boot ext4 noatime               0 2
I'd recommend to use "noatime" on both drives to prolong life of SD card flash. 

network

Also I recommend to set up network right on desktop PC.

It is enough to add pretty basic lines to /etc/networking/interface 

auto eth0

iface eth0 inet dhcp

For more details on network setup please consult your favorite search engine. 

audio
Sometimes sound on wandboard needs tuning, there are several things to remember:
  • If you use image provided by wandboard.org and you are logged in as default user (usually it's ubuntu) then you should add this user to group audio.

    usermod -a -G audio ubuntu
  • To check out available devices you can issue aplay -l command.
  • You can also use alsamixer to adjust sound output levels.

It is recommended to use smplayer for accelerated video playback.

No comments:

VIM cheat sheet

Basic basics :) i - start editing, current symbol a - start editing, next symbol Esc - stop editing :w - write to disk :w <filename> -...