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

Year One Issue #2 Feb 2014

ODROIDMagazine 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 • - 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

service to the world-wide ODROID and Open Source communities, Hard Kernel is proud to present its newest contribution to ARM technology: A 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 amazing 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!

ODROIDMagazine

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

I am a computer 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

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

ODROID MAGAZINE 4 MAKE YOUR GIANT ANDROID TABLET if the user hovers his/her finger over It’s important to check whether the Nexio Co., Ltd. Other touch screens will the screen while searching for the item touch screen is really Windows 8 com- report different VID, PID and vendor to be selected. patible or not. True Plug & Play de- information. vices do not require a separate driver Step 2: Modify to be installed on a hid-ids.h and hid- Windows PC. If the multitouch. touch screen needs a 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 directory, then add the VID and PID to be less likely to work the end of the hid-ids.h header file. with Android.

Principle of IR (Infrared) Multi-touch screen There are 4 steps to using the touch screen with the Android OS in a How to Choose an nutshell: Infrared touch screen 1) Get the Vendor ID and Product ID from the You can make your own touch screen touch screen USB interface. Example PID and VID values added to by following guides found on the Inter- 2)Modify the files hid-ids.h and hid- kernels/drivers/hid/hid-ids.h net, but it is not easy to implement the multitouch.c, both located in kernel/drivers/ complex multi-touch algorithm and well hid/ Also, add the new ID in the hid- aligned IR emitter/receiver pairs. 3) Build the kernel with the HID-MULTITOUCH multitouch.c source file. It must be Before purchasing an infrared touch option enabled, and transfer the kernel image placed in the hid_device_id mt_devices to the ODROID. screen, it’s important to evaluate its com- structure define. patibility with Android. It must meet at 4) Create an IDC (Input Device Configuration) file. least one of the following requirements:

1) Is your touch screen listed in the Linux multi-touch compatibility table? Step 1: Check the http://lii-enac.fr/en/ar- VID and PID chitecture/linux-input/ Plug the touch screen into any Linux multitouch-devices.html If yes, it will be very easy to activate your PC, then find the VID and PID by typing touch screen. lsusb in the terminal as below right. To determine which device entry 2) Is your touch screen Windows 8 compatible? is associated with the touch screen, list If yes, you need to add a few lines in the Kernel the devices before connecting the touch Example of adding the touch screen ID to driver and an input configuration file. screen, then list them again after connect- kernels/drivers/hid/ ing it. The new entry will correspond to hid-multitouch.c 3) Does your touch screen manufacturer sup- the touch screen device. ply specific Android driver source code? During our project, when the If yes, you need to follow their porting in- struction. 23-inch touch screen was con- nected, an entry of VID:03FC, A touch screen which meets the first PID:05D8 appeared in the de- requirement was not available in our lo- vice list, which represents a touch cal Korean or Chinese markets. Some screen made by Elitegroup Com- touch screen manufacturers in China of- puter Systems. With the 42-inch fered to supply the driver source code touch screen connected, an entry for their products, but the sample code of VID:1870, PID:0119 appeared was not useful in the real world. The to represent a touch screen from best alternative was a touch screen that Reading the VID and PID of the USB supported Windows 8 HID-compliant touchscreen using a Linux PC Plug & Play. ODROID MAGAZINE 5 MAKE YOUR GIANT ODROID TABLET

Step 3: Build the Step 4: Create an Test the touch screen. Our touch screen could detect up to 6 points. kernel with the HID- IDC (Input Device MULTITOUCH Configuration) file option enabled If you don’t make a proper IDC file, the resolution of the touch screen will Type “make menuconfig” to config- not 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 Multitouch panels and select it as touch.orientationAware = 1 an embedded driver (*), as seen below. device.internal = 1 keyboard.layout = qwerty Testing the touch screen - 6 points guarantee keyboard.characterMap = qwer- the sensor integration with the software. ty2 keyboard.orientationAware = This smaller 23-inch touch screen 1 panel came with 4 velcro belts and it was keyboard.builtIn = 1cursor. mode = navigation relatively easy to assemble. cursor.orientationAware = 1

The file name must beVendor_xxxx_ Product_yyyy.idc (xxxx: Vendor Configuring the touch screen with an embed- ID, yyyy: Device ID). I made two ded driver in the kernel configuration. files for Elitegroup and Nexio. The filename is case sensitive. Then, set another two options as an em- bedded driver, indicated with an asterisk (*) Vendor_03fc_Product_05d8.idc Device Drivers > Input de- and Vendor_1870_Product_0119.idc vice support > touch screens > 23-inch touch screen panel with velcro belts playing Fruit Ninja on android. 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_ GeneralTouch touch screen de- Product_05d8.idc /system/ vice support usr/idc/. adb push Vendor_1870_ Product_0119.idc /system/ usr/idc/. adb reboot

How to Attach the Conclusion 42-inch Touch Panel Besides gaming and personal use, the to the TV Screen. ODROID is ideal as the core computing de- vice for kiosks, digital signage, human inter- Carefully attach the touch screen to face research, and more, because of its high Configuring the touch screen with an embed- align the viewing window. performance computing power, relatively ded driver in the kernel configuration low cost, and open platform which allows modifications such as this touch screen. Save the Kernel configuration and A video of the results of this project, compile it to make a zImage. is on http://www.youtube.com/ Transfer the zImage to your watch?v=HDsnuxchxtU, and for more ODROID via fastboot protocol in the Preparing the touch screen: Attaching the giant action, http://www.youtube. u-boot. double-sided tape to the touch screen frame 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

his moment finds you in your fa- issue of ODROID Magazine. Handily, miliar laboratory, hunched over you printed out and bound the entire last Check that your OS your lab counter, illuminated issue of ODROID Magazine for easy T version is higher than by the soft glow of your plasma dis- reference. Sometimes, it’s just nice to play, network indicator lights, catalyzing feel paper between your fingers. Beta 1.6 chemicals in various test tubes, and such. After a few cobbled attempts at down- Before you lays a brand new ODROID- loading the latest Android release for the (Settings > System > About Tablet) U3 which you are in the process of mod- ODROID, you actually slow down and ifying 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 low the procedures for installation on of The Ben Heck Show while you hack the U2. You find the latest full version Download the Android update file. old IDE ribbon cables and connect your of Android for the U2 is the Android Visit http://dn.odroid.com/An- U3 to various items on your worktop like Beta 1.6, and the newer versions are sim- droid_Beta_1.8.0/U2/ (for other batteries and miniature displays. ply updates to that version. models of ODROID, leave off the “U2” Upon completing the last solder con- You download Android_Beta_1.6 for at the end). Select the SD or eMMC im- age, depending on the card that you have nection, you look up with a menacing the U2 from http://dn.odroid.com/ installed, and start the download. smile of accomplishment and say, “Flip Android_Beta_1.6/U2/ and write it the switch!” After a brief moment of to your SD/eMMC card as explained Create the updater directory. inactivity, you remember that you still in the January 2014 issue of ODROID Create the directory /sdcard/up- don’t have a lab minion. Not only that, Magazine. Once it has completed, you dater using File Explorer that should but there is no switch to flip. However, plug the card into your ODROID and be included in your Apps list. there is an on/off button on the U3! yell, “PUSH THE BUTTON!”, this You power on your U3, but then real- time remembering that you have neither Move the update file to the updater ize after another brief moment of inac- a minion nor a flippy-type switch. You folder. tivity that you don’t have an OS on your catch yourself cackling in glee as the AN- Copy the downloaded .zip file con- SD or eMMC card. You decide that you DROID logo appears across your mini taining the Android Beta into the /sd- should probably install Android as it is display connected to your U3. card/updater folder. 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

n the previous issue of ODROID Installing the Magazine, we discussed the ben- I efits of using ODROIDs for High 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 com- started, download the Ubuntu Server im- based cluster using five ODROIDs, we cannot mercial setting. But what about the age for your ODROID model and extract be held responsible for the giant robots that home user that wants to experiment the .IMG.XZ archived image using an ar- may someday take over your hometown. with HPC? In part one of this multi- chiving tool such as 7zip on windows, or part series, we outline the setup and by typing “xz” from the Linux command them nodes for simplicity from now on) configuration of a basic “headless” line. Finally, you can copy to the medium via the ssh protocol using Terminal (or cluster with the end goal of running of your choice, such as an SD card or Putty if running Windows) in order to parallel programs based on message an eMMC module, using the “dd” com- continue setting up our cluster. Because passing, using the Message Passing mand on Linux/OS X systems or the of potential initial hostname and MAC Interface (MPI) parallel programming Win32DiskImager.exe for ODROID on address conflicts that we will resolve in model in particular. Windows. For more detailed instructions the next section, we will need to boot the In subsequent articles, we plan to on copying over the OS, please refer to first ODROID and set a few settings be- expand on this setup to build a cluster Bohdan Lechnowsky’s article titled “In- fore starting the second. with a centralized head system or node, stalling an OS on an ODROID” from complete with services such as Puppet, the January 2014 issue of ODROID [Editor’s Note: If one is available, a develop- NFS, and LDAP, a configuration that Magazine. We recommend using the ment machine running Linux or Windows is is capable of supporting a much larger eMMC modules available from Hardker- recommended to more easily setup and reboot number of ODROID systems (nodes) nel for better performance, but SD cards the cluster, troubleshoot hardware problems, configured as an HPC cluster. For ex- work well too. and other necessary debugging. An alterna- ample, in part two, we will cover basic tive to using a separate computer is to plug a networking configuration of the head Connecting to your USB keyboard and HDMI cable into the node, including dnsmasq, NAT, and Odroid and User first ODROID and use it directly to boot- adding more nodes to the cluster, while Configuration strap the cluster instead of via SSH as de- in part three (and further installments), Since we opted to use the Ubuntu scribed in the next few paragraphs. Press we will cover additional services such Server image for our ODROIDs, we can Ctrl-Alt-F1 to use the framebuffer console as LDAP, NFS, Autofs and Puppet. connect to our XU-E systems (we’ll call if X11 is not running.]

ODROID MAGAZINE 8 HPC AT HOME

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

For the Ubuntu server image we used cation.) 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 reboot- HWaddr b6:8d:67:7b:cb:e0 ent table in the router’s admin panel. ing the machine so the changes take Since we used identical copies of the effect. For the purposes of this article eth2 Link encap:Ethernet same image on both nodes, by default we will use odroid-server0 and odroid- HWaddr 00:13:3b:99:92:b1 they had a hostname conflict, which we server1 to refer to the first and second resolved by bringing them online one ODROID respectively. Alternatively, if By default, eth0 will be the onboard at a time, then changing the individual your operating system supports it, you 10/100 ethernet connection, while the network settings. If you don’t have ac- can also type “sudo odroid-config” to second ethernet device (in this case, cess to the router’s admin panel, you can change the hostname. You can use other eth2) will be the USB Ethernet Adapter. also make use of the nmap command to names of your choice; they have to be If only eth0 shows up, try reseating your

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 onboard slot and verifying that the USB ethernet 1) Run test applications that adapter is still showing up using the “if- use multiple cores on a single config -a” command. It’s also possible ODROID that the ethernet device ID itself has changed if the adapter is unseated, in 2) Run example programs that which case you can update the /etc/net- use both ODROIDS and a total of work/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 sec- Message Passing ond approaches. You can read the exam- Interface (MPI) ple programs that come with OpenMPI Now that we have two nodes con- and MPICH to learn more. There are figured appropriately, we can now also a number of excellent online tutori- start looking towards how we can als and a few good books on program- execute HPC jobs on our two-node ming MPI, such as “Using MPI” from cluster. A parallel programming en- MIT Press (one of us co-authored that vironment such as MPI helps you book). do this. MPI takes care of start- ing up the processes that make up Building it Better the parallel programming model, The content of this article represents and provides a standardized appli- just a fraction of what we will be able cation programming interface (API) to do with our cluster down the line. for those cooperating, communicating While this setup is more than adequate Yeah, we are serious when it comes to gi- sequential processes to use to make the for handling two nodes and only a few ant robots taking over your hometown, but parallel program work. To accomplish users, if we want to grow our cluster, Voltron always wins. this, we will make use of MPI, or Mes- we will want to make use of a dedicated USB Ethernet adapter and/or verifying sage Passing Interface, which provides head node to better handle a larger num- that it works on another machine. To an API that allows nodes to send and ber of users and nodes. In addition to set up the adapter for using DHCP on receive messages while processing jobs. allowing us to hide cluster traffic from boot to get an IP address, we will need to A command called either mpirun or mp- the rest of the network, this head node modify /etc/network/interfaces iexec will start all the processes needed will also host services that will streamline and add the following two lines between across your ODROIDS under your cluster management, such as LDAP for the entries for auto lo and auto eth0: control. There are two common open user management, Puppet for content source MPI implementations available management, NFS for file sharing, and auto eth2 for download - MPICH and OpenMPI. various networking services.

iface eth2 inet dhcp For ODROID clustering purposes over In part two of this series, we will Ethernet, both work equally well. Both begin to convert odroid-server0 into a of these MPI implementations are avail- proper head node.

ODROID MAGAZINE 10 POWER CONTROL ON ODROID CLUSTERS FINE-GRAINED POWER CONTROL ON ODROID CLUSTERS 24 HIGH PERFORMANCE CORES FOR 35 WATTS Kurt Keville

ur team has experimented re- cently with a number of new Oenergy-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 demanded, but the lack of safety hats. periences come in the form of testing a mini-cluster of ARM Cortex-A9 boards running the development Ubuntu ver- The big takeaways to be initiated. Because of conventional sion targeted at that platform. standard practices of “nice” level man- In addition to the Hardkernel-rec- from this project agement and queueing system usage, ommended default install of the OS Server hibernate is of decreasing utility since most systems are fully in use if you and concurrent headless server applica- poweroff and reboot is just as quick in our organize your jobs correctly. We there- usage. Governer invocation is now the stan- tion suite (including MPI discussed on dard. fore investigated fully-on, fully-off and the last article), we installed cpufrequtils, almost-off systems with an eye towards WattsUp, and PowerNap and then up- The Powersave governor is of considerable energy savings relative to the various op- dated the systems accordingly. These value and should be used as a default in HPC tions available to us that don’t involve a packages are mainly what we will discuss clusters. full power-down. in this article, since they are where the And manual processor affinity is no longer Cold boots time for our demo cluster 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, how- in clusters that have significant reduced We have boot times on our eMMC ever, would include systems that are usage periods, and an aggressive power- fitted U2 and U3s of less than 10 sec- rarely powered down since they need to saving schedule yielded no negative re- onds so there is no argument you can respond to requests quicker than a pow- sults in our findings. Even if you do not make for suspend / resume or hibernate er-on would allow. For those scenarios have big.LITTLE enabled apps (which / thaw that isn’t better exemplified by an we investigated suspend and resume and we do not have on our U2 / U3 cluster), on / off solution or a scripted governor the 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

ODROID MAGAZINE 11 POWER CONTROL ON ODROID CLUSTERS they introduced their “SmartUPS” line. The original software application that root@odroid:~# cpufreq-info shipped with these UPSes utilized a seri- cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009 al (RS-232) connection that would allow the system to initiate a shutdown script Report errors and bugs to [email protected], please. on a server when the UPS detected that analyzing CPU 0: driver: exynos_cpufreq it was no longer getting charged. Since the original releases there have been CPUs which run at the same hardware frequency: 0 1 2 3 many improvements to this approach, CPUs which need to have their frequency coordinated by software: affording substantial scripting flexibility 0 1 2 3 to the sysadmin and introducing alter- native hardware options, like USB and maximum transition latency: 100.0 us. hardware limits: 200 MHz - 2.00 GHz SNMP connections. The open-source community has available cpufreq governors: conservative, userspace, also added many new options to this powersave,performance functionality, progressively in the form current policy: frequency should be within 200 MHz and 1.70 GHz. of software support for the nut and The governor “performance” may decide which speed to use within upsd code bases (see http://www.net- this range. workupstools.org). We can now “hook” current CPU frequency is 1.70 GHz (asserted by call to hard- the invocation of this script into a user- ware). defined usage, in our case tied to a drop cpufreq stats: 2.00 GHz:0.00%, 1.92 GHz:0.00%, 1.80 GHz:0.00%, in processor usage below 20%. NUT is 1.70 GHz:93.58%, 1.60 GHz:0.01%, 1.50 GHz:0.00%, 1.40 GHz:0.00%, compatible with Ganglia and Nagios in 1.30 GHz:0.01%, 1.20 GHz:0.00%, 1.10 GHz:0.01%, 1000 MHz:0.00%, that it affords quite a few scripting op- 900 MHz:0.00%, 800 MHz:0.00%, 700 MHz:0.00%, 600 MHz:0.00%, 500 MHz:0.00%, 400 MHz:0.00%, 300 MHz:0.01%, 200 MHz:6.38% (66) tions, so sysadmins familiar with adding ad-hoc functionality to their cluster man- agement tools should have little problem aged 5.6 per node over the course of the cpufreq-info will show this 4 times, but if you integrating it with their custom setup. benchmark suite run. It is interesting to go for powersave or conservative, get ready Additionally, cpufrequtils and pm- note that while these particular bench- to see less active processors when idle. utils are very handy sets of tools that marks managed to keep the CPUs busy, are compatible with the Linux kernel, at it did not fully utilize available memory, least as recently as 3.2. PowerNap lets which is also reflected in power usage. top command sampling a lu.A benchmark you manage this via a script interface. You can lock your board into its high- top - 09:00:58 up 2:52, 6 users, load average: 2.41, 0.74, 0.29 est speed setting by invoking “cpu- Tasks: 154 total, 2 running, 152 sleeping, 0 stopped, 0 zombie ” from freq-set –g performance %Cpu(s): 99.1 us, 0.0 sy, 0.0 ni, 0.8 id, 0.0 wa, 0.0 hi, 0.1 si, the command line or by hooking it into 0.0 PowerNap’s config scripts if you prefer KiB Mem: 2071512 total, 884916 used, 1186596 free, 111884 buffers a degree of automation. Note the ODROID U3 output above KiB Swap: 0 total, 0 used, 0 free. 421392 cached Mem right, when your processors are set to “performance” mode (one report for PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COM- MAND each processor core normally). 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 6311 root 20 0 4708 1236 836 R 0.7 0.1 0:00.11 top of 1.7 Ghz and run the workload at http://openbenchmarking.org/ Some benchmarks represent usage as connected WattsUp meter. Clearly the result/1401173-UT-1309189UT21, 400% of one process rather than 100% XU-E is much better suited to this ex- you can successfully peg the processors of 4 processes depending on wheth- periment not to mention the substan- at close to maximum utilization. Our er they are initiated as MPI jobs. We tially better performance with the big. power peaked at 6.3 Watts and aver- 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. Those Governor (freq) Avg. Watts for 6 boards items were connected to our WattsUp meter, which allowed us to measure rel- Performance (1.7 Ghz) 33.6 atively small power fluctuations, since they aggregated. We captured this Userspace (700 Mhz) 21.0 with the Linux utility described below. Additionally, we measured single node Powersave w / 2 core* 3.6 numbers on an ODROID U3. Baseline power usage on boot (note that boots Performance w / 1 core 23.4 put us into ”ondemand” mode at ini- * via a PowerNap script that invokes “echo 0 > /sys/devices/ tially 200 Mhz) was negligible. While a system/cpu/cpu2/online” and cpu3. Actually, if you set any fre- range from 200 MHz to 1.7 GHz were quency below 700Mhz on the U3, it will turn off 2 cores. available speed options for our boards Lower bars = less wattage usage (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- fined, as well as other parameters as- The SoC Drawer and SoX BoX clusters dis- sociated with reporting, grace periods assembled, those guys pack quite a punch and other functionalities. Our recommendations are to ig- nore hibernate in a server scenario; if you need immediate shutdown just The power use logging setup on power off underutilized cores at a using the Odroid board level. Rebooting takes ~10 sec- U3. onds 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 References an Intel Galileo and compares favor- ably in the openbenchmarking tests by that standard. PowerNap Tutorial http://ti- nyurl.com/PowerNapTutorial Moreover, it appears that power ef- ficiency scales superlinearly with fre- Slurm Integration http:// quency and core count. So you if you tinyurl.com/SlurmIntegration have a power budget, and few time re- Power Use Logging http://ti- strictions, you can script your cpufreqd nyurl.com/WattsUpLinuxUtil to make that a priority, and aggressive manage your power use.

ODROID MAGAZINE 13 USB GADGET DRIVERS

Gone are the days when notebooks came with Ethernet and COM ports. What do you do if you are stranded with nothing but a USB cable? USB GADGET DRIVERS MAKE YOUR ODROID COMMUNICATE WITH YOUR OLDSCHOOL PC Kevin Kim, Hardkernel Developer

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

Mass storage emulation hen developing applica- By connecting the ODROID to a PC /lib/modules/`uname -r`/kernel/ tions for the ODROID, its using its USB port, it can be "enumerat- drivers/usb/gadget/ W often necessary to trans- ed" to appear as another common USB g_mass_storage.ko fer files and commands from a main device, depending on the type of com- host PC to the development comput- munication 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/driv- Mass storage device your ODROID to communicate with ers/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 Mass storage + Serial + Ethernet cal connection between ODROID and emulate each of these data connections /lib/modules/`uname -r`/kernel/driv- your host PC. at the same time, as a multi-function link. ers/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 Emulating a mass generic sg2 type 0 # ls –al /dev/ttyGS* storage device: .. sd 56:0:0:0: [sdc] 262144 512-byte logical blocks: (134 Storage over USB crw-rw---- 1 root dialout 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/tty- carrier:0 ACM0 inet addr:192.168.100.1 collisions:0 Bcast:192.168.100.255 $ echo qwerty > /dev/ttyACM0 txqueuelen:1000 Mask:255.255.255.0

# cat /dev/ttyGS0 RX bytes:22645 (22.6 inet6 addr: KB) TX bytes:18987 (18.9 fe80::6019:ceff:fe95:e09f/64 qwerty KB) Scope:Link Connect the Micro-USB cable be- UP BROADCAST RUN- NING MULTICAST MTU:1500 Emulating a ethernet tween the host PC and the ODROID 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 ODROID: $ dmesg errors:0 dropped:0 overruns:0 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) details about the ethernet connection. 4 … usb 1-1.2.4: new high-speed # dmesg USB device number 13 using Now the ODROID will be able ehci_hcd to send and receive data through the … gadget: using random self usb0 port: ethernet address … cdc_eem 1-1.2.4:1.0: usb0: 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: Bandwidth PING 192.168.100.1 The full package (192.168.100.1) 56(84) bytes of data. [ 4] 0.0-10.0 sec 193 MBytes 162 Mbits/sec A multi-function link emulates a mass 64 bytes from 192.168.100.1: storage, serial and ethernet connection icmp_seq=1 ttl=64 time=0.348 # iperf –c 192.168.100.1 using only one combo g_multi module: ms ------64 bytes from 192.168.100.1: ------# mount icmp_seq=2 ttl=64 time=0.254 ---- ms /dev/mmcblk0p1 on /media/boot Client connecting to type vfat (rw,nosuid,nodev,fl ^C 192.168.100.1, TCP port 5001 ush,umask=000)

--- 192.168.100.1 ping sta- TCP window size: 20.7 KByte # sudo umount /dev/mmcblk0p1 tistics --- (default) # sudo modprobe g_multi file=/ 2 packets transmitted, 2 re------dev/mmcblk0p1 ceived, 0% packet loss, time ------999ms ---- After connecting the ODROID’s rtt min/avg/max/mdev = [ 3] local 192.168.100.2 Micro-USB cable to the PC, all three 0.254/0.301/0.348/0.047 ms port 34764 connected with 192.168.100.1 port 5001 functions listed above may be used si- $ iperf –s multaneously. [ ID] Interval Transfer ------Bandwidth ------[ 3] 0.0-10.0 sec 193 MBytes 162 Mbits/sec Server listening on TCP port 5001 Wow! 162Mbps is faster than normal TCP window size: 85.3 KByte 100Mbps Ethernet! (default)

------

[ 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

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

ODROID MAGAZINE 18 GAMES

actually has some The SNES was a big improvement com- games that can pared to the NES and other consoles, but be played to- that is not a big surprise if you compare gether with the specs of the two consoles: a friend, so The NES had only about 2KB of RAM and 2KB of Video RAM, and a maximum of 25 I consider colors simultaneously (out of 48 colors it a great and some grays). multiplayer Its successor, the SNES, could use up to system. Games 15bit colors (32,768 possible colors), and like Banshee or had 128 KB of RAM and a large amount of Video RAM (64 kB main RAM, 512 + 32 bytes The Chaos Engine sprite RAM, 256 × 15 bits palette RAM). are really awesome to play with a friend. The ROM size of games from the NES were between 8 KB to 1MB Left: Banshee, a great Amiga shooter On the SNES, the ROM size was between Right: The Chaos engine 256KB and 6MB.

tasking, the ability to use Next on the list It was possible to pack much hard drives to store games of emulators is more data on a SNES cartridge, and programs, and the Work- the Nintendo which allows for more con- bench Graphical User Interface, Entertain- tent, and made games look it was very impressive. ment Sys- a lot better, as seen in a di- There are some emula- tem (NES), the rect comparison between the tors that run Amiga games Super Nintendo NES and the SNES: well, but it takes lots of Entertainment Sys- The SNES also used video configuration to get the tem (SNES) and the rendering layers, which allowed games to run, and often GameBoy Advance more effects and content to put in a you have to switch between (GBA). If people talk about Nintendo, single scene, and had a higher resolution Kickstart disks (the BIOS of and especially about retro games, you are than its predecessor. the Amiga). Simply switching going to hear about NES and SNES con- through the many disks can also soles. The NES is rather old for a console, get somewhat annoying. Although but it introduced some legendary classics the graphics of the Amiga was outstand- that changed gaming history. Titles such ing it can hardly compare to other con- as Legend of Zelda or Super Mario are soles now. games that will probably I use retroarch in my ODROID never be forgotten, GameStation Turbo image to run Ami- and are one of the ga games, but unfortunately, not all of most important of them run in full speed. So, I consider the Nintendo’s fran- Amiga an unstable system to actually use chises. on the ODROID. There are some emu- The SNES lators that can run directly (for example, was a great im- E-UAE and FS-UAE), which give better provement over performance than the retroach port, but the NES, since it they require advanced configuration, and had more colors and won’t run easily with gamepads, which offered a lot more pos- the retroarch port does well. There are sibilities than the some beautiful games on the Amiga, but NES, and was, for a Zelda, Mario and Kirby, the most of them have been ported to other very long time, THE best of Nintendo’s golden age consoles or to the PC, which can be em- gaming console for ulated more successfully. people, including The benefit of the Amiga is that it professional gamers.

ODROID MAGAZINE 19 GAMES

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 cas- looked when it comes to retro gaming es, have additional content. and Nintendo. The GBA was a handheld Although the GBA is, in my opinion, console from Nintendo, very much like a far better console than the SNES, it GBA’s Riviera the GameBoy (GB) and GameBoy Color has a downside. The GBA is a handheld Promised (GBC), and was actually compatible with console, and although it had multiplayer Land both GB and GBC games. It even had capabilities between two consoles via a a second processor specifically for back- connection cable, it makes it impossible wards compatibility, so that GameBoy to play GBA games with a friend on the owners could still play their older games same machine. on the newer console. Otherwise, it was However, if you prefer single-player have very attractive graphics very much like the SNES, which made mode, you should definitely take a look and immersive gameplay. All the small handheld device very powerful at GBA games. You can also see if your of the Nintendo systems (GB, for its time. favorite SNES games exist for GBA, and GBC, GBA, NES, SNES) run fine on the maybe get a newer, better experience ODROID using the emulators provided The GBA also had 15-bit color, and the CPU from your game. If you’re looking for on ODROID GameStation Turbo. was 32-bit, as compared to the 16-bit pro- a new game to try, you should definitely I prefer to run SNES in retroarch cessor of the SNES. and play the other Nintendo emulators It also offered 32KB + 96KB of Video RAM check out the GBA game library. (internal to the CPU) and 256 KB WRAM Overall, I really like the GBA, and using mednafen since mednafen per- (outside the CPU). I routinely play some GBA, since they forms better than retroarch for these platforms, and allows software scalers If you compare these specs, the GBA such as hq2x or super2xsai, which can was a better system than the SNES in Final Fantasy IV enhance the picture quality and make nearly every aspect. The only advantage SNES vs GBA the games look more “modern” side by side. that the SNES had over the GBA was the than they really are. resolution, which was only 240x160 If you are a fan of retro pixels. Even with the lower resolu- Arcade machines, you’ll prob- tion, the cartridge size went from ably enjoy MAME, NeoGeo 1MB up to 32MB. and NeoGeo Pocket, which are available for the ODROID. MAME and NeoGeo are available on retroarch, and NeoGeo Pocket is available on mednafen. NeoGeo Pocket is similar to the GBA, and is somewhere be- tween 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 machines, and of- fers some challenging action games. MAME and NeoGeo have a lot of fast action games like Street Fighter 3

ODROID MAGAZINE 20 GAMES

most of these games without issue, and Sega Systems always tried to be just for this, it’s really nice to have. There a little bit better than the Nintendo even is a project documented on the consoles. The Sega Master System had forum where someone built their own more RAM and more colors than the Arcade Machine at home with a U2: NES, and was slightly faster. The most http://bit.ly/1cmrgjK. popular game was not actually Sonic the Another big company back in the Hedgehog, but Alex Kidd in Miracle earlier days of console gaming was Sega, World. Still, Sonic was Sega’s answer to which directly competed with Nintendo. Mario and it worked well for Sega. The Sega team had very good ideas, but in the end, upset a lot of developers and GBA’s publishers, and now Sega only produces Summon games for other consoles. Night Swordcraft The Sega MasterSystem, Sega Genesis (Mega Drive), and the Sega GameGear are the emulators that I in- 3rd Strike and 1944 The cluded in the ODROID GameStation Loop Master. Turbo image, and are probably their Arcade games vary from most well-known those that have simple graph- consoles. They ics, to 3D games, to some with also produced a sprite technology, like the previous couple more mentioned 1944 The Loop Mas- systems like ter. If you like a lot of action

Street Fighter 3 3rd Strike 1944 The Loop Master (NeoGeo) Sonic the Hedgehog Alex Kidd in Miracle World (Sega Master System) the Sega 32X, Double Dragon Sega Mega-CD, (NES) Double Dragon Sega Saturn and (SMS) the Sega Dreamcast, which was actually a and expert gameplay, the Arcade games really nice console, that the ODROID can run is what you but it’s hard to are looking for, especially when playing find emula- with friends. tors to run However, the Arcade genre is limited, these Systems and implies fast action games. You will on Linux and rarely find the RPG, Adventures or Sim- ARM so they are ulation genres on an Arcade machine. not included in the If you compare the games It’s hard to compare Arcade games with image (yet). available for the NES and Sega a SNES or Sega, since the Arcade games If you want to Master System side-by-side, you evolved a lot, and so did the hardware compare the different Sega systems to can see that the Sega actually looked a that was supporting these games. Some others of its time, you could say the lot better than the NES. If your favor- Arcade games have NES-quality graph- Sega Master System is comparable to ite game on the NES is also available ics, while others have resolution as good the NES, the Sega Genesis is similar to for the Sega Master System, I recom- as a PlayStation. the SNES, and the Sega GameGear was mend playing the Sega Master System The ODROID platform can run also a Handheld like the GBA or GBC. version instead.

ODROID MAGAZINE 21 GAMES

Sega tried to reach older gamers as for the GameGear as well. Even some well, and wanted to appeal to profes- of the Genesis games were published sional gamers. For this, the uncensored for the GameGear, so give it a try and version of Mortal Kombat was pub- lished on the Genesis, which had blood and other effects that had been removed from the SNES version. Genesis also published many sports games that were very popular among adults. Overall, the SNES had better hardware, and games looked

see what you like best. A comparison of The next console on the mar- SNES and Genesis graphics. ket to make an impact on gaming Can you tell which system is which? was Sony with its PlayStation, al- Earthworm Jim 2 though by now it’s considered retro as The next generation, Aladdin SNES vs. Aladdin Mortal Kombat more impres- well. The PlayStation has an advantage called the Sega Genesis, wasn’t sive than the Sega over the previously mentioned con- as good as the SNES, since it Genesis, but Genesis soles, because it’s from a newer gen- had less colors to choose from, tried to counter that eration, but still it offers some console and developers had a hard time with better game me- game classic that were updated for the porting games to the Genesis chanics and more new platform. since Nintendo did not allow serious games and Looking at the quality of the PS1 its companies to produce gameplay. games, there are beautiful movies, The Sega narrative speech, and high resolution GameGear was graphics. The PS1 outranks all the meant to be a previous named consoles, and if you superior handheld find a game that was originally made device and the di- for the SNES or Sega Genesis, you rect competitor of the can expect the PS1 version to have GameBoy (GB), but it was far more lots of additional content like movie than that. In fact, the Sega GameGear cut-scenes and probably better music. was even more powerful than the Sega Although the retroarch port of Master System, and had an adapter to PS1 uses a software renderer to dis- watch TV. play its graphics, they perform flu- The Sega GameGear is somewhere ently on the ODROID. Classics for any console other than Nintendo. in between the Sega Master System and like Final Fantasy 7, 8 and 9 offer Still, there were quite some nice games the Sega Genesis. It actually had even a few examples of its high resolu- for the Genesis, and they look great. more colors than the Genesis, but the tion graphics. Even better, the PS1 Although you can see more details in downside of the GameGear is that the was designed for multiplayer, which the SNES version of the game, the Sega resolution was rather low even for its means you can play with some friends Genesis had better game mechanics and time, but that wasn’t important for a on the same TV. included a sword, which was not in the handheld console. There were about Finally, we reach the most impres- SNES version. Interestingly, Disney il- 300 games available for the GameGear, sive emulator on the ODROID so lustrators were involved in creating the and if it ran on the Sega Master System, far: PPSSPP, which can play Play- animations in the Sega Genesis version, there is a good chance that it was ported Station Portable (PSP) games on the which made them look much better.

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 PSPgames that run quite nicely on the ODROID in an X11 en- vironment 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 not far from your ODROID

WHAT EMULATOR AND WHAT SYSTEM IS BEST FOR YOU? If we compare the different systems NeoGeo, since its games look the lack the ability to play together with by their power, look and feel, consid- best and have an awesome look and someone else, unless you connect ering color depth, game content, mu- feel, in my opinion. with a friend over the Internet or sic fidelity, and hardware technology, Another way of deciding what through your home network using line up nicely from least powerful to games to try, might be whether the two computers. most powerful: emulators offers the opportunity to Each system that I covered GB < GBC < NES < SMS < GAMEGEAR < GENESIS < SNES < GBA < PS1 < PSP

Not included in this ranking is the to play with other people together in in this article has its own charm. Amiga, which is more like an old time 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 be of them just by switching from one chines: NeoGeo Pocket, NeoGeo 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 clas- Although handheld devices such have all of these emulators already sic Pac-Man up to Tekken 6 for the as the GBA might be the best single- set up, ready to play games with PS1. Of these consoles, I prefer player gaming console, they normally your favorite controller.

ODROID MAGAZINE 23 TECHNICAL ARTICLE ESTIMATING RADIO NETWORK INTERFERENCE WITH MULTI-THREADED JAVA Jussi Opas

he project described in this ar- It is of interest to see that adding ticle involves the estimation of even more equally performing cores T radio network interference using shortens the used time, but not by much, a multi-threaded Java application. How as shown by the dashed line. The se- does the ODROID compare to other quentially 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 pro- kernel on ODROID XU demonstrates time unit in minutes. cess available for performing each add- this expectation model well at right. ed thread, let’s say that it takes 8 units Our sample application, called Poiju, to do some work sequentially. Adding computes estimation of radio network The characteristics of the program one new thread shortens the time to 4 interference at the beginning of next are that it uses only RAM (no file ac- units, while adding a third thread fur- page. To do the estimation, combined cess), and all work can be done by the ther shortens to 2.67 units, and the 4th coverage and service area of each radio CPU, since no GPU-related work is additional thread lessens the time to 2 cell must be calculated. Then, at each performed. Parallelization has been units. If the work is not fully paral- pixel, the field strength of interfering designed so that, for each cell, service lelizable, there is always some portion cells is computed. This is done over the area is computed first sequentially, and that must be done in sequence by one service area of carrier cells. Computa- after that interference is computed thread, and that part of the work can- tion is made on pixels of size from 30 to with many threads for cell specific not be accelerated by adding threads. 350 meters. The size of radio cells may closest candidates. Let’s start with the assumption vary 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. mance of the ap- nanoTime(); plication on XU is final double distance = practically identical SpatialMath.computeProjectedDi between 4 different stance(carrier, candidate); Linux distributions, instrument. Debian, Xubuntu, Fe- incrementDistanceTime(System. dora and Ubuntu with nanoTime() - t1); Mate desktop. There is a small, but hardly measurement results visible, improvement with OpenJDK and in JDK releases 1.6, 1.7, and 1.8. It is OracleJDK are shown also of interest to see how performance below right. is improved when frequency is changed The first obser- from 1.6 to 1.8 GHz, as shown in at end vation is that our of this page. theoretical model, as presented before, is Running times on 4 A15 core XU board with plication is below it. Also shown are the being partially fol- two different JDKs. htop terminal and the lowest application is lowed. Each added thread is the development environment called Iltel- speeding up the program ex- liJ IDEA. ecution, until the 4th thread. The ODROID-XU’s ARM proces- The first added thread yields sor offers 4 power efficient A7 cores the best performance boost. and 4 high performance A15 cores This is partially affected also [ARM13]. At any one time, either a by Just In Time (JIT) compila- cluster of little cores or a cluster of tion. JIT improves execution big cores is working, known as big. performance when same byte LITTLE architecture. Hence, there are code is executed repeatedly. 4 processes available. The Poiju appli- Adding the 3rd and the 4th threads With htop and vmstat we see that cation is using only the big cores while predictably improves performance, more than half of the time is used by intensive computations are made. while the addition of the 5th thread de- kernel instead of user space. This is a The performance of application is creases performance. We guess here that major problem that we so far noticed measured with self made instrumenta- thread scheduling and context switching only on XU. What is wrong in the ap- tion by taking core-specific times prior does not come for free, when there are plication? If there is some internal er- to doing something, and then the next many threads waiting for execution time. ror in a program and a lot of exception time right after doing the task: When we know this, it is better to limit are thrown and treated silently, it would We are doing all tests with 10,000 ra- the number of threads to 4 in the ap- affect the performance significantly. dio cells at each time. The performance plication program. That can be done by However, that should not be visible as calling the Runtime.getRuntime().avail- kernel time. After several other similar ableProcessors() method. We see also Poiju in development session on ODROID XU on a monitor via display port. that OracleJDK is performing better Over-clocking improves performance, but than OpenJDK. OpenJDK is dropping usage of self-made instrumenta- the default installed tion improves it significantly. Java on Ubuntu, so the user must manu- ally install Oracle JDK. Fortunately, it is freely available from the Oracle De- veloper website. The perfor-

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 i5 reason for the behavior, but processor is 3.3x faster than the XU. guesses and trials we were not able to we can guess things like con- Fully parallel thread configuration find the reason. Finally, we commented text switching is not efficient, self-made detailed instrumentation that or work load is not even but was being generated with Java’s nano- unbalanced, or the share of Time method. As a result, two-thirds of sequential work is large, or the computation 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 laptop 0.4 % of overall time [DAV07], and computers, one having a Celeron pro- 3) the development environment - Comparison of i5, XU and Celeron when 4 cessor at 2GHz and another having an IntelliJ IDEA - uses multiple threads threads are used. i5-2520M at 2.5GHz. The Celeron has flawlessly. We leave the cause one core while the i5m has 2 cores with as a puzzle to be solved. 2 hyper threads. We refer to these pro- For an alternative ap- cessors as x64 to signify that they are 64 proach, we implemented 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 changes these numbers to 2.5x and Meanwhile, we see that the application being computed at same time. The 3.2x respectively. In this comparison, performance at XU is being degraded work is now fully, or almost fully, the XU does 1/3rd of the work that parallelized, and the performance of 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 threading uses the whole the same Java tasks for which desktop capacity of the XU board. computers have been traditionally used. In this comparison, the Although it can’t compete against the ODROID-XU was used at brand new (and more expensive) x64 pro- 1.6 GHz with the perfor- cessors, it can be used as a replacement for mance governor option. a mobile i5. The ODROID-XU is clearly To make a more legible better than an older single-core x64 com- comparison, we take times at puter, and Java applications benefit signifi-

ODROID MAGAZINE 26 TECHNICAL ARTICLE

cantly 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- Use Linux tools like vmstat and htop to vali- lyle J. C., and Campbell R. cle and ARM to tweak Java. 2 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:Dear fellowbut this helpedone havehonestly I one, this than on countless sheet me cheat do a better to and believe immensly for our next page article. me it will help you Sincerelytimes, 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

ebol (Relative Expression the name under which you Based Object Language)is a want your script to be saved Rrevolutionary advancement in (see “vi cheat sheet” above emerging from for some basics on how to over thirty years of language research. use it). It offers enormous flexibility and After editing your script, power, with a focus on intuitive lan- you will need to change the permissions p Paste yanked data guage patterns that promote new ways so it can be accessed by Rebol 3 (exam- : Enter extended command mode. of 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. “Esc” (escape) and the arrow cursor saphirion.com/experimen- / Search forward for the text tal/builds/android/ keys didn’t even exist. One of the following the slash Download r3-droid.apk (amazingly, great advantages of the vi editor is that ? Search backward for the text it’s smaller than 2MB). it is available on nearly any unix-based following the slash When finished, double-click on the down- operating 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 about mode, and the other is the command anything you need in vi. Although it Additional mode. On the Android version of vi, may seem uncomfortable to use at first, Android notes: these two modes are toggled by press- seasoned vi users can often edit more ef- When using the Android Termi- ing CTRL and [ (more simply referred ficiently than users on any other editor, nal app, it is almost always necessary to as CTRL+[). During input mode, any graphical or not. 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 On my installation of Android, I i Insert at current position very active development, the graphi- commonly get a message when I try I Insert at beginning of line cal port of Rebol for ARM has not yet to create a new file, stating “Read-only a Append at current position been released. According to the devel- file system”. To overcome this, enter A Append at end of line opers at Saphirion, they predict a work- “mount -o remount /” at the command dd Delete current line ing ARM port of Rebol 3 with graphics prompt. This needs to be performed yy Yank (copy) current line to be available sometime in February each time Terminal is opened. . Repeat last command or March 2014. Keep checking the To edit a script using Terminal, en- cw Change current word http://development.saphirion. ter vi myscript.r where “myscript.r” is dw Delete current word com/experimental/builds directory

ODROID MAGAZINE 28 PROGRAMMING WITH REBOL for an ARM port. The graphical ver- sion for Linux x86 is already available, PROGRAMMING but it won’t work on your ODROID. The Linux ports are being helped heav- ily by a partnership with Saphirion and WITH REBOL other commercial interests, so expect a lot of movement in this area over the REDUCING COMPLEXITY IN DEVELOPMENT next few months. 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 can work wonders as a replacement to Why Rebol? sensors are built into every tablet, phone, bash, perl, PHP, Python and other lan- Modern software development tools netbook, and desktop PC, and they work guages that don’t have a native GUI. are overly complex. Creating even a transparently without having to install small program to allow users to com- 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), 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 of in-congruent work flow patterns, virtually every type of data (images, au- myscript.r. You can even execute scripts 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 generations of technology. Users don’t of “apps”, but for software develop- need to know how networks work to ers, the current landscape of tools is a connect to the Internet. Cameras, mi- painful mess. The remnants of every

ODROID MAGAZINE 29 PROGRAMMING WITH REBOL legacy software and hardware solution gone, includingmore than 40 hardware and it’s shockingly simple to learn and still haunts and infects the process of platforms and operating systems so far, use. An entire development toolkit for writing modernized code. Numerous at- and the web. R3 requires less than a minute to install, tempts to standardize on different com- All the core components that make since absolutely no hefty SDK or IDE mercially-motivated platforms and for- modern computing possible - graphic installations are required, even for An- mats have led to the need to support a user interfaces, network connectivity, droid development. huge variety of data structures, language manipulation of standard data formats, Rebol works the exact same way on syntaxes, 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 that runs exactly people who spend the majority of hundreds of megabytes of software onto a the same way on every operating system. their time doing things other than writ- desktop computer, including an Integrated Rebol was designed from the ground up ing code can learn to create powerful Development Environment (IDE), a Soft- to eliminate complexity caused by patch- custom business and personal applica- ware Development Kit (SDK), a device ing together disparate tools, and it suc- tions with it, quickly and easily, on any emulator, and any “productivity enhanc- ceeds 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 a application development is a weighty en- gy, and for a wide range of common de- 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 Rebol has a special ability to wrap more than a decade. professional engineers devote themselves new capabilities into simple language to building and supporting a single appli- structures (also known as “dialects”, Examples of Rebol’s practical cation. 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 de- Business applications to handle inventory, sales and employee management for their personal and business computing velopment 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 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 com- for Android named “Saphir” is forked Distributed apps to organize group activi- ties for your local school mercial apps. It’s a shame, because never and maintained by the Saphirion group. before has there been such a tremendous Saphirion is a commercial application Web apps to manage membership routines variety of knowledge and useful comput- development company that uses Rebol for an online club ing capability 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 are compared and contrasted at http:// Notice that every single widget word only a small community of users who bit.ly/1tHdcbS for their “Natural maps directly to something that appears communicated privately and covertly us- scope of application”. Notice how Red, on screen. There is no wasted syntax - ing invite-only communication channels, coupled with Red/System, cover the entire you really don’t even need to understand the executables of which were devel- stack of application abstraction levels, even anything about “programming” to fol- oped using Rebol 2. more so than Rebol itself. low what this code does: With the release of open source R3 and the new potential for Android de- Another language load-gui velopment, in addition to more than to learn? view [ 40 legacy platforms and web develop- I’ve heard it all ment, Rebol has attracted a new group before! field of coders interested in its practical area and productive capabilities for creat- Before starting on this section, make ing software of all sorts. In future ar- sure you have completed the Rebol 3 in- check ticles, we will show you how easy it is stallation outlined in the article by Boh- radio to get started. dan Lechnowsky in this same issue. The screenshots shown in this and future text-list Red articles are taken from a Windows work- text-table On All Platforms station, but will look nearly identical on During the closed-source era of Ubuntu, Android, or any of the other op- drop-down

Rebol 2 and 3, several languages were erating systems supported by Rebol 3. button developed as open-source variants of For years, developers have been hear- Rebol including Boron, Topaz, World ing that some “new” language technol- ] and Red. The data-interchange format, ogy will supposedly cut their develop- On Android, the Rebol command JavaScript Object Notation (JSON), was ment time by orders of magnitude. That line currently only takes single-line com- also heavily inspired by Rebol’s clean sort of talk is so common that it falls mands. This is not a problem, as Rebol data format. on deaf ears. This introductory section is syntax-free. Simply enter the com- The front-runner of these efforts provides a few short examples to sub- mand like this on Android: presently is Red, which also has a low- stantiate some of the productive capa- level subsystem called Red/System. bilities which Rebolers enjoy. Nothing load-gui While Rebol is an interpreted-only lan- else even 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- ther as an interpreted language or as a world” application for Android, Linux, down button] 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 “Es- ness is the measure of what can be accom- cape” on the keyboard to get back to the do %gui-demo.r plished by a given amount of coding. Rebol 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 Au- than the typical text-based console “hel- GUI dialects. The examples shown in geas and Puppet, both of which are not lo world” app. It’s actually a complete this and future articles make use of the general-purpose. Red falls in the same windowed form, capable of displaying “R3-GUI” dialect, which is based on, category as Rebol as far as expressive- all sorts of other useful Graphic User and very similar to, the popular Rebol 2 ness is concerned. Interface (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!

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

ne of the exciting accessories Usage available for the ODROID-U3 Ois the I/O shield, which was Download the Fir- designed as versatile, general-purpose mata software for I/O shield, and Making a Test data acquisition and control module setup 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 : Tinkering Kit The I/O shield includes a big pro- Tools > Serial Port > /dev/tty- 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 : /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. sions. Fortunately, there is a way to over- If you want to work with a particular come this limitation by using a conf file to GPIO, you must first reserve it, set the launch the module as a daemon, then using input/output direction, then start man- a shell script to perform the initialization: aging it. Once you reserve the GPIO and finish using it, you also need to free 1) Create the file /etc/init/ it, to allow other modules or processes tca6416.conf, which may require to use them. This rule applies whether root privileges: you want to use the GPIO from the ker- nel or at the user level. description “TCA6416 Module Initialization”

GPIO Export start on runlevel [2345] By typing “sudo modprobe” in the exec /usr/sbin/tca6416init. Terminal window after booting the sh Linux kernel, the GPIO driver and TCA6426 devices will be attached to the Match the simple circuit shown here, and i2c-gpio.4 bus. 16 Ports are mapped to 2) Create the file /usr/sbin/ have your U3 like we are showing below: GPIO #289~#304 (I/O tca6416init.sh: Shield pin number 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 Accessing the i2c-4/new_device GPIO from the … i2c i2c-4: new_device: In- # Enable all GPIO’s on the stantiated device tca6416 at board Linux User Space 0x20 GPIO means “General Purpose In- for gpio_n in `seq 289 304` put/Output”, and is a special pin present Next, build the u3_shield_GPIO_ do in some chips that can be set as either in- sysfs.c, located in the examples folder, put or output, and is used to move a signal using g++. Please note that the GPIO- echo $gpio_n > /sys/class/ gpio/export high or low (in output mode) or to get the sys_init() function need the super-user signal current status (in input mode). Usu- permission to do modprobe and attach done ally, these pin are directly managed by kernel i2c device. The default password on the modules, but there is an easy way to manage official Hardkernel images is “odroid”. By adding these two files, all the these pins from the user space as well. P00 port : LED blink GPIO ports will be permanently en- Standard Linux kernels contain a special P10 port : key press, then GPIO abled on reboot. You can also add your interface which allows access to the GPIO 297 read value = 0, otherwise GPIO in the “tca6416init. pins. By running the kernel menuconfig 297 read value = 1 sh” as an alternative method. command before compiling the kernel, you can easily verify if this interface is active, Starting your and enable it if necessary. The kernel tree application software Additional Credits path is Device Drivers > GPIO on boot The FirmataC library and exam- Support > /sys/class/gpio/... There’s a place on the kernel to load ples are made by jdourlens, which (sysfs interface) modules as needed. However, you can’t were slightly modified for use on the If you embed the driver, you can ac- use it to send echo commands or values ODROID: https://github. cess the GPIO via the kernel node / to sysfs without root or super-user permis- com/jdourlens/FirmataC

ODROID MAGAZINE 33 TECHNICAL ARTICLE USING AN ODROID-XU AS A WIFI ROUTER GET TO 802.11AC WITH STYLE by Mauro Ribeiro, Hardkernel Developer

f you’d like to use your ODROID- XU as a wireless router, you’ll need Ithe 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

USB 3.0 to 802.11ac Adapter make modules_install 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 internet) sync && reboot 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 width of it for Wifi AC, and because the Although unlikely, the Wifi interface you have an updated copy of the kernel XU models also permit the use of the value (the last item on the list) may be dif- on 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 is case the board is exposed to the internet. based on the Realtek 8812AU chip. If Use the provided drivers Netis ships a mini-cd with the you have problems finding the Netis Install the necessary packages Linux drivers inside. You’ll have WF2190 Adapter, there is a listof equiv- and dependencies alent adapters using the same chip here: a linux folder with the following folder: http://goo.gl/dNwdnY. apt-get install git build-es- 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. folder to your ODROID, since these are The following values are used in this tu- Build the kernel the drivers that we need to build. torial for example purposes (your local network may differ): git clone --depth 0 https:// Build the wifi drivers 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 10.10.10.253 make -j5 cd rtl8812AU_8821AU_linux_ v4.2.0_6952.20130315

ODROID MAGAZINE 34 TECHNICAL ARTICLE

* edit the Makefile and on line 583 cd RTL8812AU_8821AU_linux_ iface br0 inet static ARCH ?= .... change to ARCH ?= arm v4.2.0_6952.20130315 bridge_ports eth1 cd wpa_supplicant_hostapd make && make install address 10.10.10.254 cd wpa_supplicant_hostapd- modprobe 8821au 0.8_rtw_r6747.20130222 netmask 255.255.255.0

Now your Wifi drivers should be cd wpa_supplicant network 10.10.10.0 working properly. Again, we have to make sure that pre-up /sbin/ifconfig wlan2 up Test the Wifi Driver Ubuntu’s wpa_supplicant isn’t present: After rebooting, your LAN interface apt-get remove wpasupplicant ifconfig wlan0 up will be called br0 with eth1 being part of it. iwlist wlan0 scan make && make install Using hostapd Note that if wlan0 doesn’t exist, This installs all of our wifi drivers, Since the wireless adapter doesn’t check for wlan1 or wlan2 by typing “if- along with the manufacturer’s provided have dual radios, you have to choose be- config -a”. Save this information for tools. Let’s move on into the configura- tween the 5GHz or 2.4Ghz frequency. later, because we’ll need to know the wifi tion part. If you are on a network with only 5Ghz card name in an upcoming step. devices, which most are nowadays, use At this point, you’ll see the list of Configuration the 5Ghz config to allow a maximum Wifi networks in Range. You can now The Ubuntu Network Bridge must speed of 800Mb/s. If you need extra use your ODROID as a Wifi client to be configured in order to create the inte- compatibility with older computers, or connect to other wireless networks. gration between the Wireless and Wired your devices aren’t 5Ghz, use the 2.4Ghz connections. configuration shown below. Building hostapd To begin configuring the hostapd and wpa_supplicant cd /etc/network service, start by creating the following file using root privileges: Because Realtek 8812 isn’t supported You’ll also need to edit the interfaces on Linux yet, we need to build the drivers, file, using the following screenshot as an /etc/hostapd.conf: including hostapd, from the manufactur- example: 5GHz version er’s source provided on their website. -- 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 hos- auto eth1 tapd, let’s just make sure that we don’t wpa_passphrase=testtest 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 Building wpa_supplicant driver=rtl871xdrv

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 right now! ieee80211n=1 sleep 3

wme_enabled=1 /sbin/brctl addif br0 wlan2 Creating IP tables for internet access ht_capab=[SHORT-GI-20] DNS and DHCP Edit /etc/rc.local, and before [SHORT-GI-40][HT40+] 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 dependency in the first step. max_num_sta=8 iptables -t nat -A POSTROUT- ING -s 10.10.10.0/24 -o wpa_group_rekey=86400 - mkdir /etc/dnsmasq eth0 -j MASQUERADE 2.4GHz version Create the file /etc/dnsmasq.d/ Now we’re done, and you should odroid.conf: 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 disks ht_capab=[SHORT-GI-20] to the USB 2.0 ports of the ODROID- [SHORT-GI-40][HT40+] # that is known as lease time XU, then create a Torrent server, a wpa_key_mgmt=WPA-PSK Samba file server, or any other type dhcp-range=tag:br0,10.10.10. of shared network resource. wpa_pairwise=CCMP 1,10.10.10.253,255.255.255.0 I’ve tested the ODROID-XU router ,1440m with my Nexus 5 phone, and it report- max_num_sta=8 # 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 You should customize the inter- dhcp-option= a limitation of the Nexus 5. face parameters “ssid” and “wpa_pass- tag:br0,3,10.10.10.254 phrase” for your network. dhcp-lease-max=255 Next month, I’ll discuss how to setup some attractive graphics to monitor the Auto-Start hostapd dhcp-authoritative input/output data on your network. Edit /etc/rc.local and add the following lines before the “exit 0” line:

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!

ulti-boxing is an advanced net- lays. Using a second system to do the and another Odroid as the media client. working technique of connect- work of gathering media files then frees Since XBMC for Android gives the best Ming two or more computers to up the main system for playing smooth performance in 1920x1080 resolution, create a single virtual system. Originally video without glitches caused by spikes I chose Android Pocket Rocket as the referring to gamers who dominated on- in disk activity. client, which already has the necessary line matches by controlling several play- To illustrate the concept of Odroid SSH, VNC, and Samba protocols in- ers simultaneously, the methods can also multi-boxing, two of the community stalled. For the media server, Lubuntu be used in other applications besides images available on the Odroid forums, Whisper works well because of the pre- gaming as a way to use parallel comput- Android Pocket Rocket and Lubuntu configured Desktop Sharing, Transmis- ing to improve the overall responsiveness Whisper, can work cooperatively to sion and Samba applications. Both im- of the user experience. run two Odroids as a virtual octa-core ages are available for download from Compared to a single-box system, system. Operating two images simulta- the Odroid forums at http://forum. which requires a reboot to switch be- neously improves the stability and effi- odroid.com/. tween platforms, the key combination ciency 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 module them using a hardware-decoded video but appears on the first machine as if it 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, able eMMC modules available from the Router if disk or CPU activity is high on one Hardkernel give the best disk perfor- The server system running Whisper machine, the performance of the other mance, and for media storage, a high- needs a local static IP address so that the systems are unaffected, since each com- capacity external USB drive or SD card other Odroid can locate it on the net- puter 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 steps necessary for building a typical address, also called DHCP reservation, of the video playback, causing video Home Media Center with two Odroids, is included in the wi-fi router’s adminis- artifacts, frame stuttering and audio de- using one Odroid as the media server trative panel. For example, using a stan- ODROID MAGAZINE 37 SETTING UP A 1080p HOME MEDIA CENTER

admin panel and setting a SSH, remote commands may be sent to static IP address. the server using the standard command To reserve the static IP ad- line interface to start and stop applica- dress, boot up Whisper with tions, reboot the system, and perform its ethernet port connected other administrative functions. In the to the router, then login to media center example below, it will be the router from any comput- used to launch the VNC server. er on the network. Follow Samba is a free software implemen- the manufacturer’s instruc- tation of the SMB/CIFS networking tions, setting the static IP ad- protocol, allowing remote file servers to dress for the Odroid running be mounted as local drives. For purpos- Whisper to a convenient and es of media sharing, the Samba server easy-to-remember number, enables 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 SSH nized to use “odroid” as the username and password. These passwords should dard home Cisco router, the admin page The two Odroid have three chan- be changed before moving on to the is accessed at 192.168.1.1 with a default nels of communication with each other, next step, but in the following screen- blank username and password of “ad- known as protocols. Each protocol pro- shots, the security remains unedited and min”. Some routers use 192.168.0.1, vides a different service to allow specific all password fields contain the default 10.0.0.1 or another similar address in- types of remote access to the host server’s value of “odroid”. stead. For specific instructions, refer disk, memory and peripheral resources: Setting Up to the router manufacturer’s website or VNC stands for Virtual Network 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 operating matching the options to those shown systems, including iOS, An- below. Choose an appropriately secure droid, Windows, Linux and password for desktop access which will OSX. Its wide appeal per- later be used in setting up the Android mits unique combinations bVNCFree client. like accessing a Windows Desktop Sharing configuration menu desktop from a Macintosh, running a Linux desktop from within Windows, or wirelessly controlling mul- tiple Odroids from an An- droid phone or iPad. SSH is a Secure SHell which creates an encrypted text-based connection be- tween two computers using a networked terminal. With

ODROID MAGAZINE 38 SETTING UP A 1080p HOME MEDIA CENTER

the shared directory to “/home/ odroid/Downloads” since this is the default save directory for Trans- mission, Firefox and Chromium. If using an external USB drive, con- figure all three applications to save to a shared Samba shared storage directory located on the external drive. Output of ifconfig command on the Whisper server Setting Up the Client As a double-check, verify that the IP Now that the server is ready, dis- address of the Whisper system matches connect the keyboard, mouse and the one selected in the DHCP Reserva- monitor, and connect them to the tion router setup by running Terminal Android Pocket Rocket client ma- from the Whisper desktop and typing chine. From now on, the Whisper serv- Pocket Rocket desktop contains JuiceSSH “ifconfig”. If the addresses don’t match, er will not need any peripherals except and bVNCFree, make good use of them it may be necessary to reboot Whisper in in the case of network or router failure. order to register it under the new IP ad- The server’s desktop, command line in- Connecting the dress stored in the router. terface, files, and CPU are all available to Finally, connect any large-capacity the Android Pocket Rocket client via the Client to the Server device to use as a shared directory for the SSH, VNC and Samba protocols. Launch JuiceSSH and select “Man- media files such as an external USB The initial connection between the two age Your Connections”, and match the drive to the Whisper server, and run the computers is via SSH, so that the VNC options shown in below figures, using “Samba” applet from the “Preferences” desktop server may be started, which then the static IP address registered with the menu. Match the options shown in Fig- allows the X11 desktop to be shared. After router in the first step. Advanced users ures 5-8, substituting the preferred stor- the Vino server loads, JuiceSSH remains may skip the SSH step by adding Vino as age directory for the one shown in the in the background while the Android ap- a Linux startup task. screenshot. For the purposes of run- plication called bVNCFree gives remote ning the stress tests detailed below, set 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 Once the server is connected, ConfigurationAfter the handshake options for bVNCFree has been estab- combinations that closely resemble JuiceSSH drops into the remote server’s those used in Windows and OSX. lished, the Whisper desktop opens up, scripting shell, known as the command allowing the Android client to take full line interface or command prompt. Esc: Close a popup window control of its storage, CPU and resourc- For convenience, Whisper includes a es. By also enabling the “Fit To Screen” local Vino script which automatically Control-W: Close the current window scaling option, the virtual system gives shares the current desktop using a sin- Control-T: Open a new browser tab the appearance that the server desktop gle command. Launch the VNC server is running natively on the local Odroid by typing “vino” at the SSH command Control-C: Copy client while simultaneously running An- prompt, and entering the root password droid applications. of “odroid”. Control-X: Cut Running the Media Control-V: Paste Server Control-A: Select all Now that the two systems are connect- ed, they are ready to perform some tough Tab: Navigate to next input field tasks to show off how well the networked Alt-Tab: Switch to another appli- machines handle a high volume of disk cation I/O. For comparison, Pocket Rocket will do all of the work on its own as an exam- Alt-Tab -> Alt-Esc: Return to the JuiceSSH after running the “vino” command ple of single-boxing. By stress testing the desktop (same as Home button) client system, the areas of improvement Mouse Right-click: Go to previous window or close become more apparent when many large a popup window if there’s one open files are processed at the same time. Keyboarding For the single-box test, download sev- Like a Pro As an example of keyboard naviga- eral files, start a few torrents, and watch an Before moving on to using the tion, you can press Alt-Tab, then Alt-Es- XBMC video using only Pocket Rocket. graphical X11 desktop, it’s important to cape to get back to the Android desktop Although the Android system performs become comfortable with the Android instead of clicking on the Home button well under medium to heavy load, there interface itself. To optimize the user with the mouse from within any An- will be brief moments during video play- experience, Android provides several droid application. back where the screen will stutter, or the keyboard shortcuts that permit quick audio will be out-of-sync due to spikes in window management and data sharing disk access. Because the eMMC or exter- functions while also alleviating the need nal drive has many applications competing for using the mouse. The Alt-Tab menu in Android Pocket Rocket

ODROID MAGAZINE 40 SETTING UP A 1080p HOME MEDIA CENTER

sion 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 Android desktop, instead of resorting The Whisper desktop, as viewed through the Android bVNCFree application to an intermediate file or email. 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 dual-box setup. This separation frees up several Odroid computers which offer a ES File Explorer’s LAN tab the processor cycles and disk usage on the dedicated web server, application devel- Android client so that the video player isn’t 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 system kickstarting downloads using the rTor- a few more, using the web browser and and video player have no competition rent command line interface. Further Transmission. for the local hard drive, overall per- customizations include enabling the web After one of the media files has fin- formance improves on the Android interface in XBMC and Transmission for ished downloading, press Alt-Tab to client since it has immediate access to true remote management, and installing switch to the Android video player, such as the hard disk, now that the media files a local Apache website for managing, XBMC, then play the file from the newly streams have been moved over to the sorting and displaying the media library added 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, is nation between the two systems is that Handbrake has also recently been port- to log into the Samba share using either ES the Android client remains responsive ed to the Odroid, which can be included File Explorer’s “LAN” tab and single-click at all times, while the Whisper server in the download process for converting a media file from the shared directory, or accomodates the increased disk activity media files to the preferred resolution by starting XBMC and logging into the in the background without locking the and codec before making them available Samba share using the XBMC interface. Android system’s resources. The dual- to the Android client. Notice that moving the downloads to box version of the Media Center per- the Whisper server allows the videos to forms better than the single-box ver-

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

ODROID MAGAZINE 42