Table of Contents

Begining On Lubuntu

About this Article

Abstract

Here is a guide for people who are new to using lubuntu desktop/server on cubieboard. This article will cover the following,

Configuration

SSH Connecting

Make sure cubieboard can get to the Internet. If dhcp had been timeout, type:

  $dhclient eth0

Install openssh-service in computer and cubieboard.

  $sudo apt-get install openssh-server

ssh username@IP in the terminal, press the password.

Set Time Zone/DateTime

1.Set time zone

  $sudo tzselect

Select the Asia , press Enter and chose China ,at last selet Beijing.

2. Cope file to /etc directory

  $sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

3. Update time

  $sudo ntpdate time.windows.com

Set keyboard language

Refer to Set Keyboard Language

Flashplayer

Download the flashplayerarm,type:

$tar zxvf flashplayerarm.tar.gz  
$sudo cp libpepflashplayer.so /usr/lib/chromium-browser/plugins
$sudo cp default /etc/chromium-browser

Wifi

CB1 and CB2 do not integraed wifi chip on board ,but we can use USB WIFI. Make sure the wifi driver you use have been loaded. If not ,use

  $insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/XXX.ko

CB3(cubietruck) has integrated wifi chip .

Type : modprobe bcmdhd to load the driver .

Add "bcmdhd" at the end of file /etc/modules to activate WiFi during boot. For ecample with Lubuntu Desktop:

  $sudo vi /etc/modules

Configure wifi at cubieboards and cubietruck the same way as descibed her:

  $apt-get install linux-firmware
  $reboot
  $ifconfig wlan0 up   //open the wifi ,maybe wlan1 ..
  $iwlist wlan0 scan   //scan the wifi signal
  $wpa_passphrase SSID passwd >> /etc/wpa_supplicant.conf  // the SSid is name of signal want to be used
  $vi /etc/network/interfaces

Add below configuration to /etc/network/interfaces

  auto wlan0
  iface wlan0 inet dhcp
  wpa-conf /etc/wpa_supplicant.conf

Add below configuration to /etc/resolv.conf

  nameserver 8.8.8.8

Reboot the cubieboard,auto gain the IP.

Setting CPU Frequency

Cubieboard CPU frequency can be adjusted in real time, , the following file save as shell file, or placed in / etc / rc.local before the exit 0 can be executed. Specific CPU frequency maximum and minimum values ​​can be set based on usage .

  #!/bin/sh
  echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
  echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
  echo 25 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
  echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor

After testing, Cubieboard single core version (A10) CPU frequency can be overclocked to 1.2GHz, stable operation (would be better to stick a CPU heatsink); Cubieboard dual-core version (A20) can also be overclocked to 1.2GHz

Screenshots Tool

  apt-get install shutter

Type "shutter" in terminal to use ,like shutter GUI

Developing

Using serial debug port

The tutorial how to use TTL cable: http://linux-sunxi.org/Cubieboard/TTL

Install the tool name minicom in your computer:

  $sudo apt-get install minicom

Set the minicom configuratiaon, TTL and cubieboard are connected ,then minicomin the terminal ,enter into the console.

Installing target Toolchains

  $sudo apt-get update
  $sudo apt-get upgrade
  $sudo apt-get install vim build-essential git libusb-1.0-0-dev pkg-config -y

Hardware Testing

The best way to test hardware is install the office firmware from http://dl.cubieboard.org and usr office fitting from http://docs.cubieboard.org/addons,which can find the problem quickly you met. Of course ,you should save the data before reinstall firmware.

LEDs On Cubieboaed

These are blue LED1 meaning heartbeat and green LED2 on cb1 and cb2. LED1 - GPIO port PH21, LED2 - GPIO port PH20.
These are LED1~4 on cb3(cubietruck). LED1 - PH21, LED2 - PH20,LED3 - PH11,LED4 - PH07.Refer to FAQ about cubietruck
For cb1 and cb2:

  $echo 1 > /sys/class/gpio/export   //open the PH20
  $echo 2 > /sys/class/gpio/export   //open the PH21

The directories /sys/class/gpio/gpio1_PH20 and/sys/class/gpio/gpio2_PH21 had been create .

  $cd /sys/class/gpio /gpio1_PH20
  $echo out > direction    //set PH20 as output
  $echo 1 > value          //set PH20 as high ,grenn LED is light
  $echo 0 > value          //set PH20 as low,turn off the LED

HDMI

It would be best way connect the HDMI cable before power on the cubieboard,becuse some cable maybe appear the promble of sequence in time.
If your have not full screen display, you can try the following commands

$fbset -left 10

1.If you are using lubuntu, try the following commands

$wget http://dl.cubieboard.org/software/tools/armhf/cb-display-tool
$chmod 777 cb-display-tool
$cb-display-tool -o 8 -m 11  //switch to VGA type
$cb-display-tool -o 4 -m 4  //switch to HDMI type

If you switch to other resolution, you need to restart your X after the modification

2.The default display configuration in script.bin of uboot partition of official desktop-firmware as :

;disp init configuration
;
;disp_mode            (0:screen0<screen0,fb0> 1:screen1<screen1,fb0> 2:two_diff_screen_diff_contents<screen0,screen1,fb0,fb1>
;                      3:two_same_screen_diff_contets<screen0,screen1,fb0> 4:two_diff_screen_same_contents<screen0,screen1,fb0>)
;screenx_output_type  (0:none; 1:lcd; 2:tv; 3:hdmi; 4:vga)
;screenx_output_mode  (used for tv/hdmi output, 0:480i 1:576i 2:480p 3:576p 4:720p50 5:720p60 6:1080i50 7:1080i60 8:1080p24 9:1080p50 10:1080p60 11:pal 14:ntsc)
;screenx_output_mode  (used for vga output, 0:1680*1050 1:1440*900 2:1360*768 3:1280*1024 4:1024*768 5:800*600 6:640*480 10:1920*1080 11:1280*720)
;fbx format           (4:RGB655 5:RGB565 6:RGB556 7:ARGB1555 8:RGBA5551 9:RGB888 10:ARGB8888 12:ARGB4444)
;fbx pixel sequence   (0:ARGB 1:BGRA 2:ABGR 3:RGBA) --- 0 for linux, 2 for android
;lcd0_bright          (lcd0 init bright,the range:[0,256],default:197
;lcd1_bright          (lcd1 init bright,the range:[0,256],default:197


[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 3
screen0_output_mode = 4
screen1_output_type = 0
screen1_output_mode = 4
fb0_width = 1024
fb0_height = 768
fb0_framebuffer_num = 2
fb0_format = 10
fb0_pixel_sequence = 0
fb0_scaler_mode_enable = 0
fb1_width = 1024
fb1_height = 768
fb1_framebuffer_num = 2
fb1_format = 10
fb1_pixel_sequence = 0
fb1_scaler_mode_enable = 0

Modify the parameter according to the using HDMI displayer .For example ,screen0_output_type = 3set up HDMI output ,screen0_output_type = 4set up VGA output You can get more information about display from Display and modify script.bin from edit_the_system_configuration

VGA

Refer to HDMI section. Cubieboard1 and Cubieboard2 have no the VGA connector,but you can use Cubie Breadboard to effect output.

USB Host

The quickly way to test the interface of USB is plug the U disk . The system will identify the U disk .Use fdisk -l can see its information which meaning the interface of USB is working.

IR

IR had beed add into the kernel .If not, use command to load the moudle:

  $insmod /lib/modules/$(uname -r)/kernel/drivers/input/keyboard/sunxi-ir.ko
  $sudo cat /dev/input/event0 | hexdump //or event1,event2

Press the key of IR remote control,the terminal will print the message as:

0000000 8415 525f 50cf 0003 0001 0094 0001 0000
0000010 8415 525f 50db 0003 0000 0000 0000 0000
0000020 8415 525f 22f7 0007 0001 0094 0000 0000
0000030 8415 525f 22ff 0007 0000 0000 0000 0000

The digital '0094' is keycode of the remote control .

The sunxi-3.4 IR is exposed as a a keyboard on the Linux input device interface. For example, the following simple keybinder application might be used to run arbitrary commands when receiving a specific keycode via IR. You can install it by

$ git clone https://bitbucket.org/emiliolopez/keybinder.git
$ cd keybinder
$ sudo make install

Configuration is handled on /etc/keybinder.conf, as a "keycode,command" pair per line. The application prints every keycode received, so you may as well use it to figure out the keycodes you want to use.

To execute the application, run

$ sudo keybinder /dev/input/event0

Headphone Jack

There are two audio devices HDMI and headphone in the cubieboard.

  $sudo  alsamixer

There are two audio devices named sunxi-sndhdmi and sunxi-CODEC in the system. The sound output is send out from HDMI by default . You can adjust volume and other configuration ,use Ctrl + z to save it.
alsamixer GUI

To set sound care being sunxi-CODEC modify /etc/asound.conf to turn on the headphone.

  pcm.!default {
    type hw
    card 0    //If you want to set HDMI as output ,turn 0 to 1.
    device 0
  }
  ctl.!default {
    type hw
    card 0   //If you want to set HDMI as output ,turn 0 to 1.
  }

If plug in the headphone and type:

  $speaker-test -twav -c2

The sound "sound left,sound right,sound left" will output from headphone.

Let cubieboard speak by package named espeak :

  $sudo apt-get install espeak
  $espeak "hello"             //say: hello
  $espeak "hello_cubieboard"  //say: hello cubieboard

USB Camera

Most of the USB camera driver has integrated in the kernel,so it is available insert camera into the cubieboard.

$sudo apt-get install luvcview
$luvcview -s 1080x720 (can modify the resolution)

If cubieboard has installed mplayer ,use mplyaer to display

  $mplayer tv://

Micro SD

TBD

SATA

TBD

OTG

The OTG cable is mini usb cable ,which used to flash firmware into nand .The guid to flash to board:

  1. Press FEL key, and holding it
  2. Plug in mini usb cable, and wait the following prombt
  3. Release FEL key

After used some inferior cable to install firmware, the board maybe appear unknow system error.Powering on the cubiebaord via the cable ,which is unstable. Maybe the system will die or reboot some time ,so the recommended configuration is a 5V 2A power supply.

Troubleshooting

$sudo resize2fs /dev/nandd (replace /dev/nandd to your real block device)