Their own hands a mini-source Linux operating system
In this paper, to create this mini-Linux systems only in a specific single run, if the reader friends are interested, in this system be improved on the basis of, it is building a universal, in the most conventional PC crew to the plug-and-play system. But this is no longer the topic of this paper, friends if readers are interested, I can e-mail them and I have discussed the details of the matter.
Our goal Linux system running on a common PC-386 Intel, it can be a hard disk, can not drive while using Flash Disk instead. If it is set with Flash, from the need to be able to support Flash disk, and the size of Flash-M to 16 bytes or more. We hope that users start a boot, direct access X Window graphical interface, good operating procedures specified in advance. Does not require users to enter a user name and password to log on.
We set this goal a bit like an X Terminal terminal workstations. Little improvements can be made simply in the form of diskless, that is to say, with 16 M of the Flash disk will not. This, however, goes beyond the topic of this paper. If readers are interested in friends, and I can write for discussion.
System launched
Because we have to consider a start-up disk from Flash, we opted to use LILO as our Boot Loader, rather than use GRUB. This is because the GRUB strength of the hard disk and file system identification capabilities, and Flash in the end instead of the standard disk drives, and we use the file system may not be recognized GRUB undoing it will be self-defeating anti-GRUB. LILO on the simple and more, it began in the hard disk MBR write a small program, the small programs without file system directly from the hard drive sector, read out the Kernel Image into memory. Thus, the insurance factor will be greatly increased. And has given us freedom of choice File System room. So, are we going to install LILO?
First, we have to find an ordinary about 800 M IDE hard drive, even in the target machine IDE online. Our goal in this machine, IDE1 Flash disk is hung, hung IDE2 is a hard drive. We use standard steps in the standard hard drive IDE2 tops a Debian GNU / Linux system. Of course, if readers did not have friends Debian, Red Hat system can be installed. A properly working system, we must first do some reduction of the unnecessary X Window Service and everything deleted, and so on. The purpose of this is to enhance the system to boot speed, because in the back of our work, certainly have to be constantly re-activated machines, so we started to speed the efficiency is very crucial.
A properly working system, was done in a Falsh Ext2 file system, use this command mke2fs this can be completed. The Flash disk access is in the IDE1, in the Linux inside, it is the identity of / dev / hda. The author of this article in the operation of the whole set of a Flash entire district, therefore, call mke2fs when dealing with the / dev/hda1. Readers should be able to direct my friends in the / dev / hda done a Ext2 file system, instead of the prior district.
Flash set on doing a good job in the file system, you can build a good core of the image files to Flash vmlinuz copy of the disc. Attention to the need to put this vmlinuz image files are copied to the Flash disk, the disk before installing the Flash LILO. Otherwise, when the time comes but will LILO LILILILI fight Jiba, because it will not Kernel Image in Flash position on the disk, in which case Flash disk will not start up. Also, if readers friends in the Flash disk, which is a compressed file system, and also among LILO to time, although it can correct Kernel Image found on the hard drive of the initial position, but they have no way handle compressed file system to this Kernel Image, which they do not know how to translate it into memory to start.
Kernel Image copy of the past, we can edit a hands lilo.conf document, which can work on the system on the line. But attention to the index in lilo.conf in the path of the file name can write right. These are in the path of work on the system to look pathname. For example, if Flash was in the Mount / mnt directory, then in lilo.conf, vmlinuz pathname is / mnt / vmlinuz. Do not pay attention to this mistake. Otherwise, if the work Once off guard system to the LILO destroyed by the enemy, then trouble. There is a good lilo.conf, and then run lilo orders, attention must tell it to use this new lilo.conf file, and not to use / etc / lilo.conf.
LILO installed, we can immediately restart test. First in the BIOS inside, set to start from the IDE1, if we see the LILO prompt, and press the Enter Kernel output can see after the news, which is the installation of LILO success. Remember that the operation of this method, we updated after each match on the Flash Kernel Image, remember to update LILO. In other words, it is necessary to re-run again lilo command.
Compiler core
LILO success of the test installation, we started to consider compiling a new kernel. Of course, to compile a new kernel, we must first enter our system of work. There are two ways to enter systems, first in the BIOS setup from the start IDE2, of course, which calls for the initial installation of the system, to LILO installed in the / dev / hdb; Another option is activated or from the IDE1 , do not change the BIOS settings, but to see the LILO prompt the time to type linux root = / dev/hdb1, in the top of the linux lilo.conf there is a definition of entry, we will only use the designated entry The Kernel Image, but with / dev/hdb1 as a root file system. When the two approaches may have a better than another, some more convenient. That depends on the specific situation. However, these settings are not in conflict with each other.
In the compiler core, the core is because we only use a machine, we should have known it; the other hand, in order to reduce unnecessary complexity, we decided not kernel module support, and all items required for the direct compiled into the kernel inside. The core of this compiler out in a normal 586 motherboard, and put all the necessary functions are added, the general nor to 800 K bytes. Therefore, the approach is feasible. And reduce the complexity of the init scripts. From the operation to consider because of the need to code in the kernel anyway to load into memory, therefore, will not lead to a waste of memory.
In our target platform, we hope that the use of USB storage devices. Another point to note is that the Frame buffer support. This is mainly to support XFree86. Generally speaking, if the card is XFree86 direct support, and that the best course, it does not require the core support frame buffer. But if we do not support XFree86 graphics, we can consider using VESA mode. But XFree86 support the VESA card is not up and running beautiful, there are security issues, and sometimes during start-up and withdraw from the X Window will Huaping time. Therefore, we can use the kernel mode vesa the frame buffer, and then use the xfree86 linux frame buffer drivers. This normally see Huaping phenomenon, but there is no security problem.
Devfs is the topic we are interested. If the kernel does not use devfs, then the root system there will be a file system / dev directory of all of its contents. These elements can be used / dev / MAKEDEV to create scripts, mknod also can be used to build a manual one. This method has its own advantages. But it is the shortcomings of trouble, and the state of the kernel is not unanimous. On the contrary, if the use of devfs, we no longer need not worry about / dev directory of any thing. / Dev directory of the following items will be responsible for their own kernel code. Practical use to the effect of the consumption of the memory is not obvious. Therefore, we have chosen devfs.
Busybox
With LILO and kernel image, Next, we need to arrange the root file system. The flash disk space for only 16 M-byte, it can be said, this is our greatest challenge. Here we first introduced to small embedded Linux system for the root file system, a commonly used tool: BusyBox.
Busybox is Debian GNU / Linux famous Bruce Perens first development, the use of the Debian installation procedures. Subsequently, many Debian developers contribution to the force of this particular push busybox current defenders Erik Andersen, he was suffering from cancer, but it is an excellent free software developers.
Busybox to build a single independent enforcement procedures, called busybox. But it can be configured to implement ash shell functions, as well as dozens of small applications of the various functions. This includes a Mini-the vi editor, the system indispensable / sbin / init program, as well as other such as sed, ifconfig, halt, reboot, mkdir, mount, ln, ls, echo, etc. These cat … is a normal system indispensable, but if we put these procedures Original taken over the case, the size of their combined to overwhelm people. But busybox have all of the so versatile, but also size of about 100 K. Moreover, users can also according to their own needs, decided in the end to busybox in which several compiled into the application functions. So, bu