Cubieboard2

Ubuntu – data stored in RAM filesystem – TMPFS

In my Cubieboard2 I use Lubuntu. Since I have connected barometer and arduino to my cubieboard, I read data from that devices and store it to cubieboard2 filesystem. Since NAND memory is not quite suitable for such frequent changes because of wear-out of the memory cells over time, I’ve created temp space in RAM memory. Cubieboard2 has 1GB DDR memory so there is some space for it.


I will use TMPFS and not older RAM disks – ramfs. Tmpfs is supported by the Linux kernel from version 2.4 and up. On reboot, everything in tmpfs will be lost. The memory used by tmpfs grows and shrinks to accommodate the files it contains and can be swapped out to swap space.
To get more comprehensive info regarding those filesystems read this post or this post.

DLNA media server on Cubieboard with Lubuntu

I have installed Lubuntu on my new Cubieboard 2. I have also attached HDD to SATA so I have more space to store my media. This posts describes the steps needed to install and configure media server to share my media to other devices (media players). I spent some time to select the right one and chose minidlna tool (also known as ReadyMedia, lightweight DLNA/UPnP-AV server targeted at embedded systems).

According to Ubuntu documentation the MiniDNLA daemon serves media files (music, pictures, and video) to clients on a network. Example clients include applications such as totem and xbmc, and devices such as portable media players, smartphones, and televisions.
MiniDLNA is a simple, lightweight alternative to MediaTomb, but has fewer features. It does not have a web interface for administration and must be configured by editing a text file.

Mount SATA drive in Cubieboard with Lubuntu

The main advantage of cubieboard is it’s SATA connector. I have old HDD from notebook, so I wanted to use it as a media server.

This post has 3 parts related to HDD connected to Cubieboard2 with lubuntu:

  • Mounting HDD
  • Backup NAND
  • Spin down HDD


There are many ways to see all disks and partitions but my favorite command is lsblk:

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
NAME        FSTYPE   SIZE MOUNTPOINT LABEL
sda                149.1G
nand                 3.7G
|-nanda     vfat      64M            Volumn
`-nandb     ext4     3.6G /
mmcblk0              241M
`-mmcblk0p1 vfat     241M            SSD

or also fdisk:

I2C on Cubieboard with Lubuntu

I2C bus is used by many integrated circuits and is simple to implement. Any microcontroller can communicate with I2C devices even if it has no special I2C interface so I wanted to enable I2C also in my Cubieboard2 to get direct access to sensors.

Apache+PHP on Cubieboard with Lubuntu

I executed the following steps to install apache with PHP on my cubieboard2 with lubuntu.

Lets start with installation that will take about 25MB:

sudo apt-get install apache2
sudo apt-get install php5
sudo /etc/init.d/apache2 restart

Put your IP address to the browser (or localhost) and you see that Apache was installed correctly.

Your www content is stored in /var/www.

The whole www folder is owned by root. So for easier access I changed owner to my user named linaro

Cubieboard2 – Lubuntu – Enabling Print Screen

When I installed Lubuntu on my new Cubieboard2, the print screen was not working.
When I hit the “Print Screen” button I got this message:

I’ve fixed it by installing the scrot application:

sudo apt-get install scrot

If you hit “Print Screen” or “Alt+Print Screen” you will see a new file *_scrot.png in you home directory.

 

Cubieboard2 – Lubundu – Extending NAND from 2GB to 4GB

When I install new Lubuntu NAND image to my new Cubieboard2 I had only 2GB of space out of 4GB available.

I followed this forum to expand the filesystem to 4GB.

sudo nand-part

In my case I used this nand-part command:

sudo nand-part -f a20 /dev/nand 32768 'bootloader 131072' 'rootfs 7569408'

the number in bootloader is the same as previous partition size.
The number in rootfs is the sum of previous partition size of partition 2 and partition 3 that we wanted to merge.

Lubuntu – installing VNC server

I use vnc to access graphic interface from my PC to cubieboard that runs on lubuntu. I have chosen tightvncserver and spent some time to configure and run it. Also to my surprise it took me a while to set it up correctly. This guide was the most helpful how-to but I needed to make some changes so I’ve written this post.

Enable UART on Cubieboard with Lubuntu

I wanted to connect my cubieboard with lubuntu to my arduino via serial communication. For that I had to enable a UART and connect pins to my arduino (only RX/TX is needed). I have arduino mini 3.3V on which I have attached some sensors (outside temperature).
By this command you can check if the port is enabled:

stty -F /dev/ttyS0 -a

In fresh installation of lubuntu the ttyS0 is configured and used by kernel and ttyS1 is not enabled. You will get this message for ttyS1: