Você está na página 1de 42

I/O Shield access • Install and learn the basics of Rebol now!

ODROID
Year One
Issue #2
Feb 2014

Magazine
Turn your ODROID into a:

Giant
Tablet
And create
the ultimate
Android
experience!

High Performance
computing at home
• Meet an Odroidian
Creation and fine granular control
Mauro Ribeiro, Senior Software engineer
• Estimating Radio net interference:
Using Java mutithreading • Linux Gaming - emulators

• Start programming right away! • The art of multi boxing

• USB Gadget drivers • 811.02ac router with odroid XU


Dominate your device ports to do everything Get up to 433mbit/sec
EDITORIAL
A
service to the world-wide ODROID and Open Source communities, Hard
Kernel is proud to present its newest contribution to ARM technology:
ODROID Magazine, a free monthly PDF e-zine!
This cutting-edge online publication brings you the latest ODROID news, as
well as featured articles from the expert community that has grown around the amaz-
ing ODROID family of micro-powerhouse computers.
Intended for all levels of expertise from beginner to guru, ODROID Magazine
features definitive guides for new owners, with easy-to-follow steps in setting up your
ODROID, installing operating systems and software, and troubleshooting common
issues. For more technical users, each month will feature expert tips, hacker discus-
sions, cutting-edge projects, and technical articles to explore new ways of making
your ODROID even more versatile.
Hard Kernel’s ODROID Magazine is an ideal opportunity for our community
to come together to share and contribute articles, so that everyone can be successful
with their ODROID.
Each month, a series of article topics will be posted for consideration, and all
community members are encouraged to send submissions in exchange for monthly
rewards for those selected for publication.
The best articles are those that walk the reader through complex concepts and
procedures in a simple-to-read format. At least one picture or graphic per article is
required, and should be between 500-2000 words.
In this issue, we show you how to turn your ODROID into an enormous 42”
touchscreen Android tablet, suitable for kiosks, digital signage, gaming, accessibility,
and just plain fun. You’ve never played Fruit Ninja like this!

ODROID Magazine

Rob Roy, Chief Editor Bo Lechnowsky, Editor Bruno Doiche, Art Editor

I am a computer programmer living I am President of Respectech, Inc., a Spent his last vacation doing nothing.
and working in Silicon Valley, CA, technology consultancy in Ukiah, CA, And didn’t manage to do the half of it.
USA, designing and building websites USA that I founded in 2001. From my
such as Vevo, Hi5, Dolby Laboratories background in electronics and com-
and Hyundai. My primary languages puter programming, I manage a team
are jQuery, Angular JS and HTML5/ of technologists, plus develop custom
CSS3. I also develop pre-built operat- solutions for companies ranging from
ing systems, custom kernels and opti- small businesses to worldwide corpora-
mized applications for the ODROID tions. ODROIDs are one of the weap-
platform based on Hardkernel’s official ons in my arsenal for tackling these
releases, for which I have won several projects. My favorite development
Monthly Forum Awards. I own a lot of languages are Rebol and Red, both of
ODROIDs, which I use for a variety of which run fabulously on ARM-based
purposes, including media center, web systems like the ODROID-U2. I have
server, application development work- deep experience with many unique op-
station, and gaming console. erating systems.

ODROID Magazine, published monthly at http://magazine.odroid.com, is your source for all things ODROIDian. • Hard Kernel, Ltd. • 704 Anyang K-Center, Gwanyang, Dongan, Anyang,
Gyeonggi, South Korea, 431-815 • Makers of the ODROID family of quad-core development boards and the world’s first ARM big.LITTLE architecture based single board computer.
Join the ODROID community with members from over 135 countries, at http://forum.odroid.com, and explore the new technologies offered by Hardkernel at http://www.hardkernel.com.

ODROID MAGAZINE 3
ODROID MAGAZINE 3
Converting a Monitor to
a Giant Android Tablet
Justin Lee and Charles Park

T
ouch screens are common in devices also more expensive, especially when An infrared touch screen uses an array
such as smartphones, game con- the screen size is larger than 20 inches. of X-Y infrared LED and photodetector
soles, all-in-one computers and tab- A capacitive screen can only be acti- pairs around the edges of the screen to
lets. They also play a prominent role in the vated with an exposed finger (no gloves detect a disruption in the pattern of LED
design of digital appliances such as digital or pointers), and can experience opera- beams. These LED beams cross each
signage, Point of Sale (POS) systems, sat- tional difficulties if the monitor is not other in vertical and horizontal patterns,
ellite navigation devices, mobile phones, correctly mounted into a metal housing which helps the sensors pick up the exact
video games and some e-books. due to the electrical field. Considering location of the touch. A major benefit of
The Android OS, one of the main its ease of use and lower cost, the infra- the infrared system is that it can detect
operating systems for the ODROID, red-type touch screen is better suited for essentially any input, including a finger,
has an intuitive user interface designed this project. gloved finger, stylus or pen. It is gener-
for use with a touch screen. This article ally used in outdoor applications and
describes how to use an ODROID to Infrared(IR) Grid point of sale systems which cannot rely
change any monitor or TV into a giant touch screens on a conductor (such as a bare finger) to
Android tablet. activate the touch screen.
Unlike capacitive touch screens, in-
Infrared vs frared touch screens do not require any
Capacitive touch patterning on the glass, which increas-
es durability and optical clarity of the
screen overall system. However, infrared touch
Touch screens primarily use either screens are sensitive to dirt and dust that
infrared or capacitive technology. Ca- can interfere with the IR beams, and
pacitive touch screens are more popu- suffer from parallax in curved surfaces
lar for smartphones and tablets, but are Principle of IR (Infrared) touch screen and accidental touch notifications if

ODROID MAGAZINE 4
MAKE YOUR GIANT ANDROID TABLET
the user hovers his/her finger over the & Play. of VID:1870, PID:0119 appeared to
screen while searching for the item to It’s important to check whether the represent a touch screen from Nexio Co.,
be selected. touch screen is really Windows 8 com- Ltd. Other touch screens will report dif-
patible or not. True ferent VID, PID and vendor informa-
Plug & Play devices tion.
do not require a
separate driver to be Step 2: Modify
installed on a Win- hid-ids.h and hid-
dows PC. If the
touch screen needs a
multitouch.c
specific device driv- After downloading the appropriate
er, it is not natively Android kernel source from dn.odroid.
compatible with com, navigate to the kernels/drivers/hid/
Windows 8 and will
be less likely to work
with Android.
Principle of IR (Infrared) Multi-touch screen

How to Choose an There are 4 steps to using the touch


Infrared touch screen screen with the Android OS in a
You can make your own touch screen nutshell: Example PID and VID values added to
by following guides found on the Inter- kernels/drivers/hid/hid-ids.h
1) Get the Vendor ID and Product ID from the
net, but it is not easy to implement the touch screen USB interface.
complex multi-touch algorithm and well 2)Modify the files hid-ids.h and hid- directory, then add the VID and PID to
aligned IR emitter/receiver pairs. multitouch.c, both located in kernel/drivers/ the end of the hid-ids.h header file.
Before purchasing an infrared touch hid/ Also, add the new ID in the hid-
screen, it’s important to evaluate its com- 3) Build the kernel with the HID-MULTITOUCH multitouch.c source file. It must be
patibility with Android. It must meet at option enabled, and transfer the kernel image
least one of the following requirements: to the ODROID.
4) Create an IDC (Input Device Configuration)
1) Is your touch screen listed in the Linux file.
multi-touch compatibility table?
http://lii-enac.fr/en/ar-
chitecture/linux-input/ Step 1: Check the
multitouch-devices.html VID and PID
If yes, it will be very easy to activate your
touch screen. Plug the touch screen into any Linux
PC, then find the VID and PID by typ-
2) Is your touch screen Windows 8 compatible? ing lsusb in the terminal as below right.
If yes, you need to add a few lines in the Kernel To determine which device entry
Example of adding the touch screen ID to
driver and an input configuration file. is associated with the touch screen, list kernels/drivers/hid/
the devices before connecting the touch hid-multitouch.c
3) Does your touch screen manufacturer sup- screen, then list them again after con-
ply specific Android driver source code?
necting it. The new entry will cor-
If yes, you need to follow their porting in-
struction. respond to the touch screen device.
During our project, when the
A touch screen which meets the first 23-inch touch screen was con-
requirement was not available in our lo- nected, an entry of VID:03FC,
cal Korean or Chinese markets. Some PID:05D8 appeared in the de-
touch screen manufacturers in China vice list, which represents a touch
offered to supply the driver source code screen made by Elitegroup Com-
for their products, but the sample code puter Systems. With the 42-inch
was not useful in the real world. The best touch screen connected, an entry
alternative was a touch screen that sup- Reading the VID and PID of the USB
ported Windows 8 HID-compliant Plug touchscreen using a Linux PC

ODROID MAGAZINE 5
MAKE YOUR GIANT ODROID TABLET
placed in the hid_device_id mt_devices
via fastboot protocol in u-boot. Carefully attach the touch screen to
structure define.
align the viewing window.
Step 4: Create an
Step 3: Build the
IDC (Input Device
kernel with the HID-
Configuration) file
MULTITOUCH
option enabled If you don’t make a proper IDC file,
the resolution of the touch screen will not
Type “make menuconfig” to config- match the HDMI resolution. Create a
ure the kernel, then go to plain text file as below:
Device Drivers > HID Devices
> Special HID drivers > HID touch.deviceType = touch-
Screen Testing the touch screen - 6 points guarantee
touch.orientationAware = 1 the sensor integration with the software.
device.internal = 1
keyboard.layout = qwerty Test the touch screen. Our touch
keyboard.characterMap = qwer-
ty2 screen could detect up to 6 points.
keyboard.orientationAware = This smaller 23-inch touch screen
1
keyboard.builtIn = 1cursor.
mode = navigation
cursor.orientationAware = 1

Configuring the touch screen with an embed- The file name must be Vendor_xxxx_
ded driver in the kernel configuration. Product_yyyy.idc (xxxx: Vendor
ID, yyyy: Device ID). I made two
Multitouch panels and select it as files for Elitegroup and Nexio. The filename
an embedded driver (*), as seen below. is case sensitive.
Then, set another two options as an em-
bedded driver, indicated with an asterisk (*) Vendor_03fc_Product_05d8.idc 23-inch touch screen panel with velcro belts
Device Drivers > Input de- and playing Fruit Ninja on Android.
Vendor_1870_Product_0119.idc
vice support > touch screens >
USB touch screen Driver Copy the IDC files to your ODROID
and: with the below commands.
Device Drivers > Input de-
vice support > touch screens > adb remount
adb push Vendor_03fc_
Product_05d8.idc /system/
usr/idc/.
adb push Vendor_1870_
Product_0119.idc /system/
usr/idc/.
adb reboot panel came with 4 velcro belts and it was
relatively easy to assemble.
How to Attach the Besides gaming and personal use, the
42-inch Touch Panel ODROID is ideal as the core computing
to the TV Screen. device for kiosks, digital signage, human
Configuring the touch screen with an embed- interface research, and more, because of its
ded driver in the kernel configuration high performance computing power, rela-
tively low cost, and open platform which al-
GeneralTouch touch screen de- lows modifications such as this touch screen.
vice support A video is at http://www.youtube.
Save the Kernel configuration and com/watch?v=HDsnuxchxtU, and for
compile it to make a zImage. Preparing the touch screen: Attaching the more giant action, http://www.you-
Transfer the zImage to your ODROID double-sided tape to the touch screen frame tube.com/watch?v=n8_cV_NeWQ8.

ODROID MAGAZINE 6
INSTALLING ANDROID ON AN ODROID

Installing android
on an ODROID
the Mad Scientist chronicles continue
Bohdan Lechnowsky

T
his moment finds you in your fa- issue of ODROID Magazine. Handily,
miliar laboratory, hunched over you printed out and bound the entire
Check that your OS
your lab counter, illuminated by last issue of ODROID Magazine for easy
the soft glow of your plasma display, net- reference. Sometimes, it’s just nice to version is higher than
work indicator lights, catalyzing chemi- feel paper between your fingers. Beta 1.6
cals in various test tubes, and such. Be- After a few cobbled attempts at down-
(Settings > System > About
fore you lays a brand new ODROID-U3 loading the latest Android release for the Tablet)
which you are in the process of modi- ODROID, you actually slow down and
fying into a combination superphone/ study the proper way to do it. The Build Number has a date code,
world-domination device. As the U3 is – for most intents and and should be April-2013 or later. This
On another ODROID inches to your purposes – identical to the U2, you fol- image is 24-April-2013.
right plays an inspiring YouTube video of low the procedures for installation on the
The Ben Heck Show while you hack old U2. You find the latest full version of Download the Android update file.
IDE ribbon cables and connect your U3 Android for the U2 is the Android Beta Visit http://dn.odroid.com/An-
to various items on your worktop like 1.6, and the newer versions are simply droid_Beta_1.8.0/U2/ (for other
batteries and miniature displays. updates to that version. models of ODROID, leave off the “U2”
Upon completing the last solder con- You download Android_Beta_1.6 at the end). Select the SD or eMMC
image, depending on the card that you
nection, you look up with a menacing for the U2 from http://dn.odroid.
have installed, and start the download.
smile of accomplishment and say, “Flip com/Android_Beta_1.6/U2/ and
the switch!” After a brief moment of write it to your SD/eMMC card as Create the updater directory.
inactivity, you remember that you still explained in the January 2014 issue Create the directory /sdcard/up-
don’t have a lab minion. Not only that, of ODROID Magazine. Once it has dater using File Explorer that should be
but there is no switch to flip. However, completed, you plug the card into your included in your Apps list.
there is an on/off button on the U3! ODROID and yell, “PUSH THE BUT-
You power on your U3, but then real- TON!”, this time remembering that you Move the update file to the updater
ize after another brief moment of inac- have neither a minion nor a flippy-type folder.
tivity that you don’t have an OS on your switch. You catch yourself cackling in glee Copy the downloaded .zip file con-
SD or eMMC card. You decide that you as the ANDROID logo appears across taining the Android Beta into the /sd-
card/updater folder.
should probably install Android as it is your mini display connected to your U3.
the best choice for the superphone por- You find instructions for updating
Start the update process.
tion of your invention, and you can run to a newer version of Android on the
Linux in parallel with Android for the odroid.com blog, and you make some (Settings > About Tablet >
world-domination half of your inven- changes to bring it up to the current ver- ODROID )
tion, as explained in the January 2014 sion, like so:

ODROID MAGAZINE 7
HPC AT HOME

High
Performance
Computing
AT Home
compute like you
never did before
Cooper Filby and Anthony Skjellum -
Runtime Computing Solutions LLC

I
n the previous issue of ODROID
Installing the
Magazine, we discussed the ben-
efits of using ODROIDs for High Operating System
Performance Computing (HPC), in There are a number of prebuilt Linux
addition to various discoveries while operating systems available for ODROID
working with XU+E’s related to set- boards from http://dn.odroid.in. To get If this doesn’t make you want to make a Voltron
ting up our own cluster in a commer- started, download the Ubuntu Server based cluster using five ODROIDs, we cannot
cial setting. But what about the home image for your ODROID model and ex- be held responsible for the giant robots that
user that wants to experiment with tract the .IMG.XZ archived image using may someday take over your hometown.
HPC? In part one of this multi-part an archiving tool such as 7zip on win-
series, we outline the setup and con- dows, or by typing “xz” from the Linux them nodes for simplicity from now on)
figuration of a basic “headless” cluster command line. Finally, you can copy via the ssh protocol using Terminal (or
with the end goal of running parallel to the medium of your choice, such as Putty if running Windows) in order to
programs based on message passing, an SD card or an eMMC module, us- continue setting up our cluster. Because
using the Message Passing Interface ing the “dd” command on Linux/OS of potential initial hostname and MAC
(MPI) parallel programming model in X systems or the Win32DiskImager.exe address conflicts that we will resolve in
particular. for ODROID on Windows. For more the next section, we will need to boot the
In subsequent articles, we plan to detailed instructions on copying over first ODROID and set a few settings be-
expand on this setup to build a cluster the OS, please refer to Bohdan Lech- fore starting the second.
with a centralized head system or node, nowsky’s article titled “Installing an OS
complete with services such as Puppet, on an ODROID” from the January [Editor’s Note: If one is available, a de-
NFS, and LDAP, a configuration that 2014 issue of ODROID Magazine. We velopment machine running Linux or
is capable of supporting a much larger recommend using the eMMC modules Windows is recommended to more easily
number of ODROID systems (nodes) available from Hardkernel for better per- setup and reboot the cluster, troubleshoot
configured as an HPC cluster. For ex- formance, but SD cards work well too. hardware problems, and other necessary
ample, in part two, we will cover basic debugging. An alternative to using a
networking configuration of the head Connecting to your separate computer is to plug a USB key-
node, including dnsmasq, NAT, and Odroid and User board and HDMI cable into the first
adding more nodes to the cluster, while Configuration ODROID and use it directly to boot-
in part three (and further installments), Since we opted to use the Ubuntu strap the cluster instead of via SSH as de-
we will cover additional services such Server image for our ODROIDs, we can scribed in the next few paragraphs. Press
as LDAP, NFS, Autofs and Puppet. connect to our XU-E systems (we’ll call Ctrl-Alt-F1 to use the framebuffer con-

ODROID MAGAZINE 8
HPC AT HOME

to the router’s admin panel, you can also name. You can use other names of your
make use of the nmap command to choice; they have to be unique to each
scan your network for hosts to find node.
the ODROIDs, if you know your The MAC address conflict was a sub-
network information. For ex- tle issue that we encountered when we
ample: “nmap 192.168.1.0/24”. first set up multiple ODROID XU+E’s.
Look for a host that has port 22 We found that, by default, the onboard
open. ethernet devices all shared the same
Power on one of the MAC address, which made it impossible
ODROIDs, then enter “ssh to work on a single ODROID if mul-
odroid@ubuntu-server” (or tiple were powered online and on the
“ssh odroid@xxx.xx.xx.xxx”, same network. If the two ODROIDs
if using the IP address) in the you’re working have identical MAC ad-
Terminal or Putty window of dresses, there are two straightforward
the host computer, which will ways to resolve this: 1) configure one (or
establish a secure connection to both) of the ODROIDs to use a different
the ODROID. To login, type MACaddress, or 2) setup USB ethernet
“odroid” as the password. dongles, which should all have unique
Once the command prompt ap- MAC addresses. The specific values you
pears, you may want to run “sudo apt- choose really don’t matter, as long as you
get update && sudo apt-get upgrade” to keep them unique on your Local Area
ensure that your OS is up to date. Fur- Network (LAN).
sole thermore, we recommend you run the To change the MAC address of the
i f “passwd” command and change the pass- onboard device, edit /etc/network/
X 1 1 word for the odroid user to something a interfaces with your text editor of
is not run- little more secure, or creating new user choice, and add the line “hwaddress
ning.] accounts with the “adduser” command, ether newmac”, where newmac is an ad-
such as by running “sudo adduser kilroy”. dress in the format “b6:8d:67:7b:cb:e0”
In order to connect to your (Generally speaking, do three things key underneath the following labels:
ODROID, you’ll need to discover the with your node passwords: make them
hostname or IP address of the board. long, make them hard to guess, and store auto eth0

For the Ubuntu server image we used it in a secure location.) iface eth0 inet dhcp
on our XU+E cluster, the default host-
name is “odroid-server”, while for other Configuring Then, reboot the ODROID so the
images we’ve used, it’s been “odroid”. Networking changes take effect. Make sure to verify
Most home networks should support Before getting both ODROIDs on- the new address using the ifconfig com-
DNS by default, which will allow you to line, we need to change a few settings as mand. Alternatively, you can opt to plug
connect simply by the hostname. If this to eliminate hostname and MAC address your USB Ethernet adapters into the
fails, you can alternatively connect using conflicts that may occur on your home USB 3.0 slot, and then run “ifconfig -a |
the IP address assigned to the ODROID network with an ODROID cluster. To grep eth”, which should yield a list simi-
by your router instead. If neither of the change the hostname, we will need to lar to this:
hostnames resolves for you, check your edit two files, /etc/hostname and /etc/
router’s lease table to search for the IP hosts, changing “odroid-server’ to the eth0 Link encap:Ethernet
address, often labeled as the DHCP cli- hostname of your choice and rebooting HWaddr b6:8d:67:7b:cb:e0
ent table in the router’s admin panel. the machine so the changes take effect.
Since we used identical copies of the For the purposes of this article we will eth2 Link encap:Ethernet
same image on both nodes, by default use odroid-server0 and odroid- server1 HWaddr 00:13:3b:99:92:b1
they had a hostname conflict, which we to refer to the first and second ODROID
resolved by bringing them online one at respectively. Alternatively, if your operat- By default, eth0 will be the onboard
a time, then changing the individual net- ing system supports it, you can also type 10/100 ethernet connection, while the
work settings. If you don’t have access “sudo odroid-config” to change the host- second ethernet device (in this case,

ODROID MAGAZINE 9
HPC AT HOME

Use the appropriate ethernet device able through apt-get.


id previously found with ifconfig (in To install MPICH, run “sudo apt-get
this case, eth2). Then, power down the install mpich2”, or run “sudo apt-get in-
ODROID, put the ethernet cable that stall openmpi-bin” to install OpenMPI
was attached to the the onboard device as an alternative.
into the USB ethernet adapter, and pow-
er the ODROID back on. If, for some What you can do
reason, you aren’t able to connect, try once you’ve loaded MPI:
plugging the cable back into the on-
board slot and verifying that the USB 1) Run test applications that
ethernet adapter is still showing up us- use multiple cores on a single
ing the “ifconfig -a” command. It’s also ODROID
possible that the ethernet device ID itself
has changed if the adapter is unseated, 2) Run example programs that
in which case you can update the /etc/ use both ODROIDS and a total of
network/interfaces file accordingly. 8 cores.
At this point, the ODROID should
be configured and accessible on the net- 3) Learn how to build your own
work. Before heading on to the MPI MPI programs.
section, configure the second ODROID
using the same steps described above. In this article, we’ve focused on show-
ing you how to do the first and the second
Message Passing approaches. You can read the example
Interface (MPI) programs that come with OpenMPI and
Now that we have two nodes con- MPICH to learn more. There are also a
figured appropriately, we can now number of excellent online tutorials and
start looking towards how we can a few good books on programming MPI,
execute HPC jobs on our two-node such as “Using MPI” from MIT Press
cluster. A parallel programming en- (one of us co-authored that book).
vironment such as MPI helps you
do this. MPI takes care of starting Building it Better
up the processes that make up the The content of this article represents
parallel programming model, and just a fraction of what we will be able to
provides a standardized applica- do with our cluster down the line. While
tion programming interface (API) this setup is more than adequate for han-
for those cooperating, communicating dling two nodes and only a few users, if
Yes, we are serious when it comes to gi- sequential processes to use to make the we want to grow our cluster, we will want
ant robots taking over your hometown, but
parallel program work. To accomplish to make use of a dedicated head node to
Voltron always wins
this, we will make use of MPI, or Mes- better handle a larger number of users
eth2) will be the USB Ethernet Adapter. sage Passing Interface, which provides and nodes. In addition to allowing us to
If only eth0 shows up, try reseating your an API that allows nodes to send and re- hide cluster traffic from the rest of the
USB Ethernet adapter and/or verifying ceive messages while processing jobs. A network, this head node will also host
that it works on another machine. To command called either mpirun or mp- services that will streamline cluster man-
set up the adapter for using DHCP on iexec will start all the processes needed agement, such as LDAP for user manage-
boot to get an IP address, we will need to across your ODROIDS under your ment, Puppet for content management,
modify /etc/network/interfaces control. There are two common open NFS for file sharing, and various net-
and add the following two lines between source MPI implementations available working services.
the entries for auto lo and auto eth0: for download - MPICH and OpenMPI. In part two of this series, we will
For ODROID clustering purposes over begin to convert odroid-server0 into a
auto eth2 Ethernet, both work equally well. Both proper head node.
iface eth2 inet dhcp of these MPI implementations are avail-

ODROID MAGAZINE 10
POWER CONTROL ON ODROID CLUSTERS

Fine-grained power
control on ODROID
clusters
24 high performance
cores for 35 watts
Kurt Keville

O
ur team has experimented re-
cently with a number of new
energy-saving techniques avail-
able to server system administrators and
managers of High Performance Com-
A big problem of early software engineering
puting (HPC) clusters. Our specific ex-
was not how much power those old dinosaurs
periences come in the form of testing a demanded, but the lack of safety hats.
mini-cluster of ARM Cortex-A9 boards
running the development Ubuntu ver-
sion targeted at that platform. standard practices of “nice” level man-
The big takeaways
In addition to the Hardkernel-rec- agement and queueing system usage,
from this project most systems are fully in use if you orga-
ommended default install of the OS and
concurrent headless server application Server hibernate is of decreasing utility since nize your jobs correctly. We therefore in-
poweroff and reboot is just as quick in our us- vestigated fully-on, fully-off and almost-
suite (including MPI discussed on the age. Governer invocation is now the standard.
last article), we installed cpufrequtils, off systems with an eye towards energy
WattsUp, and PowerNap and then up- The Powersave governor is of considerable savings relative to the various options
dated the systems accordingly. These value and should be used as a default in HPC available to us that don’t involve a full
packages are mainly what we will discuss clusters. power-down.
in this article, since they are where the Cold boots time for our demo cluster
And manual processor affinity is no longer
bulk of our power / energy savings and necessary if you are using modern kernels on was less than 10 seconds and therefore
reporting are attained. your ODROIDs. validated this model. A more likely sce-
The power savings are considerable nario for traditional datacenters, howev-
in clusters that have significant reduced er, would include systems that are rarely
usage periods, and an aggressive power- fitted U2 and U3s of less than 10 sec- powered down since they need to re-
saving schedule yielded no negative re- onds so there is no argument you can spond to requests quicker than a power-
sults in our findings. Even if you do not make for suspend / resume or hibernate on would allow. For those scenarios we
have big.LITTLE enabled apps (which / thaw that isn’t better exemplified by an investigated suspend and resume and the
we do not have on our U2 / U3 cluster), on / off solution or a scripted governor novel PowerNap acpi modes.
you can tune your performance require- call in embedded HPC. Datacenter sysadmins have always
ments with rules written against pack- In an academic datacenter, you are had a way to do a “safe” managed shut-
ages like Slurm, which is currently one quite often utilizing 100% of your most down of their servers in case of a power
of the most popular queueing systems / restrictive computational resources in outage. The UPS vendor APC, in partic-
schedulers in the HPC world. your applications, or waiting for a job ular, has been a leader in this field when
We have boot times on our eMMC to be initiated. Because of conventional they introduced their “SmartUPS” line.

ODROID MAGAZINE 11
POWER CONTROL ON ODROID CLUSTERS

The original software application that


shipped with these UPSes utilized a seri- root@odroid:~# cpufreq-info
al (RS-232) connection that would allow
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
the system to initiate a shutdown script
on a server when the UPS detected that Report errors and bugs to cpufreq@vger.kernel.org, please.
it was no longer getting charged. Since
analyzing CPU 0: driver: exynos_cpufreq
the original releases there have been
many improvements to this approach, CPUs which run at the same hardware frequency: 0 1 2 3
affording substantial scripting flexibility
CPUs which need to have their frequency coordinated by software:
to the sysadmin and introducing alter- 0 1 2 3
native hardware options, like USB and
maximum transition latency: 100.0 us. hardware limits: 200 MHz
SNMP connections.
- 2.00 GHz
The open-source community has also
added many new options to this func- available cpufreq governors: conservative, userspace,
powersave,performance
tionality, progressively in the form of
software support for the nut and upsd current policy: frequency should be within 200 MHz and 1.70 GHz.
code bases (see http://www.networkup- The governor “performance” may decide which speed to use within
this range.
stools.org). We can now “hook” the in-
vocation of this script into a user-defined current CPU frequency is 1.70 GHz (asserted by call to hard-
usage, in our case tied to a drop in pro- ware).
cessor usage below 20%. NUT is com-
cpufreq stats: 2.00 GHz:0.00%, 1.92 GHz:0.00%, 1.80 GHz:0.00%,
patible with Ganglia and Nagios in that 1.70 GHz:93.58%, 1.60 GHz:0.01%, 1.50 GHz:0.00%, 1.40 GHz:0.00%,
it affords quite a few scripting options, 1.30 GHz:0.01%, 1.20 GHz:0.00%, 1.10 GHz:0.01%, 1000 MHz:0.00%,
900 MHz:0.00%, 800 MHz:0.00%, 700 MHz:0.00%, 600 MHz:0.00%, 500
so sysadmins familiar with adding ad-
MHz:0.00%, 400 MHz:0.00%, 300 MHz:0.01%, 200 MHz:6.38% (66)
hoc functionality to their cluster man-
agement tools should have little problem
integrating it with their custom setup. the course of the benchmark suite run. cpufreq-info will show this 4 times, but if you
Additionally, cpufrequtils and pm- It is interesting to note that while these go for powersave or conservative, get ready
utils are very handy sets of tools that are to see less active processors when idle.
particular benchmarks managed to keep
compatible with the Linux kernel, at the CPUs busy, it did not fully utilize
least as recently as 3.2. PowerNap lets available memory, which is also reflected
you manage this via a script interface. in power usage. top command sampling a lu.A benchmark
You can lock your board into its highest
top - 09:00:58 up 2:52, 6 users, load average: 2.41, 0.74, 0.29
speed setting by invoking “cpufreq-
set –g performance” from the com- Tasks: 154 total, 2 running, 152 sleeping, 0 stopped, 0 zombie
mand line or by hooking it into Power- %Cpu(s): 99.1 us, 0.0 sy, 0.0 ni, 0.8 id, 0.0 wa, 0.0 hi, 0.1 si,
Nap’s config scripts if you prefer a degree 0.0
of automation. KiB Mem: 2071512 total, 884916 used, 1186596 free, 111884 buffers
Note the ODROID U3 output
KiB Swap: 0 total, 0 used, 0 free. 421392 cached
above right, when your processors are set Mem
to “performance” mode (one report for
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COM-
each processor core normally). MAND
When you set the U3 proces-
6306 root 20 0 69660 43248 644 R 394.9 2.1 3:59.17 lu.A
sor frequency to the stock maximum
of 1.7 Ghz and run the workload 6311 root 20 0 4708 1236 836 R 0.7 0.1 0:00.11 top
at http://openbenchmarking.
org/result/1401173-UT- Some benchmarks represent usage as connected WattsUp meter. Clearly the
1309189UT21, you can successfully 400% of one process rather than 100% XU-E is much better suited to this ex-
peg the processors at close to maximum of 4 processes depending on whether periment, not to mention the substan-
utilization. Our power peaked at 6.3 they are initiated as MPI jobs. We tially better performance with the big.
Watts and averaged 5.6 per node over tracked the power use using an FTDI- LITTLE architecture.

ODROID MAGAZINE 12
POWER CONTROL ON ODROID CLUSTERS

Our test setup


We wanted a demo micro-cluster Governor setting versus watt utilization
that captured the power being used
by six (6) ODROID-U2 computers. Governor (freq) Avg. Watts for 6 boards
Those items were connected to our
WattsUp meter, which allowed us to Performance (1.7 Ghz) 33.6
measure relatively small power fluc-
tuations, since they aggregated. We Userspace (700 Mhz) 21.0
captured this with the Linux util-
ity described below. Additionally, we Powersave w / 2 core* 3.6
measured single node numbers on an
ODROID U3. Baseline power usage Performance w / 1 core 23.4
on boot (note that boots put us into * via a PowerNap script that invokes “echo 0 > /sys/devices/
”ondemand” mode at initially 200 system/cpu/cpu2/online” and cpu3. Actually, if you set any fre-
quency below 700Mhz on the U3, it will turn off 2 cores.
Mhz) was negligible. While a range
from 200 MHz to 1.7 GHz were Lower bars = less wattage usage
available speed options for our boards
(without overclocking), as a practical
matter we only used the lowest and
highest speeds.
We measured the following scenari-
os; All boards at peak freq, all boards at
minimum freq while retaining all cores,
all boards with 2 CPUs on at min, and
all boards with 1 CPU on at max.
PowerNap, in our conventional us-
age, controlled cpufreqd to dial down
the CPU speed to its factory-enabled
minimum when an idle period is de-
tected. An idle period can be user de- The SoC Drawer and SoX BoX clusters dis-
fined, as well as other parameters as- assembled, those guys pack quite a punch
sociated with reporting, grace periods
and other functionalities.
Our recommendations are to ig-
nore hibernate in a server scenario;
The power use logging setup
if you need immediate shutdown using an ODROID-U3
just power off underutilized cores at
a board level. Rebooting takes ~10
seconds each in our configurations.
While the U3 might not compete with
the XU on FLOPs per Watt, it does on
FLOPs per dollar. It is cheaper than an
References
Intel Galileo and compares favorably
PowerNap Tutorial http://ti-
in the openbenchmarking tests by that nyurl.com/PowerNapTutorial
standard. Moreover, it appears that
power efficiency scales superlinearly Slurm Integration http://
tinyurl.com/SlurmIntegration
with frequency and core count. So you
if you have a power budget, and few Power Use Logging http://ti-
time restrictions, you can script your nyurl.com/WattsUpLinuxUtil
cpufreqd to make that a priority, and
aggressive manage your power use.

ODROID MAGAZINE 13
USB GADGET DRIVERS

g e t Gone are the days when notebooks came


with Ethernet and COM ports. What do you

d
do if you are stranded with nothing but a USB

a
cable?

b g s
s r
u ivuer oderowith y i d o u r

dmarke younicoaltPC
o mmcho Developer
c ds ernel
ol Kim, Hardk
in
Kev

Installation
In order to use the Gadget drivers,
first verify that the following modules
are present on the ODROID system:

Mass storage emulation

W
hen developing applica- By connecting the ODROID to a /lib/modules/`uname -r`/kernel/
tions for the ODROID, PC using its USB port, it can be "enu- drivers/usb/gadget/
its often necessary to trans- merated" to appear as another common g_mass_storage.ko
fer files and commands from a main USB device, depending on the type of
host PC to the development comput- communication desired: Serial emulation
er. This can be performed via FTP or /lib/modules/`uname -r`/kernel/
SSH through the Ethernet port, but it Serial communication device drivers/usb/gadget/g_serial.ko
can be also be done over USB, to sim-
plify the setup. This article describes Network device Ethernet emulation
how to use the USB device port on /lib/modules/`uname -r`/kernel/drivers/
your ODROID to communicate with Mass storage device
usb/gadget/g_ether.ko
your host PC. To get started, a micro-
USB cable is required to make a physi- You can also use the USB cable to em- Mass storage + Serial + Ethernet
cal connection between ODROID and ulate each of these data connections at the /lib/modules/`uname -r`/kernel/drivers/
your host PC. same time, as a multi-function link. usb/gadget/g_multi.ko

ODROID MAGAZINE 14
USB GADGET DRIVERS

If the drivers aren’t initially present, Connect the ODROID’s micro-USB


To emulate
the Kernel and driver modules need to be cable to your PC and switch to using the
updated. Type the following commands Linux host.
a serial link :
into a Terminal window to upgrade: Serial over USB
On the Linux Host:
$ mkdir update-kernel && cd Load the g_serial module on the
update-kernel
If a recent Linux distribution is in- ODROID:
$ wget http://builder.mdrjr. stalled, the device should be automati-
net/tools/kernel-update.sh cally mounted. Otherwise, follow these # sudo modprobe g_serial

$ chmod +x kernel-update.sh steps to manually add it to the host PC:


Launch dmesg and find the Serial
$ sudo ./kernel-update.sh As root, launch dmesg and find Function gadget driver ready message.
the /dev/sdX device assigned to the
In the following code examples, the ODROID: # dmesg

green characters show the Terminal win- … gadget: Gadget Serial v2.4
dow running on the ODROID, and the .. scsi 56:0:0:0: Direct-
Access Linux File-CD Gadget … gadget: g_serial ready
blue characters show the Terminal on 0308 PQ: 0 ANSI: 2
the Host PC. … g_serial gadget: high-speed
.. sd 56:0:0:0: Attached scsi config #2: CDC ACM config
generic sg2 type 0
Emulating a mass
# ls –al /dev/ttyGS*
storage device: .. sd 56:0:0:0: [sdc] 262144
512-byte logical blocks: (134 crw-rw---- 1 root dialout
Storage over USB MB/128 MiB) 248, 0 Dec 31 1999 /dev/
ttyGS0
Load the g_mass_storage mod- .. sd 56:0:0:0: [sdc] Write
ule with a storage node which will be Protect is off

mounted on your host PC. .. sd 56:0:0:0: [sdc] Mode Connect the Micro-USB cable be-
Sense: 00 00 00 00 tween the host PC and the ODROID,
# mount which should give the following message
.. sd 56:0:0:0: [sdc] Asking
/dev/mmcblk0p1 on /media/boot for cache data failed on the host:
type vfat (rw,nosuid,nodev,fl
ush,umask=000) .. sd 56:0:0:0: [sdc] Assuming $ dmesg
drive cache: write through
# sudo umount /dev/mmcblk0p1 … usb 1-1.2.4: new high-speed
.. sd 56:0:0:0: [sdc] Asking USB device number 3 using
# sudo modprobe g_mass_stor- for cache data failed ehci_hcd
age file=/dev/mmcblk0p1
.. sd 56:0:0:0: [sdc] Assuming … cdc_acm 1-1.2.4:2.0: This
Launch dmesg and find the Mass_ drive cache: write through device cannot do calls on its
Storage Function gadget driver message. own. It is not a modem.
.. sdc:
… cdc_acm 1-1.2.4:2.0: tty-
… gadget: Mass Storage Func- .. sd 56:0:0:0: [sdc] Asking ACM0: USB ACM device
tion, version: 2009/09/11 for cache data failed
$
… gadget: Number of LUNs=1 .. sd 56:0:0:0: [sdc] Assuming
… lun0: LUN: file: /dev/ drive cache: write through $ ls –al /dev/ttyACM*
mmcblk0p1
.. sd 56:0:0:0: [sdc] At- crw-rw---- 1 root dialout
… gadget: Mass Storage Gad- tached SCSI disk 166, 0 Jan 22 00:29 /dev/
get, version: 2009/09/11 ttyACM0
… gadget: userspace failed to Then, mount the device and enjoy
provide iSerialNumber the file sharing:
…gadget:g_mass_storage ready Data should now be transmitted
$ sudo mount /dev/sdc /mnt/
… g_mass_storage tmp through /dev/ttyACM0 (PC), and
gadget: high-speed config #1: /dev/ttyGS0 (ODROID):
Linux File-Backed Storage $ cd /mnt/tmp

ODROID MAGAZINE 15
USB GADGET DRIVERS
errors:0 dropped:0 overruns:0 HWaddr 62:19:ce:95:e0:9f
$ sudo chmod 666 /dev/ttyACM0 carrier:0
inet addr:192.168.100.1
$ echo qwerty > /dev/ttyACM0 collisions:0 Bcast:192.168.100.255
txqueuelen:1000 Mask:255.255.255.0
# cat /dev/ttyGS0
RX bytes:22645 (22.6 inet6 addr:
qwerty KB) TX bytes:18987 (18.9 fe80::6019:ceff:fe95:e09f/64
KB) Scope:Link

Connect the Micro-USB cable be- UP BROADCAST RUN-


Emulating a ethernet tween the host PC and the ODROID NING MULTICAST MTU:1500
Metric:1
storage link: and which should show the follow-
ing messages on the host after typing RX packets:21 errors:0
Ethernet over USB dropped:0 overruns:0 frame:0
“dmesg”:
Load the g_ether module on the TX packets:33
$ dmesg errors:0 dropped:0 overruns:0
ODROID:
carrier:0
… usb 1-1.2.4: new high-speed
# sudo modprobe g_ether USB device number 12 using collisions:0
ehci_hcd txqueuelen:1000
Launch dmesg to get the Ethernet … hub 1-1.2:1.0: unable to RX bytes:4677 (4.6
Function gadget driver ready message, and enumerate USB device on port KB) TX bytes:8394 (8.3 KB)
4
details about the ethernet connection.
… usb 1-1.2.4: new high-speed
# dmesg USB device number 13 using Now the ODROID will be able to
ehci_hcd send and receive data through the usb0
… gadget: using random self
ethernet address … cdc_eem 1-1.2.4:1.0: usb0: port:
register 'cdc_eem' at usb-
… gadget: using random host 0000:00:1a.0-1.2.4, CDC EEM
ethernet address Device, 62:19:ce:95:e0:9f # sudo ifconfig usb0
192.168.100.2
… usb0: MAC $ ifconfig
e2:53:36:a5:8f:38
# ifconfig
usb0 Link encap:Ethernet
… usb0: HOST MAC HWaddr 62:19:ce:95:e0:9f usb0 Link encap:Ethernet
76:42:28:9e:9f:eb
HWaddr e2:53:36:a5:8f:38
inet6 addr:
… gadget: Ethernet Gadget, fe80::6019:ceff:fe95:e09f/64 inet addr:192.168.100.2
version: Memorial Day 2008 Scope:Link Bcast:192.168.100.255
Mask:255.255.255.0
… gadget: g_ether ready UP BROADCAST RUN-
NING MULTICAST MTU:1500 inet6 addr:
… g_ether gadget: high-speed Metric:1 fe80::e053:36ff:fea5:8f38/64
config #1: CDC Ethernet (EEM)
Scope:Link
RX packets:3 errors:0
# ifconfig dropped:0 overruns:0 frame:0 UP BROADCAST RUN-
NING MULTICAST MTU:1500
usb0 Link encap:Ethernet TX packets:4 Metric:1
HWaddr e2:53:36:a5:8f:38 errors:0 dropped:0 overruns:0
carrier:0 RX packets:594
inet6 addr:
errors:0 dropped:0 overruns:0
fe80::e053:36ff:fea5:8f38/64 collisions:0 frame:0
Scope:Link txqueuelen:1000
TX packets:434
UP BROADCAST RUN- RX bytes:488 (488.0 errors:0 dropped:0 overruns:0
NING MULTICAST MTU:1500 B) TX bytes:624 (624.0 B) carrier:0
Metric:1
$ sudo ifconfig usb0 collisions:0
RX packets:106 192.168.100.1 txqueuelen:1000
errors:0 dropped:0 overruns:0
frame:0 $ ifconfig RX bytes:120002
(120.0 KB) TX bytes:98616
TX packets:82 usb0 Link encap:Ethernet (98.6 KB)

ODROID MAGAZINE 16
USB GADGET DRIVERS

Being able to work alongside network, stor-


age and serial, will save your life more often
than you think.

192.168.100.2 port 34764


Emulating a multi
# ping 192.168.100.1
[ ID] Interval Transfer function link:
PING 192.168.100.1 Bandwidth
(192.168.100.1) 56(84) bytes The full package
of data. [ 4] 0.0-10.0 sec 193
MBytes 162 Mbits/sec A multi-function link emulates a
64 bytes from 192.168.100.1: mass storage, serial and ethernet con-
icmp_seq=1 ttl=64 time=0.348 # iperf –c 192.168.100.1
nection using only one combo g_multi
ms
---------------------------- module:
64 bytes from 192.168.100.1: ----------------------------
icmp_seq=2 ttl=64 time=0.254 ---- # mount
ms
Client connecting to /dev/mmcblk0p1 on /media/
^C 192.168.100.1, TCP port 5001 boot type vfat (rw,nosuid,no
dev,flush,umask=000)
--- 192.168.100.1 ping sta- TCP window size: 20.7 KByte
tistics --- (default) # sudo umount /dev/mmcblk0p1

2 packets transmitted, 2 re- ---------------------------- # sudo modprobe g_multi file=/


ceived, 0% packet loss, time ---------------------------- dev/mmcblk0p1
999ms ----

rtt min/avg/max/mdev = [ 3] local 192.168.100.2


port 34764 connected with
After connecting the ODROID’s
0.254/0.301/0.348/0.047 ms
192.168.100.1 port 5001 Micro-USB cable to the PC, all three
$ iperf –s functions listed above may be used si-
[ ID] Interval Transfer
Bandwidth
multaneously.
----------------------------
----------------------------
---- [ 3] 0.0-10.0 sec 193
MBytes 162 Mbits/sec
Server listening on TCP port
5001
Wow! 162Mbps is faster than nor-
TCP window size: 85.3 KByte
(default)
mal 100Mbps Ethernet!

----------------------------
----------------------------
----

[ 4] local 192.168.100.1
port 5001 connected with

ODROID MAGAZINE 17
GAMES

Linux Gaming
on ODROID
The right system for your games
Tobias Schaaf

W
hen it comes to gaming, ev- ing systems that the ODROID is able
eryone has different tastes. to emulate, and compare their pro and
There are many gaming cons are to help you decide which is the
genres, including First Person Shooter, best choice for you. This will somewhat
Role Playing, Arcade, Adventure, Simu- reflect my own opinion, and might dif-
lation, Real Time Strategy, and many fer from other people’s opinion, so
more. Some games are better suited for please consider this article more as a
consoles, while others are only playable suggestion than hard facts.
if you have a mouse and keyboard avail- If you have already downloaded and
able. Since the ODROID platform can installed my ODROID GameStation
run many types of games, choosing your Turbo image, available for free on the
gaming system really depends on per- ODROID forums, you have a good idea
sonal preference. of what systems the ODROID is able to Nintendo Entertain-
It also depends on whether you emulate. ment System or a Sega
like to play on your own (single-player First on the list is the Amiga. I had Genesis, so I’m not able to
mode), with others (team or competi- a few Amigas back in the day, and really compare the Amiga to other
tion mode), on the internet (network loved to play games on it. In the 1990s, contemporary systems.
mode), or with a friend in the same the Amiga was very popular. Compared In my opinion, the Amiga
room in front of your TV (multi-player to other PCs of the day (Apple //GS, was far ahead of its time. With games
or split screen mode). It also depends on Color Macintosh and IBM PC), it had
whether you want the old classics with improved graphics and far better sounds The Amiga desktop. This was the system that
the original beeping sounds, or prefer than most of the PC ports of that time. made all of your friends jelly, and you feeling
high fidelity audio and video with or- I never had an actual console like a Super like the coolest kid in school. No kidding!
chestral soundtracks and stunning 3D
graphics.
This month, I give an overview
of the gaming opportunities that the
ODROID platform offers, giving you
some ideas regarding what games you
might like to explore.

Finding the right


system
Since the ODROID offers so many
emulators and games, it’s hard to figure
out what system to choose from. So,
I want to examine some of the gam-

ODROID MAGAZINE 18
GAMES

The benefit people, including professional gamers.


of the Amiga is
that it actually The SNES was a big improvement com-
pared to the NES and other consoles, but
has some that is not a big surprise if you compare
g a m e s the specs of the two consoles:
that can The NES had only about 2KB of RAM and
be played 2KB of Video RAM, and a maximum of 25
together with colors simultaneously (out of 48 colors
and some grays).
a friend, so I Its successor, the SNES, could use up to
consider it a great 15bit colors (32,768 possible colors), and
multiplayer system. had 128 KB of RAM and a large amount
Games like Banshee or The Chaos En- of Video RAM (64 kB main RAM, 512 + 32
g i n e bytes sprite RAM, 256 × 15 bits palette
Left: Banshee, a great Amiga shooter RAM).
Right: The Chaos engine The ROM size of games from the NES
were between 8 KB to 1MB
On the SNES, the ROM size was be-
that took 15 disks or more, are really awesome tween 256KB and 6MB.
multi-tasking, the ability to to play with a
use hard drives to store games friend. It was possible to pack
and programs, and the Work- Next on much more data on a SNES
bench Graphical User Interface, the list of emu- cartridge, which allows
it was very impressive. lators is the Nin- for more content, and made
There are some emulators tendo Entertain- games look a lot better, as seen
that run Amiga games well, ment System (NES), in a direct comparison between
but it takes lots of config- the Super Nintendo the NES and the SNES:
uration to get the games Entertainment Sys- The SNES also used video render-
to run, and often you have tem (SNES) and the GameBoy Advance ing layers, which allowed more effects
to switch between Kickstart (GBA). If people talk about Nintendo, and content to put in a single scene, and
disks (the BIOS of the Amiga). and especially about retro games, you are
Simply switching through the going to hear about NES and SNES con-
many disks can also get somewhat soles. The NES is rather old for a console,
annoying. Although the graphics of the but it introduced some legendary classics
Amiga was outstanding it can hardly com- that changed gaming history. Titles such
pare to other consoles now. as Legend of Zelda or
I use retroarch in my ODROID Super Mario are games
GameStation Turbo image to run Ami- that will probably
ga games, but unfortunately, not all of never be forgot-
them run in full speed. So, I consider ten, and are one
the Amiga an unstable system to actu- of the most
ally use on the ODROID. There are important
some emulators that can run directly of Nintendo’s
(for example, E-UAE and FS-UAE), franchises.
which give better performance than the The SNES was
retroach port, but they require advanced a great improvement
configuration, and won’t run easily with over the NES, since it
gamepads, which the retroarch port does had more colors and
well. There are some beautiful games on offered a lot more Zelda, Mario and Kirby, the
the Amiga, but most of them have been possibilities than the best of Nintendo’s golden age
ported to other consoles or to the PC, NES, and was, for a
which can be emulated more success- very long time, THE
fully. gaming console for

ODROID MAGAZINE 19
GAMES

had a higher resolution than its prede- the lower resolution, the cartridge size
cessor. went from 1MB up to 32MB.
Another advantage of these consoles More size equals more content and
was that they were made for two con- once again, the GBA was a big improve-
trollers, which resulted in a large library ment when it came to content. It of-
of games that could be played competi- fered movie cut-scenes, beautiful music,
tively or cooperatively with friends. Be- and very nice graphics, which is why
tween all of the consoles covered in this I prefer GBA emulation over SNES.
article, I consider the SNES to be the Many games that existed on the SNES
best console for multiplayer games. were ported to the GBA, and they not
In my opinion, GBA is often over- only look much better, but in many
looked when it comes to retro gaming cases, have additional content. GBA’s
Riviera
and Nintendo. The GBA was a handheld Although the GBA is, in my opinion,
Promised
console from Nintendo, very much like a far better console than the SNES, it Land
the GameBoy (GB) and GameBoy Col- has a downside. The GBA is a handheld
or (GBC), and was actually compatible console, and although it had multiplayer
with both GB and GBC games. It even capabilities between two consoles via a
had a second processor specifically for connection cable, it makes it impossible
backwards compatibility, so that Game- to play GBA games with a friend on the Overall, I really like the
Boy owners could still play their older same machine. GBA, and I routinely play
games on the newer console. Otherwise, However, if you prefer single-player some GBA, since they have very
it was very much like the SNES, which mode, you should definitely take a look attractive graphics and immersive game-
made the small handheld device very at GBA games. You can also see if your play. All of the Nintendo systems (GB,
powerful for its time. favorite SNES games exist for GBA, and GBC, GBA, NES, SNES) run fine on
maybe get a newer, better experience the ODROID using the emulators pro-
The GBA also had 15-bit color, and the CPU from your game. If you’re looking for vided on ODROID GameStation Tur-
was 32-bit, as compared to the 16-bit pro- a new game to try, you should definitely bo.
cessor of the SNES.
check out the GBA game library. I prefer to run SNES in retroarch and
It also offered 32KB + 96KB of Video RAM
(internal to the CPU) and 256 KB WRAM play the other Nintendo emulators using
(outside the CPU). mednafen since mednafen performs
Final Fantasy IV better than retroarch for these plat-
If you compare these specs, the GBA SNES vs GBA forms, and allows software scalers
side by side. such as hq2x or super2xsai, which
was a better system than the SNES in near-
ly every aspect. The only advantage can enhance the picture quality
that the SNES had over the GBA and make the games look more
was the resolution, which was “modern” than they really are.
only 240x160 pixels. Even with If you are a fan of retro Ar-
cade machines, you’ll probably
enjoy MAME, NeoGeo and Neo-
Geo Pocket, which are available for
the ODROID. MAME and Neo-
Geo are available on retroarch,
and NeoGeo Pocket is available
on mednafen.
NeoGeo Pocket is similar
to the GBA, and is somewhere
between a GBC and GBA, but it
was not very popular, and lacks the
large game library of its competitors.
Still, it’s similar to the other Arcade ma-
chines, and offers some challenging ac-

ODROID MAGAZINE 20
GAMES

as a PlayStation. Sega GameGear was also a Handheld


The ODROID platform can run like the GBA or GBC.
most of these games without issue, and Sega Systems always tried to be just a
for this, it’s really nice to have. There little bit better than the Nintendo con-
even is a project documented on the soles. The Sega Master System had more
forum where someone built their own RAM and more colors than the NES,
Arcade Machine at home with a U2: and was slightly faster. The most popular
http://bit.ly/1cmrgjK. game was not actually Sonic the Hedge-
Another big company back in the hog, but Alex Kidd in Miracle World.
earlier days of console gaming was Sega,
which directly competed with Ninten-
GBA’s do. The Sega team had very good ideas,
Summon
but in the end, upset a lot of developers
Night
Swordcraft and publishers, and now Sega only pro-
duces games for other consoles.
The Sega MasterSystem, Sega Genesis
tion games. (Mega Drive), and the Sega GameGear
MAME and NeoGeo are the emulators that I included in the
have a lot of fast action games ODROID GameSta-
like Street Fighter 3 3rd Strike tion Turbo image,
and 1944 The Loop Master. and are probably
Arcade games vary from those their most well-
that have simple graphics, to 3D known con-
games, to some with sprite

Street Fighter 3 3rd Strike


1944 The Loop Master
(NeoGeo)
Sonic the Hedgehog
Alex Kidd in Miracle World
(Sega Master System)
soles. They Double Dragon
also produced a (NES)
Double Dragon
couple more sys- (SMS)
tems like the Sega
32X, Sega Mega-CD,
technology, like the previous mentioned Sega Saturn and
1944 The Loop Master. If you like a lot the Sega Dream-
of action and expert gameplay, the Ar- cast, which
cade games that the ODROID can run was actually
is what you are looking for, especially a really nice
when playing with friends. console, but it’s Still, Sonic was Sega’s answer
However, the Arcade genre is limited, hard to find em- to Mario and it worked well for
and implies fast action games. You will ulators to run these Sega.
rarely find the RPG, Adventures or Sim- Systems on Linux
ulation genres on an Arcade machine. and ARM so they are
It’s hard to compare Arcade games with not included in the image (yet). If you compare the games available
a SNES or Sega, since the Arcade games If you want to compare the differ- for the NES and Sega Master System
evolved a lot, and so did the hardware ent Sega systems to others of its time, side-by-side, you can see that the Sega
that was supporting these games. Some you could say the Sega Master System actually looked a lot better than the
Arcade games have NES-quality graph- is comparable to the NES, the Sega NES. If your favorite game on the
ics, while others have resolution as good Genesis is similar to the SNES, and the NES is also available for the Sega Mas-

ODROID MAGAZINE 21
GAMES

lustrators were involved in creating the available for the GameGear, and if it ran
animations in the Sega Genesis version, on the Sega Master System, there is a
which made them look much better. good chance that it was ported for the
Sega tried to reach older gamers as GameGear as well. Even some of the
well, and wanted to appeal to profes-
sional gamers. For this, the uncensored
version of Mortal Kombat was pub-
lished on the Genesis, which had blood
and other effects that had been removed
from the SNES
version. Gen-
esis also pub-
lished many

Genesis games were published for


A comparison of the GameGear, so give it a try and
SNES and Genesis graphics. see what you like best.
Can you tell which system is which?
The next console on the market to
Earthworm Jim 2
Aladdin SNES vs. Aladdin make an impact on gaming was Sony
ter System, I recommend
Mortal Kombat sports games that with its PlayStation, although by now
playing the Sega Master Sys-
were very popular it’s considered retro as well. The Play-
tem version instead.
among adults. Station has an advantage over the pre-
The next generation, called
Overall, the SNES viously mentioned consoles, because
the Sega Genesis, wasn’t as good
had better hardware, it’s from a newer generation, but still
as the SNES, since it had less
and games looked it offers some console game classic that
colors to choose from, and
more impressive were updated for the new platform.
developers had a hard time
than the Sega Looking at the quality of the PS1
Genesis, but games, there are beautiful movies,
Genesis tried to narrative speech, and high resolution
counter that with graphics. The PS1 outranks all the pre-
better game me- vious named consoles, and if you find
chanics and more se- a game that was originally made for
rious games and game- the SNES or Sega Genesis, you can ex-
play. pect the PS1 version to have lots of ad-
The Sega GameGear was meant to be ditional content like movie cut-scenes
a superior handheld device and the di- and probably better music.
rect competitor of the GameBoy (GB), Although the retroarch port of PS1
but it was far more than that. In fact, uses a software renderer to display its
the Sega GameGear was even more pow- graphics, they perform fluently on the
porting games to the Genesis since Nin-
erful than the Sega Master System, and ODROID. Classics like Final Fantasy
tendo did not allow its companies to
had an adapter to watch TV. 7, 8 and 9 offer a few examples of its
produce for any console other than Nin-
The Sega GameGear is somewhere in high resolution graphics. Even better,
tendo. Still, there were quite some nice
between the Sega Master System and the the PS1 was designed for multiplayer,
games for the Genesis, and they look
Sega Genesis. It actually had even more which means you can play with some
great.
colors than the Genesis, but the down- friends on the same TV.
Although you can see more details in
side of the GameGear is that the reso- Finally, we reach the most impres-
the SNES version of the game, the Sega
lution was rather low even for its time, sive emulator on the ODROID so
Genesis had better game mechanics and
but that wasn’t important for a handheld far: PPSSPP, which can play Play-
included a sword, which was not in the
console. There were about 300 games Station Portable (PSP) games on the
SNES version. Interestingly, Disney il-

ODROID MAGAZINE 22
GAMES

ODROID. The PSP runs a large


collection of games that offer
beautiful 3D graphics with
movie cutscenes and real
voice acting.
Although PPSSPP runs
best on a PC running Win-
dows, Linux or Android, I
also successfully ported it to the
ODROID. There are lots of PSP-
games that run quite nicely on
the ODROID in an X11 envi-
ronment using PPSSPP.

The Sony age, PS One’s Final


Fantasy VIII, and the PSP
games of Little Big planet,
Soul Calibur, Fifa Soccer
2011, Wipeout Pure and
Naruto Shippuden are all
available for your ODROID

What emulator and


what system is best for you?
If we compare the different systems since its games look the best and lack the ability to play together with
by their power, look and feel, consider- have an awesome look and feel, in someone else, unless you connect with
ing color depth, game content, music my opinion. a friend over the Internet or through
fidelity, and hardware technology, line Another way of deciding what your home network using two com-
up nicely from least powerful to most games to try, might be whether the puters.
powerful: emulators offers the opportunity to Each system that I covered in

GB < GBC < NES < SMS < GameGear < Genesis < SNES < GBA < PS1 < PSP
Not included in this ranking is the to play with other people together this article has its own charm.
Amiga, which is more like an old time in front of your TV. For multiplayer They all have some unique and en-
PC, despite its variety of games and gaming, the best consoles are MAME, gaging games, and it’s usually the
other options. Amiga games ranged NeoGeo, SNES and the PS1. There gameplay, not the graphics, that
from very simple to spectacular, offers are also multiplayer games for Sega makes a particular game so enjoy-
beautiful music and even more colors Master System and Sega Genesis as able. With an ODROID, you have
than an SNES or GBA - up to 24bit. well, but I encountered them rather the possibility of experiencing all
Also missing are the Arcade ma- rarely, so I think that SNES would of them just by switching from one
chines: NeoGeo Pocket, NeoGeo be the best choice if you want to play emulator to another. And, with
and MAME, since these systems of- with a friend. ODROID GameStation Turbo, you
fer a variety of games from the classic Although handheld devices such have all of these emulators already
Pac-Man up to Tekken 6 for the PS1. as the GBA might be the best single- set up, ready to play games with
Of these consoles, I prefer NeoGeo, player gaming console, they normally your favorite controller.

ODROID MAGAZINE 23
TECHNICAL ARTICLE

Estimating Radio
Network
Interference
With Multi-threaded Java
Jussi Opas

T
he project described in this ar- It is of interest to see that adding even
ticle involves the estimation of more equally performing cores short-
radio network interference using ens the used time, but not by much, as
a multi-threaded Java application. How shown by the dashed line. The sequen-
does the ODROID compare to other tially done 2-unit work throttles the
computers performing the same work? overall performance. If the full benefit
If some tasks can be parallelized, of all cores is the goal, then also the pre-
then each additional thread shortens viously sequential work should be paral-
the execution time of the whole job. lelized. The compilation time of Linux
Compilation time of Linux kernel on XU, the
Given that there is an execution process kernel on ODROID XU demonstrates time unit in minutes.
available for performing each added this expectation model well at right.
thread, let’s say that it takes 8 units Our sample application, called Poiju,
to do some work sequentially. Add- computes estimation of radio network The characteristics of the program
ing one new thread shortens the time interference at the beginning of next are that it uses only RAM (no file ac-
to 4 units, while adding a third thread page. To do the estimation, combined cess), and all work can be done by the
further shortens to 2.67 units, and the coverage and service area of each radio CPU, since no GPU-related work is
4th additional thread lessens the time cell must be calculated. Then, at each performed. Parallelization has been
to 2 units. If the work is not fully par- pixel, the field strength of interfering designed so that, for each cell, service
allelizable, there is always some portion cells is computed. This is done over the area is computed first sequentially,
that must be done in sequence by one service area of carrier cells. Computation and after that interference is comput-
thread, and that part of the work can- is made on pixels of size from 30 to 350 ed with many threads for cell specific
not be accelerated by adding threads. meters. The size of radio cells may vary closest candidates.
Let’s start with the assumption from 200 meter to 50 kilometers. Physical cores and/or hyper threads
that the non-parallelizable work takes The computational challenge is expo- are visible as available processors
2 units to perform, and assume that nential in its nature, as the amount of pixels [LEA99]. Java threads hide underly-
adding more threads does not incur to visit and to compute grows in potency ing operating system and hardware, so
any extra cost. Then, we add up to 12 when a more accurate resolution is used. the same program can be used on all
threads. The whole work should then platforms whereever a virtual
be done in constant time from the 4th machine is available. To imple-
to the 12th thread. With this informa- ment threads, we used Java’s
tion, we can draft an expectation mod- modern concurrency package.
el, as shown by the square dotted solid A typical development ses-
line to the right. sion with the application Poiju
is shown on the next page. The
prediction parameters dialog
Expectation model; theoretical performance
curves for multi core processors. is shown in the front, and the
main window of the Poiju ap-

ODROID MAGAZINE 24
TECHNICAL ARTICLE
final long t1 = System. The performance
nanoTime();
of the application
final double distance = on XU is practically
SpatialMath.computeProjectedDi identical between 4
stance(carrier, candidate);
different Linux dis-
instrument. tributions, Debian,
incrementDistanceTime(System. Xubuntu, Fedora and
nanoTime() - t1);
Ubuntu with Mate
desktop. There is a
measurement results small, but hardly vis-
with OpenJDK and ible, improvement in JDK releases 1.6,
OracleJDK are shown 1.7, and 1.8. It is also of interest to see
below right. how performance is improved when fre-
The first observa- quency is changed from 1.6 to 1.8 GHz,
tion is that our theo- as shown in at end of this page.
retical model, as pre-
sented before, is being Running times on 4 A15 core XU board with
plication is below it. Also shown are the partially followed. two different JDKs.
htop terminal and the lowest application is Each added thread is speed-
the development environment called Iltel- ing up the program execution,
liJ IDEA. until the 4th thread. The first
The ODROID-XU’s ARM proces- added thread yields the best
sor offers 4 power efficient A7 cores performance boost. This is
and 4 high performance A15 cores partially affected also by Just In
[ARM13]. At any one time, either a Time (JIT) compilation. JIT
cluster of little cores or a cluster of big improves execution perfor-
cores is working, known as big.LIT- mance when same byte code is
TLE architecture. Hence, there are 4 executed repeatedly.
processes available. The Poiju applica- Adding the 3rd and the 4th threads With htop and vmstat we see that
tion is using only the big cores while predictably improves performance, more than half of the time is used by ker-
intensive computations are made. while the addition of the 5th thread de- nel instead of user space. This is a major
The performance of application is creases performance. We guess here that problem that we so far noticed only on
measured with self made instrumenta- thread scheduling and context switch- XU. What is wrong in the application?
tion by taking core-specific times prior ing does not come for free, when there If there is some internal error in a pro-
to doing something, and then the next are many threads waiting for execution gram and a lot of exception are thrown
time right after doing the task: time. When we know this, it is better to and treated silently, it would affect the
We are doing all tests with 10,000 ra- limit the number of threads to 4 in the performance significantly. However,
dio cells at each time. The performance application program. That can be done that should not be visible as kernel time.
by calling the Runtime.getRuntime(). After several other similar guesses and
availableProcessors() method. We see
Poiju in development session on ODROID
XU on a monitor via display port. also that OracleJDK is performing bet- Over-clocking improves performance, but
ter than OpenJDK. Open- dropping usage of self-made instrumenta-
tion improves it significantly.
JDK is the default
installed Java on
Ubuntu, so the user
must manually in-
stall Oracle JDK.
Fortunately, it is
freely available from
the Oracle Develop-
er website.

ODROID MAGAZINE 25
TECHNICAL ARTICLE

when 5 and more threads are the 4th thread and put the numbers of
used. From the vmstat output partially and fully parallel runs into one
we can produce a graph, where illustration below.
user space time and idle time In this test, the multi-core ARM
is shown together with perfor- processor is doing its jobs much faster
mance, see the figure at bot- than the one core Celeron processor.
tom left. With 4 threads, the performance is
We don’t know the actual 1.8x better. Meanwhile, the mobile
reason for the behavior, but i5 processor is 3.3x faster than the
trials we were not able to find the rea- we can guess things like con- XU. Fully parallel thread configura-
son. Finally, we commented self-made text switching is not efficient,
detailed instrumentation that was being or work load is not even but
generated with Java’s nanoTime method. unbalanced, or the share of
As a result, two-thirds of the computa- sequential work is large, or
tion time disappeared. something similar. The first
We can expect that nanoTime inef- guess can be sorted out with
ficiency and any other similar feature the following reasoning: 1)
of Java on ARM will be streamlined in there are no problems in
future, as there is news of co-operation multi-threaded Linux ker-
[JAC13]. Since we let the ARM proces- nel compilation, 2) literature
sor do the work that traditionally has search shows that context Performance profile when the application is
been assigned to desktop computers, we switch time should be at maximum fully parallelized.
also made a comparison with two lap- 0.4 % of overall time [DAV07], and
top computers, one having a Celeron 3) the development environment -
Comparison of i5, XU and Celeron when 4
processor at 2GHz and another having IntelliJ IDEA - uses multiple threads threads are used.
an i5-2520M at 2.5GHz. The Celeron flawlessly. We leave the cause
has one core while the i5m has 2 cores as a puzzle to be solved.
with 2 hyper threads. We refer to these For an alternative ap-
processors as x64 to signify that they are proach, we implemented
64 bit x86 processors. The comparison is threading differently, and
shown above. also made a couple of other
With this different scale in the graph, changes. Now, cells are or-
it is obvious that something starts to ganized into as many work
throttle the performance from the 5th lists as there are threads to
thread on. Adding more threads, up to be used. Both service areas
12, does not seem to degrade the per- and interferences are com-
formance of the one core Celeron at all. puted in parallel, so there are N cells tion changes these numbers to 2.5x
Meanwhile, we see that the application being computed at same time. The and 3.2x respectively. In this compar-
performance at XU is being degraded work is now fully, or almost fully, ison, the XU does 1/3rd of the work
parallelized, and the performance of that an I5 can do at the same time.
Processor is not loaded, instead there is the application clearly improved. The
free capacity. Performance graph follows now our Summary
expectation model. Multi- The ODROID XU board performs the
threading uses the whole same Java tasks for which desktop comput-
capacity of the XU board. ers have been traditionally used. Although
In this comparison, the it can’t compete against the brand new
ODROID-XU was used at (and more expensive) x64 processors, it
1.6 GHz with the perfor- can be used as a replacement for a mobile
mance governor option. i5. The ODROID-XU is clearly better
To make a more legible than an older single-core x64 computer,
comparison, we take times at and Java applications benefit significantly

ODROID MAGAZINE 26
TECHNICAL ARTICLE

from the usage of multiple threads. Through this exercise, the per- bana, IL. 5 pp. 2007. http://
formance of the Poiju on other plat- www.cs.huji.ac.il/~feit/exp/
The default on-demand governor of Linux is forms was improved by 40%. On the expcs07/papers/136.pdf
biasing performance test results, because ODROID-XU alone, the improvement
the CPU’s clock frequency is being changed
automatically. Therefore, in Linux, one should was huge from the initial design stage. [LEA99] Lea Doug. Concur-
use performance frequency scaling governor In general, desktop Java applications can rent Programming in Java, De-
during performance tests. be improved when they are also tested sign Principles and Patterns,
on the ARM-based XU. The ODROID Second Edition. Addison Wes-
The System.nanoTime method costs a lot of computes interference estimate to 10, ley. ISBN 0-201-31009-0. 411
kernel time. The nanoTime method problem
affects both Celeron and ARM processors, 000 radio cells in 9.6 seconds by using pages. November 1999.
while the mobile i5 processor does not suffer pixel based computation and multi-
from it as much. The call to nanoTime should threaded Java. [ARM13] ARM Limited. Multi-
be commented out in production code. This exercise has been made as an ad- threading technology and the
hoc, BYOD type project. The content challenges of meeting perfor-
When high work load is given to parallel
threads, then an equal amount of threads to here as such does not imply anything mance and power consumption
the number of available processors should be about actual products of NSN. demands for mobile applica-
used. The Runtime.getRuntime(). tions. 9 pages, 2013.
availableProcessors() method can
References
be can be used for this purpose. [DAV07] David F. M., Car- [JAC13] Jackson Joab. Ora-
lyle J. C., and Campbell R. cle and ARM to tweak Java. 2
Use Linux tools like vmstat and htop to vali-
date loading and kernel time. For profiling H. Context Switch Overheads on pages. 2013. http://www.java-
an application, jvisualvm in JDK’s bin di- Mobile Device Platforms. Uni- world.com/article/2078833/en-
rectory can be used. Don’t trust self-made versity of Illinois at Urbana- terprise-java/oracle-and-arm-
instrumentation without a backup mea- Champaign 201 N Goodwin Ave Ur- to-tweak-java.html
surement tool.

7/24/13 vi-vim-cheat-sheet.gif (1024×724)


Dear reader: I honestly have to make a better cheat sheet than this one, but this one has helped me
on countless occasions, and believe me, it will help you immensly for the article on the next page.
Sincerely Bruno Doiche

ODROID MAGAZINE 27
www.viemu.com/vi-vim-cheat-sheet.gif 1/1
HOW TO INSTALL REBOL

how to
install rebol
A Beginner’s Guide
by Bohdan Lechnowsky, Editor

R
ebol (Relative Expression the name under which you
Based Object Language)is a want your script to be saved
revolutionary advancement in (see “vi cheat sheet” above
programming language emerging from for some basics on how to
over thirty years of language research. use it).
It offers enormous flexibility and pow- After editing your script,
er, with a focus on intuitive language you will need to change the permissions p Paste yanked data
patterns that promote new ways of so it can be accessed by Rebol 3 (exam- : Enter extended command mode.
thinking about software tasks. ple: chmod 755 myscript.r) Here are a few extended commands:
w Write (save) the file
Follow these steps to install open- vi Cheat Sheet q Quit (don’t save) the file
source Rebol 3 with GUI support: “vi” was created back in the days wq Write and quit
when there were very few special keys q! Quit, even if the file has
Open a web browser and navigate to
on computer keyboards. Keys like been changed since last write
http://development.
saphirion.com/experimen- “Esc” (escape) and the arrow cursor / Search forward for the text
tal/builds/android/ keys didn’t even exist. One of the great following the slash
Download r3-droid.apk (amazingly, advantages of the vi editor is that it is ? Search backward for the text
it’s smaller than 2MB). available on nearly any unix-based op- following the slash
When finished, double-click on the down-
erating system, including Android.
load icon (usually by the clock) and grant in-
stallation permissions. Because of the early limitations of There are much more in-depth vi
Go to the apps list, and click the icon for computer keyboards, vi was designed to cheat sheets online, but the above com-
R3/Droid. have two modes. The first is the input mands should allow you to edit just
mode, and the other is the command about anything you need in vi. Al-
Additional mode. On the Android version of vi, though it may seem uncomfortable to
Android notes: these two modes are toggled by pressing use at first, seasoned vi users can often
When using the Android Ter- CTRL and [ (more simply referred to edit more efficiently than users on any
minal app, it is almost always neces- as CTRL+[). During input mode, any other editor, graphical or not.
sary to have root permissions. To login key you type is entered at its face value.
as root, enter “su” at the command During command mode, here are some
prompt. This needs to be performed helpful commands: On Ubuntu/ARM
each time Terminal is opened. As open-source Rebol 3 is still in very
On my installation of Android, I i Insert at current position active development, the graphical port
commonly get a message when I try to I Insert at beginning of line of Rebol for ARM has not yet been re-
create a new file, stating “Read-only a Append at current position leased. According to the developers at
file system”. To overcome this, enter A Append at end of line Saphirion, they predict a working ARM
“mount -o remount /” at the command dd Delete current line port of Rebol 3 with graphics to be avail-
prompt. This needs to be performed yy Yank (copy) current line able sometime in February or March
each time Terminal is opened. . Repeat last command 2014. Keep checking the http://
To edit a script using Terminal, en- cw Change current word development.saphirion.com/ex-
ter vi myscript.r where “myscript.r” is dw Delete current word perimental/builds directory for an

ODROID MAGAZINE 28
PROGRAMMING WITH REBOL

ARM port. The graphical version for


Linux x86 is already available, but it
won’t work on your ODROID. The
Programming
Linux ports are being helped heavily by
a partnership with Saphirion and other
commercial interests, so expect a lot of
with rebol
movement in this area over the next few
months.
Reducing Complexity in Development
In the meantime, Rebol 3 is avail- by Nick Antonaccio and Bohdan Lechnowsky, Editor
able in the non-GUI variety from
http://rebolsource.net, and crophones, speakers, GPS and other sen-
can work wonders as a replacement to Why Rebol? sors are built into every tablet, phone,
bash, perl, PHP, Python and other lan- Modern software development tools netbook, and desktop PC, and they
guages that don’t have a native GUI. are overly complex. Creating even a work transparently without having to
small program to allow users to com- install hardware, drivers, or OS patches.
plete the most basic computing task Tiny form factors, like ODROID,
Follow these steps to install Rebol typically requires the installation of a and inexpensive cellular network con-
3 on Ubuntu/ARM:
complex Integrated Desktop Environ- nections, enable new types of applica-
ment (IDE), a bloated Software Devel- tions that weren’t practical, even on
Open a browser and navigate to http://re-
opment Kit (SDK), and other support- laptop machines, a few years ago. The
bolsource.net.
Locate the download for Linux ARM. It comes ing tools. Developers need a working high-speed quad-core ODROID pro-
in two variants: hard float and soft float. Either knowledge of diverse chains of tools cessors, not to mention even the least
should work fine, but if you have trouble, the soft patched together, along with library expensive modern phones and tablets,
float version is likely more compatible with most Application Programming Interfaces run circles around the best desktop PCs
systems.
(API), database systems, and more just of a decade ago. Deep data content of
After downloading, open Terminal and rename the
downloaded file to “r3” for ease-of-use (example: to create a simple application. every sort, in every field of study and
sudo mv r3-linux-arm-g4d9840f r3) For most developers, the thought interest, is available instantly online to
Also, change permissions to allow executing the of building mobile apps, desktop GUI anyone around the globe. Mainstream
file (example: sudo chmod 755 ./r3) programs, and web applications repre- handheld hardware is tiny, the interfaces
To run it, enter sudo ./r3. To execute a
sents mastering a tremendous variety are beautiful, standard formats exist for
script located in a file, enter sudo ./r3
myscript.r. You can even execute scripts of in-congruent work flow patterns, virtually every type of data (images, au-
located on the Internet like this: sudo ./r3 incompatible data formats, and incon- dio, video, structured tables of text and
http://mysite.com/myscript.r. sistent development methodologies that numeric data, etc.), and well known op-
sap productivity at every turn. For these erating systems and software all function
developers, it’s an unavoidable part of in a relatively uniform and familiar way,
If opening Rebol 3 without launch- the job. so that everything just “works” the way
ing a script, you can now type any Rebol We live in a time when ubiquitous that users expect.
commands at the command prompt.
and inexpensive handheld wireless de- Being able to use the amazing pro-
vices and ODROIDs connect us all to grammable network-connected comput-
an enormous world of useful data re- ing power in our pockets, and all around
sources. Those devices enable critical us, makes available enormous cultural
data management, communications, potential that has never before been
business transactions, entertainment, available, and gives us the ability to cre-
and other practical benefits which deep- ate custom applications which leverage
ly affect the nature and quality of our that tremendous power will only con-
daily lives. tinue to grow in importance for future
The primary frustrations of device generations.
ownership have been eliminated by new This situation is fantastic for users of
generations of technology. Users don’t “apps”, but for software developers, the
need to know how networks work to current landscape of tools is a painful
connect to the Internet. Cameras, mi- mess. The remnants of every legacy soft-

ODROID MAGAZINE 29
PROGRAMMING WITH REBOL

ware and hardware solution still haunts gone, includingmore than 40 hardware and it’s shockingly simple to learn and
and infects the process of writing mod- platforms and operating systems so far, use. An entire development toolkit for
ernized code. Numerous attempts to and the web. R3 requires less than a minute to install,
standardize on different commercially- All the core components that make since absolutely no hefty SDK or IDE
motivated platforms and formats have modern computing possible - graphic installations are required, even for An-
led to the need to support a huge vari- user interfaces, network connectivity, droid development.
ety of data structures, language syntaxes, manipulation of standard data formats, Rebol works the exact same way on
and tool sets. etc. are handled in Rebol using the sim- every platform, without any changes
To even begin creating a typical “hello plest possible syntax, and implemented to code or workflow routine. Even
world” app for Android, you need to install using a tiny interpreter that runs exactly people who spend the majority of their
hundreds of megabytes of software onto a the same way on every operating system. time doing things other than writ-
desktop computer, including an Integrated Rebol was designed from the ground ing code can learn to create powerful
Development Environment (IDE), a Soft- up to eliminate complexity caused by custom business and personal applica-
ware Development Kit (SDK), a device patching together disparate tools, and it tions with it, quickly and easily, on any
emulator, and any “productivity enhanc- succeeds brilliantly in that regard. chosen platform.
ing” tools that help ease the wildly com- Rebol side-steps most of the mess Despite its extremely simple na-
plex process of writing an applications. that has evolved over the years in main- ture, R3 is not a hobbyist toy or lim-
Even for seasoned developers, modern stream software development technolo- ited learning environment. Rebol is
application development is a weighty en- gy, and for a wide range of common de- a powerful and deep professional tool
deavor. If you also intend to port your ap- velopment tasks, it “just works” quickly, which has proven itself in numerous
plications across mobile, desktop and web easily, and more simply than can be critical commercial projects, across
platforms, you need truly deep experience, imagined by anyone mired in the mess a wide array of demanding industry
skill, and lots of time. of traditional programming tools. environments, around the world, for
It’s not uncommon to see teams of pro- Rebol has a special ability to wrap more than a decade.
fessional engineers devote themselves to new capabilities into simple language
building and supporting a single applica- structures (also known as “dialects”, Examples of Rebol’s practical
tion. Despite the fact that Android is an domain specific languages, or “DSL”s) application in the real world
open platform, today’s devices feel closed, which control multiple layers of com-
Quick schedule apps
or at least cumbersome, for developers. puting functionality. It goes far beyond
The hurdles to learning how to program the abilities promised by old, rigid Ob- Email programs with special features for
are too much for all but full time develop- ject Oriented Programming (OOP) ap- personal use
ers. Gone are the days when even hobby- proaches, and it has a proven record of
ists could write useful custom applications reducing complexity in widely varied Business applications to handle inventory,
sales and employee management
for their personal and business computing development tasks.
devices. Recently, Rebol version 3 (“Rebol 3” Niche commercial applications intended for
There was a time in our history when or “R3”) was released by Carl Sassenrath international re-sale
this activity was just as popular, accessible as an open source project, and a version
and even fun for users as running commer- for Android named “Saphir” is forked Distributed apps to organize group activi-
ties for your local school
cial apps. It’s a shame, because never before and maintained by the Saphirion group.
has there been such a tremendous variety Saphirion is a commercial application Web apps to manage membership routines
of knowledge and useful computing capa- development company that uses Rebol for an online club
bility sitting at our fingertips. as their primary development tool. Free,
open source R3 Saphir releases also exist Hardware interfaces to control computer-
ized machinery in your home or business
Rebol for Windows, Mac, and Linux desktop
On All Platforms operating systems, and R3 server ver- Systems to manage robotics at brand name
For more than a decade, a small sions enable easy and portable web de- manufacturing facilities
group of developers, coding in Rebol, velopment strategies.
have known what it means to be truly In most cases, Saphir R3 download
productive, using a single simple tool to sizes range between 0.5 and 1.5 mega- Evolution of Rebol
create applications of all types, for ev- bytes, with GUI, networking, and all For most of its life, Rebol 2 was a
ery popular platform that has come and other required components included, closed source commercial tool which

ODROID MAGAZINE 30
PROGRAMMING WITH REBOL

thrived as a “secret weapon” among only bit.ly/1tHdcbS for their “Natural maps directly to something that appears
a small community of users who com- scope of application”. Notice how Red, on screen. There is no wasted syntax -
municated privately and covertly using coupled with Red/System, cover the entire you really don’t even need to understand
invite-only communication channels, stack of application abstraction levels, even anything about “programming” to fol-
the executables of which were developed more so than Rebol itself. low what this code does:
using Rebol 2.
With the release of open source R3 Another language load-gui

and the new potential for Android de- to learn? view [


velopment, in addition to more than I’ve heard it all
40 legacy platforms and web develop- field
before!
ment, Rebol has attracted a new group area
of coders interested in its practical and Before starting on this section, make
productive capabilities for creating sure you have completed the Rebol 3 check

software of all sorts. In future articles, installation outlined in the article by radio
we will show you how easy it is to get Bohdan Lechnowsky in this same issue.
started. The screenshots shown in this and future text-list

articles are taken from a Windows work- text-table


Red station, but will look nearly identical on
On All Platforms Ubuntu, Android, or any of the other drop-down

During the closed-source era of Re- operating systems supported by Rebol 3. button
bol 2 and 3, several languages were de- For years, developers have been hear-
veloped as open-source variants of Rebol ing that some “new” language technol- ]

including Boron, Topaz, World and Red. ogy will supposedly cut their develop- On Android, the Rebol command
The data-interchange format, JavaScript ment time by orders of magnitude. That line currently only takes single-line com-
Object Notation (JSON), was also heav- sort of talk is so common that it falls on mands. This is not a problem, as Rebol
ily inspired by Rebol’s clean data format. deaf ears. This introductory section pro- is syntax-free. Simply enter the com-
The front-runner of these efforts vides a few short examples to substanti- mand like this on Android:
presently is Red, which also has a low- ate some of the productive capabilities
load-gui
level subsystem called Red/System. which Rebolers enjoy. Nothing else even
While Rebol is an interpreted-only lan- comes close to its simplicity. view [field area check radio
guage, Red and Red/System can run ei- Using R3, you can build a GUI “hello text-list text-table drop-
down button]
ther as an interpreted language or as a world” application for Android, Linux,
compiled language. Red’s founder and Windows, and Mac as simply as this: Alternatively, multi-line programs
lead developer is Nenad Rakocevic, aka can be written with any text editor, and
“DocKimbel”. load-gui executed using Rebol. For instance, if
The Rebol language family was recently view [text “Hello World!”] you create a file called gui-demo.r that
recognized as the most expressive multi- you can execute from the Rebol 3 com-
purpose languages, as seen in the chart at On Android, there will be no “close” mand line:
http://bit.ly/1iikG1r. Expressive- button on the window, so press “Escape”
do %gui-demo.r
ness is the measure of what can be accom- on the keyboard to get back to the Rebol
plished by a given amount of coding. command line. That’s it!
The only two languages rated as The program above is much more Pleas note that Rebol has numerous
more expressive than Rebol are Augeas than the typical text-based console “hel- GUI dialects. The examples shown in
and Puppet, both of which are not gen- lo world” app. It’s actually a complete this and future articles make use of the
eral-purpose. Red falls in the same cat- windowed form, capable of displaying “R3-GUI” dialect, which is based on,
egory as Rebol as far as expressiveness is all sorts of other useful Graphic User In- and very similar to, the popular Rebol 2
concerned. terface (GUI) widgets. Visual Interface Dialect (VID).
Red, along with Red/System, is the first Here’s another simple program that In the next article, we’ll look at creat-
real contender to be a “full-stack” program- displays some text entry fields, buttons, ing a fully functional text editor, graphi-
ming solution. Several popular languages lists, and other common GUI widgets. cal calculator, and more!
are compared and contrasted at http:// Notice that every single widget word

ODROID MAGAZINE 31
IO PORTS ON ODROID-U3

I/O Shield
Access
using the C/C++ language
for ODROID-U3
Justin Lee and Kevin Kim

O
ne of the exciting accessories
Usage
available for the ODROID-U3
is the I/O shield, which was Download the Firmata
designed as versatile, general-purpose software for I/O shield, and set- Making a Test
data acquisition and control module up the configuration as follows:
Circuit with the U3
to provide a direct connection to the
I/O shield and the
ODROID-U3 I/O connector. Port setup :
The I/O shield includes a big pro- Tools > Serial Port > /dev/tty-
Tinkering Kit
totyping area, so you can wire up DIP ACM99 Use the following parts from the tin-
chips, sensors, and more. Along the kering kit, also available from the Hard-
edges, all the GPIO/ADC/PWM and Open the example code and upload kernel website: B, C, E, G, H, I, J:
power connectors are broken out to 0.1” it to your IO_shield:
pins for ease of access. There are also File > Examples > Firmata > Stan-
two 3-pin headers for small servo motor dardFirmata
connections, and a 10-pin connector of
I2C/GPIO for further expansion. Download the I/O shield source code
This article will get you started with http://dn.odroid.com/U3_
using the I/O shield using examples in Accessory/u3_IOshield_ex-
the C++ language. ample.tgz

1. Extract source code using the “tar -xvzf”


Installation command.
The drivers are installed by default 2. Build the libfirmatac.a library.
on Ubuntu 13.10, which is available for
download from the ODROID forums. 3. Build the Example code which links
Verify that you have the following mod- libfirmatac.a:
ule (Ti’s TCA6416A I2C to Parallel Port Ex-
pander) in your kernel source tree: /lib/ ledBlink.ex is an IO Shield ‘D13’
modules/`uname -r`/ kernel/ port LED blink example.
drivers/gpio/gpio-pca953x.ko
servotest.ex is an IO Shield ‘D3’ port
servo motor control example.

Firmata example code

Launch Ubuntu Software Center, search for


“arduino”, and install it

ODROID MAGAZINE 32
IO PORTS ON ODROID-U3

sys/class/gpio. limitation by using a conf file to launch the


If you want to work with a particular module as a daemon, then using a shell
GPIO, you must first reserve it, set the script to perform the initialization:
input/output direction, then start man-
aging it. Once you reserve the GPIO 1) Create the file /etc/init/
and finish using it, you also need to free tca6416.conf, which may require
it, to allow other modules or processes to root privileges:
use them. This rule applies whether you
want to use the GPIO from the kernel or description “TCA6416 Module
Initialization”
at the user level.
start on runlevel [2345]
GPIO Export
exec /usr/sbin/tca6416init.
By typing “sudo modprobe” in the sh
Terminal window after booting the Linux
kernel, the GPIO driver and TCA6426
devices will be attached to the i2c-gpio.4 2) Create the file /usr/sbin/
Match the simple circuit shown here, and
have your U3 as shown below bus. 16 Ports are mapped to GPIO tca6416init.sh:
#289~#304 (I/O Shield pin num-
ber P00~P07, P10~P17): #!/bin/bash

# Load the Kernel Module


# sudo modprobe gpio-
pca953x modprobe gpio-pca953x

# sudo su –c ‘echo tca6416 # Set the I2C address of the


0x20 > /sys/devices/plat- module
form/i2c-gpio.4/i2c-4/new_
device echo tca6416 0x20 > /sys/de-
vices/platform/i2c-gpio.4/
# dmesg i2c-4/new_device

Accessing the … i2c i2c-4: new_device: In- # Enable all GPIO’s on the
stantiated device tca6416 at board
GPIO from the Linux 0x20
User Space for gpio_n in `seq 289 304`

GPIO means “General Purpose Input/ Next, build the u3_shield_GPIO_ do


Output”, and is a special pin present in sysfs.c, located in the examples folder,
using g++. Please note that the GPIO- echo $gpio_n > /sys/class/
some chips that can be set as either input
gpio/export
or output, and is used to move a signal high sys_init() function need the super-user
or low (in output mode) or to get the sig- permission to do modprobe and attach done
nal current status (in input mode). Usually, i2c device. The default password on the
these pin are directly managed by kernel official Hardkernel images is “odroid”. By adding these two files, all the
modules, but there is an easy way to man- P00 port : LED blink GPIO ports will be permanently en-
age these pins from the user space as well. P10 port : key press, then GPIO abled on reboot. You can also add your
Standard Linux kernels contain a special 297 read value = 0, otherwise GPIO application software in the “tca6416init.
interface which allows access to the GPIO 297 read value = 1 sh” as an alternative method.
pins. By running the kernel menuconfig
command before compiling the kernel, you Starting your
can easily verify if this interface is active, and application software Additional Credits
enable it if necessary. The kernel tree path is on boot The FirmataC library and exam-
Device Drivers > GPIO Support There’s a place on the kernel to load ples are made by jdourlens, which
> /sys/class/gpio/... (sysfs modules as needed. However, you can’t use were slightly modified for use on the
interface) it to send echo commands or values to sysfs ODROID: https://github.
If you embed the driver, you can without root or super-user permissions. com/jdourlens/FirmataC
access the GPIO via the kernel node / Fortunately, there is a way to overcome this

ODROID MAGAZINE 33
TECHNICAL ARTICLE

Using an ODROID-XU
as a Wifi Router
get to 802.11ac with style
by Mauro Ribeiro, Hardkernel Developer

I
f you’d like to use your ODROID-
XU as a wireless router, you’ll need
the following items, all of which are
available from the Hardkernel website:

ODROID-XU (+E or Lite)


Believe us, this
USB 3.0 to Gigabit LAN Adapter setup means
business
MicroUSB 3.0 to USB OTG Cable
make modules_install
USB 3.0 to 802.11ac Adapter
The LAN Interface is eth1 (Gigabit Adapter) cp arch/arm/boot/zImage /me-
microSD or eMMC with Ubuntu Server in- dia/boot
stalled
The WAN Interface is eth0 (Connected to the
sync && reboot
internet)
The ODROID-XU works best for
this project because it offers a USB 3.0 The Wifi Interface is wlan2 This builds a new -XU kernel from
port, so that we can use the full band- the latest GitHub source code. Now you
width of it for Wifi AC, and because the Although unlikely, the Wifi interface have an updated copy of the kernel on
XU models also permit the use of the value (the last item on the list) may be dif- your ARM Board!
USB 3.0 Gigabit LAN adapter. For best ferent for your LAN, but this is covered
throughput, we’ll use our 10/100 On- below. It’s also very important for secu- Dealing with Realtek Wifi drivers.
board LAN as the WAN Port. rity that you change both the root pass- Realtek wifi drivers are slightly tricky
The USB 3.0 to Wifi adapter used in word and the “odroid” user password, in to configure:
thie article is a Netis WF2190, which case the board is exposed to the internet.
Use the provided drivers
is based on the Realtek 8812AU chip.
Netis ships a mini-cd with the
If you have problems finding the Netis Install the necessary packages
Linux drivers inside. You’ll have a
WF2190 Adapter, there is a listof equiv- and dependencies
linux folder with the following fold-
alent adapters using the same chip here:
http://goo.gl/dNwdnY. apt-get install git build-es-
er: RTL8812AU_8821AU_linux_
Before starting, make sure that you sential bridge-utils v4.2.0_6952.20130315. Copy that
have at least 4GB of free disk space. The folder to your ODROID, since these are
following values are used in this tutorial Build the kernel the drivers that we need to build.
for example purposes (your local net-
git clone --depth 0 https:// Build the wifi drivers
work may differ): github.com/hardkernel/linux.
git -b odroidxu-3.4.y linux cd RTL8812AU_8821AU_linux_
The LAN address will be 10.10.10.0/24 v4.2.0_6952.20130315/driver
cd linux
The LAN gateway (ODROID) will be tar zxvf rtl8812AU_8821AU_
10.10.10.254 make odroidxu_ubuntu_defcon- linux_v4.2.0_6952.20130315.
fig tar.gz
The DHCP Range will be 10.10.10.1 to
make -j5 cd rtl8812AU_8821AU_linux_
10.10.10.253
v4.2.0_6952.20130315

ODROID MAGAZINE 34
TECHNICAL ARTICLE
* edit the Makefile and on line 583
ARCH ?= .... change to ARCH ?= arm cd RTL8812AU_8821AU_linux_ iface br0 inet static
v4.2.0_6952.20130315
bridge_ports eth1
make && make install
cd wpa_supplicant_hostapd
address 10.10.10.254
modprobe 8821au
cd wpa_supplicant_hostapd-
0.8_rtw_r6747.20130222 netmask 255.255.255.0
Now your Wifi drivers should be
working properly. cd wpa_supplicant network 10.10.10.0

pre-up /sbin/ifconfig wlan2


Test the Wifi Driver Again, we have to make sure that up
Ubuntu’s wpa_supplicant isn’t present:
ifconfig wlan0 up After rebooting, your LAN interface will
apt-get remove wpasupplicant
iwlist wlan0 scan be called br0 with eth1 being part of it.
make && make install
Note that if wlan0 doesn’t exist, check Using hostapd
for wlan1 or wlan2 by typing “ifconfig This installs all of our wifi drivers, Since the wireless adapter doesn’t
-a”. Save this information for later, be- along with the manufacturer’s provided have dual radios, you have to choose be-
cause we’ll need to know the wifi card tools. Let’s move on into the configura- tween the 5GHz or 2.4Ghz frequency.
name in an upcoming step. tion part. If you are on a network with only 5Ghz
At this point, you’ll see the list of devices, which most are nowadays, use
Wifi networks in Range. You can now Configuration the 5Ghz config to allow a maximum
use your ODROID as a Wifi client to The Ubuntu Network Bridge must speed of 800Mb/s. If you need extra
connect to other wireless networks. be configured in order to create the inte- compatibility with older computers, or
gration between the Wireless and Wired your devices aren’t 5Ghz, use the 2.4Ghz
Building hostapd connections. configuration shown below.
and wpa_supplicant To begin configuring the hostapd
cd /etc/network service, start by creating the following
Because Realtek 8812 isn’t supported file using root privileges:
on Linux yet, we need to build the driv- You’ll also need to edit the interfaces
/etc/hostapd.conf:
ers, including hostapd, from the manu- file, using the following screenshot as an
facturer’s source provided on their web- example:
5GHz version
site.
-- BEGIN -- # Change this to match your
Build hostapd config
# setup loopback interface
from the manufacturer’s source interface=wlan2
auto lo
cd RTL8812AU_8821AU_linux_ ctrl_interface=/var/run/hos-
v4.2.0_6952.20130315/wpa_ iface lo inet loopback tapd
supplicant_hostapd
# setup eth0 as DHCP for our # Your network name
tar zxvf wpa_supplicant_hos- WAN
tapd-0.8_rtw_r6747.20130222. ssid=ODROID-NET 5Ghz
tar.gz auto eth0
channel=36
cd wpa_supplicant_hostapd- iface eth0 inet dhcp
0.8_rtw_r6747.20130222/hos- wpa=2
tapd # setup eth1 as manual and
leave it empty # Your network password
Before building and installing ho- auto eth1 wpa_passphrase=testtest
stapd, let’s just make sure that we don’t
have Ubuntu’s hostapd installed: iface eth1 inet manual bridge=br0

apt-get remove hostapd # Create our bridge with eap_server=0


eth1 on it and use the IP
make && make install 10.10.10.254 wps_state=0

auto br0 driver=rtl871xdrv


Building wpa_supplicant

ODROID MAGAZINE 35
TECHNICAL ARTICLE
beacon_int=100 Now that our devices can connect
/usr/local/bin/hostapd /etc/ to our new network, they need to be
hw_mode=a hostapd.conf &
able to access the internet. We’ll fix that
ieee80211n=1 sleep 3 right now!

wme_enabled=1 /sbin/brctl addif br0 wlan2 Creating IP tables


for internet access
ht_capab=[SHORT-GI-20] DNS and DHCP
[SHORT-GI-40][HT40+]
Edit /etc/rc.local, and before
Our network needs both a DNS and “exit 0”, add the following lines:
wpa_key_mgmt=WPA-PSK a DHCP Server in order to auto-con-
figure our clients. In this case, we’ll use echo 1 > /proc/sys/net/
wpa_pairwise=CCMP dnsmasq since we already installed it as a ipv4/ip_forward
max_num_sta=8
dependency in the first step.
iptables -t nat -A POSTROUT-
- mkdir /etc/dnsmasq ING -s 10.10.10.0/24 -o
wpa_group_rekey=86400
eth0 -j MASQUERADE
2.4GHz version Create the file /etc/dnsmasq.d/
odroid.conf: Now we’re done, and you should
interface=wlan2 have a fully functional wireless router.
ctrl_interface=/var/run/hos- resolv-file=/etc/resolv.dns-
tapd masq

ssid=ODROID-NET 2.4Ghz addn-hosts=/etc/dnsmasq/


hosts

channel=6 dhcp-hostsfile=/etc/dnsmasq/
dhcp
wpa=2
expand-hosts
wpa_passphrase=testtest
min-port=4096
eap_server=0
stop-dns-rebind
wps_state=0
rebind-localhost-ok
driver=rtl871xdrv
interface=br0
beacon_int=100 LAN Utility showing
# Here on this line we’ll that the router is up
hw_mode=g configure the LAN interface and running
(br0), initial IP Address
ieee80211n=1
# last IP address, Network
wme_enabled=1 netmask and the time that a To make your router even more
IP will be kept to a client
useful, you can also attach USB
ht_capab=[SHORT-GI-20] disks to the USB 2.0 ports of the
[SHORT-GI-40][HT40+] # that is known as lease
time ODROID-XU, then create a Torrent
wpa_key_mgmt=WPA-PSK server, a Samba file server, or any oth-
dhcp-range=tag:br0,10.10.10. er type of shared network resource.
wpa_pairwise=CCMP 1,10.10.10.253,255.255.255.0
,1440m I’ve tested the ODROID-XU router
max_num_sta=8 with my Nexus 5 phone, and it report-
# This line we configured the ed a throughput of 433Mb/s. That’s
wpa_group_rekey=86400 IP address of our gateway quite nice for Wifi, isn’t it ? It could
(the odroid)
go faster, but I think that 433Mb/s is a
You should customize the interface dhcp-option= limitation of the Nexus 5.
parameters “ssid” and “wpa_passphrase” tag:br0,3,10.10.10.254
for your network.
dhcp-lease-max=255 Next month, I’ll discuss how to setup
Auto-Start hostapd
some attractive graphics to monitor
dhcp-authoritative
Edit /etc/rc.local and add the the input/output data on your net-
following lines before the “exit 0” line: work.

ODROID MAGAZINE 36
Setting up a 1080p Home Media Center

The Art
of Multi-boxing
1080p Home Media Center
using Pocket Rocket and Whisper
by Rob Roy, Chief Editor A pair of ODROID U3s can run all of this!

M
ulti-boxing is an advanced net- Using a second system to do the work of and another Odroid as the media client.
working technique of connect- gathering media files then frees up the Since XBMC for Android gives the best
ing two or more computers to main system for playing smooth video performance in 1920x1080 resolution,
create a single virtual system. Originally without glitches caused by spikes in disk I chose Android Pocket Rocket as the
referring to gamers who dominated on- activity. client, which already has the necessary
line matches by controlling several players To illustrate the concept of Odroid SSH, VNC, and Samba protocols in-
simultaneously, the methods can also be multi-boxing, two of the community stalled. For the media server, Lubuntu
used in other applications besides gam- images available on the Odroid forums, Whisper works well because of the pre-
ing as a way to use parallel computing to Android Pocket Rocket and Lubuntu configured Desktop Sharing, Transmis-
improve the overall responsiveness of the Whisper, can work cooperatively to sion and Samba applications. Both
user experience. run two Odroids as a virtual octa-core images are available for download from
Compared to a single-box system, system. Operating two images simul- the Odroid forums at http://forum.
which requires a reboot to switch be- taneously improves the stability and ef- odroid.com/.
tween platforms, the key combination ficiency of both environments, with the In this dual-box system, media ac-
Alt-Tab switches between the different advantage of doubling the computing quisition is performed only by the Linux
desktops of the multi-boxed machines. power, RAM and disk storage available server, which can elegantly handle a high
Tasks that would normally slow down for use. Alternatively, the full-featured volume of disk and ethernet activity.
the user interface, such as downloading, Dream Machine image may be used in- When media files are ready for viewing,
video conversion, or torrents, are moved stead of Whisper, and the Couch Potato the Android system loads them from
to a second computer which performs SD card image may be substituted for a common shared directory and plays
its job seamlessly in the background, Pocket Rocket in case an eMMC mod- them using a hardware-decoded video
but appears on the first machine as if it ule is not available. player like XBMC or MXPlayer.
were a native application. As a multiple The first step, after downloading and
Odroid owner, it’s more economical to Gathering copying the images to an eMMC mod-
connect several Odroids together, ac- the Equipment ule or SD card, is to set up the network
cessed by a single monitor and keyboard, Setting up an Odroid multi-boxed neighborhood so that the Odroids can
than to purchase separate equipment for virtual computer requires any two find each other.
each computer. Odroids from the X, U or XU series,
The primary advantage of delegating and a modern wi-fi router. The remov- Configuring
tasks among several computers is that, if able eMMC modules available from the Router
disk or CPU activity is high on one ma- Hardkernel give the best disk perfor- The server system running Whisper
chine, the performance of the other sys- mance, and for media storage, a high- needs a local static IP address so that the
tems are unaffected, since each comput- capacity external USB drive or SD card other Odroid can locate it on the net-
er has its own local resources, without permits sharing of large files between work easily. Without a static IP, the con-
needing to compete for processor cycles the computers without crowding the nections would need to be reconfigured
or hard drive access. For example, when main operating system partition. with a new IP address after each reboot.
watching videos, heavy background The following guide outlines the The option to assign a permanent IP
downloading can affect the frame rate of steps necessary for building a typical address, also called DHCP reservation,
the video playback, causing video arti- Home Media Center with two Odroids, is included in the wi-fi router’s admin-
facts, frame stuttering and audio delays. using one Odroid as the media server istrative panel. For example, using a

ODROID MAGAZINE 37
Setting up a 1080p Home Media Center

admin panel and setting a With SSH, remote commands may be


static IP address. sent to the server using the standard
To reserve the static IP ad- command line interface to start and stop
dress, boot up Whisper with applications, reboot the system, and per-
its ethernet port connected form other administrative functions. In
to the router, then login to the media center example below, it will
the router from any comput- be used to launch the VNC server.
er on the network. Follow Samba is a free software implementa-
the manufacturer’s instruc- tion of the SMB/CIFS networking pro-
tions, setting the static IP ad- tocol, allowing remote file servers to be
dress for the Odroid running mounted as local drives. For purposes
Whisper to a convenient and of media sharing, the Samba server en-
easy-to-remember number, ables video, audio and other files to be
such as 192.168.1.100. accessed by the Android media client via
the ethernet port.
Enabling To improve system security, all three
Desktop protocols require separate usernames
Sharing, and passwords. For convenience, Sam-
Typical router admin panel with option Samba and ba, SSH and VNC are initially synchro-
to assign static IP address nized to use “odroid” as the username
SSH and password. These passwords should
standard home Cisco router, the admin The two Odroid have three chan- be changed before moving on to the next
page is accessed at 192.168.1.1 with a nels of communication with each other, step, but in the following screenshots,
default blank username and password of known as protocols. Each protocol pro- the security remains unedited and all
“admin”. Some routers use 192.168.0.1, vides a different service to allow specific password fields contain the default value
10.0.0.1 or another similar address in- types of remote access to the host server’s of “odroid”.
stead. For specific instructions, refer disk, memory and peripheral resources:
to the router manufacturer’s website or VNC stands for Virtual Network Setting Up
user manual for details on accessing the Computing, a protocol that broadcasts the Server
a graphical desktop to a remote system For the initial setup, connect the
and processes input from the remote Odroid running Whisper to the key-
Router admin panel with “odroid” client added
keyboard and mouse as if they were con- board, mouse and monitor. Enable
to DHCP reservation list as 192.168.1.100
nected locally. VNC servers Desktop Sharing by selecting “Desktop
and clients are available for Sharing” from the “Internet” menu, and
nearly all modern operat- matching the options to those shown
ing systems, including iOS, below. Choose an appropriately secure
Android, Windows, Linux password for desktop access which will
and OSX. Its wide appeal later be used in setting up the Android
permits unique combina- bVNCFree client.
tions like accessing a Win-
Desktop Sharing configuration menu
dows desktop from a Ma-
cintosh, running a Linux
desktop from within Win-
dows, or wirelessly control-
ling multiple Odroids from
an Android phone or iPad.
SSH is a Secure SHell
which creates an encrypted
text-based connection be-
tween two computers us-
ing a networked terminal.

ODROID MAGAZINE 38
Setting up a 1080p Home Media Center

tory to “/home/odroid/Downloads”
since this is the default save direc-
tory for Transmission, Firefox and
Chromium. If using an external
USB drive, configure all three ap-
plications to save to a shared Samba
shared storage directory located on
the external drive.

Output of ifconfig command on Setting Up


the Whisper server
the Client
Now that the server is ready, dis-
As a double-check, verify that the IP connect the keyboard, mouse and
address of the Whisper system matches monitor, and connect them to the
the one selected in the DHCP Reserva- Android Pocket Rocket client ma-
tion router setup by running Terminal chine. From now on, the Whisper
from the Whisper desktop and typing server will not need any peripherals ex- Pocket Rocket desktop contains JuiceSSH
“ifconfig”. If the addresses don’t match, cept in the case of network or router fail- and bVNCFree, make good use of them
it may be necessary to reboot Whisper ure. The server’s desktop, command line
in order to register it under the new IP interface, files, and CPU are all available
address stored in the router.
Connecting the
to the Android Pocket Rocket client via
Finally, connect any large-capacity the the SSH, VNC and Samba proto- Client to the Server
device to use as a shared directory for cols. Launch JuiceSSH and select “Man-
media files such as an external USB drive The initial connection between the two age Your Connections”, and match the
to the Whisper server, and run the “Sam- computers is via SSH, so that the VNC options shown in below figures, using
ba” applet from the “Preferences” menu. desktop server may be started, which then the static IP address registered with the
Match the options shown in Figures 5-8, allows the X11 desktop to be shared. After router in the first step. Advanced users
substituting the preferred storage direc- the Vino server loads, JuiceSSH remains may skip the SSH step by adding Vino
tory for the one shown in the screenshot. in the background while the Android ap- as a Linux startup task.
For the purposes of running the stress plication called bVNCFree gives remote
tests detailed below, set the shared direc- control of the Whisper desktop.

Configuring the Samba options in Whisper

JuiceSSH configuration options

ODROID MAGAZINE 39
Setting up a 1080p Home Media Center

Connecting
with VNC
Launch the bVNCFree application,
and select “New Connection”. Match
the configuration options to those
shown in Figure 8, again using the static
IP address registered with the router and
used when setting up JuiceSSH.

Juice SSH connecting to the Whisper server

Android has many built-in shortcut key Configuration options for bVNCFree
Once the server is connected, Juic-
combinations that closely resemble
eSSH drops into the remote server’s After the handshake has been estab-
those used in Windows and OSX.
scripting shell, known as the command lished, the Whisper desktop opens up,
line interface or command prompt. Esc: Close a popup window allowing the Android client to take full
For convenience, Whisper includes a control of its storage, CPU and resourc-
local Vino script which automatically Control-W: Close the current window es. By also enabling the “Fit To Screen”
shares the current desktop using a sin- scaling option, the virtual system gives
Control-T: Open a new browser tab
gle command. Launch the VNC server the appearance that the server desktop
by typing “vino” at the SSH command Control-C: Copy is running natively on the local Odroid
prompt, and entering the root password client while simultaneously running An-
of “odroid”. Control-X: Cut droid applications.
Control-V: Paste
Running the Media
Control-A: Select all Server
Now that the two systems are connect-
Tab: Navigate to next input field ed, they are ready to perform some tough
Alt-Tab: Switch to another appli-
tasks to show off how well the networked
cation machines handle a high volume of disk
I/O. For comparison, Pocket Rocket will
JuiceSSH after running the “vino” command
Alt-Tab -> Alt-Esc: Return to the do all of the work on its own as an example
desktop (same as Home button) of single-boxing. By stress testing the cli-
ent system, the areas of improvement be-
Mouse Right-click: Go to previous window or close
a popup window if there’s one open come more apparent when many large files
Keyboarding are processed at the same time.
Like a Pro As an example of keyboard naviga- For the single-box test, download sev-
Before moving on to using the graph- tion, you can press Alt-Tab, then Alt-Es- eral files, start a few torrents, and watch an
ical X11 desktop, it’s important to be- cape to get back to the Android desktop XBMC video using only Pocket Rocket.
come comfortable with the Android instead of clicking on the Home button Although the Android system performs
interface itself. To optimize the user with the mouse from within any An- well under medium to heavy load, there
experience, Android provides several droid application. will be brief moments during video play-
keyboard shortcuts that permit quick back where the screen will stutter, or the
window management and data sharing audio will be out-of-sync due to spikes in
functions while also alleviating the need disk access. Because the eMMC or exter-
for using the mouse.
The Alt-Tab menu in Android Pocket Rocket

ODROID MAGAZINE 40
Setting up a 1080p Home Media Center

forms better than the single-box version


because of its compartmentalized use of
each system’s peripherals.
Files may also be copied and shared
from one system to another using ES
File Explorer, so that documents may
be edited locally on the Android client
system while maintaining a read-only
master copy on the Whisper server. Ad-
ditionally, bVNCFree allows text data
to be transferred between previously
unconnected desktop environments
(ex. between Windows and Linux) us-
ing the Copy and Paste function of the
The Whisper desktop, as viewed through the
Android bVNCFree application
Android desktop, instead of resorting
to an intermediate file or email.
nal drive has many applications competing
for storage, the playback experience gets Building
slightly degraded at random intervals due a Cluster of Odroids
to locked resources. Follow the steps again to connect
To improve stability and video play- more computers to the cluster, with a
back, the tasks of downloading and han- separate SSH and VNC session control-
dling high volumes of disk access are ling each additional system. For my per-
delegated to the Whisper server in the sonal multi-boxing system, I connected
ES File Explorer’s LAN tab
dual-box setup. This separation frees up several Odroid computers which offer a
the processor cycles and disk usage on the dedicated web server, application devel-
Android client so that the video player isn’t the Whisper server allows the videos to opment packages, and a security testing
waiting for another application to finish play smoothly on Android, without stut- suite, all operating in their own resource
before loading the next piece of the video tering or momentary freezing. The play- spaces, coordinated using the Android
from the hard drive. back on the Android client remains con- Pocket Rocket desktop.
In order to perform the dual-box stress sistent despite heavy stress,on the server,
test, shut down all of the downloads and which grealy improves the experience of Advanced
torrents on the Android system so that using Pocket Rocket by itself. Multi-boxing
only the video player is running. Press Seasoned Linux users can add auto-
Alt-Tab to switch to the bVNCFree ap- Peeking mation to the Media Center by sched-
plication, then use the Whisper desktop Under the Hood uling cron jobs, adding RSS feeds, and
to download several large files and torrent Since the Android operating sys- kickstarting downloads using the rTor-
a few more, using the web browser and tem and video player have no compe- rent command line interface. Further
Transmission. tition for the local hard drive, overall customizations include enabling the web
After one of the media files has finished performance improves on the Android interface in XBMC and Transmission for
downloading, press Alt-Tab to switch to client since it has immediate access to true remote management, and installing
the Android video player, such as XBMC, the hard disk, now that the media files a local Apache website for managing,
then play the file from the newly added streams have been moved over to the sorting and displaying the media library
Samba shared directory. ethernet port. The result of the coordi- contents in an easy-to-read format.
The simplest way to load a media file, nation between the two systems is that Handbrake has also recently been ported
is to log into the Samba share using either the Android client remains responsive to the Odroid, which can be included in
ES File Explorer’s “LAN” tab and single- at all times, while the Whisper server the download process for converting me-
click a media file from the shared directory, accomodates the increased disk activity dia files to the preferred resolution and
or by starting XBMC and logging into the in the background without locking the codec before making them available to
Samba share using the XBMC interface. Android system’s resources. The dual- the Android client.
Notice that moving the downloads to box version of the Media Center per-

ODROID MAGAZINE 41
MEET AN ODROIDIAN

meet
an odroidian
Mauro Ribeiro: The Software Genius
Behind Odroid’s Linux Kernels
edited by Rob Roy

What is your official title and role at awesome 386 comput-


Hardkernel? er. I still recall the ex-
Senior Software Engineer, I mainly act specs” 386-DX40,
do Kernel work, Linux Support and deal 4MB of RAM, VGA
with our forums. Trying to get onto the Card, 14” Color Moni-
Hardware world too.. Its a lot of fun :) tor (CRT), Dual Floppy
5 1/2 and 3 1/4. And
As one of the moderators of the ODROID an outstanding 260MB
forums, what do you like most about the Seagate HDD. I kept
ODROID community? this machine. The CRT
I think that what I like most the is and HDD are dead, but
amount of information that we managed everything else works.
to share and how many users that we had I really got into
with no Linux knowledge, now they are Linux in 1998. A friend Mauro dressed in a typical korean attire, a
quite advanced. of mine brought me a CD-ROM from cool memento of his last korean trip.
USA containing “Slackware 97”. That is
How did you get started with computers? where everything started.
Since I was 2 years old (from what I room using 5 10W leds. Right now I
can remember), I’ve shown a tendency in What are some of your favorite projects have it about 70% complete. Minor bits
dealing with electric and electronic stuff. that you’ve seen ODROIDs being used are missing, such as cabling, housing and
Mostly because of my uncle’s influence, for? remote control Software.
who taught me basic electronics since I I love projects that deal with light
was kid. I was 5 or 6 years old when my control and ambiance light control. I What other interest and hobbies do you
uncle showed me an Apple 2+. From a don’t think I have seen any of those so far enjoy?
friend of his. This was on 1989 or 1990. using ODROID’s. I’ve seen some pret- Race Cars are probably what I love
A year later, my uncle gave me an ty neat robots powered by ODROID’s, most apart from the computer side. I’ve
and I’m on my own been part of the scene dealing with cars
personal project to do ECU’s. Combustion engines are fun.
some light control with About my dogs: They are two Lhasa-
ODROID’s :) Apso. Meg is the older, she’s 6 years old
now.Junior is the last born of her mother,
Do you have any per- he’s 4 years old now. Laika and Res were
sonal projects that my very first dogs. They are the couple
you’re working on using that gave birth to all of my current dogs.
ODROIDs? Unfortunately, Laika passed away early
Yes, ambient light last year due to complications of a sur-
control. It’s using a gery to remove stones on her bladder. Res
U3+Shield board to sadly passed away a couple months later.
control the light on my Laika died at age 7 ,and Res died at age 9.

ODROID MAGAZINE 42

Você também pode gostar