Skip to content
Adam YH Lee edited this page Jul 30, 2015 · 101 revisions

Welcome to the yocto-manifest wiki!

This page has been created to catch miscellaneous, yet still time-saving, information about the BSP layer. For an overview, please visit the official software development section

Images

Types of Images

There are 3 different images that you can build with the Gumstix BSP Layer.

Kernel

Versions

Platform Previous Stable Current Stable
Overo 3.17.y (config) 3.18.y (config)
Duovero 3.17.y (config) 3.18.y (config)
Pepper 3.17.y (config) 3.18.y (config)

Force Build/rebuild a Package

Bitbake's clean option (eg. bitbake -c clean virtual/kernel) does not completely remove the build data. This is especially true for the boot loader and kernel packages. You can do the following to rebuild these packages:

bitbake -f -c compile virtual/kernel
bitbake -f -c deploy virtual/kernel

Speed up Bitbake

By default both tar ball and ubi images (ie. gumstix-test-image-overo.tar.bz2 and gumstix-test-image-overo.ubi) are created. If you don't need the ubi image, you can disable it in the machine configuration file for your build target.

For overo, change meta-gumstix/conf/machine/overo.conf:

from

IMAGES_FSTYPE += "tar.bz2 ubi"

to

IMAGES_FSTYPE += "tar.bz2"

And duovero.conf and pepper.conf for Duovero and Pepper respectively.

Disable LXDM (Login Manager)

To drop into the terminal on boot, LXDM has to be disabled. Comment out the following line in conf/local.conf to take out LXDM from image

VIRTUAL-RUNTIME_graphical_init_manager = "lxdm"

If you want to temporarily disable LXDM while running your image, you can disable the service like this from console:

$ systemctl disable lxdm

Useful Bitbake Commands

# Show _image's_ packages
bitbake -g <image> && cat pn-depends.dot | grep -v -e '-native' | grep -v digraph | grep -v -e '-image' | awk '{print $1}' | sort | uniq

# Check if certain _package_ is present on current Yocto Setup
bitbake -s | grep <pkg>

# List all tasks for _package_
bitbake -c listtasks <package>

# Show versions
#bitbake --show-versions | grep <package>

# Get a detailed build history
Find out the name, size and more about the installed packages with [buildhistory](http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#enabling-and-disabling-build-history)

$ tree .
.
├── build-id.txt
├── files-in-image.txt
├── image-info.txt
├── installed-package-names.txt
├── installed-package-sizes.txt
└── installed-packages.txt

Adding applications to Gumstix images

You can search for available Linux applications, tools and libraries that can be easily added to the Gumstix Yocto Project images from the Recipe page of OpenEmbedded Layer Index. Edit your gumstix-console-image.bb or gumstix-xfce-image.bb in meta-gumstix-xfce-image/recipes/images/ to add and/or remove recipes.

Default login

You can login as root without password.

Enabling Network Connections

#For ethernet connection Ethernet connection is detected and eth0 is configured automatically. No additional steps are necessary.

#For wireless connections Please modify /etc/wpa_supplicant/wpa_supplicant-wlan0.conf with your SSID and passphrase and reboot the machine. This will configure wlan0 with an IP. It is recommended to have the external antenna connected.

Note: If no SSID is given in wpa_supplicant-wlan0.conf, the wlan0 will try to connect to any open network available and you might see it hopping from one network to another.

Enabling Bluetooth

$ systemctl enable bluetooth.service # reboot
$ hcitool scan #should reveal bluetooth devices in the vicinity

Using Bluetooth GUI tool to pair peripherals

Gumstix XFCE Image contains Bluetooth GUI tool, which you can use to pair with your Bluetooth devices. Note that you have to enable the Bluetooth service as described in the previous section

Using USB-otg port as a serial console port

From Yocto Project 1.5 and on, serial gadget driver is built into the Gumstix Linux kernel. Hence even if your board does not have a dedicated serial console port, you can use an existing USB-otg port for serial communication. Once you connect the USB-otg port of your Gumstix board to one of your computer's USB ports, you should see a new device in /dev. You can check the exact name by running dmesg from your computer's console. Usually the new device has the name of /dev/ttyACM0. Use minicom or kermit to access your Gumstix through this device.

Using USB-otg port on DuoVero as host

Due to the way USB controller is implemented, we have to load a gadget driver for an MUSB port to work as the host mode. There is an extra step for Duovero:

1. As mentioned in my original post, I enabled the "USB gadget driver" 
and "USB OTG support" through menuconfig. 
2. I tried loading the driver at run-time using "modprobe g_serial" ==> 
But no use, device not detected on OTG port. 
3. I loaded the driver at boot time ==> For this, make a file 
"g_serial.conf" in /etc/modules.d/ on target board (duoVero here). 
     Content of the file: 
     g_serial 

     Actually, this specifies the name of driver to be loaded at boot 
time, that is "g_serial" in our case. 
4. Reboot/hard-reset the board with USB device connected on OTG port. 
5. See the results and your device connected using "lsusb" command. 

See original post

Using USB-otg port on Overo as a mass storage device

  1. Build kernel, kernel modules, and a new rootfs with g_mass_storage support. In other words, mark Mass Storage Gadget as M, as a module, in the kernel config, and bitbake a new image.
  2. Deploy the new kernel and rootfs to your uSD card.
  3. You can mount the boot partition of your COM as follow:
    $ modprobe g_mass_storage file=/dev/mmcblk0  
    
  4. On your host machine, your COM should appear as a USB storage device.

For debug tips take a look at here

Using USB-otg port as Ethernet

  1. On the target

    modprobe g_ether
    
  2. On the host

    HOST_USB_IP=10.0.1.1
    sudo ifconfig usb0 $HOST_USB_IP netmask 255.255.255.0
    

    If you see an error like this: SIOCSIFNETMASK: Cannot assign requested address, try the following:

    sudo ip addr add 10.0.1.1 dev usb0
    
  3. On the target

    HOST_USB_IP=10.0.1.1
    TARGET_USB_IP=10.0.1.2
    ifconfig usb0 $TARGET_USB_IP netmask 255.255.255.0
    route add default gw $HOST_USB_IP
    
  4. Test connection from target to host

    ping -c 5 10.0.1.1
    

##Autologin into XFCE

LXDM does not adopt to small screens very well. For example, the user selector is not visible on 4.3 inch resistive touch screens available for Overo and Pepper.

You can simply bypass the login screen with this:

/etc/lxdm/lxdm.conf

## uncomment and set autologin username to enable autologin
autologin=gumstix

##Setting Time Zone

The default time zone is UTC (tzdata).

root@duovero:~$  date
Fri May  2 22:24:58 UTC 2014

You can set it to your own time zone like below:

root@duovero:~$    ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime 
root@duovero:~$  date
Fri May  2 15:30:41 PDT 2014

You can also set it during the image creation time. Scott at Jumpnow Technologies has posted this:

... 
set_local_timezone() { 
    ln -sf /usr/share/zoneinfo/EST5EDT ${IMAGE_ROOTFS}/etc/localtime 
} 

ROOTFS_POSTPROCESS_COMMAND += " \ 
    set_local_timezone ; \ 
 " 
root@duovero:~# date 
Mon Apr 14 11:31:52 EDT 2014 

You can append the above in the image recipe.

##Using Duovero Zepher as Wireless Access Point

Access point mode can be supported using Duovero Zepher's Wi2Wi 0015 chip. Scott at Jumpnow Technologies has written a thorough article on getting it configured.

##Disable a Network Interface

#wlan0
ip link set wlan0 down
#eth0
ip link set eth0 down

##Adding Joystick support

$ bitbake -c menuconfig virtual/kernel 
// enable input device joystick
$ bitbake -f -c compile virtual/kernel 
$ bitbake -f -c deploy virtual/kernel 

/dev/input/js0 is now detected.

##Change Touchscreen Orientation on Pepper

To change the orientation of the screen, add the line Option "Rotate" "CCW" in /etc/X11/xorg.conf

         Section "Device"
                   Identifier "Builtin Default fbdev Device 0"
                   Driver  "fbdev"
                   Option "Rotate" "CCW"
         EndSection

Also you will probably want to correct the touch sensor orientation. Add Option "SwapAxes" "true" and Option "InvertX" "true" in /usr/share/X11/xorg.conf.d/10-evdev.conf

         Section "InputClass"
                   Identifier "evdev touchscreen catchall"
                   MatchIsTouchscreen "on"
                   MatchDevicePath "/dev/input/event*"
                   Driver "evdev"
                   Option "SwapAxes" "true"
                   Option "InvertX" "true"
         EndSection

[ref] http://elinux.org/CircuitCo:BeagleBone_LCD7

Install Python SimpleHTTPServer

  1. Install necessary Python libraries:

    $ smart update
    $ smart install python-netserver python-misc python-pkgutil
    
  2. Goes to the folder of the web server root and type:

    $ python -m SimpleHTTPServer
    

    If the COM and your PC are in the same LAN, You should be able to access the folder content by:

    http://your.board.ip.address/8000
    

Install Python-PIP

The python-pip is provided through the recipe:

$ smart install python-pip

Use iperf to test Ethernet Throughput

iperf is not available through Gumstix Package repo yet. So here we build an image with it.

  1. Add iperf to recipes-images/gumstix/gumstix-console-image.bb

    @@ -61,6 +62,7 @@ UTILITIES_INSTALL = " \
       vim \
       wget \
       zip \
    +  iperf \    // make iperf to build into the image
    
    

    Build and flash the image.

  2. There is one PC(192.168.0.100) and one DuoVero (192.168.0.111) connected to the same LAN Let's set PC as server

    iperf -s -P 1 -i 1 -p 5001 -C -f k
    

    On DuoVero (192.168.0.111)

    iperf -c 192.168.1.100
    

    [More instructions on iperf] (http://openmaniak.com/iperf.php)

    We can use jperf on PC side to visualize the testing result [Instructions on jperf] (https://code.google.com/p/xjperf/)

Connect Bluetooth Speaker to Overo

The following messages from dmesg show the Bluetooth driver is properly initialised:

[   25.884857] Bluetooth: Core ver 2.16
[   25.890655] Bluetooth: HCI device and connection manager initialized
[   25.895996] Bluetooth: HCI socket layer initialized
[   25.899719] Bluetooth: L2CAP socket layer initialized
[   25.903686] Bluetooth: SCO socket layer initialized
[   26.083221] Bluetooth: vendor=0x2df, device=0x911a, class=255, fn=2
[   27.388702] Bluetooth: vendor=0x2df, device=0x911b, class=255, fn=3
[   27.892120] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   27.897399] Bluetooth: BNEP filters: protocol multicast

There are three Bluetooth utilities be used: hciconfig, hcitool and l2ping

hciconfig is used for local Bluetooth device management, some useful hciconfig commands:

hciconfig -a    #list all active Bluetooth device
hciconfig hci0 piscan # Set DuoVero as a discoverable device
hciconfig hci0 class 010704 # Set DuoVero as a car audio device the Bluetooth class

hcitool is used for remote Bluetooth discovery and connection management, some useful hcitool commands:

hcitool scan # scan and list current Bluetooth device that is visible

l2ping can be used to test if a device is reachable. The result address of hcitool scan should respond to l2ping request

l2ping XX:XX:XX:XX:XX

Install the bluez-testtools. This contains a couple of useful scripts that we can use.

smart update
smart install python-dbus #needed for running bluez-testtools scripts
smart install bluez-testtools

This installs a few test scripts in /usr/lib/bluez4/test/. We will be using the following scripts from there.

 1) simple-agent #This is used for pairing a pin for Bluetooth device.
 2) test-audio #This is used for  establishing a audio test channel on Bluetooth. 

Add /usr/lib/bluez4/test to your PATH

export PATH=$PATH:/usr/lib/bluez4/test

Run the following command to make a connection to a Bluetooth speaker. I used an INSIGNIA Bluetooth speaker, Model No:NS-SPBT02-G-C :

$ simple-agent hci0 XX:XX:XX:XX:XX:XX 

XX:XX:XX:XX:XX:XX is the speaker Bluetooth address discovered by hcitool scan. First, turn on the speaker, the LED on the speaker will start to flash blue and red. This means the device is in pairing mode. Execute the command and the Bluetooth agent should be created. You only need to do this once. If there is a notification showing the agent is already created, you can skip this step.

$ test-audio connect XX:XX:XX:XX:XX:XX 

This will connect Overo to the speaker. The flashing LED will become constant blue once the connection is established.

Write a configuration file at ~/.asoundrc, One example of .asoundrc file. Replace xx:xx:xx:xx:xx:xx with the target Bluetooth device address:

pcm.bluetooth {
        type bluetooth
        device "xx:xx:xx:xx:xx:xx"    # This should be the target  Bluetooth device address
        profile "auto"
}

Change the settings in /etc/bluetooth/audio.conf to this:

# root@overo:/etc/bluetooth$  cat audio.conf
# Configuration file for the audio service

# This section contains options which are not specific to any
# particular interface
[General]
Enable=Source,Sink,Headset,Gateway,Control,Socket,Media

# Switch to master role for incoming connections (defaults to true)
#Master=true

# If we want to disable support for specific services
# Defaults to supporting all implemented services
#Disable=Gateway,Source,Socket

# SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
# Defaults to HCI
SCORouting=PCM

# Automatically connect both A2DP and HFP/HSP profiles for incoming
# connections. Some headsets that support both profiles will only connect the
# other one automatically so the default setting of true is usually a good
# idea.
AutoConnect=true

# Headset interface specific options (i.e. options which affect how the audio
# service interacts with remote headset devices)
[Headset]

# Set to true to support HFP, false means only HSP is supported
# Defaults to true
HFP=true

# Maximum number of connected HSP/HFP devices per adapter. Defaults to 1
MaxConnected=1

# Set to true to enable use of fast connectable mode (faster page scanning)
# for HFP when incoming call starts. Default settings are restored after
# call is answered or rejected. Page scan interval is much shorter and page
# scan type changed to interlaced. Such allows faster connection initiated
# by a headset.
FastConnectable=false

# Just an example of potential config options for the other interfaces
#[A2DP]
#SBCSources=1
#MPEG12Sources=0

Reboot the board and connect using the test-audio Python script

test-audio connect XX:XX:XX:XX:XX:XX 

We can use aplay to play audio on Bluetooth device:

aplay -D plug:bluetooth some.wav

If you want to play on the native audio-out on DuoVero:

aplay -D some.wav

./var/lib/bluetooth folder contains currently Bluetooth paired and trusted devices

If you want to change the volume of the playback, edit the configuration file at ~/.asoundrc and add the following lines to it:


pcm.softvol
{
	type softvol
	slave.pcm "bluetooth"
	control.name "Bluetooth Playback Volume"
	control.card 0
}

Note: The control name must end with "Playback Volume" because this prevents the alsamixer from showing it as capture control. Refer to the alsa page for more details.