The software was originally written, for the operating system Linux. Support for operating systems FreeBSD and NetBSD was added since version 0.3.0. Another supported architecture is ARM (Acorn/Advanced RISC Machine) based embedded systems. I will try to point out some advantages and disadvantages of these operating systems and architectures in the following sections.
The operating system Linux, or more correctly GNU/Linux, is a Unix-like operating system based on GNU utilities and the Linux Kernel. Its development is one of the most prominent examples of free and open source software collaboration. Typically all the underlying source code can be used, freely modified, and redistributed by anyone under the terms of the GNU GPL and other free licenses.
Linux distributions are predominantly known for their use in servers, although they are installed on a wide variety of computer hardware, ranging from embedded devices and mobile phones to supercomputers, and their popularity as a desktop/laptop operating system has been growing lately due to the rise of netbooks and the Ubuntu distribution of the operating system.
The millions of lines of source code are available to developers. The open code makes it easier for developers to learn and understand the Black Box of an operating system and its utilities. The Linux developer community is probably the biggest in the world of software development and it is growing every day. The main advantages of GNU/Linux and other open operating systems in comparison to the most popular commercial operating system in use, Microsoft Windows, are their undemanding hardware requirements, modularity and portability.
From the point of PBMaster's development, Linux was a good starting point because there are a number of books, tutorials and examples available discussing device driver development. There is plenty of driver source code for all sorts of hardware available which helped me to get familiar with the development.
The operating system
FreeBSD is a free operating system descended from the Berkeley Software Distribution. FreeBSD's code base has undergone over thirty years of continuous development, improvement, and optimization. FreeBSD is very well-known for people involved in internet services, but is not popular as GNU/Linux. The code is developed and maintained by a smaller group of individuals. In my opinion, the smaller group of highly qualified and experienced developers makes the development more flexible and in most cases better designed. Conversely the speed of development is notably slower in comparison to the Linux community.
FreeBSD provides many interesting and useful techniques like the Jail mechanism, a secure and low overhead system-level virtualization. Other techniques are for example the implementation of bus space APIs (taken from the NetBSD OS) or port collections. Generally FreeBSD is a very well designed operating system suitable for modern servers as well as desktops. It supports tens of architectures, but is not as large scale as GNU/Linux.
The port of PBMaster's drivers to FreeBSD was relatively fast and without any big problem. The driver's performance is even slightly better than on Linux.
NetBSD is a free, secure, and highly portable Unix-like Open Source operating system available for many platforms, from large-scale server systems to powerful desktop systems to handheld and embedded devices. Its clean design and advanced features make it excellent in both production and research environments, and the source code is freely available under a business-friendly license. NetBSD is developed and supported by a large and vivid international community.
NetBSD has been ported to a large number of 32- and 64-bit architectures, from VAX minicomputers to Pocket PC PDAs. The NetBSD motto is "Of course it runs NetBSD." As of 2007, NetBSD supports more than 54 hardware platforms (comprising around 17 different processor architectures). Although the Linux 2.6 kernel includes support for more processor architectures, NetBSD supports more platforms than any single Linux distribution. The kernel and userland for these platforms are all built from a central unified source-code tree managed by CVS. Currently, unlike other kernels such as uClinux, the NetBSD kernel requires the presence of an MMU (Memory Management Unit) in any given target architecture.
The port of PBMaster's drivers to NetBSD was a little bit more complicated as the mechanism of kernel modules is not very well supported in the latest release version (NetBSD 4.0.1). As far as I know there are no mechanism in the LKM module framework (Loadable Kernel Modules) to share symbols between modules and there is no mechanism for passing parameters on kernel loading. Fortunately there is a new module kernel framework named MODULAR supporting all the forementioned mechanisms. This framework is enabled by default in the current development tree (NetBSD 5.99.4). Another non-trivial task was studying how to write a kernel module under NetBSD, as there is very little documentation and examples available on the internet. Fortunately the NetBSD source code is well organized and keep strictly BSD-coding style.
One of the many nice features of NetBSD and FreeBSD is the implementation of the bus space APIs. These provide a single API to replace inb/outb and direct memory reads/writes. The advantage of this is that a single driver can easily use either memory-mapped registers or port-mapped registers (some hardware supports both). The abstract layer defines that every device having a child is a bus.
At the top level resides the root device which is the parent to hang all other devices on. For each architecture, there is typically a single child of root which has such things as host-to-PCI bridges, etc. attached to it. For x86, this root device is the nexus device and for Alpha, various different models of Alpha have different top-level devices corresponding to the different hardware chipsets, including lca, apecs, cia and tsunami.
Each device in the Newbus architecture asks its parent to map its resources. The parent then asks its own parent until the nexus is reached. So, basically the nexus is the only part of the Newbus system which knows about all resources. The beauty of this transition upwards is that there is room to translate the requests. For example, the 0x230 IO port request might become memory-mapped at 0xb0000230 on a MIPS box by the PCI bridge. The following listing shows an example of the device tree.
nexus0 apic0 ram0 npx0 acpi0 cpu0 pcib0 pci0 hostb0 pcib1 pci1 vgapci0 nvidia0 pbm_950pci0 skc0 sk0 miibus0 e1000phy0 atkbdc0 atkbd0 psm0 pbm_82500
NetBSD, like its sister project FreeBSD, was originally derived from the 4.3BSD release from the Computer Systems Research Group of the University of California, Berkeley. The project is released like FreeBSD under the BSD license. In a nutshell the BSD license requires only that redistribution of the software, in source code or in binary, must reproduce the copyright notice of the software it derived from. This allows companies to develop products based on software released under the BSD license without the requirement to make changes public. It is less strict than the GNU license, where any software derived from the GNU licensed software must release changes to the public. It is often the main reason why hardware manufacturers do not provide their products with device drivers for Linux OS as all software derived from GNU/Linux must be released under the GNU license - in this case the device drivers.
Advanced (Acorn) RISC Machine is a 32-bit RISC processor architecture developed by ARM Limited that is widely used in embedded designs. Because of their power saving features, ARM CPUs are dominant in the mobile electronics market, where low power consumption is a critical design goal. As of 2007, about 98 percent of the more than a billion mobile phones sold each year use an ARM architecture CPU. Today, the ARM family accounts for approximately 75% of all embedded 32-bit RISC CPUs, making it the most widely used 32-bit architecture. ARM CPUs are found in most corners of consumer electronics, from portable devices (PDAs, mobile phones, media players, handheld gaming units, and calculators) to computer peripherals (hard drives, desktop routers).
PBMaster's drivers have been ported to an ARM based board (microcontroller LPC~2148 by NXP Semiconductors), making the drivers ready for use in embedded applications.