26
Fri, Apr
1 New Articles

The Linux Letter: Embedded Linux

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times
Cheap computing power is as close as your nearest office supply store.

 

Call me a geek, but I always get excited when I acquire a new, more powerful server. To me, there's nothing quite as beautiful as a well-engineered piece of hardware, and IBM's xSeries boxes never fail to bring a smile to my face. As much as I have always loved the bigger machines, I have come to realize that for some of my projects, even a minimal desktop computer is an unnecessary waste of physical space and electricity. Thus, I found myself in a quest to find minimalist computing nirvana. What a short trip! I found all that I needed was in the diminutive and hackable embedded hardware disguised as wireless routers available at your neighborhood office supply store.

 

My wireless router of choice (for the home market) is the Linksys/Cisco WRT54GL. The very first thing I usually do when deploying one of these routers is to install an alternative firmware package, such as DD-WRT. I deviate from the factory-supplied firmware because the replacements provide all of the functionality of the original firmware but add enhancements that let me get creative crafting customized firewalls. Running the Linux kernel and using BusyBox (which provides some of the familiar *nix tools) puts me into productive and comfortable territory.

 

During one of my investigative forays, I came across some replacement firmware, called OpenWRT, that opened my eyes to the power of the little boxes. The project Web site says it succinctly: "OpenWrt is described as a Linux distribution for embedded devices." It goes on to say, "Instead of trying to create a single, static firmware, OpenWrt provides a fully writable filesystem with package management. This frees you from the application selection and configuration provided by the vendor and allows you to customize the device through the use of packages to suit any application. For [the] developer, OpenWrt is the framework to build an application without having to build a complete firmware around it; for users this means the ability for full customization, to use the device in ways never envisioned." OpenWRT is actually a fork of the DD-WRT project, decomposing the latter into component parts that can be installed or omitted as required. Thus, the limited RAM inherent in embedded devices can be more efficiently utilized.

What's the Use?

So now you're thinking "OK, Kline, other than as a wireless router, what could you use one of these things for?" If you look at the Table of Hardware, you'll see that there's more to them than meets the eyes. Scrolling down to the entry for the WRT54GL and clicking on the "supported" link will reveal that the box has two serial ports on the board; they're simply not routed to the outside of the case. With some minimal hardware hacking, you can easily add A/D converters to monitor voltages,temperatures or switch contact positions, or you could add a level converter (such as the MAX232 chip) to bring the serial TTL voltages to RS232 levels, enabling you to access serial devices. Although the WRT54GL isn't one, many of the embedded devices sport USB ports, offering even greater possibilities. Not a hardware hacker? No problem. There are still many uses for which you need not even open the box, let alone attack with a soldering iron. I'll discuss a non-trivial example shortly.

Getting Started

Loading OpenWRT onto an embedded system couldn't be easier. A basic firmware image is readily available on the download link at the project Web site. You have a choice of two flavors: whiterussian and kamikaze. (Yes, they are named after mixed drinks.) The whiterussian release is considered stable (but not yet deprecated). The kamikaze release is where development is currently concentrated. For the purposes of discussion, I'll choose the kamikaze release, and clicking on that link brings me to a page listing recent versions, the latest of which (at the time of this writing) is 7.09. (You may want to open another browser window and follow along.) Unless you know of a specific bug regression, you'll want the latest version, so click on 7.09. At this point, you may panic when you see a list of 11 folders! Where do you go from here? With the exception of the "docs" directory, each folder represents a specific embedded system. The one you need to pick can be determined by referring to the "Table of Hardware" page and looking up your specific box. For the WRT54GL, we can see that it is built on the Broadcom 5352 chipset. For Broadcom, we have two choices: brcm-2.4 and brcm47xx-2.6. But we can quickly eliminate the 47xx series, since that is for the 4710 and 4712. We're not done yet. Drilling down further, we see that there are a number of variations on that chipset. It so happens that the WRT54GL is most closely matched by the link for the openwrt-wrt54g-2.4-squashfs.bin, so download it.

I realize that this sounds complicated, and it can be, so if you want to take the express route, simply click on the "Supported" link on the "Table of Hardware" page and you'll find not only the correct file name but also instructions on how to load it. The WRT54GL's supported link has the correct information under "Installation," as does all of the other supported hardware.

 

Once your new firmware image is loaded, you'll probably want to do the initial configuration by unplugging the box from your network and connecting a PC directly to one of the LAN ports. Upon reboot, the box will be configured for the 192.168.1.0/24 network, with its IP address set to 192.168.1.1 and the dhcp server turned on. You wouldn't want this to cause problems on your production network. At this point, you can follow the documentation that is common to all OpenWRT installations and start hacking!

 

Once you have configured the box for your network and have provided it Internet access, log into the system and issue the command "ipkg update" and then "ipkg list" to see the complete list of software available from the official repositories. The list is quite impressive.

A Concrete Example

I hate to sound like some slick infomercial salesman, but if I could offer you a telephone system for your home with features that rival the PBX at your office, how much would you be willing to pay? What if I told you that it had full IVR and voicemail features and could screen calls to keep those pesky ex-es or late-night solicitations out? Now how much would you pay? In June 2006, I wrote an article describing Asterisk, an open-source PBX that has those features and so many more. My original home version of Asterisk was built using a Dell desktop system that I bought during one of their "give-it-away" sales. That system has served me well, but there are three major downsides to it: 1) the system generates a good deal of heat, thus raising my cooling costs in the summer; 2) the system uses about 150 watts of power, so every 10 hours I'm using 1.5 kWh of electricity, at a cost of roughly 10 cents per kWh. Figuring 720 hours in a month, it's costing me around $7.20 to keep that box running ($86.40/year), in addition to whatever it's costing to cool it.; and 3) the thing isn't exactly silent. I get to listen to the fan whenever the house is quiet and I'm in my home office.

 

Here's where OpenWRT came to the rescue. I purchased an Asus WL-500G Premium wireless router for use as my Asterisk box. This is a more powerful box than the WRT54GL (twice as much NVRAM and RAM and a slightly faster processor), and it has two USB ports. Providing storage for the Asterisk software and my voicemail was as easy as plugging a 2G USB memory stick into the back of the box and then configuring it to be mounted into the file system.

 

To connect to the PSTN, I purchased a Linksys SPA3102 VOIP adapter, which has three ports: one that plugs into the PSTN, one into which I plug my analog phone, and a network port. The SPA3102 presents the phone line to Asterisk as an outgoing trunk and the analog phone as an extension.

 

What makes this system more useful to me than a simple answering machine is the access I now have. When a call comes into my home business numbers, three phones ring simultaneously: my analog phone at my home office, a SIP phone I have at my main office, and my cell phone. If I pick up any of these phones, the call will be connected to me. If I don't answer any of them, the call goes to the Asterisk voicemail system, which emails the message to me as an attachment. I now have as much or as little availability as I desire.

 

How much did this all cost? I bought the Asus for around $70. The SPA3102 cost me $85. I "charged up" my Teliax account with $10 (that's 500 minutes). So the total, not including my Polycom SIP phone, is $165. (The Polycom cost me about the same amount). I could just have easily used a softphone running on a PC to save the cost of the Polycom, but I really like those phones, so the cost was worth it to me.

The Savings

Moving to Asterisk saved me quite a bit of money. I used to have three phone lines coming into my home office, with five different numbers. I have reduced that to one physical line and one distinctive ring number, opting instead to take advantage of Teliax, a VOIP provider. I have a pay-as-you-go plan with them, so I don't have the monthly fees I used to have for the other two lines. Changing to VOIP has saved me around $80 per month.

 

Migrating my Asterisk installation from the Dell desktop machine to the embedded system has resulted in additional savings. I calculate that the combined power consumption of the Asus and the SPA3102 is an order of magnitude less than that of the Dell, thus I'm spending roughly $9 annually to run both pieces. My air conditioner is happy that it is no longer competing with the phone system (saving money there), and since the embedded systems have no fans, quiet now reigns supreme at night (saving my sanity).

 

As I look at the little Asus, I marvel at what power can be had for such a minimal cost. I can't argue that you can purchase monitors and other such devices off-the-shelf and ready-to-roll. But I can do the same thing for less than half the cost with just a little elbow grease, thanks to Linux. And I'll have a lot more fun doing it.

Barry Kline 0

Barry L. Kline is a consultant and has been developing software on various DEC and IBM midrange platforms since the early 1980s. Barry discovered Linux back in the days when it was necessary to download diskette images and source code from the Internet. Since then, he has installed Linux on hundreds of machines, where it functions as servers and workstations in iSeries and Windows networks. He co-authored the book Understanding Web Hosting on Linux with Don Denoncourt. Barry can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it.

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: