Sergey Khlutchin (sergey@elphel.com)
Oleksandr Melichenko (alexlp@elphel.com)
Ilya Shpan'kov (ilya@elphel.com)
Creation of modern hardware today is inextricably related to the software. We use computer programs at a stage of organization of the project, we use specialized software for creation of experimental models of our products and their further testing and debugging. We also give a full package of the software to end users of our products, allowing them to use all functionalities and internal potential of complex digital devices to their full potential. Figuratively speaking, the software is a kind of the «soul» that allows to inhale a spark of life into «corporal environment» hardware. Taking into account that various application software allows to use practically the same set of hardware in completely various areas of human activity (the same personal computer, for example, can serve as game station, a server or sound recording studio depending on the installed software), we can safely say that software is one of the main parts in making any type of hardware.
Thus, starting a new «hard» project, we should carefully choose the software with which we shall work further. And almost right away there is a question: what software to choose? If your new company has good sponsors or your uncle has left to you an impressive inheritance, it is possible to take advantage of the available developments offered by large companies for appreciable money. Also you can order their custom-developed software (if a non-standard approach is required) for an even more appreciable sum. But will such choice be the rational decision? Unfortunately, no. More often than not, there are more problems in the end: development of your products is delayed to uncertain deadline, the price of your final product indecently grows and you realize that bypassing competitors with the help of a flexible price policy is already impossible. On the other hand, when you receive the new software for your product from other developers, suddenly you understand -- you don't know how it works! I.e., you see that necessary functions are carried out, but you don't know what occurs inside the program. Sources are closed, and digging in binary files is often unlawful. Besides, your developer informs you that proprietary components were used in creation of your software, and you have no right to make changes to it without the appropriate license. Fortunately (For you? Or for your developer?) your software developer has such a license and you now are obliged to the end of your days (or your device) to work in a tandem with same software developer, whether you like it or not. Nice prospects, aren't they?
There is another way -- you can employ a staff of programmers and begin the development of the software independently. In this case you can know precisely how every bit of your software will work and what is placed in each line of your source code. You can also operatively make changes to code at any time and you don't need to ask for someone's permission. But what price are you paying for this imaginary freedom? Salaries to the programmers are equivalent to expenses for a purchase of the ready-made software, because you will begin all work practically from scratch! If you want to use some modules developed by other companies to reduce time spent, you will be confronted with license payments in most cases. Thus follows, that neither of these ways work for young companies which frequently consist of one or two talented young people with the heads full of ideas, but empty pockets. For them there is a third way -- to use free software with open source code.
This way promises plenty of benefits for beginning developers: it is not necessary to start development from zero, the choice of free and open software as a basis exempts you from license payments and allows to change source code if needed. Also the openness of your project (I hope you remember about the GPL license) will allow talented programmers access from all over the world, and will probably considerably speed up preparation of the end-product or add some new unique functions. And all this without any global financial investments. All that is required from you is to agree with the game rules accepted in the world of free software. I think it's a low price to pay for real advantages in the future.
This third way was chosen at Elphel Inc, which consisted of only two people in the beginning of developing reconfigurable high-speed network cameras. Shortly the developers' team was replenished with new participants from different countries and today they are in the final stages of debugging the Elphel-333 camera, which considerably outperforms many modern alternatives. And all this is due to correctly chosen software and principles of free development. By "correct" I mean the open and freely distributed software. And below I shall try to explain why such a choice is correct. But let's start in order.
One that seeks - shall always find
As I mentioned earlier, without the software any device is only a set of lifeless parts. This applies to network cameras as well. To display a sequence of frames on the monitor, we needed an appropriate video player. It is necessary to admit that we first tried to adapt existing free-of-charge programs with closed source code from known developers. Unfortunately the possibilities of new Elphel cameras were far beyond what proprietary players were designed for. We needed to change the code of the player itself but had no right to do it independently for licensing reasons. An unknown company offering software industry giants to make some amendments to code in their product made no sense -- we simply would not have been heard. It was then that we decided to turn to free video players with an open code. MPlayer turned out to have the most suitable characteristics and set of codecs. We made small changes to the source code of the program which enabled the use of this popular player to display the contents generated by our cameras.
But next followed another problem: a player with changes introduced by us should work on the camera end user's computer. MPlayer resides perfectly in a Linux environment, but the majority of users have Windows installed. There is a free version of MPlayer for this operating system as well, but debugging revealed that free MPlayer and proprietary Windows don't always cooperate smoothly. But we cannot change the source code of the operating system for obvious reasons. We also cannot force the end users of Elphel cameras to install a Linux distribution -- that would go against principles of freedom of choice, declared by the community of free developers. A compromise was required and found after our acquaintance with the Live-CD Knoppix (Danke, Herr Knopper!).
The «Live» distribution has many unique qualities which make it the ideal tool for creating custom software solutions. Just the fact that a completely prepared operating system and accompanying software are loaded on a computer in a couple minutes without any installation or other preliminary work, prompts an emotional shock in some of Windows users. After the long and tiresome juggle of driver CDs, office applications and other useful programs, the fast start of a ready virtual software environment from one CD looks like magic art. Besides, this environment is absolutely impenetrable for viruses, trojans, spyware and other malicious software flooding the Internet -- the thin sparkling piece of plastic with the data on it serves as the most reliable firewall. When the user realizes this, a justifiable admiration arises in his soul for the authors of such a miracle.
Of course as time goes on, the user looks at the structure of the applications which are included in Live-CDs more critically: some things are not so convenient to use, some familiar programs are missing, etc. There is a solution for this case as well. Thanks to the numerous scripts that allow one to create the Live-CD from a stationary operating system, a user with some programming experience can remaster the distribution as he sees fit. After making the changes, the resulting disk image is written to CD and you get the same reliable and convenient Live-CD as before, now filled with your choice of software. This is yet one more big plus added to a coin box of «Live» distribution advantages over stationary ones.
Many developers frequently use existing qualities of Live-CDs to create their own specialized distributions. It is enough to recall such distributions as Linux LiveCD Router -- a Linux distribution designed to share a broadband connection over WiFi, Trustix Secure Linux -- the software kit for secure work with data for companies of any scale, ParallelKnoppix -- a remastered edition of Knoppix that allows setting up a cluster of machines for parallel processing, and many many more. There are entire musical studios for professional sound treatment, and game stations -- all this on one Live-CD. The breadth of applications of such solutions is limited only by our imagination.
When choosing a basis for software intended for our network cameras, we looked at several varieties of Live-CDs. From a huge array of «Live» distributions, Knoppix turned out to be most adapted to work on the majority of computers, due to its advanced system of automatic detection and configuration of personal computer hardware. Thus we have ensured that the end users of Elphel cameras will have a minimum of problems when working with the cameras. The remastered distribution of Knoppix with the modified video player is packaged with our cameras. It is remarkable with what ease we have reached a desirable result: we did not create a new product expending lots of time and money, rather just made cosmetic changes to an existing product. But this resulted in a complete high-grade software solution for such non-standard equipment as our high-speed network cameras.
At the same time we managed, as goes a Russian saying, to kill two hares with one shot. We have decided to not remove software which is not required for normal work with our cameras from Knoppix, thus assigning our products one more noble mission -- to help popularize free software for users, who previously have not even considered alternatives to proprietary software. Getting with the camera such applications as the graphical KDE desktop environment, Open Office.org, The Gimp and many other useful applications (as a reminder, Knoppix includes almost 1,8 GB of free software), our users receive an opportunity to independently test out this software in a working environment and compare against earlier used software. Even I don't know which of the two purposes of our products is more important.
A good programmer is always trying to automate routine work. Ever since we chose Knoppix as a software basis for our cameras, remastering the Live-CD turned into ordinary work and, naturally, we have tried to simplify this process in every possible way. In particular, we wrote a script for the automatic execution of most procedures of Knoppix remastering and the addition of new software to the Live-CD. Currently the script's job consists of the following stages:
-
Unpacking the initial Knoppix
-
Removal of packages according to a given list
-
Addition of packages from deb, tar.gz or rpm files, which fit into the debs/ directory
-
Checking the compatibility of old patches with new Knoppix files (if a new version of the distribution is being remastered)
-
Patching the files in the unpacked Knoppix
-
Creation of a new compressed image of the Knoppix file system from the received file tree
-
Unpacking and mounting of the initrd image
-
Alteration - patching and unpacking of archives for the initrd
-
Unmounting and packing the initrd
-
Changing boot loading parameters
-
Creation of a new ISO-image of the CD with using the new files and exluding any unnecessary files
Prior to remastering, all initial data that will be necessary for the script to work is prepared:
-
Initial CD or ISO-image
-
Set of additional packages
-
The list of additional packages with all dependencies which will be downloaded from a Debian site via apt-get
-
The list of packages being eliminated
-
The set of patches
-
Set of patches and packages for the initrd (packages for the initrd are usually tar.gz archives)
-
The list of excluded uncompressed files (which will be put directly on the CD instead of inside the compressed image)
-
Files that will be added and replaced on the CD (including a new kernel and index.html)
-
A file with the version number of the alteration
We constantly improve the script, therefore it is quite probable that the current version will carry out little bit distinct from the list of above-stated operations.
So the problem with the camera software was solved with the help of Knoppix. But our goal as a commercial company consists not only of receiving profit on sales of Elphel cameras (although that by itself is a pleasant enough process already), but to also offer any assistance to the Open Source and Free Software movement. Simply distributing money as sponsorship is not productive. We decided to choose another way. Each buyer of Elphel cameras receives a significant discount ($100 for each camera) provided he plans to independently work on improving the cameras' software in the future and to do it by the principles of Free Software development, returning the results of his work to the community. In return we guarantee complete support for this work with our next software product. This outlines our next step -- creating customized development tools based on the now familiar to us Knoppix.
According to our idea, the user of Elphel cameras should have the opportunity to create his own software for the cameras or make necessary changes to existing software to achieve the highest results when using the cameras in non-standard conditions for example. We decided to offer our clients not only a detailed description of the products and source codes, but also provide the entire toolkit necessary to work with the source code. For this purpose we decided to take a freely distributed development platform called Eclipse and to «cross» it with the Knoppix Live-CD. And this turned out to be quite feasible.
The technology of creating a comparable specialized product is rather simple: with the help of our «magic» script we install the new software, then create an image of the now updated disk. Next we record the ready ISO-image to a CD and attain a Live-CD with the Eclipse development environment. It is necessary to say that because of restrictions of the CD format and a rather big volume occupied by Eclipse, we first had to remove some components that were present in Knoppix, but we tried to ensure that such actions did not negatively affect the functionalities of Knoppix as a whole. Thereafter we resolved to use the DVD format which allowed us to not reduce the current Knoppix software components but still add new components.
If you think this marked the end of our mission for us -- you are mistaken. Developers are enterprising people, especially free developers. Now that the problems with the software of our cameras and corresponding software development toolkits are practically resolved, the next software product is in line -- a toolkit for hardware development. You see, Elphel cameras use the FPGA Spartan-3, and software development for these reprogrammable microchips is one of the most important tasks. It is the quality of the code tied to the Spartan-3, that high performance parameters of our network cameras bank on. Therefore in the near future we plan to prepare a custom Knoppix-based Live-CD which will make hardware development possible. We will use specialized Xilinx software intended for programming FPGA's such as the Spartan-3.
On account of the transition to the DVD format, we plan to include all necessary reference and training materials coupled with the software, which will allow developers to quickly grasp the skills needed for working with FPGA's professionally. Specialized programs for development of printed circuit boards will accompany the complete set. Consequently this will result in a universal toolkit which will enable not only the development of network cameras, but any other equipment that uses an FPGA. This Live-DVD will be included with Elphel cameras, as well as freely distributed to any developer even if their work is not related with our cameras in any way.
Perhaps some people will think we are wasting our time creating development toolkits which are not vital for our cameras. In reality it's by no means useless work. By developing new software on the Knoppix Live-CD base, we create a comfortable environment for developers to bring significant contributions in perfecting our cameras. Even if they use our Live-CDs in other areas, the hardware developers will gradually convert (or, at least get accustomed) to principles of free development, which will positively affect the Linux-community as a whole. As you know, hardware problems arising due to closed specifications and proprietary drivers often add a spoon of tar to the Free Software batch of honey. We provide a real example that it is quite possible to create hardware according to principles of Free Software while making a profit, as well as offer anyone to try their hand in comparable projects and perhaps join followers of open software and hardware.
To be fair, we have to note that negative moments also inevitably arise with use of «Live» distributions (perfection as we know, is unattainable). In particular, the speed of applications is considerably reduced when working from a CD-ROM because the data is compressed and it takes time unarchive it. However, if you continually use a limited number of applications (as for example in the case of using Elphel cameras), all necessary data is loaded into virtual memory which increases work speed.
There is one more problem -- the limited size of a CD-format. If the software you are adding takes up substantial size, inevitably a question comes up: at the cost of which applications can this be accomplished? Usually, we first try to replace all software which is rarely used or is not essential for full functionality of the Live-CD. Another decision (I think, a more correct one) -- is the transition to more spacious optical disks -- DVD, for example.
But probably the support of your branch of a Live-CD poses the most complicated problem. Each new version of Knoppix comes with an mass of changes which don't always follow the previous structure. Thus appears a need for continued integration of the software developed at Elphel to the changed conditions of the Live-CD. A possible solution to this problem can be closer cooperation with the core team of Knoppix developers. Many changes we make with the new versions can be useful to other users of Knoppix too. Therefore in the near future we plan to prepare a list of improvements which in our opinion could be included in the basic distribution.
Despite some difficulties, everything mentioned above can serve as a precedent that the principles of free development have a huge potential which can be used in work on a great variety of projects. And Elphel is an example. Having chosen free software as a foundation -- Knoppix, Eclipse, Xilinx, MPlayer, Theora, etc. -- we were able to provide highest quality software for ourselves and our clients, with minimal expense of time and money. Thus we act not only as consumers, but also contribute to the world of free software. Along with creating specialized «Live» distributions, we tuned up Knoppix in terms of localization and changed the set of included applications, which has proven rather useful to another project -- «Russian Knoppix», a Russian version of the famous distribution. Besides, in the fall of the current year the popular Russian computer magazine «Home PC» is planning to release a specialized version of the Knoppix Live-CD which will use the experience and development of the Elphel team.
In the future we plan to work with the core developers of Knoppix more closely. Reasoning is that some improvements introduced during the preparation of our specialized Live-CD can be useful to many Knoppix users. This concerns recompiling the kernel, improvement of USB-2 support, compiling DEB packages in the Knoppix environment, etc. If such changes were necessary to us, it is possible they will be useful to someone else also.
Our project also brings considerable benefit to users of other Linux distributions. The Theora video codec is in its beta-testing stage, but is already advanced enough to be part of many free distributions. Having chosen this codec as the basic for processing content generated by our cameras, we constantly try to improve its functionalities. We work in close contact with the main developers of the Theora free codec. Moreover, the Theora developers have an opportunity to use our hardware, and at any time can make necessary actions on testing and debugging it on our equipment using remote access. Naturally, in the future all owners of free operation systems which include the free Theora codec will use the results of our joint experiments for handling of multimedia content.
One more important benefit resulting from our choice of Knoppix as the basis software for Elphel cameras is the opportunity of popularization of free operation systems for users who in the past worked exclusively with proprietary software. Receiving a whole set of development tools included with the free operating system together with the cameras, our clients can naturally adapt to work with alternative software on office computers and even home desktops. All this should occur naturally, without additional efforts or any strong-willed decisions of company managements. An additional incentive is the system of significant discounts if the buyers are planning to return the results of their improvements or own developments under open licenses to the community in the future.
Moreover, the principles of free software development that we use at our company pushed us to the idea of expanding the sphere of distribution of freedom -- by analogy to software, we distribute our hardware development under an open license too. Our cameras and specifications are completely open and accessible, allwowing recurrence and improvement (why not?) for all willing developers. We hope, that in the future this will allow other developers from different countries to work with us towards the creation of high-speed network cameras by analogy with the software development. Possibly our experience appears interesting for other manufacturers of hardware too, and that will be one more step to a completely free world of development of the new generation of digital devices. And we are confident that the principles of free open development will only help considerably speed up all scientific and technical progress.