Building Linux for Pandaboard ES

Experimentation with the Skype runtime on the igepv2 board resulted in many days of frustration and endless performance diagnostic leading to a decision to focus on slightly more powerful platform. The Skype audio/video communication works OK on the igepv2 board (OMAP3530) however the CPU is loaded close to 100% which makes the performance monitor in the Skype runtime to keep reducing video framerate and target video bitrate which produces quite unpleasant behaviour. I had a Pandaboard ES lying around and decided to use it for the next experimentation. The Pandaboard ES has OMAP4460 which is dual core running on 1.2GHz so I hope to get some performance boost compare to the igepv2 which is OMAP3530 on 720MHz.  I'm using Openembedded (OE) for building custom linux distributions for my embedded projects and the following description will cover just that environment.

Configuring openembedded

A few years ago I have setup the Angstrom distribution which I'm still using however with significant modifications. The OE setup for the Pandaboard consisted from  these steps

Environment setup

Create a new file with environment variables to configure the OE system. Before building any package with the OE we inject these variables to the system on the command line .

I named the file environment-2010-panda

export MACHINE=omap4430-panda
export DISTRO="angstrom-2010.x"
export DISTRO_DIRNAME="angstrom_2010_x"
export OE_BUILD_DIR="/attic/angstrom2/build_panda"

export OE_BUILD_TMPDIR="\${OE_BUILD_DIR}/tmp-angstrom_2010_x"
export OE_SOURCE_DIR="/attic/angstrom2/sources"
export OE_BASE="/attic/angstrom2/"
export PATH="/attic/angstrom2/sources/bitbake/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin"

export BB_ENV_EXTRAWHITE="MACHINE DISTRO GIT_PROXY_COMMAND ANGSTROMLIBC http_proxy ftp_proxy https_proxy all_proxy ALL_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS"

export BBPATH="${OE_BUILD_DIR}:/attic/angstrom2/sources/openembedded"

Second step was to create the build directory build_panda/conf and file with local configuration build_panda/conf/local.conf with this content

# Where to store sources
DL_DIR = "/attic/angstrom2/sources/downloads"
#INHERIT += "rm_work"

# Which files do we want to parse:
BBFILES ?= "/attic/angstrom2/sources/openembedded/recipes/*/*.bb"
BBMASK = ""

# Qemu 0.12.x is giving too much problems recently (2010.05), so disable it for users
ENABLE_BINARY_LOCALE_GENERATION = "0"
OE_ALLOW_INSECURE_DOWNLOADS="1"

# What kind of images do we want?
IMAGE_FSTYPES += "tar.bz2"

# Make use of SMP:
#   PARALLEL_MAKE specifies how many concurrent compiler threads are spawned per bitbake process
#   BB_NUMBER_THREADS specifies how many concurrent bitbake tasks will be run
PARALLEL_MAKE     = "-j6"
BB_NUMBER_THREADS = "4"

# Set TMPDIR instead of defaulting it to /tmp
TMPDIR = "/attic/angstrom2/build_panda/tmp-angstrom_2010_x"

# Don't generate the mirror tarball for SCM repos, the snapshot is enough
BB_GENERATE_MIRROR_TARBALLS = "0"

CE_VERSION = "latestlatest"

TERMCMD = ${XTERM_TERMCMD}
TERMCMDRUN = ${XTERM_TERMCMDRUN}

And that's basically it. Now we are gonna configure and build the kernel.

Adding & building Kernel 3.5.4 in the OE

Since the current version of the OE doesn't include last kernel 3.5.4 (as of writing this) I had to add this version to the OE. The only problem was that the module-init-tools-cross_3.12.bb recipe didn't include reference on the depmod-3.5 package. I fixed it by appending virtual/${TARGET_PREFIX}depmod-3.5 to the PROVIDES variable.

PROVIDES += "virtual/${TARGET_PREFIX}depmod virtual/${TARGET_PREFIX}depmod-2.6 virtual/${TARGET_PREFIX}depmod-3.0 virtual/${TARGET_PREFIX}depmod-3.5"

Of course I had to create a new recipe for this version of kernel. There was no surprise here. The recipe looks like this

/recipes/linux/linux-omap4_3.5.4.bb

CORTEXA8FIXUP = "no"
COMPATIBLE_MACHINE = "omap4430-panda"

require linux.inc

DESCRIPTION = "Linux kernel for OMAP processors"
KERNEL_IMAGETYPE = "uImage"

SRC_URI = "http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.5.4.tar.bz2 \
           file://defconfig"

PV = "3.5.4"
S = "${WORKDIR}/linux-3.5.4"

After creating this recipe we need to configure the kernel.

bitbake -c menuconfig virtual/kernel

The Pandaboard has two video output (actually three, the third being a composite video but this one is not exposed on the board) HDMI and DVI. The DVI is generated by TFP410 DVI transmitter which is connected on the main display bus that is shared with the LCD display (if connected) The TFP410 is being turned on/off via I2C line. Long story short we need to select the FTP410 panel in the kernel config in order to use the DVI output.

CONFIG_PANEL_TFP410=y

To configure the audio we need to do more configuration. Audio IO is supported by TWL6040 chip so we need to select the following.

CONFIG_TWL6040_CORE=y
CONFIG_SND_OMAP_SOC=y
 CONFIG_SND_OMAP_SOC_DMIC=m
 CONFIG_SND_OMAP_SOC_MCPDM=m
 CONFIG_SND_OMAP_SOC_HDMI=m
 CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=m
 CONFIG_SND_OMAP_SOC_OMAP_HDMI=m
CONFIG_SND_SOC_I2C_AND_SPI=y
 CONFIG_SND_SOC_DMIC=m
 CONFIG_SND_SOC_OMAP_HDMI_CODEC=m
 CONFIG_SND_SOC_TWL6040=m

With the kernle 3.5.4 (3.4.2, 3.6-rc2 and most likely other) The following option must be disables, otherwise the audio playback is completely distorted !!

# OMAP Feature Selections
 #
 # CONFIG_OMAP_SMARTREFLEX is not set
 # CONFIG_OMAP_RESET_CLOCKS=y

Now for the Wifi support select these options.

CONFIG_WL12XX=m
CONFIG_WLCORE=m
CONFIG_WLCORE_SDIO=m

The last step is to compile the kernel

bitbake -f -c compile virtual/kernel

And then force the build, this will update the sysroot and create the kernel package with all modules.

bitbake -f -c build virtual/kernel

Booting from network with TFTP, PXE & NFS

While developing for the embedded devices I like to boot it over network from my dekstop. It's quite nice to have the root filesystem and the kernel on my computer so I can quickly update it and test changes. First thing to do is to setup a NFS and tftp servers and populating the rootfs and boot directories. This is somewhat trivial and there is not much to be said about it. The second think is to create the PXE file with the boot parameters. The PXE configuration file is loaded from the tftp server to the memory on the device. This is basically a configuration controlling from where to get the kernel and what kernel parameters to use for the booting process. Optionally one can also specify to load the init ramdisk.

The PXE file needs to be stored in a file int the pxelinux.cfg directory. This of course depends on the version of the u-boot loader you have. I'm using linaro u-boot loader U-Boot SPL 2012.07

The image with the PXE configuration can have many names. The u-boot loader tries several names, the first being the mac address of the network interface. In my case it is:

01-2e-60-09-a7-46-01

And this is the content of my file PXE file stored in /tftp/panda_es/pxelinux.cfg/01-2e-60-09-a7-46-01  The directory /tftp/panda_es/ is the root of the tftp server.

default panda-natty
prompt 0
timeout 3

label panda-natty
kernel uImage

append console=ttyO2,115200n8 mem=1G@0x80000000 noinitrd rw init=/init root=/dev/nfs ip=192.168.0.104:192.168.0.107:192.168.0.1:255.255.255.0::eth0:on nfsroot=192.168.0.107:/srv/nfs/porky/seemee/panda_es,wsize=1024,rsize=1024,nolock,vers=3 rootwait earlyprintk smsc95xx.macaddr=01:2e:60:09:a7:46:01 vram=48M omapfb.vram=0:8M,1:8M,2:8M omapfb.mode=dvi:1360x768-16@60 omapdss.def_disp=dvi

#initrd panda_es/uInitrd

When you start the device you need to tell the u-boot loader to actually get boot from the network. These are the commands you need to run on the Pandaboard. Of course it requires you are connected to the Pandaboard over the RS232 line. In the minicom (or any serial port terminal) type the following commands.

setenv bootfile porky/seemee/panda_es/uImage;
 setenv serverip 192.168.0.107;
 setenv autoload no;
 usb start;
 bootp;
 pxe get;
 pxe boot

Instead of writing these commands every time you are booting you can create boot.scr file and store it on the SD card in the boot partition (this is the VFAT one:) This is how it can be done:

  1. Create panda-pxe-boot.txt file with this contents:
    setenv bootfile panda_es/uImage;
    setenv serverip 192.168.0.107;
    setenv autoload no;
    usb start;
    bootp;
    pxe get;
    pxe boot
  2. sudo mkimage -A arm -T script -O linux -C none -a 0 -e 0 -n "boot.scr" -d panda-pxe-boot.txt panda-pxe-boot.scr
  3. copy boot.scr along with MLO, u-boot and uImage in MMC/SD boot partition.

If you want to build you u-boot loader you can get one from the linaro git repository and compile it. The latest u-boot that supports the Pandaboard ES is here:

git clone git://git.linaro.org/boot/u-boot-linaro-stable.git

Now configure the u-boot for the pandaboard ES.

make CROSS_COMPILE=/attic/angstrom2/build_panda/tmp-angstrom_2010_x/sysroots/i686-linux/usr/armv7a/bin/arm-angstrom-linux-gnueabi- omap4_panda_config

and compile

make CROSS_COMPILE=/attic/angstrom2/build_panda/tmp-angstrom_2010_x/sysroots/i686-linux/usr/armv7a/bin/arm-angstrom-linux-gnueabi-

When you finish copy the u-boot.img and the MLO to the root of the boot partition on your SD card. Than add the boot.scr that we created in the previous step and reboot your device.

Wifi driver

When booting the new kernel I noticed the wifi driver was complaining about not having a firmware to load on the wifi WL12xx chip. To sort this out I downloaded a snapshot of the ti-connectivity and copied the content to the /lib/firmware/ti-connectivity on the board.

http://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git;a=tree;f=ti-connectivity;h=5c71f576b35d1e15825173d650dc84476d1115b7;hb=HEAD

Next time...

I'm sorry for this rather rough description of the Pandabaord setup, I did it quite in hurry because I still haven't sorted it out completely which is my focus now.  For example I still haven't tested the audio input, OpenGL rendering nor the accelerated video codec. I'm gonna write up more detail and accurate description or if you will a quite how to build a fully working system for the Pandaboard ES with all the extra features of the Omap4460

There are some interesting links that helped me a bit while building the system for the Pandaboard.

Here are some interesting links I used.

Audio
http://omappedia.org/wiki/Audio_Drive_Arch#Platform_Driver

Video/Display
http://omappedia.org/wiki/Bootargs_for_enabling_display#Zorder_of_an_overlay_.5BSpecific_to_OMAP4_Not_Applicable_to_OMAP3.5D

HW acceleration
http://omappedia.org/wiki/Ducati_For_Dummies
http://omappedia.org/wiki/Category:RPMsg

OMAP4 resources
http://focus.ti.com/pdfs/wtbu/omap_4_pb_swpt034.pdf

This entry was posted in ARM, Embedded, Linux. Bookmark the permalink.

Leave a Reply