Saturday, November 9, 2013

Setting up the Cubieboard 2 with Linux

The Raspberry Pi has become very popular among hobbyists and has given rise to many similar boards. One such is the Cubieboard. The Cubieboard is a single board computer made in China using an AllWinner system on a chip. The original was released in 2012 with a single Cortex A8 ARM chip clocked at 1GHz, 512 MB of RAM, a 10/100 megabit ethernet port and 4 GB of NAND flash RAM with Android pre-installed. In 2013, the Cubieboard 2 was released containing 1 GB of RAM and a dual core Cortex A8 followed by the Cubietruck which added 2GB of RAM and gigabit ethernet. A nice feature of all Cubieboards is the presence of a SATA connector, allowing for better disk performance compared to the flash or micro sd memory cards. Also, they are all under $100 with the original costing around $49, the Cubieboard 2 going for about $69 and the latest version costing around $89. I purchased a Cubieboard 2 to play with finding it really good bang for the buck.

The Cubieboard is roughly the size of a credit card and won't take up much space on a desk. The board comes with a USB to DC connctor which I hooked up to 2 amp USB wall charger I bought so I would not need to rely on another computer to power it. There are 2 USB ports so its easy to hook it up to a USB mouse and keyboard. It also features an HDMI out for connecting to monitors. You can power up the board as is and run Android 4 after connecting everything or you can replace the OS with something else. There are two ways you can accomplish this. First you can use Berryboot to write an Operating System to a micro sd card and then boot from the card as described here. Additionally you can flash the NAND memory that comes with it and replace the default Operating System. I chose the latter option.

Flashing the Cubieboard 2

The first step I took was to download and install PhoenixSuit from the CubieBoard site to my Windows 7 PC. This included a driver for recognizing the Cubieboard on my PC. I then downloaded a Linux image from the site to flash on to the board. I had trouble finding one that PhoenixSuit would accept and ultimately settled on Lubuntu desktop 1.06 from here. I then hooked up the Cubieboard to my PC using a micro USB to USB cable which holding down the FEL button at the same time (located right under the micro USB port). After it loaded the driver and recognized the board, I then disconnected it and launched PhoenixSuit.

At the top of the screen is a menu with an item labeled Firmware. I clicked on that and then browsed to the image I downloaded (lubuntu-desktop-nand.img.gz). I then reconnected the Cubieboard to the PC while holding down the FEL button and the program automatically started to flash the device. At the popup that initially appears, I chose Yes. After about 10 minutes or so, the job was done and I disconnected the board.

Running Lubuntu

Unfortunately as of right now I cannot get the HDMI output to work with Lubuntu. Instead, using my PC I used Putty to connect to it using Cubieboard2 as the address. The default user name and password are linaro and linaro. The first step I took was to set the IP address to something static to make it easier to work with other devices on the network. I edited the /etc/network/interfaces file to change the eth0 option to the following:

iface eth0 inet static
    address 192.168.1.50
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1

Then I restarted the networking service:

sudo service networking restart

After this I decided to try out the SATA port. I purchased a 320 GB 2.5 drive and a cheap external rack to mount it in. After hooking up the drive using the provided SATA cable, I checked my devices using fdisk and saw it listed as /dev/sda:

sudo fdisk -l

I then used fdisk to create a single partition on the drive:

sudo fdisk /dev/sda

At the prompt I entered n to tell it to create a new partition. I then chose primary with partition number of 1. I left the default values for the sectors blank so it would use the entire disk. At the main prompt I entered w to write the partition table to the disk. When this was done I exited.

With the partition created I was then able to format and mount the drive. I created an ext3 partition mounted at /storage with the following:

sudo mkfs.ext3 -b 4096 /dev/sda1
sudo mount /dev/sda1 /storage

Finally I added the following entry to /etc/fstab so it would mount after booting:

/dev/sda1   /storage   ext3    defaults 1   1

There is still plenty more to try with this board. Many distributions are available for Berryboot that may allow for a better experience and there is help available on the forums. This is an easy starting point though and will hopefully encourage others to try out these boards.

1 comment: