User:MarkoPagott

From Wandboard Wiki
Jump to: navigation, search

Hi,

I'm a common developer who bought Wandboard (WB) Duo by accident, and now I'm trying to sort things out on "how does it works". Basically I'm creating this because I got tired of searching forum "where have I posted/seen that information", if it helps you out I see no reason why not to say thanx :)

On this page I'll try to make collection of links on "bring to life" process.

I will keep this page as informative as possible, so be advise it is NOT RECOMMENDED SKIPPING PARTS of this document. All this information is important for your board to work.

Overview

Board top

There are two boards: Motherboard (MB) and CPU board. The motherboard contains outlets to external ports so peripherals can be connected to smaller CPU board. It you change MB, you can get extended features like LVDS or VGA connectivity and likes.

IMPORTANT!

  • It is highly unrecommended to use wireless adapters (wifi or bluetooth) without mounted antenna. This may lead to temporary or permanent damage of wireless chip!
  • If you plan to have heavy loads on CPU I would recommend to use heat sink.
  • To boot system you should use SDCard slot on CPU board (there are two, one card slot is on the left of "board top" picture, the other is on the right of "board bottom" picture, see below).
  • To have normal operation board needs 5V with 2A current, I recommend using at least 4A "general purpose" adapter or it would be better to use old PC power supply (I use old 200W AT power supply, I took yellow and black wires from molex hdd plug).

Mp-wandboard top.jpg

Board bottom

Bottom of the board contains plugs that are pretty self explanatory, but there are a couple of important notes. Note, that I'm describing this system as one board, but in fact it's mother board ports and slots I'm describing now.

IMPORTANT!

  • There is no SATA on WB Solo or Duo. Yes, there is SATA plug, but it's no better that toy one. SATA works only on Quadro board!
  • There is SECOND card slot on the bottom, it is convenient for storage extension or data copying, but it is not usabe as a boot slot (unless you have GRUB on your first SD card, but anyway, U-boot bootloader should be started from slot that is on CPU board).

Mp-wandboard bottom.jpg

Electronics

RS232/UART

IMPORTANT! If you are running Linux on your host system we recommend either kermit or cu as terminal emulation programs. Do not use minicom, since this has caused problems for many users, especially for software download over the serial port. Form U-boot manual.

During systems startup you'll need to access console and configure bootloader. This can be accomplished in following ways (I assume that /dev/ttyUSB0 is your USB-2-COM port address):

screen /dev/ttyUSB0 115200 8N1

or (minicom is not recommended, see above)

minicom -b 115200 D /dev/ttyUSB0

or

microcom -p /dev/ttyUSB0 -s 115200

or if you work on windows, use PuTTY and connect to virtual serial port created by your USB-2-COM adapter (usually something above COM4), set baud rate 115200

OTG

To connect OTG port you need special cable, but it's not necessarily reason to go shopping. OTG differs from regular USB with two crossed ground pins (see below).

OTG pinnout.jpg

Software

Fist of all, I'd like to mention, that any action you would take will require source code. You can get it either with "wandboard-sdk" (which is preferable) or from developer's website (in this case you should patch some packages like kernel for example).

SD card layout

Now, you have to be aware of iMX6 (and all u-boot) partitioning: first 512 bytes are FAT, don't touch it. Then after 1k goes u-boot with ~250kB weight. Then for some unknown reason ppl write raw kernel (which is really not what is described in wandboard.h file).

| 0-446: FAT | 447-1024: 0000000 | 1k-aprox 250k u-boot | 250k-1M: 0000000 | 1M-3M zImage |

In my case I desided to quit having headache with raw image (luckily wandboard.h file was aligned towards normal linux partitioning) and made simple structure.

/dev/sda1: boot (starts at 1MB of drive, we need to write u-boot, remember?)
/dev/sda2: root
/dev/sda3: swap

boot - contains: uEnv.txt, zImage (exaclty zImage named and packed so, unlike said above), and kernel config (just in case).

root - "/" partition.

swap - no comments.

Creating bootable SD

INFO! In this example I would not create swap partition, but you can do it if you need to.

#fdisk /dev/sdd (assuming /dev/sdd is your SDcard)
Command: n
Select: p
Partition number: 1
First sector: 2048
Last sector: +128M 
(->Now the same again, but)
Partition number: 2
First sector: (propsed, in my case it was 264192)
Last sector: (enter, to use all remaining space)
(->Enable 1-st partition to be bootable)
Command: a
Partition number: 1
(->Write everything and exit)
Command: w

cfdisk on sdd should show 1Mb of free space, then boot partition, then root partition. Now, let's create file system:

mkfs.ext4 /dev/sdd1
mkfs.ext4 /dev/sdd2

As easy as killing bunnies with an axe (c) Carmageddon.

Next up, mount sdd2 to /mnt/root (or whatever you wish), an sdd1 to /mnt/root/boot (this should be inside your "whatever" folder.

Now, all you have to do is to unpack contents of archive to newly mounted folder (I hope no need to tell, that you should change to source dir). This could take some time... Check the result, mine unpacked to /mnt/root/binary/boot/filesystem.dir, if so then change to that folder and do mv * ../../.. (boot folder may not move). Get rid of garbage.

tar xvzf linaro-precise-ubuntu-desktop-20121124-560.tar.gz -C /mnt/root/

Next there will be u-boot and kernel setup (see below).

U-Boot

File uEnv.txt should be put in /mnt/root/boot folder (in this example).

Then you should write bootloader to SD card like:

dd if=u-boot.imx of=/dev/sdd bs=1k seek=1

Then you should make (or use provided, if you have such) kernel, see below.

uEnv.txt

This is config file that has to be put to boot partition besides kernel. This file will command bootloader how to behave. Here's mine (be advised, that I'm not fan of raw_writing kernel every time, so I use "separate boot partition layout", so root is located on mmcblk0p2, see layout above).

Now, u-Boot loads two general components: zImage (or uImage) which is kernel, and dtb file. Each of this components have it's place (the address) in memory to be loaded:

  • zImage - 0x12000000
  • dtd file - 0x11000000

Netconsole

U-Boot has technology, that allows one to have WB console working over LAN. To make it work with faulty RS232 we should modify U-Boot sources, compile our own bootloader and write it to SD card. Don't worry it's not that complex.

Plan A

From u-boot folder open file include/configs/wandboard.h and add following lines:

// Define addresses:
#define CONFIG_NETMASK 255.255.255.0
#define CONFIG_IPADDR 192.168.10.99
#define CONFIG_GATEWAYIP 192.168.10.1
#define CONFIG_SERVERIP 192.168.10.100

#define CONFIG_NETCONSOLE 1
#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1

Note, that 10.99 is your board IP and 10.100 is address of PC that accepts your netconsole. You can find complete pastebin of my wandboard.h here, be sure to adjust IP addresses before use!

Plan B

If you wish to have opportunity turning netconsole off, you can compile this variant of wandboard.h file and make the rest of settings with uEnv.txt file like this:

ip_dyn=no
ethaddr=<PUT YOUR MAC HERE> 
ipaddr=192.168.10.99
netmask=255.255.255.0
serverip=192.168.10.126
ncip=192.168.10.126
nc=setenv stdin nc;setenv stdout nc;setenv sterr nc
stdin=nc
stdout=nc
stderr=nc
mmcargs=setenv bootargs netconsole=6666@192.168.10.99/,@192.168.10.126/ ${optargs} root=${mmcroot}   rootfstype=${mmcrootfstype}

Well, the downside of this flexible approach is that you get console output slightly later than in "Plan A", so you'll see only "booting mmc" part.

Then you should compile image as usual with "make" command, and write it to boot sector:

dd if=u-boot.imx of=/dev/sdd bs=1k seek=1 

There are two ways to listen to netconsole. Ubuntu way is to install nc.traditional and run:

nc.traditional -l -u -p 6666 & nc.traditional -u 192.168.10.99 6666

or you can use ncb command which is under tools folder in u-boot dir.

IMPORTANT! If at boot time WB will not find remote PC for netconsole IT WOULD NOT BOOT!

Linux kernel

I recommend to compile kernel using WB SDK scripts, as a result you'll get kernel zImage, archive of firmware and archive of modules, which should be unpacked to appropriate folders of /mnt/root

IMPORTANT! zImage is not compatible with u-Boot and needs to be converted by means of mkimage. go to u-boot/tools, and issue the following comand (I copied kernel to that folder):

./mkimage -A arm -O linux -T kernel -C gzip -a 0 -e 0 -n Linux-3.0.35-wand3 -d 3.0.35-wand3.zImage 3.0.35-wand3.uImage

afterwards, you might want to check your kernel by:

./mkimage -l 3.0.35-wand3.uImage

or you can enable "#define CONFIG_CMD_BOOTZ" in include/configs/wandboard.h (Thanks to Robert Nelson).

After making all transformations, you should place uImage named zImage (what an irony :) ) to /mnt/root/boot folder (in this example, you should place to /dev/sdd2 mount point).

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 (oldtimers 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.

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 <kernel source>/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.

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=<really-long-uuid-number-here> /		ext4	noatime,errors=remount-ro	0 1
UUID=<really-long-uuid-number-here> /boot	ext4	noatime				0 2

I'd recommend to use "noatime" on both drives to prolong life of SDcard 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.

Linaro

Linarologo.png

Basicaly it's distribution that we will work with. As I figured out, there are "snapshot builds" that are made based on "slice" of current ubuntu distribution. The idea is that enginers of [www.linaro.org/ linaro] assemble every month new distribution, that contains all packages and fixes that released since previous distribution. That's why it's 12.04, 12.05, 12.06 unlike ubuntu.

Currently, for WB it is good to use only distributions based on ubuntu 12.04 (because of situation with vivante GPU drivers, see above), which are linaro: 12.04-12.11. Next linaro release is based on ubuntu 12.10 and can not use current GPU drivers.

IMPORTANT! If you choose to install Nano package, be ready that you'll be forced to install everything including xorg and locales packages.

As I get it, linaro comes with minimum of country-specific options. To get locales in tune, you should define needed locales by

locale-def en_US

edit /etc/default/locale and add locales we defined above. Now we need just

update-locale

Ubuntu

Logo-ubuntu-orange.png

Ubuntu is pretty huge project which also covers arm architecture. Unfortunately pure ubuntu distribution is available only for iMX53 chips (which partially explains why there is test image only for armel CPU on WB website).

For now there is no direct use of ubuntu in WB (unless you can put up with HF emulation and loss of CPU time).

Yocto

Yplogotrans-small.png

Yocto is not distribution, as I get it, Yocto is set of tools that help you generate linux for embeded solutions. For now I've tried out demo image from website. Well... it works. It looks like embedded system, touch-oriented. It has the same problem as Linaro/Ubuntu with Xorg resolution over HDMI-DVI (see xorg section above).

Android

Androidlogo.png

Android is OS developed and maintained by Google. I also tried out image from website.

  • There are no google app installed, so there is no Play Store.
  • I haven't figured out if I can use Superuser privileges.
  • By default it ran 640x480 which was pretty low. There is no xorg.conf there so yet there is a problem to force change resolution.

Copyright

All this information is provided for educational purposes. Any copying of this information should be agreed. On any Copyright policy change for this website (wiki) I reserve right to remove all this information.

By hosting this information, you agree with policy above.

Disclaimer

All rights and logos belong to their rightful owners.