Pages

Thursday, 11 September 2014

Slice: The user friendly media player with Raspberry Pi heart

Kickstarter, one of my favourite sites, I think it's even becoming an addiction :)

As you can see on my public Kickstarter profile you can expect some brand new backed board reviews coming your way in the next months. They are all FPGA related. For completeness here's the list:
My latest Kickstarter catch is 'Slice' a nice media player based on the Raspberry Pi.
You're not too late to get one! You can still make a pledge till September 25th.

The IRIS+ Personal Drone

These drones keep getting better and cheaper by the day.....

A nice idea to put under the christmas tree :)


Sunday, 31 August 2014

HummingBoard: Boot your rootfs from mSATA

The HummingBoard-i2eX version has an onboard mSATA II connector. This layout provides you the easiest way to hook up an SSD. All you need is an mSATA Drive. Just plug the drive into the mSATA slot on the back of the Hummingboard and the job is done!




The next step is to move your rootfs to the SSD to unleash the extra SSD power.

Move the rootfs to a SATA Drive

It’s impossible to boot from a SATA drive without an SD card, you will still need a small SD card for the bootloader. However, it is possible to adjust the bootscript (which is similar to a bootloader) on the SD card so that it points directly to your SATA drive. This way your system will boot the OS right from the SATA drive.

Here’s what you have to do:

Note: all this commands require root privileges.
  1. run sudo fdisk -l and identify your SATA drive. In this example /dev/sda represents the SSD disk.
  2. Prepare your disk
    > sudo fdisk /dev/sda
    
    Delete all partitions using the “d” option
    Create a new primary partition using the “n” option (you can accept all the defaults)
    Use the “w” option the apply the changes.
    Format the partition for rootfs with EXT4 filesystem
    > mkfs.ext4 /dev/sda1
    

Copying Rootfs

I still assume that /dev/sda represent the SATA drive
> mkdir /tmp/source /tmp/target
> sudo mount /dev/mmcblk0p2 /tmp/source
> sudo mount /dev/sda1 /tmp/target
> (cd /tmp/source; sudo tar --backup -c *) |sudo tar -C /tmp/target -xv
Change the kernel parameters in order to boot from the SSD drive
> mkdir /tmp/boot
> sudo mount /dev/mmcblk0p1 /tmp/boot
> sudo vim /tmp/boot/uEnv.txt
Change the last line to:
.. root=/dev/sda1 ...
Sync to disk and reboot to your hard drive
> sync
> reboot 
You can test the result with: df -h

Banana Pi Benchmarks: Banana Pi with SSD Vs Raspberry Pi

I reran the Banana Pi benchmark with an SSD hooked up.

Because most of the benchmarks only use the CPU the result is almost the same. As soon as applications also rely on storage you will see a performance gain. In my test this is reflected in the Nginx benchmark.

The disk benchmark (dbench) shows the performance difference in real numbers: if you use an SSD instead of an SD-card you gain about 44MB/s in disk performance.

The complete benchmark results can be found here






Thursday, 28 August 2014

Banana Pi: resizing the SD card root partition on Lubuntu

Do this only right after flashing the image on the SD-Card, so if anything goes wrong you do not lose any data.

sudo fdisk /dev/mmcblk0

In fdisk:

Press ‘p’ to print the partition table:

Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes
4 heads, 16 sectors/track, 486192 cylinders, total 31116288 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00084078

   Device Boot           Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048      124927       61440   83  Linux
/dev/mmcblk0p2          124928    31116287    15495680   83  Linux
  • Press 'd' to delete a partition:
  • Enter '2' to choose the second partition.
  • Press 'n' to create a new partition:
  • Enter 'p' to select primary as partition type.
  • Partition number: enter to accept 2 as default partition number.
  • First sector: enter to accept default.
    • This should be 124928
  • Last sector: enter to accept default.
  • Press 'w' to write the new partition table.

Reboot to force the kernel to recognise the new partition table.

sudo reboot

After the system has come back up you still have to resize the partition.

sudo resize2fs /dev/mmcblk0p2

Done.

Saturday, 16 August 2014

Cooking with Chef: Create private and pubic subnet EC2 instances in a VPC with Knife

In order to access your AWS instance in a VPC private subnet you need a bastion host ( NAT instance). The setup of a bastion is quite easy as described here.

One important remark: don’t forget to add an outbound (egress) rule to the NAT security group (NATSG) to allow SSH traffic.

As soon as you have your bastion in place you probably want to create or bootstrap new instances in your private subnet. Knife gives you the possibility to create EC2 instances in both private and public subnets, you only have to specify the right options to the knife command.


Create an instance in a private subnet

knife ec2 server create --flavor t2.micro --image ami-d44193a3  \
--security-group-ids sg-abcd1234 --tags Name=instance-name      \
--node-name instance-name  --environment staging                \
--region eu-west-1 --availability-zone eu-west-1a               \
--subnet subnet-1122aabb --ssh-gateway ec2-user@1.2.3.4         \
--server-connect-attribute private_ip_address                   \
--ssh-user ubuntu --ssh-key staging-key                         \
--run-list 'role[nosql]' --ebs-size 24                          \
--ebs-volume-type gp2
  • ssh-key staging-key: the key pair to access you bastion host
  • ssh-gateway ec2-user@1.2.3.4: refers to your bastion host
  • server-connect-attribute private_ip_address: tell knife to access your newly created instance on its private ip through your bastion host.
Remark: this only works if you add the private key (here staging-key) to your authentication agent! Specifying it as identity_file (-i option) does NOT work!
ssh-add staging-key.pem  

SSH access to an instance in a private subnet.

In order to access your instance in a private subnet you need to tunnel your connection. Edit your .ssh/config and add the following lines:
Host sbastion
    HostName 1.2.3.4
    User ec2-user
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentityFile ~/.ssh/staging-key.pem
    LogLevel quiet

Host 10.0.0.*
    User ubuntu
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentityFile ~/.ssh/staging-key.pem
    ProxyCommand ssh -W %h:%p sbastion
    LogLevel quiet
This config allows you to access any instance in your private subnet (10.0.0.*) via a simple command.
Here’s an example:
ssh 10.0.0.23

Create an instance in a public subnet

You have two options to create an instance in a public subnet:
  • Associate the instance with an Elastic ip (here: 55.77.1.1)
    knife ec2 server create --flavor t2.micro --image ami-fd6cbd8a  \
    --security-group-ids sg-abcd1234 --tags Name=instance-name      \
    --node-name instance-name --environment staging                 \
    --region eu-west-1 --availability-zone eu-west-1a               \
    --subnet subnet-2233ccdd --associate-eip 55.77.1.1              \
    --server-connect-attribute public_ip_address                    \
    --run-list 'role[webserver]' --ebs-size 24                      \
    --ebs-volume-type gp2 -x ubuntu -S GP-Staging  
    
  • Associate the instance with a public ip:
    knife ec2 server create --flavor t2.micro --image ami-fd6cbd8a \
    --security-group-ids sg-abcd1234 --tags Name=instance          \
    --node-name instance-name --environment staging                \
    --region eu-west-1 --availability-zone eu-west-1a              \
    --subnet subnet-2233ccdd --associate-public-ip                 \
    --server-connect-attribute public_ip_address                   \
    --run-list 'role[webserver]' --ebs-size 24                     \
    --ebs-volume-type gp2 -x ubuntu -S GP-Staging   
    



Happy cooking!

Monday, 11 August 2014

Banana Pi: Boot your rootfs from SATA

Because the Banana Pi comes with a SATA connector it gives you the possibility to hook up an SSD or other hard drive. Besides it even provides a 5V power connector allowing you to power an SDD right from the board. Just be cautious with the power connector’s polarity, I had to switch the wires of my SATA power cable to get things right!


Move the rootfs to a SATA Drive

Currently it’s impossible to boot from a SATA drive without a SD card. You will still need a small SD card for the bootloader. However, it is possible to adjust the bootscript (which is similar to a bootloader) on the SD card so that it points directly to your SATA drive. This way your system will boot the OS right from the SATA drive.

Here’s what you have to do:

Note: all this commands require root privileges.
  1. Connect your SSD (of course :-) )
  2. run fdisk -l and identify your SATA drive. In this example /dev/sda represents the SSD disk.
  3. Prepare your disk
    > fdisk /dev/sda
    
    Delete all partitions using the “d” option
    Create a new primary partition using the “n” option (you can accept all the defaults)
    Use the “w” option the apply the changes.
    Format the partition for rootfs with EXT4 filesystem
    > mkfs.ext4 /dev/sda1
    

Copying Rootfs

I still assume that /dev/sda represent the SATA drive
> mkdir /tmp/1 /tmp/target
> mount /dev/mmcblk0p2 /tmp/1
> mount /dev/sda1 /tmp/target
> (cd /tmp/1; tar --backup -c *) |tar -C /tmp/target -xv
Change the kernel parameters in order to boot from the SSD drive
> mkdir /tmp/boot
> mount /dev/mmcblk0p1 /tmp/boot
> vim /tmp/boot/uEnv.txt
Change the last line to:
.. root=/dev/sda1 ...
Sync to disk and reboot to your hard drive
> sync
> reboot 
You can test the result with: df -h

Saturday, 9 August 2014

HummingBoard GPIO

GPIO Header Pinout

GPIO Layout

Pin
Signal
Pin
Signal
1
3.3V
2
5V
3
I2C_SDA
4
5V
5
I2C_SCL
6
GND
7
GPIO 1
8
UART TX
9
GND
10
UART RX
11
GPIO 73
12
GPIO 72
13
GPIO 71
14
GND
15
GPIO 10
16
GPIO 194*
17
3.3V
18
GPIO 195*
19
SPI_MOSI
20
GND
21
SPI_MISO
22
GPIO 67
23
SPI_SCLK
24
ECSPI2_SS0
25
GND
26
ECSPI2_SS1

* Pins 16 and 18 are actually SD3_CMD and SD3_CLK signals that can be muxed to support flex can TX/RX interface (i.e. those can be connected to an external CAN) 

Note: SPI and I2C can also be muxed to be GPIO

Accessing GPIO from Linux userspace

The external GPIOs are available under the /sys/class/gpio folder in Linux.

Get the current list of reserved GPIO

> mount -t debugfs none /sys/kernel/debug
> cat /sys/kernel/debug/gpio

Reserve/free a GPIO pin

> echo XX > /sys/class/gpio/export
> echo XX > /sys/class/gpio/unexport

Set GPIO pin Direction

> echo in > /sys/class/gpio/gpioXX/direction
> echo out > /sys/class/gpio/gpioXX/direction

Set the value of an output pin

> echo 1 > /sys/class/gpio/gpioXX/value
> echo 0 > /sys/class/gpio/gpioXX/value

Get the value of an input pin

> cat > /sys/class/gpio/gpioXX/value

Wednesday, 6 August 2014

HummingBoard Benchmarks: Raspberry Pi vs HummingBoard vs Banana Pi

Today I benchmarked another competitor of the Raspberry Pi, the HummingBoard. This board is available in three different flavours: HummingBoard-i1, HummingBoard-i2 and HummingBoard-i2eX. The last one (i2ex edition) is the most powerful and expensive one, it’s also the one I used for my tests.

As you can see in the test results below the HummingBoard performs way better than the Raspberry Pi. It also outperforms the Banana Pi quite nicely.

Currently, the only downside of the HummingBoard is its price. For a Raspberry Pi you pay only $35, for the Banana Pi you pay around $50. The price for a HummingBoard i2eX is $99.99.

Note: for the tests I used an up-to-date version of Debian Jessie.












The full report is available here.

Monday, 28 July 2014

UDOO Quad VS Raspberry PI VS Banana PI: Benchmark comparison

I just finished benchmarking the UDOO Quad (running Linaro Ubuntu 12.04). It’s the first quad core ARM SBC I benchmarked and as expected it performs quite nice compared to its single and dual core rivals. It comes with a little price, power consumption. During the tests the board was hooked up to a power supply feeding it 13V DC, at peak levels the board needed more then 700 mA, I can tell you, without a fan the heat sink becomes quite hot…

In the meantime I also got a confirmation that my Hummingboard is on its way, I’m really curious to see how that one will perform compared to the Raspberry and Banana Pi… to be continued

The complete benchmark details are available here.