Beruflich Dokumente
Kultur Dokumente
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
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
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
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
ODROID MAGAZINE 12
POWER CONTROL ON ODROID CLUSTERS
ODROID MAGAZINE 13
USB GADGET DRIVERS
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:
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
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
ODROID MAGAZINE 16
USB GADGET DRIVERS
----------------------------
----------------------------
----
[ 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.
ODROID MAGAZINE 18
GAMES
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
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
ODROID MAGAZINE 22
GAMES
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.
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
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
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
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
ODROID MAGAZINE 32
IO PORTS ON ODROID-U3
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`
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 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
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!
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
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.
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.
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
ODROID MAGAZINE 41
MEET AN ODROIDIAN
meet
an odroidian
Mauro Ribeiro: The Software Genius
Behind Odroid’s Linux Kernels
edited by Rob Roy
ODROID MAGAZINE 42