 | Level: Intermediate Tim McIntire (tm@timmcintire.net), Consultant, Freelance Writer
29 Aug 2006 NetBSD runs on more hardware platforms than any other UNIX®
derivative due to smart design decisions and a commitment to portable code.
Whether you're porting an operating system to a proprietary embedded system or
looking for stability and compatibility across hardware platforms in the lab,
NetBSD and its open license is a compelling alternative to Linux® and
the GNU Public License (GPL).
One feature listed on the NetBSD Web site is that the operating system is hype
free. I can do without hype, but generating some buzz for this operating system that is often overlooked certainly wouldn't hurt.
NetBSD has an interesting architecture, which is often taken for granted and
rarely commented on outside Berkeley Software Distribution (BSD) circles. The system's
well thought-out design allows for wide hardware support, a small footprint,
stability, and security. NetBSD's unique features include a new paradigm for
handling device drivers and other interesting innovations.
These design decisions and commitment to source code, which not only works but
works right, have helped NetBSD lay claim to being the most portable UNIX®
derivative in existence. It particularly excels in embedded systems, but you should
also consider it as a compelling alternative to more mainstream servers,
desktops, and laptop operating systems.
An introduction to BSD
Three major BSD-derived operating systems are freely available: NetBSD,
FreeBSD, and OpenBSD. All three systems are related to the original BSD
distribution of UNIX, which dates back to the 1970s. In the early 1990s,
at about the same time Linux® was coming together as a legitimate
competitor to UNIX, a separate track was being forged to create a free
UNIX-like operating system based on BSD. All three BSD versions have
strong points, with FreeBSD leading the way in user base, OpenBSD leading
in security, and NetBSD leading in portability.
Of course it runs on NetBSD
You can port NetBSD to run on just about anything with a processor -- hence
the motto, "Of course it runs on NetBSD." NetBSD supports more than 50
platforms, ranging from old 68K and million instructions per second (MIPS)
systems to the newest x86_64 processors from Advanced Micro Devices, Inc. (AMD) and Intel®. Furthermore --
and possibly more importantly -- NetBSD has been ported for use on a
massive number of embedded systems.
Embedded systems
Embedded systems are huge part of everyday life in the 21st century, far
outselling traditional computing devices such as desktops, laptops, and
servers. From mobile phones to automobiles to cable boxes, you're more than likely using a computer in some aspect of your life. The operating system and software that sit inside these devices is often as important as the
traditional engineering decisions that go into their design.
Examples of NetBSD embedded systems range from the useful (routers and
switches) to the bizarre (a NetBSD toaster). The variety of architectures
commonly used in embedded systems far exceeds common choices for traditional
computers, so portability is vital.
NetBSD's small footprint, ease of portability, and BSD license make it a
perfect choice for embedded systems. The small footprint is extremely
important, as most embedded systems have a small amount of memory. Therefore,
the operating system must be as thin as possible. Ease of portability
significantly cuts development time to bring new products to market, which
is key to staying ahead of competitors. The BSD license allows companies to
build commercial products based on NetBSD and sell them for a profit while keeping
the source code proprietary.
The BSD license
The BSD license is a big factor in corporate decision making when an
organization is choosing NetBSD (or other BSD variants) over Linux for
commercial products. The Linux kernel and most Linux software is released
under the General Public License (GPL), which requires the release of the source for all modified codes.
In contrast, the BSD license allows companies to modify and sell NetBSD
code without releasing the modified source, thereby allowing companies to
keep intellectual property close to the vest while leveraging open source
software for the base of their product.
In recent years, numerous companies have been sued over the improper use of
GPL software. Choosing software released under the BSD license gives wider
operating room for commercial products, which is another reason NetBSD is
so well suited for embedded systems. For instance, if Company A were to use
NetBSD in a new smart phone running on Intel XScale® technology,
the company might add kernel support for Evolution-Data Optimized (EV-DO)
devices. Under the BSD license, the company can keep this code proprietary
so that Company B can't use the same code for their new phone. Had Company A
decided to use a Linux kernel, their source for any modifications to the
kernel would have to be released back to the community under a GPL license.
Note: Find information in the BSD newsletter in the Resources section on building a small NetBSD kernel as a starting point for an embedded system.
NetBSD: Not just for embedded systems
Any system administrator who has been in the business for a while understands
the inevitability of hardware changes. You see it everyday when looking through
an information technology (IT) room filled with architectures that were hot
one day but failed to stand the test of time -- be it for technical or
commercial reasons. Unfortunately, when many of these systems pass, their
operating systems pass along with them. A big advantage of running a highly
portable operating system, such as NetBSD, is consistency across platforms. If
a system administrator can be confident that an operating system runs on
the oldest workstation in the lab and the newest server comes off the
assembly line, that administrator's job becomes substantially simpler. This
simplification can be referred to as hardware compatibility through
software homogeneity. A similar example is sharing productivity
documents across computers running Microsoft® Windows® and
Mac OS X by using Microsoft Office programs on both platforms. Sharing at
the operating system level is an advanced extension of the same concept,
suitable for developers rather than everyday users.
Some system administrators might argue that they have always, and will always, run on an x86 platform. So why should they be interested in an operating system that prides itself on portability? There are two answers (and one of them includes a question):
- A large component of the portability of NetBSD can be credited to
an intelligently designed system and well-defined implementation
standards. Portability and good design often go hand in hand, making
the benefits of these decisions evident throughout the operating system.
- Can you define always? While many companies and labs have been using
x86 architectures for quite some time and don't anticipate variations,
disruptive changes in technology are always difficult to predict.
Knowing that your operating system won't restrict purchasing decisions
opens up a cornucopia of choices that otherwise could not have been
considered.
Saving money and gaining peace of mind by knowing that they won't need to port
software and control systems to a new operating system are real and tangible
benefits. Through these benefits, system administrators and programmers can
focus on moving forward rather than simply keeping pace.
The NetBSD kernel
Every part of the NetBSD kernel is carefully thought out, with clean design
and portability in mind. Here's a brief look at some design components of
the NetBSD kernel.
NetBSD device drivers
NetBSD's machine-independent driver framework is a unique method of
handling device drivers, and it's crucial for simple and quick ports. In
most operating systems, a device driver is specific to a piece of hardware
(video card, network interface card (NIC), and so on), bus (such as
Peripheral Component Interconnect (PCI), Industry Standard Architecture
(ISA), Universal Serial Bus (USB)), and platform (i386, 68k, PowerPC®, and
so on). In NetBSD, device drivers are written to extend across multiple
buses and multiple platforms, enabling developers to include addenda to
the device driver's code to add compatibility to a new setup rather than
writing a whole new driver. This is a huge shift from the typical operating system device driver paradigm that helps in overcoming one of the biggest stumbling blocks for operating system developers, system administrators, and component manufactures.
File system support
NetBSD, again encouraging portability and interoperability, includes
support for many different file systems. Berkeley Fast File System (FFS)
is the default choice, with support in 32-bit and 64-bit configurations.
Other major file systems that NetBSD supports include the Linux ext2 and
the Windows NTFS and FAT32 file systems. The standard CD file system,
International Standards Organization (ISO) 9660, is also supported, with
both Rockridge and Joliet extensions.
Cryptographic device driver
The combined effect of today's wide-spread use of laptop computers and
the increased amount of sensitive company and personal information stored
digitally is a recipe for disaster. Every few months, you read a story in
the headlines about a lost computer, or hard disk, containing sensitive
data -- be it a government lab, a credit card company, or an individual
who had all his or her banking information, including their Social Security number, on a
personal computer. The fact is accounts, passwords, and permissions can
only protect your data in the context of an operating system that obeys
stated rules. Bits are bits, and any hard disk pulled out of one computer
and put into another can easily be read -- unless that data is encrypted.
File encryption can be accomplished in a variety of ways, but it's rarely
used because of the burden on system administrators or users. Most data
encryption methods require explicit decisions of where and when to encrypt
data, manual mounting and unmounting of encrypted images, and entering
passwords.
NetBSD uses the cryptographic device driver (CGD) to implement an encrypted
file system with a virtual device. By sitting between the rest of the
operating system and the actual disk, CGD looks and acts like any other
disk drive attached to the system, allowing for transparent access to
secure storage.
Note: See the NetBSD
Guide in the Resources section for information on how to enable CGD.
General security
NetBSD takes security very seriously; the inclusion of the CGD is only one
of many examples. If portability is rule number one for the NetBSD
community, security doesn't sit far behind. An absolute dedication to
well-written code is paramount, including procedures for code auditing
and continued checks. Second, like OpenBSD, the default installation
includes a bare minimum of packages installed, or configured. The
first thing a system administrator is likely to do after a NetBSD
installation on a server is to configure the network and enable Secure
Shell (SSH), which gives you an indication of how little the default
configuration enables. While some new users might argue that this approach
makes things more difficult on them, learning to control and configure
services is an important part of any UNIX-like operating system, and
learning to do so doesn't take long. A quick read through the official
NetBSD Guide helps get new users off the ground.
Note: See the Resources section for an additional
link from gna.org to a great document for new NetBSD users.
Application support: Package source and binary emulation
Application support in NetBSD is both wide and varied. Most standard software
familiar to administrators of UNIX-like operating systems is natively
available to NetBSD and easily installed through the NetBSD Packages
Collection (pkgsrc), which includes more than 5000 packages. If you
can't find what you are looking for through pkgsrc, you can always run through a series of
binary emulators built into NetBSD, the most prominent of which is the
Linux emulator running on i386.
The default installation of NetBSD, however, is quite thin. Not only is it
configured with most services turned off, it has few packages installed, period.
The kernel, compilers, network services, XFree, and standard UNIX utilities
are all that's included in the base distribution. To install packages you're
used to finding in a UNIX-like operating system (such as MySQL or PostgreSQL),
use the pkg_add command to extract and install
software (from local disk, CD/DVD, or over the network). If you're installing
an x86 system, you can use /cdrom/packages/i386/All/ on the i386pkg-3.0.iso
CD. Packages installed through the pkg_add command
are installed in /usr/pkg/ and do not interfere with the core components of
NetBSD.
For non-native applications, NetBSD can transparently run binaries from a
variety of UNIX-like operating systems with a negligible impact on
performance. While most of the popular open source applications have been ported to
run natively on NetBSD, some commercial applications, such as Matlab and
Mathematica, cannot be ported by the user community because the code is
proprietary. This is where binary emulation becomes important for NetBSD
users. The emulation process is streamlined because the binaries are native
to the underlying architecture of the system. Don't confuse binary emulation
with the CPU-hungry process of hardware emulation, which is not at play here.
Binary emulation is often suitable for running processor-intensive
applications in a production environment.
Decisions, decisions
NetBSD's attention to detail, well-written code, and vast portability make it a solid choice for a number of deployment scenarios. Unfortunately, BSD derivatives are flying just low enough to stay under the radar and many developers and system administrators are missing important opportunities. The most important part of making a good decision is to be well informed. BSD might or might not be the right choice for you, but don't make the mistake of overlooking it just because you're familiar with something else. Use this article as a starting point to familiarize yourself with NetBSD, then give the distribution a shot -- the least you can do is learn.
Resources Learn
- NetBSD: Check out the official NetBSD home page.
-
NetBSD Guide: Read this official guide to learn more.
- NetBSD kernel: Find information in the BSD newsletter on building a s small NetBSD kernel as a starting point for an embedded system.
- The cryptographic device driver:
An explanation of how to enable the cryptographic device driver is available in the NetBSD Guide.
- NetBSD 3.0: An additional link from gna.org that provides additional documentation for new NetBSD users.
- AIX and UNIX: Visit the developerWorks AIX and UNIX zone to expand your UNIX skills.
- New to AIX and UNIX: Visit the New to AIX and UNIX page to learn more about AIX and UNIX.
- developerWorks
technical events and webcasts: Stay current with developerWorks technical events and webcasts.
- AIX 5L Wiki: A collaborative environment for technical information related to AIX.
- Podcasts: Tune in and catch up with IBM technical experts.
Get products and technologies
Discuss
-
Participate in the AIX and UNIX forums:
- Participate in the developerWorks
blogs and get involved in the developerWorks community.
About the author  | 
|  | Tim McIntire works as a consultant and co-founder of Cluster Corporation, a market leader in HPCC software,
support, and consulting. He also contributes periodically to IBM developerWorks and Apple
Developer Connection. Tim's research, conducted while leading the computer science effort at
Scripps Institution of Oceanography's Digital Image Analysis Lab, has been published in a
variety of journals, including Concurrency and Computation and IEEE Transactions
on Geoscience and Remote Sensing. You can visit TimMcIntire.net
to learn more. |
Rate this page
|  |