™ Control Your Own Data with the Personal Cloud

Since 1994: The Original Magazine of the Linux Community OCTOBER 2013 | ISSUE 234 | www.linuxjournal.com EMBEDDED DIAGNOSE YOUR CAR WITH ANDROID TEST NEW BUILDS QUICKLY WITH A U-BOOT TRICK BUILD A PERSONAL COMPUTER OR SERVER WITH AN EMBEDDED SYSTEM + Shell Scripts and ImageMagick

HOW-TO: rss2email ZURB FOUNDATION Set Up Your A Simple Approach Design a Responsive Own BirdCam for Viewing RSS Feeds Web Site

LJ234-Oct2013.indd 1 9/20/13 11:50 AM Linux Journal_Layout 1 8/6/13 10:19 AM Page 1

Attend the Largest Dedicated Android Conference in the Universe!

SAN FRANCISCO November 12-15, 2013

Get the best real-world Android developer training anywhere! • Choose from more than 75 classes and tutorials • Network with speakers and other Android developers • Check out more than 40 exhibiting companies

“AnDevCon is a great opportunity to take your Android skills to the next level, get exposed to technologies you haven’t touched yet, and network with some of the best Android developers in the world.” —Joe Mitchell, Software Engineer, Quicken Loans

“It’s a blast learning and exchanging ideas with phenomenal speakers and cutting-edge experts who have the exp erience.” —Brad Holmes, Software Developer, uShip

Register Early and Save at www.AnDevCon.com

AnDevCon™ is a trademark of BZ Media LLC. Android™ is a trademark of Google Inc. Google’s Android Robot is used under terms of the Creative Commons 3.0 Attribution License.

A BZ Media Event Follow us: twitter.com/AnDevCon

LJ234-Oct2013.indd 2 9/18/13 4:08 PM LJ234-Oct2013.indd 3 9/18/13 4:08 PM OCTOBER 2013 CONTENTS ISSUE 234 EMBEDDED FEATURES 64 Be a Mechanic...with Android and Linux! Decode Your “Check Engine” light. Bill Childers

74 Create a Mini PC or Server with Olimex’s Olinuxino A13/A13Micro Build a capable Linux personal computer or server with a cheap embedded system. Ronald Kurniawan

91 A Handy U-Boot Trick U-Boot over LAN. Bharath Bhushan Lohray

ON THE COVER • Control Your Own Data with the Personal Cloud, p. 104 • Diagnose Your Car with Android, p. 64 • Test New Builds Quickly with a U-Boot Trick, p. 91 • Build a Personal Computer or Server with an Embedded System, p. 74 • Shell Scripts and ImageMagick, p. 36 • How-To: Set Up Your Own BirdCam, p. 48 • rss2email: a Simple Approach for Viewing RSS Feeds, p. 42 • Zurb Foundation—Design a Responsive Web Site, p. 26 Cover Image © Can Stock Photo Inc. / pzAxe

4 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 4 9/18/13 4:08 PM INDEPTH 104 The Personal Cloud What happens when you take all the functionality of enterprise commercial software and make it available to individuals? We’re about to find out. T.Rob COLUMNS 26 Reuven M. Lerner’s At the Forge Zurb Foundation

36 Dave Taylor’s Work the Shell Image Manipulation with ImageMagick

42 Kyle Rankin’s Hack and / Command-Line Cloud: rss2email

48 Shawn Powers’ The Open-Source Classroom It’s a Bird. It’s Another Bird! 64 114 Doc Searls’ EOF The First Personal Platform— for Everything IN EVERY ISSUE 8 Current_Issue.tar.gz 10 Letters 14 UPFRONT 24 Editors’ Choice 60 New Products 117 Advertisers Index 74

LINUX JOURNAL (ISSN 1075-3583) is published monthly by Belltown Media, Inc., 2121 Sage Road, Ste. 395, Houston, TX 77056 USA. Subscription rate is $29.50/year. Subscriptions start with the next issue.

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 5

LJ234-Oct2013.indd 5 9/18/13 4:08 PM Executive Editor Jill Franklin [email protected] Senior Editor Doc Searls [email protected] Associate Editor Shawn Powers [email protected] Art Director Garrick Antikajian [email protected] Products Editor James Gray [email protected] Editor Emeritus Don Marti [email protected] Technical Editor Michael Baxter [email protected] Senior Columnist Reuven Lerner [email protected] Security Editor Mick Bauer [email protected] Hack Editor Kyle Rankin [email protected] Virtual Editor Bill Childers [email protected]

Contributing Editors Ibrahim Haddad • Robert Love • Zack Brown • Dave Phillips • Marco Fioretti • Ludovic Marcotte Paul Barry • Paul McKenney • Dave Taylor • Dirk Elmendorf • Justin Ryan • Adam Monsen

Publisher Carlie Fairchild [email protected]

Director of Sales John Grogan [email protected]

Associate Publisher Mark Irgang [email protected]

Webmistress Katherine Druckman [email protected]

Accountant Candy Beauchamp [email protected]

Linux Journal is published by, and is a registered trade name of, Belltown Media, Inc. PO Box 980985, Houston, TX 77098 USA

Editorial Advisory Panel Brad Abram Baillio • Nick Baronian • Hari Boukis • Steve Case Kalyana Krishna Chadalavada • Brian Conner • Caleb S. Cullen • Keir Davis Michael Eager • Nick Faltys • Dennis Franklin Frey • Alicia Gibb Victor Gregorio • Philip Jacob • Jay Kruizenga • David A. Lane Steve Marquez • Dave McAllister • Carson McDonald • Craig Oda Jeffrey D. Parent • Charnell Pugsley • Thomas Quinlan • Mike Roberts Kristin Shoemaker • Chris D. Stark • Patrick Swartz • James Walker

Advertising E-MAIL: [email protected] URL: www.linuxjournal.com/advertising PHONE: +1 713-344-1956 ext. 2

Subscriptions E-MAIL: [email protected] URL: www.linuxjournal.com/subscribe MAIL: PO Box 980985, Houston, TX 77098 USA

LINUX is a registered trademark of Linus Torvalds.

LJ234-Oct2013.indd 6 9/18/13 4:08 PM ® has the tools to keep you afloat. Key Features:

• Dual Intel® Xeon® Processors 5600 Series TrueNAS® Unified Storage features the Intel® Xeon® Processor • Support for CIFS, NFS, iSCSI, and more 5600 series and supports high availability, remote replication, • Active Directory, LDAP, and NIS integration deduplication, encryption, compression, and snapshots. It has • Multi-Petabyte Scalability the tools to deal with any storage challenge you may face.

Intel, the Intel logo, and Xeon Inside are trademarks or registered trademarks of Intel Corporation in the U.S. and other countries.

Call iXsystems toll free or visit our website today! 1-855-GREP-4-IX | www.iXsystems.com

LJ234-Oct2013.indd 7 9/18/13 4:08 PM Current_Issue.tar.gz

Stealth Linux SHAWN POWERS

y favorite scene from The the Google Reader shutdown. One of Karate Kid (the original the things I love about Linux is that M from 1984, sorry, I’m old) there’s no single way to do anything. is when Mr Miyagi stops the Cobra While I want a bookmark to take me Kai sensei, John Kreese, from beating from RSS site to RSS site, Kyle shows up his defeated student. Miyagi is a us to have articles delivered via e-mail. small, feeble-looking old man, and If that sounds interesting to you, he has no need to prove to anyone check out his column this month for that he’s an awesome warrior. Linux instructions on how he does it. is much the same: awesome and Dave Taylor and I have a little unassuming. Linux is slowly but surely crossover with our columns this taking over the world, embedded into month, which is completely cell phones, televisions, wristwatches coincidental, but very aptly timed. and server rooms. Because Linux itself Dave explores the power of the isn’t a commercial entity, it doesn’t ImageMagick suite of tools used need to be flashy, and it doesn’t need in scripting. I follow later in the to brag. When it comes to embedded magazine with my column describing systems, Linux is “honking the nose” my homemade streaming Webcam of proprietary alternatives, just like Mr of “BirdTopia”, or “Backyard” Miyagi does to the bully. as others refer to it. I use some We start out our Embedded issue ImageMagick tools to manipulate the with Reuven M. Lerner’s column. This images pulled from my cell phones, month, Reuven explores an alternative all from scripts on my Linux server. to the extremely popular Twitter I’ve enjoyed creating my BirdCam Bootstrap. Zurb Foundation may setup more than most of my Linux sound like a character from Starcraft, projects, and I hope it inspires you but in fact, it’s a competitor to Twitter to try something similar! Bootstrap that is worth a look. Kyle The truly embedded portion of this Rankin takes the path less traveled as issue starts with Bill Childers and well this month with his solution to his article on interfacing with your

8 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 8 9/18/13 4:08 PM CURRENT_ISSUE.TAR.GZ

vehicle’s OBD system. Using Android with managing our personal, private and a fancy dongle, Bill explains how data in a world focusing on selling to get diagnostic information directly services? T.Rob explores that and from your car! If your “Check Engine” gives us a lot to consider. light suddenly pops on, but gives no Much like “cloud” computing, reason as to why, Bill’s article will be “embedded” computing has a fairly extremely helpful. Ronald Kurniawan flexible definition. One thing is goes one step deeper and shows how certain, however, and that is that to use an $80 embedded system from Linux is perfect for the embedded Olimex to create a desktop system, or world, however you define it. With even a complete server. Proving there’s its breathtaking variety of hardware more to the tiny embedded world support and unassuming happiness than just Raspberry Pi devices, Ronald living behind the scenes, the walks through the entire process for embedded market may be the vehicle getting a system running. Linux finally uses to take over the Most new embedded systems take world. Year of the desktop? Pshaw, advantage of the U-Boot system more like year of “the everything for starting up. Bharath Bhushan else”, with a little desktop on Lohray covers U-Boot and some the side! Although Linux may not of its features, along with a few have the marketing campaign, or tricks. Whether you need to boot ad campaigns of the proprietary your embedded device from an SD alternatives, much like Mr Miyagi, it card, a USB stick or even over TFTP, doesn’t need it. Just do the job, do it U-Boot can make modifications as well, and the rest will fall into place. simple as a device reboot. Bharath We hope you enjoy this issue (very walks through the process and likely reading it on your embedded gives configuration examples. And device); we certainly enjoyed putting finally, T.Rob talks about the future it together!■ of the Cloud—specifically, the Personal Cloud. While the fluid size Shawn Powers is the Associate Editor for Linux Journal. and burstable expansion of cloud He’s also the Gadget Guy for LinuxJournal.com, and he has computing has revolutionized the an interesting collection of vintage Garfield coffee mugs. way we think about server rooms, it Don’t let his silly hairdo fool you, he’s a pretty ordinary guy also has moved sensitive data out of and can be reached via e-mail at [email protected]. our personal control. How do we deal Or, swing by the #linuxjournal IRC channel on Freenode.net.

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 9

LJ234-Oct2013.indd 9 9/18/13 4:08 PM letters

Doc Searls replies: Coincidentally, I am a youth of 66 as well. So let’s toast staying young for the duration (clink!).

As I said, mostly I stay in private homes (all with free Internet connections) when I’m paying my own way. And, I like AirBnB. But the youth hostel idea is also a good one, and even cheaper. Thanks!

Cerberus, I In the August 2013 issue, Shawn Powers recommended the Cerberusapp application to track the Net Connectivity in Hotels location of your Android phone (see In Doc Searls’ article “Dear Hotels: his UpFront piece titled “Android Quit Being A-holes” in the August Candy: Hire a Cerberus to Find Your 2013 issue, he writes: “In the US Phone”). This is indeed a great app; and Europe, the expensive hotels thanks for sharing. are the ones with inconvenient connectivity deals....It’s the cheap However, you should be hotels that offer free Internet, just aware of the privacy policy like they offer free electricity, heat, (https://www.cerberusapp.com/ air conditioning and running water.” privacy.php): “LSDroid uses your personally identifiable, location... I’ve recently stayed in youth hostels in information...to create new features, northern Italy and in Alberta, Canada. promotions, functionality and They all had free Wi-Fi. Why would services....LSDroid uses cookies and anyone stay in an expensive hotel? log file information to...b) provide custom and personalized content, And, I’m a “youth” of 66—most youth advertisements and information; hostels seem to have no age limit. c) monitor the effectiveness of our —David Brown marketing campaigns....LSDroid

10 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 10 9/18/13 4:08 PM [ LETTERS ]

discloses aggregate, anonymous log access to the back issues—maybe that file and usage information in reports helps?—Shawn Powers to interested third parties....” Google Reader I just thought you and LJ readers I saw Shawn Powers’ article on should be aware of the privacy Google Reader via the Linux Journal implications when using the app. RSS feed (“The Google Giveth” in —Aviv the May 2013 issue).

Ugh! Thanks for pointing that out. Go to http://keepamericaatwork.com. Creepy indeed.—Shawn Powers I decided to do this when Google

Archive CD? I already own the 1994–2009 Linux Journal Archive CD. Is there a way to just download/purchase the issues from 7” Panel PC Ÿ ARM9 400Mhz Fanless Processor 2010 onward, or do I have to purchase Ÿ Up to 1 GB Flash & 256 MB RAM PPC-E7+ Ÿ 7" 800 x 480 TFT LED Backlit LCD another archive disk? Also, do you plan Ÿ Analog Resistive Touchscreen Ÿ 10/100 Base-T Ethernet to have another Linux and Amateur Ÿ 3 RS232 & 1 RS232/422/485 Port Ÿ 1 USB 2.0 (High Speed) Host port Radio issue? I enjoyed the January Ÿ 1 USB 2.0 (High Speed) OTG port Ÿ 2 Micro SD Flash Card Sockets 2010 issue. P.S. I enjoy the articles in Ÿ SPI & I2C ports Ÿ I2S Audio Interface w/ Line-in/out Linux Journal; keep up the good work. Ÿ Operating Voltage of 12 to 26 Vdc Ÿ Optional 2D Accelerated Video & Decoder —Micheal Trombley Ÿ Pricing start at $550 for Qty 1 2.6 KERNEL Designed and Manufactured in the USA the PPC-E7+ Compact The archive CDs are an all-or-nothing Panel PC comes ready to run with the Operating System installed on Flash. Apply power and watch the Linux X Windows User sort of thing. The intention isn’t to resell Interface appear on the vivid 7” color LCD. Interact with the PPC- E7+ using the responsive integrated touch-screen. Everything the same thing every year, but rather works out of the box, allowing you to concentrate on your application, rather than building and configuring device drivers. to provide a full archive for those folks Just Write-It and Run-It. hoping to catch up. They’re also nice www.emacinc.com/panel_pc/ppc_e7+.htm

for people like me who like to “collect Since 1985 OVER the whole set”, but I don’t think there 28 YEARS OF SINGLE BOARD are any plans to release incremental SOLUTIONS EQUIPMENT MONITOR AND CONTROL · · updates. That said, subscribers have Phone: ( 618) 529-4525 Fax: (618) 457-0110 Web: www.emacinc.com

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 11

LJ234-Oct2013.indd 11 9/18/13 4:08 PM [ LETTERS ]

Reader disappeared, so that I wouldn’t And, because I also have subscribed to be dependent on any system. Keep America At work via the e-mail subscription plugin, I automatically Basically, I host my own site, and I use get a copy of everything that gets a plugin called wp-o-matic that goes added via e-mail in case I become too out and grabs the RSS feeds that I busy to check the site itself. So far, it program it with. works like a champ.

Because I’m using WordPress, I can The downside is that if you’re categorize those feeds (look on the subscribed via the e-mail plugin, right-hand sidebar for the categories), and you add a bunch of new feeds, and now I can view articles by category you will get a bunch of e-mails or by searching. Most important, I can until it processes the new feeds, click on a day in the calendar and read but then because most places all feeds for that particular day. release only one or two articles

LINUX JOURNAL on your Android device Download app now in the Android Marketplace

www.linuxjournal.com/android

For more information about advertising opportunities within Linux Journal iPhone, iPad and Android apps, contact John Grogan at +1-713-344-1956 x2 or [email protected].

LJ234-Oct2013.indd 12 9/18/13 4:08 PM per day, it is very manageable. —Virgil At Your Service

Interesting concept. Over the past few months, I’ve SUBSCRIPTIONS: Linux Journal is available in a variety of digital formats, including PDF, written about a few ways to replace Google Reader, .epub, .mobi and an on-line digital edition, but creating a personalized blog that “writes itself” as well as apps for iOS and Android devices. Renewing your subscription, changing your based on subscribed feeds...that’s interesting. Of e-mail address for issue delivery, paying your invoice, viewing your account details or other course, it makes me want to have you add your subscription inquiries can be done instantly on-line: http://www.linuxjournal.com/subs. own RSS feed to your feed aggregation setup, E-mail us at [email protected] or reach to see if it blows itself up, but that’s just the us via postal mail at Linux Journal, PO Box 980985, Houston, TX 77098 USA. Please prankster in me coming out!—Shawn Powers remember to include your complete name and address when contacting us.

ACCESSING THE DIGITAL ARCHIVE: Cerberus, II Your monthly download notifications will have links to the various formats I often pass on Shawn Powers’ “Android Candy” tips and to the digital archive. To access the digital archive at any time, log in at to my wife. I did so this month for the Cerberus app, http://www.linuxjournal.com/digital. but then almost immediately saw this story: “Google LETTERS TO THE EDITOR: We welcome your Unveils Android Version of ’Find My iPhone’” letters and encourage you to submit them at http://www.linuxjournal.com/contact or (http://officialandroid.blogspot.com/2013/08/ mail them to Linux Journal, PO Box 980985, Houston, TX 77098 USA. Letters may be find-your-lost-phone-with-android.html). edited for space and clarity.

WRITING FOR US: We always are looking for contributed articles, tutorials and You might want to alert your users to this real-world stories for the magazine. development in next month’s LJ. An author’s guide, a list of topics and due dates can be found on-line: —Bob L. http://www.linuxjournal.com/author.

FREE e-NEWSLETTERS: Linux Journal editors publish newsletters on both Thanks Bob! This is especially interesting based on a weekly and monthly basis. Receive late-breaking news, technical tips and Aviv’s letter regarding Cerberus. It does mean I’ll be tricks, an inside look at upcoming issues reading the fine print on the Google solution before and links to in-depth stories featured on http://www.linuxjournal.com. Subscribe installing though, that’s for sure.—Shawn Powers for free today: http://www.linuxjournal.com/ enewsletters.

WRITE LJ A LETTER We love hearing from our readers. Please send us ADVERTISING: Linux Journal is a great resource for readers and advertisers alike. your comments and feedback via http://www.linuxjournal.com/contact. Request a media kit, view our current editorial calendar and advertising due dates, or learn more about other advertising PHOTO OF THE MONTH and marketing opportunities by visiting us on-line: http://ww.linuxjournal.com/ Remember, send your Linux-related photos to advertising. Contact us directly for further information: [email protected] or [email protected]! +1 713-344-1956 ext. 2.

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 13

LJ234-Oct2013.indd 13 9/18/13 4:08 PM UPFRONT NEWS + FUN diff -u WHAT’S NEW IN KERNEL DEVELOPMENT

There recently was a flame war on “People are different. I’m not polite, the linux-kernel mailing list that and I get upset easily but generally got some attention outside the kernel don’t hold a grudge—I have these community. It started when Greg explosive emails. And that works well Kroah-Hartman complained that for some people. And it probably people were sending patches for the doesn’t work well with you. And you stable series that didn’t belong there, know what? That’s fine. Not everybody and Linus Torvalds suggested he has to get along or work well with each learn how to yell at people more; then other. But the fact that it doesn’t work Sarah Sharp said that Linus shouldn’t with you doesn’t make it ’wrong’.” And be advocating abuse. he said that the issue was really about It turned out to be an interesting “how to work together DESPITE people culture clash. Sarah posed her argument being different. Not about trying to as, “Violence, whether it be physical make everybody please each other.” He intimidation, verbal threats or verbal gave the example of Sarah’s work with abuse is not acceptable. Keep it Greg, saying that they worked a lot professional on the mailing lists.” And, with each other, probably because they “In karate, or any other sport, if your did work well together, and that that opponent is motionless on the floor, was as it should be. you stop. You can’t see the person The debate went on for a bit, and you’re emailing. You can’t see if the ultimately the two of them, and others, first conversation-disabling blow has decided to continue the discussion at completely knocked them out. You can’t the upcoming Kernel Summit, over see if you’ve misjudged their mental cookies and pot brownies. strength for the day and completely The debate interests me personally wiped out their ability to use their brain because, on the one hand, no one to correct the technical mistake you’re should ever be abused. That’s what trying to get them to fix.” abuse is—something that shouldn’t Linus posed his response as being, happen. Otherwise, it’s just an activity.

14 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 14 9/18/13 4:08 PM [ UPFRONT ]

And on the other hand (in my opinion), Linus Torvalds is the one doing the not all of his “yelling” is really abuse. flaming. So I’m interested to see what For one thing, it’s an e-mail list, and kind of public pressure ultimately will there is a long and glorious history of come to bear on Linus to stop doing flame wars on e-mail lists. People aren’t something that’s really an ordinary required to participate, even when on-line activity.—ZACK BROWN

Non-Linux FOSS: Launchy!

that runs on Windows, OS X or Linux. It listens for a predefined keystroke and then pops up a search window. You start typing the application, (Image from http://www.launchy.net) document or media file you want to With Unity’s method for launching and start, and Launchy autocompletes based finding programs and applications, and on its index of your system. The main OS X’s spotlight tool becoming the new advantage is the ability to launch a way to launch programs, the entire way program without moving your fingers we think about launching programs is from the keyboard. changing. Although I still like to have a Launchy is fast, accurate and doesn’t few icon shortcuts on my task bar, many steal lots of resources on your system. folks prefer a quick keystroke to bring up I can’t find a way to make Windows Gnome-Do, or Unity’s launcher, or even behave this way on its own, so although OS X’s spotlight. If you’re one of those Launchy is cross-platform, it probably people, but can’t seem to find a smooth will be the most useful for Windows way to accomplish your launching on users. You can download your copy Windows, check out Launchy. today at http://www.launchy.net. Launchy is an open-source dæmon —SHAWN POWERS

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 15

LJ234-Oct2013.indd 15 9/18/13 4:08 PM [ UPFRONT ]

Own Your Data with OwnCloud

faint of heart, as it requires some PHP tweaking and really should be SSL-encrypted, but for anyone comfortable with configuring LAMP applications, it’s not insurmountable. Once your server I love Dropbox. I really do. With is installed, there are native syncing a Google AdWords campaign, applications for Windows, OS X, and $50 or so, I was able to Linux, Android and iOS. Because max out my free storage. That OwnCloud is hosted on your own means I have around 24GB of server, your space limitation is based free Dropbox storage to fiddle on your actual hard drive space! with. Granted, that’s a lot, but If you’ve ever wished your Dropbox in the grand scheme of things, data was hosted on your own 24GB isn’t very much space. servers, or if you just don’t have During the past few years, I’ve enough space, check out OwnCloud. mentioned several alternatives It not only supplies file syncing, but (like SparkleShare), but the new with its extendible infrastructure, kid on the block, OwnCloud, is it also can do calendaring, sharing a Web-based application that and pretty much anything else provides a plethora of cloud-based you’d want to do with cloud services. The most popular is its computing. Check it out today file syncing. at http://www.owncloud.org. Setting up OwnCloud isn’t for the —SHAWN POWERS

16 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 16 9/18/13 4:08 PM [ UPFRONT ]

Surf Safely with sshuttle

your system firewall to tunnel all (yes all) traffic through a remote SSH connection. The remote connection doesn’t even need administrator privileges, so your shell account at your Web host might suffice for securing your traffic in a hotel or coffee shop. sshuttle will even tunnel your DNS lookups, which In past issues, I’ve explained how to means your entire network interaction set up a SOCKS proxy with SSH. I’ve should be secure and encrypted. demonstrated how to tunnel traffic sshuttle is in many OS repositories, with SSH. I’ve even shown how to or you can downloaded it from circumvent a company firewall with https://github.com/apenwarr/sshuttle. SSH. I’ve never been able to use SSH With a simple sudo sshuttle completely as a VPN, however, and --dns -vvr username@server that’s always bummed me out—until 0/0, all your traffic will be encrypted I discovered sshuttle. and funneled through the remote Mind you, sshuttle isn’t a new server. Because DNS also is tunneled, program. It isn’t even a new concept. it means you won’t be vulnerable What it is, however, is pure awesome. to DNS poisoning either! Check out Basically, launching the sshuttle sshuttle today. You won’t be sorry. binary with root privileges will modify —SHAWN POWERS

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 17

LJ234-Oct2013.indd 17 9/18/13 4:08 PM [ UPFRONT ]

Mapping Your GIS Data

I’ve already looked at some GIS package management systems. If applications available on Linux. not, you always can download the Programs like GRASS and qgis sources and build it from scratch. provide a full set of tools to do It does depend on Python, among GIS. Sometimes, that’s really several other libraries, so you overkill though. You may just want need to do a bit of a dependency to display some data geographically dance. Binary downloads even are and create a map. For those cases, available for Windows and Mac there is Thuban, an interactive OS X, so you can point your geographic data viewer non-Linux friends to them. (http://thuban.intevation.org). If you don’t already have data Most distributions should have of your own, sources of public- a package available within their domain GIS data are available

Figure 1. Starting Thuban gives you a blank slate.

18 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 18 9/18/13 4:08 PM [ UPFRONT ]

on-line. Here are a couple: simply grabbed several of the data http://www.naturalearthdata. files available on-line. com/features and http://wiki. When you start Thuban, you end openstreetmap.org/wiki/Shapefiles. up with a completely blank slate The files available on these sites (Figure 1). The first step is to start will get you started with SHP files a new session, which you can do by that contain at least basic features selecting the menu item File→New for most of the world. Session (not much will change on the Thuban is not as flexible as full- screen). In order to start building your fledged GIS software and cannot map, you need to add layers that can handle very many data file formats. be manipulated. I started by selecting You can use SHP files, DBF database the menu item Map→Add Layer and files and various image file formats. adding in an SHP file to give me the In the screenshots for this article, I basic geographic attributes for my

Figure 2. Adding a new layer opens a file selection dialog where you can choose an SHP file.

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 19

LJ234-Oct2013.indd 19 9/18/13 4:08 PM [ UPFRONT ]

Figure 3. By default, Thuban just displays all of the data with a single symbol color.

home province of New Brunswick the Generate Class button. The (Figure 2). This includes several Generate Classification window different geographical items, such will pop up, where you can click as water, river banks and parks. The on the Retrieve From Table button default display is not very interesting to get a list of the possible values. yet (Figure 3). I accepted the default gray-scale You can edit the way a layer is mapping for the colors, giving four displayed either by double-clicking new entries in the layer properties. the layer within the list in the But this is not very interesting legend pane or by right-clicking either, yet. Selecting each of the the layer of interest and selecting new properties, you can edit the Properties. This will pop up a new symbol and change the colors for window (Figure 4). In this case, I each of the types (Figure 5). If you selected the “type” field within want to have a preview of what the classification pane. The easiest this will look like, you can click choice at this point is to click the Try button. If it doesn’t quite

20 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 20 9/18/13 4:08 PM [ UPFRONT ]

Figure 4. Each layer has a properties window where you can control how the data gets displayed.

look right, you always can click the has several different attributes to Revert button to undo the changes play with. For now, I selected four and try something else. different road types and highlighted Although every map begins with them with four different colors. a single layer, it is very rare that There is still a default color for any a single layer is enough to show road types other than the four I all the details you may want to selected. To make them go away have displayed. In this example, I on the map, you can select the don’t have any roads on my map. default property and simply make A separate SHP file is available that it transparent. Then, only the four has this information, however. So, I selected road types will show up. clicked on the menu item Map→Add Now the map is starting to look a Layer and added the file roads.shp. bit more interesting, and I need to Opening up the properties dialog start worrying about what order the shows that this particular SHP file layers are in.

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 21

LJ234-Oct2013.indd 21 9/18/13 4:08 PM [ UPFRONT ]

Figure 5. Using the Generate Class button is a shortcut to get you started.

Thuban will draw layers in the To manipulate the map itself, order they appear in the legend list, Thuban uses a sort of mode system. starting at the bottom and working To zoom in, you need to select the its way up. You can move a particular zoom button. Then, you either can layer up our down by selecting it and use click and drag to select a region then using the buttons at the top of to zoom in on or simply click a spot the legend pane. on the map to re-center and zoom Another type of layer you can use in. Once you have zoomed in, you is an image layer. Obviously, the can use the pan tool to move the image needs to be geo-referenced view window around the map to in some way. Thuban supports the highlight different regions. There geoTIFF file format. If you place are buttons to zoom you to specific your image at the bottom of the scales such that the entire map is layer list, you then can draw on top visible. This always takes you back of it with the data in the SHP files. to the default map view.

22 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 22 9/18/13 4:08 PM [ UPFRONT ]

Two tools allow you to work with individual They Said It elements from an SHP file. The first is an information tool that pops up a detail window for any element you select. The My home is not a second is a label tool. When you select an place, it is people. element, a dialog window pops up allowing —Lois McMaster you to select one of the properties to be Bujold displayed as a label. Once you have a map you’re happy with, The middle of you probably will want to save it for later the road is where use. Because Thuban works with sessions, all the white line of your work in generating the map will be is—and that’s saved as a session within Thuban, as long as the worst place you remember to save it by clicking the menu to drive. item File→Save Session. —Robert Frost But, this doesn’t help much if you want to use your map outside Thuban. There is The future will be an option to export a map as an SVG file by better tomorrow. using the menu item Extensions→Write SVG —Dan Quayle Map. This is not the most efficient output available, however. My simple example here Some have been blew up to more than 50MB for a single map thought brave with two layers. because they The other option is to print your map. were afraid to Although you can print to actual paper, run away. for a hard copy, you also can print to a file —Thomas Fuller using the generic PostScript printer. This generates a PostScript file that will be a Reading is bit more manageable. You also can convert no substitute this PostScript file to other formats with for action. relative ease. So, to get a PDF of your map, —Colleen you can print to a PostScript file and then Wainwright convert it to PDF with the ps2pdf utility. Now you have a map that you can share with friends and family.—JOEY BERNARD

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 23

LJ234-Oct2013.indd 23 9/18/13 4:08 PM [ EDITORS' CHOICE ]

Dude, Where’s EDITORS’ CHOICE My Car? ★ When my family moved to Grand Rapids, Michigan, last year, one of the biggest adjustments was dealing with city parking. While we usually remember what side of the mall we parked on, there was a time downtown that I couldn’t remember what parking garage we used, much less what level or spot. Thankfully, I had the parking ticket in my pocket, which included the address for the particular parking lot we used. Although we had to walk up 15 levels one by one to find the car, at least we knew it was there somewhere! If you’ve ever walked around a parking lot wondering if you were the victim of theft, or possibly going senile, Valet is the perfect app for you. It not only

24 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 24 9/18/13 4:08 PM remembers the GPS location of (Maybe that’s just me.) your parked car, but it also has In fact, Valet fills such a simple a timer to remind you of parking yet helpful purpose, it’s earned meter timing. Plus, if your car has this month’s Editors’ Choice award. Bluetooth connectivity, Valet will Its automatic tracking based on record where you left your car vehicle Bluetooth is really the without any interaction on your feature that puts it over the top for part. It just marks the location me. It’s the best $0.99 I’ve spent where Bluetooth disconnected, and in a while. You can find it at the it happily guides you back when Google Play store, or check out the you’ve finished spending your Web site: http://valetapp.co. paycheck at Teavana in the mall. —SHAWN POWERS

Linux JournaL on your e-Reader

Customized e-Reader editions Kindle and Nook editions FREE for Subscribers now available

LEARN MORE

LJ234-Oct2013.indd 25 9/18/13 4:08 PM COLUMNS AT THE FORGE

Zurb REUVEN M. LERNER Foundation Designing a responsive Web site? Zurb Foundation is a worthy competitor to Twitter Bootstrap.

I was recently speaking with a new in many ways. But it really hadn’t client about a consulting project, and registered much on my radar, and we were discussing the technologies I hadn’t paid much attention to it. we were going to use. I said, “So, I It turns out that I should have been assume that we’ll be using Twitter paying attention. Zurb is a worthy Bootstrap as a CSS framework, competitor to Bootstrap, and it has right?” Bootstrap, of course, is the some advantages that make it more open-source CSS framework written appropriate in some cases. in the LESS language that recently So in this article, I take a look at released its third version, which has Zurb Foundation, considering it both become wildly popular among Web as a standalone CSS framework and as developers. I’ve used Bootstrap on something you can use from within an a number of projects in the past application framework, such as Ruby few years, and I’ve been pleasantly on Rails. Zurb recently released version surprised to discover just how easily 4 of the Foundation framework, I could implement layouts, menus and although it is not as popular as and sidebars, as well as produce Bootstrap, the people who are using nice-looking tables and buttons. it seem to be quite passionate about I was surprised when the client its advantages. said, “No, we’re actually using Zurb Foundation.” Now, I had heard of Foundation Basics Foundation before. Zurb is a Web If you aren’t yet familiar with CSS design company based in California, frameworks, the idea is pretty whose Foundation framework straightforward. When you want to preceded and inspired Bootstrap lay out a Web application, you likely

26 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 26 9/18/13 4:08 PM COLUMNS AT THE FORGE

will want some headlines, some text, use Foundation. some sidebars, a menu and all sorts How can you use Zurb Foundation? of other design elements. You could Download the package. You have design the entirety of the layout, several options, but the easiest one classes and CSS from scratch each is to use the precompiled CSS files. time. Or, you could use predefined Go to the Zurb Foundation download styles, designed to work with all sites, site at http://foundation.zurb.com/ with a great deal of flexibility. download.php, and from there, Each modern CSS framework click on the button for “download functions in this same way. You put Foundation CSS”. text into divs and give each div a class If you want to change the defaults, indicating how many columns across you could download the SCSS version it should be, up to the maximum and do it that way. Alternatively, the number of columns defined by the good people at Zurb have provided framework. Foundation offers 12 a Web-based selection system, such columns, meaning that you can lay that you can indicate what parts of out your design in one very wide Foundation you want, as well as which column, two equally sized columns colors and styles. The CSS that you (6+6) or even something wilder, download then will be precompiled, such as 3+4+5. customized according to your needs. Foundation, like other modern If you download the simple CSS frameworks, goes way beyond version and open the resulting zipfile, just providing you with a nice a sample HTML page (index.html) grid. It also gives you control over will be at the top level of the navigation elements and forms, and folders. There also will be several even gives you some JavaScript- subfolders, whose names are fairly based elements for displaying self-explanatory: js (JavaScript), css images and dialog boxes. (stylesheets) and img (images). The bulk of Foundation is Looking at the HTML page, you implemented using SCSS, a modern can see that Foundation is loaded in implementation of SASS. SCSS five steps: is a superset of CSS that can be 1) First, you load the core Foundation compiled (using an open-source tool) CSS file: into regular CSS files. However, you don’t need to know SCSS in order to

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 27

LJ234-Oct2013.indd 27 9/18/13 4:08 PM COLUMNS AT THE FORGE

Now, this is definitely a long and I’ve covered Modernizr in this column complex CSS file. However, remember before; it allows you to test for certain that this defines all of the styles, HTML5 features and use alternatives for all of the aspects of Foundation. if the feature doesn’t exist. You can Moreover, this is the result of use Modernizr in your application translating the SCSS source into CSS; if you wish, but it’s loaded here so expressed as SCSS, the file is much that Foundation can handle different shorter and easier to understand. browser versions. 2) After loading the Foundation 3) Next, you load the JavaScript CSS file, you then load Modernizr. for Foundation. But here, things

Listing 1. Hello, world

Minimal Zurb Foundation file

Hello, world headline

Hello, world paragraph

28 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 28 9/18/13 4:08 PM COLUMNS AT THE FORGE

get a bit more interesting. Rather the page before loading and executing than a


This should constantly refresh

sure the image was actually fetched head. The key part of the script is from my server every couple seconds the JavaScript code, which defines an proved challenging. Listing 3 shows action for an image with a specific my final HTML file. ID. You can see the ID is “cam” in A large part of the top of the file the JavaScript and in the img tag shown in Listing 3 is just defining below. The peculiar part of the script the specific HTML standards in use. is the bit of random info after the I’ll be honest, most of it is over my photo URL. That’s actually the part

56 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 56 9/18/13 4:09 PM COLUMNS THE OPEN-SOURCE CLASSROOM

of the script that not only reloads 2500 milliseconds as the refresh time, the image every 2.5 seconds, but because it seems to work from most also loads the image with a ?rand=RANDOMNUMBER at the end. That’s basically me fooling the browser into thinking there is a new image to download every time, so I don’t get shown a cached image. There are several ways to do such a thing, but this proved to be the simplest and most cross-browser-friendly in my testing. There is concern of filling up caches or buffers on the server, but so far I haven’t experienced any issues.

The End! Or Is It? To fulfill my personal needs, the bash scripts and the bit of JavaScript really did all I needed. I can view the BirdCam from multiple computers in my house, and even from the Internet. Each “video frame” is around 600K, so although it still uses significant bandwidth, it’s nothing like trying to stream full video. I have noticed that with slow cellular connections, sometimes the image freezes, because it tries Figure 5. With the ability to view BirdCam to refresh before the original remotely, I can get some great shots, even image is loaded. I settled on when I’m not home!

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 57

LJ234-Oct2013.indd 57 9/18/13 4:09 PM COLUMNS THE OPEN-SOURCE CLASSROOM

locations (Figure 5). were worried about saturating my home If you visit my BirdCam now connection, fear not; I planned ahead. (http://birds.brainofshawn.com), you’ll probably notice I’ve done a little Winter Is Coming more tweaking. I’ve added a query If you set up a similar Webcam, I’d love to the local weather station, and I to hear about it. You’re also welcome to added the current temperature to the watch the exploits of my bird obsession annotation. The big change, however, as winter approaches. The bubbling is one you hopefully shouldn’t notice. bird bath soon will be replaced with a Because I knew I’d be sending this to tens of thousands of potential bird watchers, I figured I probably should scale my solution to the cloud. Granted, 5Mbit upload speed is decent, but not if 100 people are trying to check out my backyard! My simple solution was to replace the sleep command in the bird_update script with an scp command that uploads the bird.jpg file to my Web hosting provider. I still try to be a good netizen and upload the actual file to the ramdisk on my provider’s server, but with the .jpg file being served from the cloud, I’m not worried about an influx of bird watchers. If you Figure 6. Bird water just tastes better.

58 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 58 9/18/13 4:09 PM COLUMNS THE OPEN-SOURCE CLASSROOM

heated version, and I’ll be adding more making a MAME cabinet years ago. suet and peanuts for the winter birds. There’s just something about building If you happen to be watching, and see with Linux that warms my heart.■ a cool bird, don’t hesitate to send me the photo! I had a visit from an Indigo Shawn Powers is the Associate Editor for Linux Journal. Bunting one day that I saw via BirdCam, He’s also the Gadget Guy for LinuxJournal.com, and he has an but that was when I was using an old interesting collection of vintage Garfield coffee mugs. Don’t let iPhone, so the image is very poor quality. his silly hairdo fool you, he’s a pretty ordinary guy and can be BirdTopia attracts more than just birds reached via e-mail at [email protected]. Or, swing by too. While the occasional squirrel is the #linuxjournal IRC channel on Freenode.net. brave enough to visit, the most common non-aviary visitor is Zoey (Figure 6). I wish you an awesome weekend Send comments or feedback via project! I have enjoyed playing with http://www.linuxjournal.com/contact BirdCam almost as much as I enjoyed or to [email protected].

LJ234-Oct2013.indd 59 9/18/13 4:09 PM NEW PRODUCTS

NVIDIA CUDA

Version 5.5 is the latest and greatest iteration of NVIDIA CUDA, NVIDIA’s parallel computing platform and programming model that harnesses the power of GPUs. CUDA 5.5, sayeth NVIDIA, provides programmers with a robust, easy-to-use platform to develop advanced science, engineering, mobile and HPC applications on x86 CPU-based systems, and now on ARM-based ones as well. Beyond native support for ARM platforms, CUDA 5.5 delivers a number of new advanced performance and productivity features, including enhanced Hyper-Q support, MPI workload prioritization, and new guided, step-by-step performance analysis and fast cross-compile on x86. The latter feature enables developers to compile ARM code on fast x86 processors and transfer the compiled application to ARM. The v5.5 release also offers a full suite of programming tools, GPU-accelerated math libraries and documentation for both x86- and ARM-based platforms. http://www.nvidia.com

Gumstix’s Geppetto Platform Gumstix continues to add fire power and options to Geppetto, the company’s modular, drag-and-drop platform for designing and building customized single-board Linux solutions. The most recent enhancement to Geppetto involves the addition of the Texas Instruments Sitara AM3354 processor, which Gumstix says will offer more flexibility to users and raise Geppetto’s ability to enable a rapid go-to-market strategy for its customers. While designing a board using Geppetto, users simply drag and drop the processor onto a board and then connect the desired features to implement it. Fully assembled single-board computers are ordered at the touch of a button and arrive within 20 business days. Furthermore, notes Gumstix, Geppetto’s support for the Yocto Project build system makes it easy for developers to create a complete, portable solution with minimal time and effort. http://geppetto.gumstix.com

60 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 60 9/18/13 4:09 PM NEW PRODUCTS

Dan McCreary and Ann Kelly’s Making Sense of NoSQL (Manning Publications) NoSQL tools like MongoDB, Neo4j and Redis take innovative approaches to the unique problems of handling data in modern distributed and Web-based systems. The new book, Making Sense of NoSQL: A guide for managers and the rest of us by Dan McCreary and Ann Kelly, is a resource for learning about NoSQL solutions. According to publisher Manning Publications, the book clearly and concisely explains the concepts, features, benefits, potential and limitations of NoSQL technologies. Using examples and use cases, illustrations and plain, jargon-free writing, this guide shows how one can assemble a NoSQL solution to replace or augment a traditional RDBMS effectively. After reviewing database concepts alongside the new NoSQL patterns, authors McCreary and Kelly explore topics including Big Data, search, reliability, business adaptability, cloud computing, large CPU-count data centers and customized solutions. http://www.manning.com

Chris Strom’s 3D Game Programming for Kids (Pragmatic Programmers) What’s even better than playing games? Creating your own, of course. And thus you shall be so empowered if you digest the contents of Chris Strom’s new book 3D Game Programming for Kids: Create Interactive Worlds with JavaScript. Targeted at younger readers, Strom’s book illustrates how to create on-line games. Using nothing more than a browser and the language of the Web, JavaScript, readers will learn programming and visualize cool, 3-D results as they type. To make things easier for beginners, the kid-friendly ICE Code Editor was created especially for this book. Want a red donut? Make hundreds of them, spinning around like crazy, right next to the entered code. Readers can create games quickly by focusing on the project-based lessons. If they want to go further and understand the theory or mathematical functions, they can turn to the chapters that explain the programming concepts. http://www.pragprog.com

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 61

LJ234-Oct2013.indd 61 9/18/13 4:09 PM NEW PRODUCTS

Directory Wizards Inc.’s UnitySync

Into the big Linux tent we welcome Directory Wizards, whose UnitySync solution is now available on the Linux platform. UnitySync is a centralized service that synchronizes data between directories so that organizations enjoy a unified view of their disparate directories. Our sources at Directory Wizards say that UnitySync can scale from small directories with hundreds of objects to enterprise directories consisting of hundreds of thousands of objects without requiring extensive training or installation/ configuration time. UnitySync users can synchronize account information between different directories so that each directory contains a unified view of the other non-connected directories. In addition, users can define authoritative data sources, enabling one system to update individual attributes of existing objects of another. No scripting, programming or extra databases are required. The Windows Intel 32-bit platform also is supported. http://www.dirwiz.com

Coraid ZX4000 File Storage Appliance

Public cloud scalability, economics and resilience models are three macroforces affecting IT. Storage specialist Coraid’s response to these trends is the new ZX4000 File Storage Appliance, a storage building-block solution for both enterprise and cloud deployments that combines Flash performance, multi-petabyte scale and distributed resilience. Coraid suggests that the ZX solution’s unique architecture allows for a potentially limitless pool of elastic, shared, block storage that easily scales performance via the addition of more ZX appliances. The ZX4000 can be deployed in a resilient architecture that offers protection against up to three shelf or drive failures while retaining high storage efficiencies of around 80%. This enterprise-class storage solution, says Coraid, is available at a cost comparable to consumer-grade public cloud services and at a fraction of the cost of legacy NAS storage. Since its introduction in 2012, the ZX product line has been deployed by customers in a wide variety of applications including backup, public and private clouds, and media. http://www.coraid.com/products

62 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 62 9/18/13 4:09 PM NEW PRODUCTS

The Document Foundation’s LibreOffice

The Document Foundation proudly calls its new LibreOffice 4.1 office suite “not only the best but also the most interoperable free office suite ever”. The 4.1 milestone release features a large number of improvements in the area of document compatibility, which increases the opportunities of sharing knowledge with users of proprietary software while retaining the original layout and contents. Numerous improvements have been made to OOXML import and export filters, as well as to legacy Microsoft Office and RTF file filters. Other new interoperability- focused features include font embedding in Writer, Calc, Impress and Draw and import and export functions new in Excel 2013 for ODF OpenFormula compatibility. http://www.libreoffice.org

MWR InfoSecurity’s drozer The Android security testing framework formerly known as Mercury—and now called drozer—was released recently by MWR InfoSecurity. With drozer, companies using Android mobile devices now can safeguard their assets and IT infrastructure by running full, dynamic security assessments. A new drozer feature is the ability to compromise Android devices through publicly available exploits, something that helps organizations understand how a technical vulnerability on a mobile device can become a real threat to their business. Drozer unifies these publicly available exploits into a single framework and improves the quality of the exploitation code and payloads available to the penetration tester. Drozer provides support for any Android device running Android 2.1 and beyond, covering 99% of the devices in the market. The open-source tool is available to download from the MWR Labs Web site. http://www.mwrinfosecurity.com

Please send information about releases of Linux-related products to [email protected] or New Products c/o Linux Journal, PO Box 980985, Houston, TX 77098. Submissions are edited for length and content.

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 63

LJ234-Oct2013.indd 63 9/18/13 4:09 PM FEATURE Be a Mechanic...with Android and Linux! BE A MECHANIC... with ANDROID and LINUX!

“Check Engine Soon”—that little orange light on your car’s instrument panel is possibly one of the more annoying things about modern automobiles. Ever had it pop on during a trip and wonder whether it was just something mundane, like your gas cap being loose, or whether it’s something deathly serious and a piston could come shooting out the side of your engine block at any time? Well, thanks to an inexpensive little piece of hardware and an Android tablet, I’ll help you decode that little orange light in your car.

BILL CHILDERS

64 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 64 9/18/13 4:09 PM he human race has had in 1996, and with that, we’ve got automobiles for more than the system in place today: OBD-II T 100 years now, but we’ve (Onboard Diagnostics, 2nd revision). had computer monitors and control engine operation only for around OBD-II Basics 30 years or so. The first computer Any car sold in the United States controls were primitive, hard to work after 1996 uses the OBD-II computer with and expensive. Each automotive system, so the majority of cars on manufacturer had its own computer the road today have this system. systems, protocols, connectors and Thanks to OBD-II’s standardization and trouble-code definitions. I worked as age, lots of tools have been released a mechanic during the late 1980s and to work with the system. Because early 1990s, and I remember those OBD-II defines the connector and systems well—not fondly, of course, protocol, that means you need both a but well. Some of those systems hardware device to interface with the required you to do crazy things like connector and some software to speak jump a connector with a piece of wire, the protocol. then turn the key on and off three The hardware I use is the Soliport times and observe the Check Engine ELM327 Bluetooth OBD-II Scanner light as it flashed on and off. You’d (see the Amazon link in the Resources have to count the number of flashes section of this article). It’s a very accurately and then look up the inexpensive (less than $20) dongle “trouble code” that flashed in that plugs in to the OBD-II port under a service manual, and you might get your dashboard, draws its power a clue as to what was wrong with directly from the car and converts the the vehicle. Those early diagnostic OBD-II-specific signals to serial-over- systems made seasoned mechanics Bluetooth. There are other OBD-II scan who were used to troubleshooting tools on the market. Some are just the machinery of an engine rather plain-old cables to hook straight into than its electronics shudder a computer’s RS-232 serial port, and with trepidation. Over time, the others are as fancy as full-on bridges manufacturers made the systems to a Wi-Fi network. And, there are better. The Society of Automotive other manufacturers of Bluetooth Engineers made the connector, OBD-II scan tools, but just make sure protocol and trouble codes a standard whatever you get is based on the

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 65

LJ234-Oct2013.indd 65 9/18/13 4:09 PM FEATURE Be a Mechanic...with Android and Linux!

ELM327 chipset. Another piece of hardware you’ll need is a computer of some kind. Any Linux-powered laptop with Bluetooth will suffice, but the form factor is kind of clunky when you’re dealing with a cramped automotive cockpit. (See the Using a Laptop to Scan Your OBD-II System sidebar if you want to use a laptop.) My personal preference is to use an Android device to interpret the signals coming from the OBD-II system in the car. I use a Nexus 7 tablet for this, but any Android device should work. I’ve used a Motorola Droid RAZR and the very first HTC G1 Android phone for this as well. Software-wise, my choice for this on Android is Torque, an excellent app that not only can collect all the OBD-II stats, but also graph and log them in myriad ways. (There’s also a free version, Torque Figure 1. Tools of the Trade: a Nexus 7 Tablet and a Lite, that has a fair deal of Soliport Bluetooth OBD-II Scanner the functionality of the full

66 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 66 9/18/13 4:09 PM Using a Laptop to Scan Your OBD-II System

Although it’s possible to use a laptop to do the same duty as an Android device, it’s a little more involved, as the Bluetooth protocol stack on a Linux laptop requires some more massaging than simply pairing up an Android device. However, if you’re comfortable with the command line and Bluetooth commands like rfcomm, it’s absolutely possible, and there are some good OBD-II packages like pyobd and openobd. You won’t get some of Torque’s value-add features, like accelerometer and GPS integration, but you still can use the laptop for diagnostic purposes and data logging.

Using an Old Nokia Internet Tablet to Scan Your OBD-II System

In the December 2008 issue of LJ, I wrote an article called “Hacking the Nokia Internet Tablet”, and I talked about ways to hack and extend the Nokia N800 tablet. It turns out there’s an application for the N800 and N810 called Carman that was designed to work with wired OBD-II adapters, but it works just fine with the Soliport Bluetooth Scanner. Carman used to be in the Maemo repositories. I no longer have a working N800, so I can’t check that now, but when my N800 did work, I used it a few times to diagnose the car. So, if you’ve got a Nokia device sitting in a drawer gathering dust, pull it out and put it to use!

version.) Grab either one from the perhaps, as it’s very easy to make a Google Play store. mess of things). Flashing your car’s Note that this solution is for read- computer with a new fuel curve or only access to the OBD-II system in ignition timing map is a nontrivial the car. You can’t modify the running exercise that requires an adapter with parameters of the vehicle with this different voltage levels and different adapter, unfortunately (or fortunately, software. So, don’t worry about

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 67

LJ234-Oct2013.indd 67 9/18/13 4:09 PM FEATURE Be a Mechanic...with Android and Linux!

breaking your car with this solution—you’re just “peeking under the hood”.

Using Torque and the Soliport Bluetooth Adapter The Soliport adapter comes with a little CD-ROM in the box, but it’s not required for use with an Android device. To get started, you first need to find the OBD-II port in your car. In most cars sold in the United States, the port is under the dash on the driver’s side of the car. Find the port, and plug the Soliport in to it. Next, start the car, because the Figure 2. The Torque Home Screen

68 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 68 9/18/13 4:09 PM OBD-II port isn’t powered until the as before, then select “Vehicle car’s ignition is on. (Make sure your Profile” and “Create new profile”. garage door is open, please. I don’t Then, fill in the pertinent information want to receive hate mail from your about your vehicle. This information relatives on how you suffocated from is used by Torque to compute carbon monoxide poisoning!) Next, things that can be calculated, like you need to go through the standard horsepower, fuel economy and other Bluetooth pairing process to pair metrics. When you’re done, go back your Android device to the Soliport to the main screen. adapter. (The pairing code is 1234 if you can’t find it in the instructions— Checking for Fault Codes coincidentally, it’s the same Let’s start by doing basic diagnostics combination that’s on my luggage.) on your car. From the main screen, Once you’ve got your Android select Fault Codes, then press the device all paired up to the Soliport, large magnifying glass to start a scan you’re ready to fire up Torque. Start of your car’s computer for trouble Torque on your Android device, and codes. If your Check Engine light is you’ll be greeted with the Torque on, you’ll probably find your issue main screen. represented as a code here. My father’s 2001 Chevy Silverado pickup Setting Up Torque was showing a Check Engine light, Now that you have Torque up, select and I ran a quick scan on it with the little “settings” slider on the Torque. It resulted in a trouble code of bottom left of the screen, and select P1416. A quick Google search of that “OBD2 Adapter Settings”. Set the trouble code showed that it was the connection type as Bluetooth, and Secondary Air Valve, Bank 2. It turned choose the Soliport if prompted. Go out that was a little smog system valve back to the main settings screen and right on top of the engine, on the select your desired units (Imperial or passenger side. Amazon.com had that Metric), and any other preferences particular part for $37, and we had it you choose, then flip back to the at his house in two days. Torque main screen. I had the Check Engine light on my Next, you’re going to create a wife’s Durango pop on not long after, “profile” for your vehicle. Select the and I used the tool to scan her car. settings slider from the main screen Her car came back with a P0440 code,

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 69

LJ234-Oct2013.indd 69 9/18/13 4:09 PM FEATURE Be a Mechanic...with Android and Linux!

which means “Evaporative Emission Control System Malfunction”. I searched a bit more on the Internet and found that the most common cause of this code is a broken or mis-installed fuel filler cap. It turned out that was exactly the case—her fuel filler cap wasn’t tightened all the way. I tightened the cap and cleared the code via the Torque app, and it never returned.

Getting Performance Data Those two cases listed above more than paid for the cost of the Soliport adapter and the Figure 3. Torque’s Virtual Instrument Panel

70 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 70 9/18/13 4:09 PM Torque application, but Torque can do can be handy on long trips. so much more. Torque can pull data Torque also has other features, from sources other than your OBD-II like the ability to log your data for sensors. It also can poll your Android future analysis. It also can graph that device’s accelerometer and GPS. data and correlate it to your GPS This means it can do performance position and accelerometer data. calculations, such as 0–60 mph time This can be useful if you happen to (or 0–100 kph time), 1/4 mile time or be an amateur racer and would like even horsepower calculations. This to get information about your car’s requires that you get your car’s data performance at certain points on the entered correctly into the vehicle racetrack. Most people won’t need profile during setup time, particularly that ability, but it’s nice to know that the vehicle weight (including your the developer of Torque thought that weight as driver, and any other stuff out. All the data necessary to do those you may have inside the car). If you do performance testing, make sure you’re doing it safely—and don’t violate any laws in your locality. However, I think one of the coolest New on things that Torque and the Soliport LinuxJournal.com, adapter can do is they can act as an auxiliary instrument panel for the White Paper your car. Any bit of information that Library passes through the OBD-II sensors can be logged, graphed or placed on a digital dial. You can pick and choose how you want that information presented as well—including the size and position of the graphs and dials. This information can be extremely valuable, for instance, displaying the current engine manifold vacuum. As a general rule, under cruise conditions, higher manifold vacuum means higher fuel economy, so having this gauge up www.linuxjournal.com/whitepapers

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 71

LJ234-Oct2013.indd 71 9/18/13 4:09 PM FEATURE Be a Mechanic...with Android and Linux!

calculations is there, it just needs to fool you—like the computers you’re be glued together. already familiar with, an automobile is just a collection of technology and Closing machinery, and you can troubleshoot Computer control systems in cars used it just like a computer.■ to be mysterious, overly complicated, finicky pieces of technological voodoo Bill Childers is an IT Manager in , where he lives to even the most seasoned mechanic. with his wife and two children. He enjoys Linux far too much, and Scan tools were proprietary and cost probably should get more sun from time to time. thousands of dollars, and mechanics needed a special tool for each car manufacturer. With the advent of OBD-II and inexpensive computers, it’s Send comments or feedback via now easy to de-mystify and diagnose http://www.linuxjournal.com/contact your car. Don’t let the strange terms or to [email protected].

Resources

Soliport ELM327 Bluetooth OBD-II Scanner: http://www.amazon.com/Soliport-Bluetooth-OBDII-Diagnostic-Scanner/dp/B004KL0I9I

Torque Android OBD-II Scanner App: https://play.google.com/store/apps/details?id=org.prowl.torque&hl=en

Torque Lite (FREE) Android OBD-II Scanner App: https://play.google.com/store/apps/details?id=org.prowl.torquefree&hl=en

OBD-II Trouble Code Lookup: http://www.obd-codes.com/trouble_codes

PyOBD Home Page: http://www.obdtester.com/pyobd

OpenOBD Home Page: http://sourceforge.net/apps/mediawiki/openobd/index.php?title=OpenOBD

Carman on the Nokia N800: http://tabletblog.com/2007/02/carman-bluetooth-elmscan-5-and-n800.html

72 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 72 9/18/13 4:09 PM NOVEMBER 3-8, 2013 • WASHINGTON, D.C.

27th Large Installation System Administration Conference

Keynote Address: “Modern Infrastructure: The Convergence of Network, Compute, and Data” by Jason Hoffman Join us for 6 days of practical training on topics The 3-day Technical Program includes: including: Plenaries by Hilary Mason, bitly, and SRE Classroom: Non-Abstract Large Todd Underwood, Google System Design for Sysadmins by John Invited Talks by industry leaders such Looney, Google as Ariel Tseitlin, Netflix; Jeff Darcy, Red Root Cause Analysis by Stuart Kendrick, Hat; Theo Schlossnagle, Circonus; Matt Fred Hutchinson Cancer Research Center Provost, Weta Digital; and Jennifer Davis, PowerShell Fundamentals by Steven Yahoo! Murawski, Stack Exchange Paper presentations, workshops, vendor Introduction to Chef by Nathen Harvey, exhibition, posters, Guru Is In sessions, Opscode BoFs, and more! New for 2013: The LISA Lab Hack Space! Register by October 15 and save. Additional discounts are available! www.usenix.org/lisa2013 Sponsored by in cooperation with LOPSA

LJ234-Oct2013.indd 73 9/18/13 4:09 PM lisa13_luckylisa_LJ_091013.indd 1 9/10/13 4:47 PM FEATURE Create a Mini PC or Server with Olimex’s Olinuxino A13/A13Micro

Create a Mini PC or Server with Olimex’s Olinuxino A13/A13Micro STEP-BY-STEP INSTRUCTIONS ON HOW TO CREATE A PERSONAL COMPUTER OR EVEN A SMALL SERVER WITH THIS GREAT EMBEDDED SYSTEM FOR LESS THAN $80 US!

RONALD KURNIAWAN

74 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 74 9/18/13 4:09 PM limex is a Bulgarian Arm and eabihf more than once. company known for Let me clarify those terms in order its innovative hobbyist to avoid confusion with other terms products. It has a wide that you might encounter if you array of microcontroller- decide to go further into the world of based products, ranging cross-compilation. fromO the small Arduino clones to Arm is a general name for a family the very able system that has the of microcontroller architectures Allwinner A13 microcontroller as its designed by ARM Holdings, a brain. In this article, I describe how British company. You can find Arm you can create a working Linux system microcontrollers inside most portable for the Olinuxino A13 and Olinuxino modern gadgets, ranging from A13Micro from scratch. mobile phones, Nintendo DS portable Let’s begin by obtaining and game consoles to Apple iPhone and compiling the kernel, creating the Apple TV. ARM Holdings does not U-Boot system, preparing the root manufacture these microcontrollers; filesystem and getting the necessary rather, it licenses the designs to other packages to create a comfortable companies. These companies then add minimal computing environment. their own “secret recipes” into the At the end of this article, I also designs and then manufacture and sell explain how to install a compact the finished microcontrollers. This is desktop environment. why there are so many variants of Arm I am using Ubuntu 12.04 (Precise architecture and so many companies Pangolin) for my build system. Any that produce Arm microcontrollers. Debian-based system users should be EABI stands for Embedded able to follow the instructions in this Application Binary Interface. It article with relative ease. Before you specifies the low-level conventions begin, you should create a directory for embedded software under your home directory to contain application. When it comes to Arm all your work. I am going to call mine microcontrollers, they come in many “A13System”. sizes, ranging from very small to large. The smaller variants don’t have What Are Arm and eabihf? the necessary memory or power to As you progress further into the process floating-point computation article, you will encounter the terms on the hardware itself, thus making it

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 75

LJ234-Oct2013.indd 75 9/18/13 4:09 PM FEATURE Create a Mini PC or Server with Olimex’s Olinuxino A13/A13Micro

necessary to do it by software. These n uboot-mkimage. variants are called Arm soft float. There are other variants that can n git. process the floating-point calculation by hardware, like vector floating n debootstrap. point (vfp). These two EABIs (soft float and vfp) are what is usually n debian-archive-keyring (if you known as armel. A newer EABI decide later that you want to use that targets the higher end of Arm Debian rootfs). microcontrollers with more efficient floating-point instructions than vfp is n qemu-user-static. called hard float, thus armhf. Olimex’s A13WiFI, A13 and Once you finish installing the A13Micro boards are powered by the prerequisites, you then need to create Allwinner A13 Arm microcontroller, several softlinks in the same directory which are based on ARMv7 design. where gcc-4.6-arm-linux-gnueabihf is ARMv7, as with the newer ARMv8, installed (in my case, it is located in fully supports armhf. /usr/bin). Use the which command to find the installation directory: Prerequisites You can find all the necessary $ which arm-linux-gnueabi-gcc-4.6 URLs for file downloads and other information in the Resources section Next, create softlinks for of this article. You need to install the arm-linux-gnueabihf-gcc-4.6, following programs before you can arm-linux-gnueabihf-gcov-4.6 and commence the build process: arm-linux-gnueabihf-cpp-4.6:

n build-essential. $ sudo ln -s /usr/bin/arm-linux-gnueabihf-gcc-4.6 \

/usr/bin/arm-linux-gnueabihf-gcc

n gcc-4.6-arm-linux-gnueabihf (the $ sudo ln -s \ version might vary from one distro to /usr/bin/arm-linux-gnueabihf-gcov-4.6 \ another; the latest I came across at /usr/bin/arm-linux-gnueabihf-gcov the time of this writing is version 4.7). $ sudo ln -s /usr/bin/arm-linux-gnueabihf-cpp-4.6 \

/usr/bin/arm-linux-gnueabihf-cpp n ncurses-dev.

76 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 76 9/18/13 4:09 PM Preparing the Kernel and U-Boot if everything goes correctly, you The good people at Linux Sunxi are should end up with u-boot.bin and kind enough to share the kernel spl/sunxi-spl.bin. and U-Boot code tailored to run on Go to the kernel source directory. Allwinner chips. You have the option Check the configuration directory of getting and compiling version ($KERNEL_DIR/arch/arm/configs) 3.0 or 3.4 of the Linux kernel. The for the A13 configuration file compilation procedures are similar. (a13_defconfig) or A13Micro For the purpose of this article, I am (a13om_defconfig). If you do not using kernel version 3.4. Get the have the configuration file for kernel and U-Boot source from Linux A13Micro (which is usually the Sunxi’s GitHub repository: case), you can find the download URL in the Resources section. $ git clone -b sunxi-3.4 Now you need to check the https://github.com/linux-sunxi/linux-sunxi.git configuration file for a specific line. $ git clone -b sunxi I learned the hard way that without https://github.com/linux-sunxi/u-boot-sunxi.git this line, the compilation will fail. Add the following line to your Let’s compile U-Boot first. configuration file if it does not exist Depending on the target system or uncomment it: (A13 or A13Micro), go to the U-Boot directory and issue the CONFIG_GPIOLIB=y following command: Once again, depending on the $ make a13-olinuxino \ target system, issue one of these CROSS_COMPILE=arm-linux-gnueabihf- sets of commands to compile the kernel source: or: $ make ARCH=arm a13_defconfig $ make a13-olinuxinom \ $ make menuconfig CROSS_COMPILE=arm-linux-gnueabihf- or: Note: the dash (-) at the end of the commands are not typos. $ make ARCH=arm a13om_defconfig After the make process finishes, $ make menuconfig

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 77

LJ234-Oct2013.indd 77 9/18/13 4:09 PM FEATURE Create a Mini PC or Server with Olimex’s Olinuxino A13/A13Micro

Figure 1. Selecting Power Management Options

The last step allows you to There is a special step you should customize your kernel. In order adhere to if you are compiling to avoid a long and painful the kernel for A13Micro boards. debugging process, always make You need to remove the option to sure you are able to compile “Suspend to RAM and standby”, the minimal kernel (that means which is located under “Power compiling without any options Management options”. A13Micro added) successfully first. Once you boards do not support this option. succeed, you can add more options If you are planning to use any of to your kernel. Note any options the board’s GPIO pins, make sure you add to the kernel configuration, that you select “An ugly sun4i as it will aid you in figuring out gpio driver” option under “Device which feature(s) does not work. Drivers” and “Misc devices”.

78 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 78 9/18/13 4:09 PM Figure 2. Uncheck Suspend to RAM and Standby

Figure 3. Selecting Misc Devices under Device Drivers

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 79

LJ234-Oct2013.indd 79 9/18/13 4:09 PM FEATURE Create a Mini PC or Server with Olimex’s Olinuxino A13/A13Micro

Figure 4. Realtek 8192C Driver as a Module

Figure 5. Networking Support Option

80 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 80 9/18/13 4:09 PM Figure 6. Make sure that TCP/IP networking is selected.

I also plan to use Olimex’s Stick module. The driver I used for MOD-WIFI USB Stick Module2 that this Wi-Fi device was “Realtek 8187 adds the Wi-Fi capabilities to the and 8187B USB support”. board. To do that, you need to You also have to make sure that include the driver for the module, TCP/IP is selected and included in which is called “Realtek 8192C USB the kernel. Tick Networking Support Wifi for SW” and is located under and press Enter to select it. “Device Drivers/Network device Go inside Networking options support/Wireless LAN”. You are and make sure that TCP/IP networking welcome to experiment with other is selected. Wi-Fi devices. I can vouch that I Once you are satisfied with your successfully run the A13 board with configuration, save it and go back the Netgear WG111v2 USB Wifi to the command prompt. Issue the

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 81

LJ234-Oct2013.indd 81 9/18/13 4:09 PM FEATURE Create a Mini PC or Server with Olimex’s Olinuxino A13/A13Micro

following commands to compile the pull the basic filesystem structure kernel and build the drivers: from a Debian repository. You are free to use a repository that is closer $ make ARCH=arm \ to you, rather than the same one CROSS_COMPILE=arm-linux-gnueabihf- uImage I use in this example. Enter the $ make ARCH=arm \ following as root or using sudo, CROSS_COMPILE=arm-linux-gnueabihf- \ inside your newly created directory: INSTALL_MOD_PATH=out modules

$ make ARCH=arm \ # debootstrap --foreign --arch armhf wheezy \

CROSS_COMPILE=arm-linux-gnueabihf- \ /home/user/A13System/debian-rootfs \

INSTALL_MOD_PATH=out modules_install http://ftp.debian.org/debian

When the compilation finishes, Note that the resulting structure you will end up with the kernel is still not a complete filesystem. image in $KERNEL_DIR/arch/arm/ The next step is to create a chroot boot/uImage and the modules and system within your new directory. drivers in $KERNEL_DIR/out/lib/ For those of you who are not modules/$KERNEL_VERSION. familiar with chroot, this command The next step is to prepare a effectively creates an isolated system minimal filesystem for your board. within your “host” system: The easiest option I’ve found so far is by using the root filesystem # cp $(which qemu-arm-static) \ from the Debian project or Ubuntu, /home/user/A13System/debian-rootfs/usr/bin as both distributions provide # mount -t proc proc \ armhf binaries for the essential /home/user/A13System/debian-rootfs/proc applications. I explain how to # chroot /home/user/debian-rootfs /bin/bash prepare both options next. I have no name!# ./debootstrap/debootstrap \ Preparing the Filesystem: --second-stage Debian Wheezy Start by creating a new directory Copy the qemu-arm-static binary for your root filesystem. For into your root filesystem’s /usr/bin the sake of clarity, I call mine directory. The qemu-arm-static debian-rootfs. You’ll use an binary helps run the armhf binaries application called debootstrap to from your x86/64-bit systems. You

82 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 82 9/18/13 4:09 PM also need to mount the deb http://ftp.debian.org/debian wheezy-updates \ host’s proc filesystem into your main contrib non-free chroot system. When you first deb-src http://ftp.debian.org/debian \ get inside the chroot system, wheezy-updates main contrib non-free you might find a strange prompt greeting you (“I have no name!”). deb http://security.debian.org/ wheezy/updates \ This is not a cause for concern, main contrib non-free and you can safely disregard it. deb-src http://security.debian.org/ \ Once you are inside your chroot wheezy/updates main contrib non-free system, execute another call to debootstrap to complete the base Preparing the Filesystem: Ubuntu system (with --second-stage). If you are feeling adventurous, you If you are curious whether you always can try to debootstrap your really are running an armhf system Ubuntu root filesystem, just like I within your chroot system, issue described in the previous section. the uname command to check. If (You also can find instructions on you see something like “armv7l” the Internet for that.) Here, let’s somewhere in the output, it is opt for an easier way and just an indication that your chroot is download a ready-made minimal running the armhf system. root filesystem provided by Ubuntu. The next step is to update your Several packages are available, apt source list file. Within your including Ubuntu 12.04, 12.10 chroot system, or using the build and 13.04. Make sure that you are host’s editor, go and edit the file downloading the armhf version of /etc/apt/sources.list that resides the root filesystem package. inside your root filesystem directory. Create a directory for your Add the following lines to this Ubuntu root filesystem and extract file (remember, you can use other the contents of the file you just Debian repositories as well): downloaded into it. Your next move should be to edit /etc/resolv.conf and deb http://ftp.debian.org/debian wheezy main \ add your nameserver in there. Also, contrib non-free take a look at your sources.list file deb-src http://ftp.debian.org/debian wheezy main \ in /etc/apt/. You might want to add contrib non-free universe and multiverse at the end of each deb and deb-src line.

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 83

LJ234-Oct2013.indd 83 9/18/13 4:09 PM FEATURE Create a Mini PC or Server with Olimex’s Olinuxino A13/A13Micro

You should check the version chroot system: number of your qemu-arm-static. Version 1.0.50 that comes with root@host:/# apt-get update standard install of Ubuntu 12.04 root@host:/# apt-get install apt-utils ncurses-dev generates errors when running the root@host:/# apt-get install dialog locales tzdata following steps on my build system root@host:/# locale-gen en_AU en_AU.UTF-8 for the Ubuntu root filesystem. To root@host:/# dpkg-reconfigure locales solve the problem, I had to compile root@host:/# dpkg-reconfigure tzdata my own qemu-arm-static. I used root@host:/# apt-get install iputils-ping \ version 1.0.91 (see Resources for wpasupplicant dhcpcd5 sudo openssh-server ntp \ the download URL of the source openssh-client package). Do the following steps to root@host:/# apt-get install nano vim gettext \ configure and compile the binary, bison automake autoconf and copy the resulting qemu-arm to root@host:/# apt-get install python rsyslog \ qemu-arm-static inside your Ubuntu network-manager alsa-utils root filesystem’s /usr/bin directory: Now let’s configure Wi-Fi $ ./configure \ connectivity. I’m assuming that you’re --prefix=/home/user/A13System/qemu-arm-static \ using a Wi-Fi USB adapter for your --static --disable-kvm \ connectivity and that your wireless --target-list=arm-linux-user network connection configuration is using WPA for security. Change $ make the steps accordingly for your $ make install configuration. Edit your /etc/network/ interfaces and add the following Finishing Touches for the lines, changing the values as needed: Root Filesystem What you have so far is just a very auto wlan0 basic filesystem. Now let’s improve iface wlan0 inet dhcp it so that you have the tools wpa-ssid YOUR_ESSID required for a comfortable basic wpa-psk YOUR_PASSPHRASE computing environment. Change the locales generated according to Next, if you want your bash shell your own locale. All the processes to have autocompletion, edit /etc/ described next are done inside the bash.bashrc and uncomment some

84 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 84 9/18/13 4:09 PM of the lines to be something like entire root filesystem so you can the following: deploy it easily to your MicroSD card later. Exit the chroot environment # Commented out, don't overwrite xterm -T and do the following inside your # "title" -n "icontitle" by default. root filesystem directory: # If this is an xterm set the title to

# user@host:dir # umount proc

case "$TERM" in # rm ./usr/bin/qemu-arm-static

xterm*|rxvt*) # tar -zcvf /home/user/my-rootfs.tar.gz *

PROMPT_COMMAND='echo -ne \ "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' Preparing the MicroSD Card ;; I am using a 4GB MicroSD card for *) my board. I am sure that a 2GB ;; MicroSD card would be sufficient to esac contain all your files, but it is nice to have some room for additional # enable bash completion in interactive shells applications. You need to create two if [ -f /etc/bash_completion ] && ! shopt -oq \ partitions on your empty MicroSD posix; then card. The first one is a VFAT partition . /etc/bash_completion of around 17MB for U-Boot and the fi kernel image. The rest will be used to store your root filesystem. Check /etc/shadow for the following: Mount the MicroSD card. Take note of the device name your root:*:15629:0:99999:7::: computer gives the MicroSD card. daemon:*:15629:0:99999:7::: Some computers recognize the card as /dev/sdX, while others call If you see an asterisk (*) after the it /dev/mmcblkX (for this example, first colon on the line for root, you I assuming that your card is should remove it. This will allow you recognized as /dev/sdb): to set the root password yourself on the first run. # fdisk -u=sectors /dev/sdb You have completed the process of building the root filesystem for Type “p” to list the partitions your board. Next, let’s compress the inside the card. If you have any

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 85

LJ234-Oct2013.indd 85 9/18/13 4:09 PM FEATURE Create a Mini PC or Server with Olimex’s Olinuxino A13/A13Micro

Figure 7. List of Partitions on a 4GB MicroSD Card

partitions at all listed, delete them values, which will fill the remainder by pressing “d”. Once the card is of the card. empty, create a new partition by Type “p” again to list the pressing “n”. Make this the first partitions. You should see something primary partition. fdisk is going like what is shown in Figure 7. to ask you for starting and ending Type “w” to write the changes sector numbers. Type “2048” and permanently onto the card. Now, “34815”, respectively. Repeat the create the two filesystem types on process for the second partition. the partitions: This time, just press Enter when asked for starting and ending sector # mkfs.vfat /dev/sdb1 numbers; fdisk will use the default # mkfs.ext3 /dev/sdb2

86 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 86 9/18/13 4:09 PM Don’t forget to do the sync type here, as you are not going after every command you type to write to /dev/sdb1 or /dev/sdb2 for the MicroSD card. Sync ensures but to /dev/sdb: that the changes are flushed and keeps the card in the correct state. # cd /home/user/A13System/u-boot Next, mount the partitions. I am # dd if=spl/sunxi-spl.bin of=/dev/sdb bs=1024 \ assuming the mountpoints are seek=8 /media/card1 for /dev/sdb1 and # dd if=u-boot.bin of=/dev/sdb bs=1024 seek=32 /media/card2 for /dev/sdb2. First, # sync populate the root filesystem and copy the kernel modules onto the Now your MicroSD card is ready first partition: to use.

# cd /media/card2 First Run # tar -xzvf /home/user/A13System/my-rootfs.tar.gz Plug in the card in the slot on # sync the board. Also plug in the ...[THIS WILL TAKE SOME TIME] Wi-Fi USB Stick, a keyboard # cp -a $KERNEL_DIR/out/lib/modules/3.4.43+/ \ and the VGA monitor (use a ./lib/modules/. USB hub if you have to). Plug # sync in the power cord and wait for the login prompt. Copy the uImage file from your Log in with the root account. kernel directory (in arch/arm/boot) You shouldn’t need a password to the first partition, along with for the first run. After you get in, a file called script.bin. script.bin set a secure password for your stores the system configuration root account and create another settings necessary for Allwinner account for your daily use. Put chips. If you want to edit these this new user into the sudoers settings, convert this .bin file into a file. Check whether you have .fex file using a tool called bin2fex. network connectivity. Test the You can edit the resulting file with board remotely by connecting to any text editor. it via SSH. If you can do all that For the last step, you need to successfully, congratulations! You write U-Boot onto the card itself. have a great minimalist PC/server Pay extra attention to what you at your disposal.

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 87

LJ234-Oct2013.indd 87 9/18/13 4:09 PM FEATURE Create a Mini PC or Server with Olimex’s Olinuxino A13/A13Micro

IF YOU ARE INTERESTED IN USING THIS BOARD WITH A GRAPHICAL USER INTER- FACE, YOU NEED TO USE A LIGHTWEIGHT GUI ENVIRONMENT, BECAUSE THE BOARD DOES NOT HAVE MUCH RAM TO SPARE.

Figure 8. A13Micro Running Fluxbox

88 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 88 9/18/13 4:09 PM Desktop Environment Restart the board. When the board If you are interested in using this restarts, you will be greeted with board with a graphical user interface, your new login manager. Make sure you need to use a lightweight GUI you select Fluxbox from the session environment, because the board does menu on Lightdm screen when you not have much RAM to spare. There are logging in. Enjoy your new are several options from which to mini-personal computer/server!■ choose, such as LXDE and XFCE4; however, I use a different package Ronald Kurniawan is a software developer living in Brisbane, here called Fluxbox. You also need to Australia. Ronald is interested in embedded systems, Linux, install a light graphical login manager. Java development and trying to come up with interesting Using the package manager, install and wacky ways to combine them. Ronald can be reached lightdm and fluxbox. Yes, it is really at [email protected]. that easy. These commands will install the desktop environment, graphical login manager and their required servers and libraries: Send comments or feedback via http://www.linuxjournal.com/contact root@a13board:/# apt-get install lightdm fluxbox or to [email protected].

Resources

Debian Repositories List: http://www.debian.org/mirror/list

A13Micro’s Kernel Configuration File: http://goo.gl/YnZ1s

Script.bin for A13 and A13Micro Boards: http://goo.gl/7QZuoU

Ubuntu 12.04 Core Root Filesystem: http://goo.gl/eoALA

Ubuntu 12.10 Core Root Filesystem: http://goo.gl/iLcV8

Ubuntu 13.04 Core Root Filesystem: http://goo.gl/cytEY

Qemu Source Code Download: https://launchpad.net/qemu-linaro/+download

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 89

LJ234-Oct2013.indd 89 9/18/13 4:09 PM FEATURE A Handy U-Boot Trick A HANDY U-BOOT TRICK

Deploy and test new builds quickly with no more than rebooting the board.

BHARATH BHUSHAN LOHRAY

90 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 90 9/18/13 4:09 PM mbedded developers working After losing the BeagleBoard, I hit on kernels or bare-metal upon the idea to load my bare-metal E programs often go through code over the LAN via bootp and several development cycles. Each TFTP and leave the board untouched. time the developer modifies the This not only reduced the risk of code, the code has to be compiled, mechanically damaging my board, but the ELF (Executable and Linkable it also improved on my turn-around Format)/kernel image has to be times. I no longer needed to copy files copied onto the SD card, and the to the SD card and move it around. card then has to be transferred from In this article, I present a brief the PC to the development board introduction to U-Boot and then and rebooted. In my experience as describe the necessary configurations a developer, I found the last two to set up a development environment steps to be a major bottleneck. Even using DHCP and TFTP. The setup copying files to the fastest SD cards I present here will let you deploy is slower than copying files between and test new builds quickly with hard drives and sometimes between no more than rebooting the board. computers across the network. I use the BeagleBone Black Moreover, by frequently inserting (http://beagleboard.org/Products/ and removing the SD card from the BeagleBone%20Black) as the slot, one incurs the risk of damaging target platform and Ubuntu as the fragile connectors on the the development platform for my development boards. Believe me! I examples in this article. You may, lost a BeagleBoard by accidentally however, use the methods presented applying too much force while holding here to work with any board that the board and pulling out the SD card. uses U-Boot or Barebox as its The pressure caused the I2C bus to stage-2 bootloader. fail. Because the power management chip was controlled by I2C, nothing U-Boot other than the serial terminal worked U-Boot is a popular bootloader used after that. Setting aside the cost of by many development platforms. the board, a board failure at a critical It supports multiple architectures time during a project is catastrophic if including ARM, MIPS, AVR32, Nios, you do not have a backup board. Microblaze, 68K and x86. U-Boot

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 91

LJ234-Oct2013.indd 91 9/18/13 4:09 PM FEATURE A Handy U-Boot Trick

U-Boot is a pretty advanced bootloader that is capable of loading the kernel and ramdisk image from the NAND, SD card, USB drive and even the Ethernet via bootp, DHCP and TFTP.

Listing 1. The Serial Console Output from the Stage-1 Bootloader

U-Boot SPL 2013.04-rc1-14237-g90639fe-dirty (Apr 13 2013 - 13:57:11) musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, ➥HB-ISO Tx, SoftConn) musb-hdrc: MHDRC RTL version 2.0 musb-hdrc: setup fifo_mode 4 musb-hdrc: 28/31 max ep, 16384/16384 memory USB Peripheral mode controller at 47401000 using PIO, IRQ 0 musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, ➥HB-ISO Tx, SoftConn) musb-hdrc: MHDRC RTL version 2.0 musb-hdrc: setup fifo_mode 4 musb-hdrc: 28/31 max ep, 16384/16384 memory USB Host mode controller at 47401800 using PIO, IRQ 0 OMAP SD/MMC: 0 mmc_send_cmd : timeout: No status update reading u-boot.img reading u-boot.img

has support for several filesystems The U-Boot project also includes as well, including FAT32, ext2, ext3, the x-loader. The x-loader is a small ext4 and Cramfs built in to it. It also stage-1 bootloader for ARM. Most has a shell where it interactively modern chips have the ability to read can take input from users, and it a FAT32 filesystem built in to the supports scripting. It is distributed ROM. The x-loader loads the U-Boot under the GPLv2 license. U-Boot is a into memory and transfers control stage-2 bootloader. to it. U-Boot is a pretty advanced

92 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 92 9/18/13 4:09 PM Figure 1. Boot Sequence

bootloader that is capable of loading Figure 1 shows the default boot the kernel and ramdisk image from sequence of the BeagleBone Black. the NAND, SD card, USB drive and This sequence is more or less even the Ethernet via bootp, DHCP applicable to most embedded systems. and TFTP. The x-loader and U-Boot executables

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 93

LJ234-Oct2013.indd 93 9/18/13 4:09 PM FEATURE A Handy U-Boot Trick

Listing 2. The Serial Console Output from the Stage-2 Bootloader

U-Boot 2013.04-rc1-14237-g90639fe-dirty (Apr 13 2013 - 13:57:11)

I2C: ready

DRAM: 512 MiB

WARNING: Caches not enabled

NAND: No NAND device found!!!

0 MiB

MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1

*** Warning - readenv() failed, using default environment

musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx,

➥HB-ISO Tx, SoftConn)

musb-hdrc: MHDRC RTL version 2.0

musb-hdrc: setup fifo_mode 4

musb-hdrc: 28/31 max ep, 16384/16384 memory

USB Peripheral mode controller at 47401000 using PIO, IRQ 0

musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx,

➥HB-ISO Tx, SoftConn)

musb-hdrc: MHDRC RTL version 2.0

musb-hdrc: setup fifo_mode 4

musb-hdrc: 28/31 max ep, 16384/16384 memory

USB Host mode controller at 47401800 using PIO, IRQ 0

Net: not set. Validating first E-fuse MAC

cpsw, usb_ether

Hit any key to stop autoboot: 0

are stored in the files called MLO and shown in Listings 1–3. The x-loader uboot.img, respectively. These files are is responsible for the output shown stored in a FAT32 partition. The serial in Listing 1. Once the execution is port outputs of the BeagleBone are handed over to U-Boot, it offers you

94 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 94 9/18/13 4:09 PM Listing 3. The Serial Console Output from the Stage-2 Bootloader and Kernel

gpio: pin 53 (gpio 53) value is 1 Booting using the fdt blob at 0x80f80000

Card did not respond to voltage select! XIP Kernel Image ... OK

. OK

. Using Device Tree in place at 80f80000, end 80f888fb

.

gpio: pin 54 (gpio 54) value is 1 Starting kernel ...

SD/MMC found on device 1

reading uEnv.txt Uncompressing Linux... done, booting the kernel.

58 bytes read in 4 ms (13.7 KiB/s) [ 0.106033] pinctrl-single 44e10800.pinmux: prop pinctrl-0

Loaded environment from uEnv.txt ➥index 0 invalid phandle

Importing environment from mmc ... .

Running uenvcmd ... .

Booting the bone from emmc... .

gpio: pin 55 (gpio 55) value is 1 [ 9.638448] net eth0: phy 4a101000.mdio:01 not found on slave 1

4215264 bytes read in 778 ms (5.2 MiB/s) .---O---. gpio: pin 56 (gpio 56) value is 1 | | .-. o o | | |-----.-----.-----.| | .----..-----.-----. 22780 bytes read in 40 ms (555.7 KiB/s) | | | __ | ---'| '--.| .-'| | | Booting from mmc ... | | | | | |--- || --'| | | ' | | | | '---'---'--'--'--. |-----''----''--' '-----'-'-'-' ## Booting kernel from Legacy Image at 80007fc0 ... -' | '---' Image Name: Angstrom/3.8.6/beaglebone

Image Type: ARM Linux Kernel Image (uncompressed) The Angstrom Distribution beaglebone ttyO0

Data Size: 4215200 Bytes = 4 MiB

Load Address: 80008000 Angstrom v2012.12 - Kernel 3.8.6

Entry Point: 80008000

Verifying Checksum ... OK beaglebone login:

## Flattened Device Tree blob at 80f80000

a few seconds to interrupt the boot called bootcmd. bootcmd holds the sequence, as shown in Listing 2. If search sequence for a file called you choose not to interrupt, U-Boot uImage. This is the kernel image. executes an environment variable The kernel image is loaded into the

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 95

LJ234-Oct2013.indd 95 9/18/13 4:09 PM FEATURE A Handy U-Boot Trick

Listing 4. Well Formatted Content of the Variable bootcmd

01 gpio set 53; 02 i2c mw 0x24 1 0x3e; 03 run findfdt; 04 mmc dev 0; 05 if mmc rescan ; 06 then 07 echo micro SD card found; 08 setenv mmcdev 0; 09 else 10 echo No micro SD card found, setting mmcdev to 1; 11 setenv mmcdev 1; 12 fi; 13 setenv bootpart ${mmcdev}:2; 14 mmc dev ${mmcdev}; 15 if mmc rescan; 16 then 17 gpio set 54; 18 echo SD/MMC found on device ${mmcdev}; 19 if run loadbootenv; 20 then 21 echo Loaded environment from ${bootenv}; 22 run importbootenv; 23 fi; 24 if test -n $uenvcmd; 25 then 26 echo Running uenvcmd ...; 27 run uenvcmd; 28 fi; 29 gpio set 55; 30 if run loaduimage; 31 then 32 gpio set 56; 33 run loadfdt; 34 run mmcboot; 35 fi; 36 fi;

96 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 96 9/18/13 4:09 PM memory, and the execution finally is U-Boot shell. At the shell, you can transferred to the kernel, as shown see a list of supported commands in Listing 3. by typing help or ?. You can list all The search sequence defined in the defined environment variables with bootcmd variable and the filename the env print command. These (uImage) are hard-coded in the U-Boot environment variables are a powerful source code (see Listing 9). Listing tool for scripting. To resume the boot 4 shows the formatted content of sequence, you either can issue the the environment variable bootcmd. boot command or run bootcmd. A The interesting parts of bootcmd are good way to understand what the

The uEnv.txt file is a method for users to insert scripts into the environment.

lines 19–28. This part of the script bootcmd is doing is to execute each checks for the existence of a file command one at a time from the called uEnv.txt. If the file is found, U-Boot shell and see its effect. You may the file is loaded into the memory replace the if...then...else...fi (line 19). Then, it is imported to the blocks by executing the conditional environment ready to be read or statement without the if part and executed (line 22). After this, the checking its output by typing echo $?. script checks to see if the variable uenvcmd is defined (line 24). If it is DHCP defined, the script in the variable is The DHCP (Dynamic Host executed. The uEnv.txt file is a method Configuration Protocol) is a protocol for users to insert scripts into the to provide hosts with the necessary environment. Here, we’ll use this to information to access the network on override the default search sequence demand. This includes the IP address and load the kernel image or an ELF for the host, the DNS servers, the file from the TFTP server. gateway server, the time servers, the For better insight into the workings TFTP server and so on. The DHCP of U-Boot, I recommend interrupting server also can provide the name the execution and dropping to the of the file containing the kernel

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 97

LJ234-Oct2013.indd 97 9/18/13 4:09 PM FEATURE A Handy U-Boot Trick

image that the host must get from the TFTP server to continue booting. Listing 5. The Host Configuration Section for a DHCP Server The DHCP server can be set up to provide a configuration either for the subnet 192.168.0.0 netmask 255.255.0.0 { next-server 192.168.146.1; entire network or on a per-host basis. option domain-name-servers 192.168.146.1; Configuring the filename (Listing 5) option routers 192.168.146.1; for the entire network is not a good range 192.168.145.1 192.168.145.254; idea, as one kernel image or ELF file

will execute only on the architecture # The BeagleBone Black 1

for which it was built. For instance, host BBB-1 {

the vmlinuz image built for an x86_64 next-server 192.168.146.1;

will not work on a system with an filename "/BI/uImage";

ARM-based processor. hardware ethernet C8:A0:30:B0:88:EB; The Ubuntu apt repository fixed-address 192.168.146.4; offers two DHCP servers: } isc-dhcp-server and dhcpcd. } I prefer to use isc-dhcp-server. The isc-dhcpd-server from the Ubuntu repository is pretty recommend installing Webmin from advanced and implements all the the apt repository. See the Webmin necessary features. I recommend using documentation for instructions for Webmin to configure it. Webmin adding the Webmin apt repository to is a Web-based configuration tool Ubuntu (http://www.webmin.com/ that supports configuring several deb.html). Linux-based services and dæmons. I Once you have your DHCP server

IMPORTANT NOTE: Be extremely careful while using the DHCP server. A network must not have more than a single DHCP server. A second DHCP server will cause serious problems on the network. Other users will lose network access. If you are on a corporate or a university network, you will generate a high-priority incident inviting the IT department to come looking for you.

98 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 98 9/18/13 4:09 PM installed, you need to configure tftp-hpa. I recommend tftp-hpa, a subnet and select a pool of IP as development of atftp has seized addresses to be dished out to hosts since 2004. on the network on request. After tftpd-hpa is more or less ready this, add the lines corresponding to to run just after installation. The the host from Listing 5 into your default file store is usually /var/lib/ /etc/dhcp/dhcpcd.conf file, or do tftpboot/, and the configuration files the equivalent from Webmin’s for tftp-can may be found in /etc/ intuitive interface. In Listing 5, default/tftpd-hpa. You can change C8:A0:30:B0:88:EB corresponds to the location of the default file store the BeagleBone’s Ethernet address. to any other location of your choice The next-server is the address of by changing the TFTP_DIRECTORY the TFTP server from which to fetch option. The TFTP installation creates a the kernel image of ELF. The /BI/ user and a group called tftp. The tftp uImage filename is the name of the server runs as this user. I recommend kernel image. Rename the image to adding yourself to the tftp group and whatever you use. changing permissions on the tftp data directory to 775. This will let you read TFTP and write to the tftp data directory TFTP (Trivial File Transfer Protocol) is without switching to root each time. a lightweight file-transfer protocol. Moreover, if files in the tftp data It does not support authentication directory are owned by root, the tftp methods. Anyone can connect and server will not be able to read and download any file by name from the serve them over the network. You server or upload any file to the server. can test your server by placing a file You can, however, protect your server there and attempting to get it using to some extent by setting firewall the tftp client: rules to deny IP addresses out of a particular range. You also can make $ tftp 192.168.146.1 -c get uImage[COMMAND] the TFTP home directory read-only to the world. This should prevent Some common problems you may any malicious uploads to the server. face include errors due to permission. The Ubuntu apt repository has two Make sure that the files are readable different TFTP servers: atftp and by the tftp user or whichever user the

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 99

LJ234-Oct2013.indd 99 9/18/13 4:09 PM FEATURE A Handy U-Boot Trick

Listing 6. An Example of the uenvcmd Variable for DHCP Booting

echo Booting the BeagleBone Black from LAN (DHCP)... dhcp ${kloadaddr} tftpboot ${fdtaddr} /BI/${fdtfile} setenv bootargs console=${console} ${optargs} root=${mmcroot} ➥rootfstype=${mmcrootfstype} optargs=quiet bootm ${kloadaddr} - ${fdtaddr}

Listing 7. An Example of uenvcmd Variable for TFTP Booting

echo Booting the BeagleBone Black from LAN (TFTP)...

env set ipaddr 192.168.146.10

env set serverip 192.168.146.1

tftpboot ${kloadaddr} /BI/${bootfile}

tftpboot ${fdtaddr} /BI/${fdtfile}

setenv bootargs console=${console} ${optargs} root=${mmcroot}

➥rootfstype=${mmcrootfstype} optargs=quiet

bootm ${kloadaddr} - ${fdtaddr}

tftpd runs as. Additionally, directories mentioned before, running a poorly must have execute permission, or tftp configured DHCP server will cause a will not be able to descend and read network-wide disruption of services. the content of that directory, and However, if you know what you are you’ll see a “Permission denied” error doing and have prior experience with when you attempt to get the file. setting up network services, this is the simplest way to boot the board. U-Boot Scripting A DHCP boot can be initiated Now that you have your DHCP and simply by adding or modifying the TFTP servers working, let’s write uenvcmd variable in the uEnv.txt file, a U-Boot script that will fetch the as shown in Listing 6. uEnv.txt is kernel image and boot it. I’m going found in the FAT32 partition of the to present two ways of doing this: BeagleBone Black. This partition is using DHCP and using only TFTP. As I available to be mounted when the

100 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 100 9/18/13 4:09 PM BeagleBone Black is connected to (http://www.denx.de/wiki/DULG/ your computer via USB cable. Manual). The various commands in For a TFTP-only boot, you manually the uenvcmd variable must be on the specify an IP address for the same line separated by a semicolon. development board and the TFTP server. You may notice that I place my script This is a much safer process, and you in uenvcmdx instead of uenvcmd. incur very little risk of interfering with This is because test -n throws an other users on the network. As in the error to the console based on the case of configuring to boot with DHCP, content of the variable it is testing. you must modify the uenvcmd variable Certain variable contents, especially in the uEnv.txt file. The script shown in long complicated scripts, cause the Listing 7 is an example of how to set up test -n to fail with an error message your BeagleBone Black to get a kernel to the console. Therefore, I put a image from the TFTP server and pass on simple command to run uenvcmdx the execution to it. in uenvcmd. If you find that your Both Listing 6 and 7 are formatted script from the uEnv.txt is not being to give a clear understanding of the executed, look for an error on the process. The actual uEnv.txt file should serial console like this: look something like the script shown in Listing 8. For more information test - minimal test like /bin/sh about U-Boot scripting, refer to the U-Boot FAQ (http://www.denx.de/ Usage: wiki/DULG/Faq) and U-Boot Manual test [args..]

Listing 8. An Example of uEnv.txt for TFTP Booting

optargs=quiet uenvcmdx=echo Booting the bone from emmc...; env set ipaddr ➥192.168.146.10; env set serverip 192.168.146.1; tftpboot ➥${kloadaddr} /BI/${bootfile}; tftpboot ${fdtaddr} ➥/BI/${fdtfile}; setenv bootargs console=${console} ➥${optargs} root=${mmcroot} rootfstype=${mmcrootfstype} ➥optargs=quiet; bootm ${kloadaddr} - ${fdtaddr} uenvcmd=run uenvcmdx

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 101

LJ234-Oct2013.indd 101 9/18/13 4:09 PM FEATURE A Handy U-Boot Trick

On some development ethaddr along with the rest of the boards like the BeagleBoard xM uEnv.txt script. (http://beagleboard.org/Products/ An alternative but cumbersome BeagleBoard-xM), the Ethernet way to change the default boot port is implemented on the USB bus. sequence is to modify the U-Boot Therefore, it is necessary to start the source code. Modifying the source USB subsystem before attempting code gives you greater versatility for any network-based boot. If your booting your development board. development board does not hold a When you interrupt the U-Boot boot Flash memory on board, it may not sequence, drop to the U-Boot shell have a MAC address either. In this and issue the env print command, case, you will have to set a MAC you’ll see a lot of environment address before you can issue any variables that are defined by default. network requests. You can do that These environment variables are by setting the environment variable defined as macros in the source

Listing 9. Part of the u-Boot/include/configs/am335x_evm.h File Responsible for the Default Script in the bootcmd Variable

#define CONFIG_BOOTCOMMAND \ "mmc dev ${mmcdev}; if mmc rescan; then " \ "echo SD/MMC found on device ${mmcdev};" \ "if run loadbootenv; then " \ "echo Loaded environment from ${bootenv};" \ "run importbootenv;" \ "fi;" \ "if test -n $uenvcmd; then " \ "echo Running uenvcmd ...;" \ "run uenvcmd;" \ "fi;" \ "if run loaduimage; then " \ "run mmcboot;" \ "fi;" \ "fi;" \

102 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 102 9/18/13 4:09 PM code. Modifying the source code n BeagleBoard: u-Boot/include/ aims at modifying these variables. configs/omap3_beagle.h As shown in Figure 1, U-Boot begins loading the kernel by executing the Conclusion script in bootcmd. Hence, this is the I hope the instructions provided here variable that must be modified. help you create a system to develop To begin, you’ll need the source code and deploy bare-metal programs to U-Boot from the git repository: and kernel images quickly. You also may want to look into $ git clone git://git.denx.de/u-boot.git u-boot-v2, also known as Barebox (http://barebox.org). The most Before making any modifications, I helpful code modification that recommend compiling the unmodified I suggest here is to compile the source code as a sanity check: U-Boot with an elaborate boot sequence that you can tailor to your

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean needs with the least modifications.

You can try out some fancy scripts

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_evm_config to check and update firmware

over LAN—I would consider that

$ make -j 8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- really cool. Write to me at bharath (you-know-what) lohray (you-know- This most likely will work without what) com.■ a hitch. Now you can modify the u-Boot/include/configs/am335x_evm.h Bharath Bhushan Lohray is a PhD student working on file. In this file, you’ll find code similar his dissertation on image compression techniques at the to Listing 9. Modify this as you please Department of Electrical and Computer Engineering, Texas and re-compile. Depending on your Tech University. He is interested in machine learning and target board, you will have to modify considers building a terminator the echelon of human a different file. The files to some advancement—at least until we build the terminator. common target platforms are:

n Panda Board Send comments or feedback via (http://pandaboard.org): u-Boot/ http://www.linuxjournal.com/contact include/configs/omap4_common.h or to [email protected].

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 103

LJ234-Oct2013.indd 103 9/18/13 4:09 PM INDEPTH The Personal Cloud The Personal Cloud gives you access and control over your own data and lets you do more with it than your vendors can. Who wouldn’t want that? The question is, how do we get there from here? T.ROB

Personal. personal information. The ubiquity of What do you say when someone the phrase “that’s personal” speaks to asks “How much money do you a broadly shared understanding that make?”, or “How old are you?”, we get to choose what information or “How much do you weigh?”, about ourselves we reveal and to or “What is your address?” The whom we reveal it. quintessential response “that’s Cloud. personal” works because of an There is no industry-standard underlying assumption that we are definition of the term “cloud”, but we within our rights to withhold that should at least all be able to agree on information and, more important, that a few attributes. Many of these are privacy is the default and natural state optional depending on who you talk of affairs. There is no government to, but the one essential element of procedure on reaching the age of the cloud is abstraction. An observer majority requiring you to check sees the cloud as a single logical thing boxes on an interminably long list, with which to interact and need not enumerating all of the personal data be concerned with the individual attributes that you choose to keep elements that make up the cloud. private. As a sovereign person, they In addition, a cloud will have one or are all considered private. It is your more of the following elements: choice whether to reveal your income, age, weight or any other piece of n Elasticity: computing resources can

104 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 104 9/18/13 4:09 PM INDEPTH

be allocated dynamically to match you? How much do you weigh? What variable load. is your address?” Whether the cloud is personal or not depends on who n Redundancy: the use of multiple gets to decide the answers to these physical servers increases the questions. It is not enough that the availability of the cloud service. response back is “that’s personal” if someone else can override your n Resiliency: the cloud service can preferences and make the disclosure survive interruption or loss of some anyway. It is only a Personal Cloud physical components without loss if you have ultimate control over of function. whether to disclose that information. A Personal Cloud starts with the n Runtime resolution: resource assumption that privacy is the default identities and addresses are and natural state of affairs and then resolved dynamically. incorporates that design philosophy into a cloud computing architecture n Ubiquity: some clouds are public owned and operated by an individual. while others are private. However Resist the temptation to read more they are scoped, a cloud service is into that statement than there is. expected to be accessible from all For example, there is no requirement points within that scope. that a Personal Cloud must be self- hosted. Today there are commercial By incorporating these elements, services for password management, cloud architecture aims to deliver storage, backups, VoIP, chat and computing services that are as reliable more, all of which fit the definition and available as power or water. The of Personal Cloud. In all these cases, ultimate expression of the cloud is the custodians of the data have no that the computing infrastructure access to it. Instead, they provide completely disappears except for the the framework in which the data user interface. owner sets policies that express the Personal Cloud. relationship between the data and any Imagine a cloud database filled with third parties authorized to access it. If information about you and a vendor it is a cloud architecture, respects the inquiring of that cloud “How much owner’s privacy, and the owner is the money do you make? How old are ultimate authority over authorization

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 105

LJ234-Oct2013.indd 105 9/18/13 4:09 PM INDEPTH

decisions, it is a Personal Cloud. media. The motors have receded into the background, and we rarely think Not a Buzzword about them at all, unless they break. Much of the buzz about cloud The same thing is happening computing is just that—buzz. But now with computing. There is more Personal Cloud is more. There is computing capacity in the average a parallel here with the way we modern phone than there was in the purchase motive power. In San Lunar Lander. It’s everywhere around Francisco, halfway down the hill on you, and more is on the way. All of Mason Street, there are giant motors your devices that have an embedded transferring motive power to cables, motor soon will have embedded which in turn run below the street to computing power, if they do not distribute that motive power along already. Things that currently have no the cable car routes. When the cable motor or computing power—switches, car requires motive power, it gets it outlets and bulbs, for example—soon directly from the cable. Many years will become smart. More important, ago, factories worked the same way. all of these sensors, devices and Large motors distributed motive computing platforms are increasingly power to belts and pulleys that interconnected and integrated with if- distributed it throughout the factory. then-else rules engines that correlate But that method didn’t scale very events to generate complex behaviors well. There is no tap from your house in formerly dumb devices. Sensors, to an underground cable that provides actuators and computing power are power for washers and dryers, quietly but inexorably being woven refrigerators and so on. Nor is there into the fabric of your life. a giant motor in the back yard and a Is it reasonable to assume that with system of pulleys and belts running all this computing power available from it to the house. Instead, we to individuals that we will fail to self-host hundreds of tiny motors, apply it in commercial settings for invisibly built in to disk drives, DVD our own benefit, in much the same players, appliances, clocks and almost way that our vendors have applied everything capable of movement. it on the supply side? The value The magic of this is that we don’t proposition of E-Commerce, Supply think of these things as motors that Chain Management and Customer wash clothes, tell time or spin digital Relationship Management always

106 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 106 9/18/13 4:09 PM INDEPTH

applied to individual users. We never all the disk drives, DVD players, clocks, delivered it to that market because of refrigerators and other appliances, and cost, but that barrier continues to fall. equipping them with belts and pulleys. These applications radically transformed You could do it, but it doesn’t scale commerce on a global scale when they and you won’t like the experience. were first built out by large enterprises. We have the opportunity to transform Impersonal Clouds commerce again, with even greater Let’s revisit that cloud database filled impact, by building out business with information about you and a functionality on the consumer side. vendor inquiring of that cloud “How Or we could continue to focus on much money do you make? How old making better versions of Angry Birds are you? What is your address?” If and moving light switches from the that cloud is owned by a credit bureau wall to the phone. or data broker, the responses will be Today’s architecture, in which the actual values. There is no default vendors have all the data and assumption of privacy. You have no computing power, is a dying relic, left say in how much data about you these over from a world where computing commercial entities hold, whether it was specialized and so expensive that is accurate or with whom they share only large businesses could afford it. it. The entire business model of data It is the cable car wheelhouse or the brokers is to provide answers for big motor out back behind the factory. questions to which, if you had been But in a world of cheap and abundant asked in person, you would have computing power, individuals are the responded by saying “that’s personal”. natural points of integration for their The impersonal cloud also hoards own data. Now we have the choice your data, preventing you from to continue on with the legacy model deriving any benefit from it. If you or to move to a new model in which participate in a grocery loyalty the individual’s computing capacity program, somewhere out there is improves the experience of both the a database containing line-item individual and the vendor. Having records all your purchases. That’s a all that computing power on the rather intimate level of detail about consumer side and not building out you and your immediate household. new business integration seems to me If someone on the street asked you to be akin to ripping the motors out of detailed questions about some of

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 107

LJ234-Oct2013.indd 107 9/18/13 4:09 PM INDEPTH

those line items, you undoubtedly you place your bets? Although the would say “that’s personal”. If that specific implementations have yet to same person then offered to pay you be revealed—that’s your job—we do a dollar for details of which personal know some general directions with a hygiene products you use and how high degree of confidence. First and often you buy them, it would seem foremost among these is that the creepy. But that is exactly the kind of Personal Cloud wants to be invisible. information we give out in exchange Once the user sets up the connection for a dollar off of a jug of milk. and preferences, the fact that the I’ve been told that the average apps are backed by a Personal Cloud person has no use for grocery line- should not normally be evident to item data. If that is true (and I don’t the user. The exceptions exist mainly believe that it is), it’s only because where the Personal Cloud provides we do not yet have access to that enhanced functionality, such as data and, therefore, have not written prompting the user for permission to applications to use it. We don’t know release information. Other than those now what we’ll do with that data any exceptions, all the user should see is more than we could have looked at the exposed functionality. HTTP in 1983 and predicted Web 2.0. Some additional Personal Cloud What we do know now though is that directions are listed below. The all the data is held by vendors, and strategy for deriving these is to wherever it is that Personal Cloud can imagine a future state where privacy take us, we can’t get there from here. is baked into the architecture and Getting access to our own data is the where sharing is enabled by policy. first step. Personal Cloud is Cloud 2.0. This is the opposite of today’s model where the architecture is built for Strategies for Personal Cloud sharing and privacy is provided by Development policy. Also, assume a future state Twenty years from now, we will know where individuals have access to all what the Personal Cloud equivalents the transaction data their vendors of Google, Wikipedia, YouTube, currently collect, and to the data from Facebook and Instagram are, and all their devices, and that all of this they will seem obvious in hindsight. is accessible to the user in aggregate But if you want to get started in through their Personal Cloud. Personal Cloud today, where do Software — Extend Supply Chain

108 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 108 9/18/13 4:09 PM INDEPTH

management systems all the way to extends the basic connectivity of the the consumer so that the merchant is Internet with a community and context the next-to-last rather than the last for trusted identity and interactions stop in the chain. The opportunity between people, businesses and here is to create the API of Me and My devices. There is a growing collection Things and to assist large Enterprise of information, references and index to understand the value in integrating of projects related specifically to with it. Considerable momentum Personal Cloud at Personal-Clouds.org. already exists in Vendor Relationship The folks at Kynetx have built and Management applications, the implemented CloudOS and an event consumer counterpart to Customer network that are up and running Relationship Management. In short, re- today and built on the Personal Cloud imagine business software as owned philosophy. This is a non-inclusive list and operated by and for the individual. but will jump-start your investigation There are a number of initiatives into Personal Clouds. and groups working to provide Data aggregation and infrastructure and resources to further integration — Much of the value these concepts. The unsurprisingly of data lies in the ability to correlate named Privacy By Design framework and analyze across many datasets “advances the view that the future to find valuable relationships. For of privacy cannot be assured solely example, consumers can participate by compliance with legislation and in cradle-to-cradle tracking of regulatory frameworks; rather, recyclable resources by integrating privacy assurance must become data from their purchasing, waste an organization’s default mode and recycle streams. Add Health of operation”. The Personal Data data to the mix for insight into how Ecosystem Consortium’s mission is to dietary purchasing habits affect connect entrepreneurs and startups wellness. Integrate power and water focused on user-centric personal data, consumption for a total household advocate for individuals’ rights to tools greenness rating. But, which vendor and access to their own data, and to will collect and manage all this help existing businesses dependent information for you? on the old personal data ecosystem Mint.com aggregates all your transform to become profitable in financial accounts into a single view the new one. The Respect Network but probably won’t be adding your

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 109

LJ234-Oct2013.indd 109 9/18/13 4:09 PM INDEPTH

health records, power and grocery providers cannot process your data loyalty information any time soon, if they cannot see it. If you are to nor would you want it to. If Mint.com get any value out of the data you began asking for your health and choose to keep private, you will grocery data, you probably would need something that you control to tell it “that’s personal”. The Personal correlate, analyze and visualize it. One Cloud version of an aggregator approach, exemplified by OwnCloud, operates more like FileThis.com. is a framework made up of database FileThis periodically fetches your hosting, a plugin architecture and APIs. bank statements, e-bills and Out of the box, the system supplies purchase receipts, then loads them cloud storage, calendaring, contact into a data store that you control. lists, music streaming and on-line It never stores the information it photo galleries. But the real power is collects on your behalf nor does it in the plugin architecture and APIs. For attempt to provide any analysis or example, there is no personal health presentation of that data. You supply vault in the basic version of OwnCloud, the credentials and the storage, it but that easily could be added. supplies the integration. Alternatively, some Personal Cloud Apart from a few early examples, applications will run standalone. this field is wide open. Every loyalty Consider the FileThis service program, interactive heath service, mentioned previously. Among government-hosted citizen database, the other accounts to which it social-media service, utility provider, integrates, it can download your identity provider, bookmark sync bank statements. But this requires service, contact list or other service you to give it your on-line banking that holds your information is a credentials, which is a bit problematic. candidate either to aggregate that That issue would go away if you data into a single view or pull it into could run its application locally. The the individual’s Personal Cloud. If those standalone app model provides all the services hope to remain competitive, benefits of the vendor’s integration they will recognize the value in know-how without exposing your empowering individuals to access their banking account credentials. own data and begin to cooperate with Retro-fit — There are a lot of integrators and publish APIs. “dumb” appliances out there with Hosted apps and plugins — hosting plenty of useful life in them. Similarly,

110 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 110 9/18/13 4:09 PM INDEPTH

there are very few existing houses and turns those into more complex wired for data or that have their own behaviors. Of course, getting a data Personal Cloud servers. If we imagine fabric into the home is a prerequisite, a future world where all those devices so the installation of home- are smart, how do we get from here automation servers, cabling, power- to there? One way might be to take over-Ethernet and Wi-Fi access points the Crutchfield approach and apply it also will be a growth opportunity. to the Internet of Things. Crutchfield built an unlikely Stupid Cloud Tricks business by betting that ordinary To seed your mind with ideas for people could and would install high- Personal Cloud development, imagine end stereos into their own cars if they a world in which the most mundane had access to tools and instructions. objects and surfaces are smart and in Crutchfield provided custom wiring which you can program behaviors based harnesses that eliminated most of on interactions of devices and events in the complexity, access to tools and your life. The cloud also has access to comprehensive instructions from an all your transaction and demographic exhaustive database of vehicle makes data, location and preferences. Now and models. The bet paid off and it combine these in the most far-fetched grew into a formidable player in the way that you can think of. consumer audio business. Here’s an example. My smart house A similar model would work for would have individually addressable Internet-enabling dumb devices. path lighting throughout. My dog Assuming that you had the would have an NFC or Bluetooth appropriate wiring harness, a Wi-Fi- beacon on his collar so that the enabled Arduino or Digispark could house could know exactly where he be dropped into a washer, dryer, is. I would then program a behavior refrigerator or other appliance in causing the path lighting to follow minutes. This could jump-start the him around the house. Once he got Internet of Things and most of the used to that, I would train him that research could be crowdsourced. following the path lighting cues There are business opportunities in would lead to a reward. The last step performing the installations and in would be to create a phone app (I’ll providing the code that sends and call it “Fetch”) that leads the dog receives events from the devices from wherever he is in the house to

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 111

LJ234-Oct2013.indd 111 9/18/13 4:09 PM INDEPTH

wherever I am. You don’t have to honor the pledge I admit this is a very stupid cloud and can turn the light back up, but trick. I criticized vendors for moving the closer your house gets to its wall switches to phone apps, and I projected abatement, the larger the just did the same thing with the dog. rebate you get. The point is that if you own the data With enough devices and your devices talk first to you participating, discretionary load instead of the vendor, you are not abatement will allow us to defer the constrained by the vendor’s choice of need to build more power plants. integrations and can invent weird and But this considers only the first- wonderful behaviors for your stuff. tier effects. The system really gets (But you have to admit that a phone interesting when social aspects app that remotely controls the dog is are added. Your Personal Cloud kinda cool.) So let’s try something a knows how much load abatement bit more practical. you have provided, what your Your power company has a rate baseline usage is and the normal plan that lets it shut off your water interior conditions in the house. heater and air conditioner when it Someone eventually will combine or a neighboring utility has a peak these into a competitive social load shortage. But why limit this to app where individuals or groups water heaters and air conditioners? can compete for energy-efficiency When the home is filled with smart badges. How do you compare devices, it will be possible for with your neighborhood? Your lights, fans, battery chargers or region? Households with similar any powered device to take part demographics? Can your scout in discretionary load abatement. troop be the greenest in the pack? For example, on receiving an What will your Stupid Cloud Tricks abatement request, an LED bulb (or be? Feel free to dream some up and the dashboard controlling that bulb) send them to [email protected]. might respond with an offer to cut Or just wait a few years and create 10% of its current drain during them for real. the abatement period. Because the house knows whether anyone is Personal Cloud = Opportunity home, the degree of abatement can These types of applications are not vary automatically and accordingly. only possible but trivial when we

112 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 112 9/18/13 4:09 PM INDEPTH

all have access to our own data and Consortium, Project VRM and the are not dependent on vendors for Respect Network.■ the integrations. Personal Cloud detractors claim that individuals have T.Rob spent the last 20 years working on security, clustering, shown no interest in having access high availability and architecture of enterprise messaging. He to their own data. Until PRISM, many intends to spend the next 20 applying these same technologies said we have no interest in privacy to benefit individuals through technologies, such as Personal either. But this is not a question of Cloud and Internet of Things. He recently left IBM, where he whether Personal Clouds will exist was a product manager for the WebSphere messaging product or whether individuals need or want family, to start IoPT Consulting with the mission of putting access to their own data. Technology People first in the Internet of Things. He can be found at seeps into every niche that will https://ioptcponsulting.com or https://t-rob.net. (Full disclosure: support it, and this is hardly a niche. T.Rob is a member of the Respect Network and the Personal Data When the value of Personal Cloud Ecosystem Consortium, but please don’t hold that against them.) apps exceeds their cost, they will flourish. It really is that simple. The market for Personal Clouds is Resources

a superset of that for mobile phones, FileThis: http://filethis.com game consoles, NAS devices, home- entertainment servers and home- Kynetx Developer Resources: http://developer.kynetx.com automation servers because they are all potentially participants. That LastPass: https://lastpass.com is a very large market, which with Mint: http://www.mint.com regard to Personal Cloud, is as yet OwnCloud: https://owncloud.com untouched. Those who can make the value of Personal Cloud exceed PDEC: http://pde.cc

the cost (as measured in currency, Personal Clouds.org: skill requirement and administrative http://personal-clouds.org overhead) can begin to carve out Privacy by Design: their own piece of that very large pie. http://www.privacybydesign.ca Would you like your piece of that pie now? For more information on Project VRM: http://projectvrm.org Personal Clouds and the ecosystem Respect Network: growing up around them, please http://respectnetwork.com visit the Personal Data Ecosystem

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 113

LJ234-Oct2013.indd 113 9/18/13 4:09 PM EOF

The First DOC SEARLS Personal Platform—for Everything Computing started out corporate, then it got personal. Same thing happened with networking. Next up: the cloud.

aybe the biggest thing that eight are Linux and two are FreeBSD: ever happened to Linux— http://news.netcraft.com/archives/ M at least scale-wise—is 2013/07/01/most-reliable-hosting- virtualization. As I recall, virtualization company-sites-in-june-2013-2.html.) first materialized in a big commercial Now think about the Internet way with IBM, which started by putting of Things, often abbreviated IoT. many Linux instances on System z It is generally assumed today that mainframes. (Once on the old Linux the Internet of Things will require Show, we had a guest geek from IBM embedded smarts. But in fact, any thing who said it was not only his idea, can have a cloud, whether the thing but also that he came up with it over has embedded smarts or not. This lunch.) IBM didn’t call those mainframes insight comes to us from Phil Windley “clouds”, but that’s what it hosted. (http://www.windley.com), the hacker- Now we have clouds of clouds of Linux in-chief of Kynetx (http://kynetx.com), all over the place. Nothing could be a small Utah start-up with very big plans. more widespread and ordinary. (Of (Disclosure: I sometimes consult them, as Netcraft’s ten most reliable hosting I do a number of other companies.) Phil company sites for June of this year, is also the inventor and alpha maintainer

114 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 114 9/18/13 4:09 PM EOF

of CloudOS, a small and simple cloud n Sangean PR-D5 radio. operating system for anybody and n Delkin Sensor Scope. anything, including you and every thing n Ful backpack. you own. CloudOS is open source and n InFocus Model LP-130 projector. GPL’d. So is KRL (kinetic rule language, n Teac model HD-100 HD Radio receiver. http://en.wikipedia.org/wiki/Kinetic_ n Sirius Sportster satellite radio receiver. Rule_Language), the first language for n Garmin Legend HCx GPS. programming on CloudOS (among other n A 30" x 30" tablecloth that looks things), also first authored by Phil. like the QR code shown in Figure 1 By abstracting intelligence away from (https://squaretag.com/app.html#!/ physical things, we can unburden those app/a41x178/squareTag_scanned things of the need to be intelligent in &tagName=YUV6WT&token= themselves. In fact, we can enlarge to E0BFBEA6-E8CD-11E2-BD96- absolute the variety of things that can D358A022FB09). have intelligence. Phil embodies this range in the word “pico”, for persistent compute The doors to those things’ clouds object. One of his is a pothole in front of are the QR codes I’ve hung or stuck on his house (http://www.windley.com/ them—and, in the case of the last one, archives/2013/04/potholes_and_ the item itself is a QR code. There can picos.shtml). That pothole has brains be other doors as well (for example, in the cloud Phil gave to it, and that URLs), but QR codes are handy because: cloud is in Phil’s personal cloud a) as with Ethernet, the patent owners (http://personal-clouds.org/wiki/ (Denso, in Japan) decided they would Main_Page). To help demonstrate how rather create more value than they this can work in everyday life, here is a capture, so they let anybody do anything list of things I’ve made smart by giving they want with QR codes; and b) they’re each its own cloud: easy to scan with a smartphone.

n Canon 5D camera body. Figure 1. n Canon 30D camera body. Doc’s 30" x 30" n Dish Network VIP 922 set-top box, tablecloth with Slingbox. looks like this n Eurorack UB802 audio mixer. QR code. n LaCrosse Technology BC-9009 battery charger.

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 115

LJ234-Oct2013.indd 115 9/18/13 4:09 PM EOF

Until now, QR codes have had the For example, I have messages waiting misfortune of being exploited mostly for the makers of many of the items by marketers, which is why they above. Here are a few: appear as “robot barf” on promotional jive all over the place. But now it’s time n Canon — I’m in the market for a 5D for the hackers to take over, which Mark III when the price for a new one is what the ones working for Kynetx falls below $2500. have done. They created a service (http://www.windley.com/archives/ n LaCrosse — I’ll be glad to testify 2013/01/introducing_squaretag.shtml) my love for the charger in any called SquareTag (https://squaretag.com), promo you want to run. It’s the best which hosts things’ clouds. SquareTag’s charger I’ve ever used. The display business model, for now, is selling hang- also tends to flicker and fade. Is tags and stickers with QR codes on them. there an easy fix for that? I’m using some of the tags and stickers for the things in the list above. (Note n Sangean — Gave the radio a 5-star that SquareTag isn’t a silo. I can take my review on Amazon, but I won’t things’ clouds, plus my own personal buy another one like it unless it cloud, and put them wherever I want. does HD too. That means I can self-host them, put them in Dropbox, or stick them in some n Garmin — Love the sensitivity and other cloud service.) the UI. What I want are more than Through a feature called “safe and 10,000 waypoints in memory and the mine” you can present a message to any ability to produce KML files. Samaritan who scans the QR code of a thing you’ve lost. For example, “This bag n Dish Network — DishAnywhere is belongs to (your name). Text me at (your a great system. That’s mostly how I number).” From any computing device, watch the VIP 922. What I’d like is you can write or change that message. to have access to all the menu items But here’s the biggest thing: remotely through the browser UI and Every thing’s cloud is a platform for on the tablet app. Please notify me relationship—between you (as the when that feature is ready. Thanks. owner) and whoever else you welcome aboard: notably the companies that I also can advertise to the world, make and sell the things you’ve bought. should I wish, some or all of what I

116 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 116 9/18/13 4:09 PM say about those products in my cloud. Or, I can restrict what I say just to the companies I invite into a relationship, Advertiser Index such as the ones above. Thank you as always for supporting our Likewise, any company (such as advertisers by buying their products! Canon, LaCrosse, Sangean and Garmin) can give every product it sells a unique ADVERTISER URL PAGE #

cloud of its own, with its own QR code, All Things Open http://www.allthingsopen.org 41 and transfer ownership of that cloud to AnDevCon Fall http://www.andevcon.com 2 the customer along with the product

Big Data TechCon http://www.bigdatatechcon.com/ 47 itself. If the customer welcomes a SanFrancisco2013/index.html relationship with the company, and the Drupal Camp Atlanta http://www2.mediacurrent.com/ 120 company agrees to the customer’s terms l/10072/2013-09-10/fw6gp

of engagement (such as, “respect the Emac, Inc. http://www.emacinc.com 11

privacy of this communication channel in EmperorLinux http://www.emperorlinux.com 31 the following ways”), the whole “own iXsystems, Inc. http://www.ixsystems.com 7 cycle” of a product becomes a much richer experience for both the customer Manage Engine http://www.manageengine.com 45

and the company. The QR code then OVH http://www.ovh.com 35 becomes what’s called a “TalkTag”— Seattle GNU/Linux http://seagl.org 119 meaning that its purpose is to serve as Conference

a way for the customer to signal his or Silicon Mechanics http://www.siliconmechanics.com 3

her interest in talking to the company. USENIX LISA https://www.usenix.org/conference/LISA2013 73 For example, I can program the cloud of my Dish Network set-top box to make a scan of its QR code send a message to

the company saying I’d like a call from ATTENTION ADVERTISERS an agent to help me work through a problem. I’ve talked to call-center people The Linux Journal brand’s following has grown to a monthly readership nearly about this possibility and they love it. one million strong. Encompassing the What they love especially is that it’s magazine, Web site, newsletters and much more, Linux Journal offers the now possible to have a standard way ideal content environment to help you for customers to relate to companies. reach your marketing objectives. For The problem today is that every more information, please visit http://www.linuxjournal.com/advertising. company’s CRM (customer relationship

WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 117

LJ234-Oct2013.indd 117 9/20/13 11:51 AM EOF

management) system is a silo, each who are ready and able truly to help with its own silo’d “relationships” with each other. customers, all of which are governed At this point, as T.Rob says in his at call centers by IVR (Interactive Voice article in this issue, we’re still at the Response) systems, followed by scripted beginning of whatever it is we’ll make interactions when a customer gets of personal clouds. CloudOS itself is through to a human being. If ways can about where Linux was in the months be found to normalize the protocols of after Linus wrote “I’m doing a (free) genuine relationships between companies operating system...”. But the population and customers, the work of the call center of available hackers for personal cloud can be made far more easy and efficient. projects is several orders of magnitude In fact, the only way that can happen is if larger than the one to which Linus the customer’s side does the normalizing. wrote. Yet, the challenge is remarkably Once that happens, both sides similar: take something that has been can learn far more from each other, purely corporate (in this case, “the in far better ways. If the product cloud”), make it personal, and then is the platform for a genuine two- ramp it out to everything it might way relationship, both company and conceivably work on, improving it along customer are in far better positions to the way, and not stopping. learn from each other. Companies can The result, if all goes according to update manuals and provide notices of plan, is a true Internet of Things and the firmware updates. Customers can tell reframing of business around fully useful companies directly what’s working or relationships between customers and not working, how the product might be companies—or, for that matter, between improved and what new products the anybody and anything.■ company might consider making. We also can start to evolve past Doc Searls is Senior Editor of Linux Journal. He is also a the current marketing system, by fellow with the Berkman Center for Internet and Society at which makers and sellers labor Harvard University and the Center for Information Technology constantly to entrap and coerce and Society at UC Santa Barbara. customers into restrictive dependencies. Communications inside silo’d coercive systems tend to be far more restrictive, Send comments or feedback via and far less useful, than communications http://www.linuxjournal.com/contact between free and independent parties or to [email protected].

118 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM

LJ234-Oct2013.indd 118 9/18/13 4:09 PM Seattle GNU/Linux Conference

Seattle needed a new grassroots Free Software summit, so we created one!

Join speakers and participants from around the world for the inaugural Seattle GNU/Linux Conference.

October 11th and 12th, 2013, Seattle Central Community College campus.

Visit SeaGL.org for more information.

LJ234-Oct2013.indd 119 9/18/13 4:09 PM LJ234-Oct2013.indd 120 9/18/13 4:09 PM