Linux is a very powerful and Configurable operating system for many users. In the past, a Unix-like operating system was impossible for most people. It's not the four-digit price of the operating system, but its hardware. Even if you use the free SCO Unixware for personal use, it still requires SCSI devices, and many of us use the IDE devices to reduce costs. As Linux becomes increasingly powerful, you have to do some work on this simple operating system: Configure your core based on your hardware and operations.
The core of the current installation is 1.2.x or earlier. In any case, it is necessary to use the new 2.0.x core. The core can be obtained from the installation package, such as Red Hat, Caldera, and Debian. This is almost everything. When updating the core seems frustrating, It is not bad to use the installed core. Updating is good for your system.
Why are you looking for trouble?
Standard core installation is a kind of effort like many systems), try to install a set of available Linux systems as much as possible. In this case, the core is very inflated. It contains code that is not needed by General machines. Standard installation may also have no code required by users.
Of course, when you purchase new hardware, You need to upgrade your core. Upgrading in the same series is usually quite intuitive. When you upgrade, for example, from 1.2.x to 2.0.x, This is the scope of this article and requires a bit of understanding ). It is best to find a new sales CD to start-this is as practical as the 2.1.x core updated to the trial.
Core version number
All Linux kernels contain three numbers separated by dots. The first number is the core version. We are now the Third Edition 2.) Some people may use the core of version 1, And I know at least some people are using version 0.
The second number is the core master number, and the master number is also a number including 0), indicating stability. In this way, these cores will not have some buckets and they have undergone a considerable number of tests. When a version contains some small buckets, they will be upgraded to make the hardware compatible or enhance the core to deal with hackers. For example, the core 2.0.30 avoids the support for the 2.0.29 report BUG. It contains several patches, including protecting SYN to prevent server attacks. The core with zero master number is the core of development. These software packages that may not be tested, but may not be interrupted frequently. Sometimes, for better work, users need to adopt the latest and best support core before the next stable core release. This is the same as having no objection to the truth, which has essentially changed the system.
The last number is the next number, which is added for each change. If you see the core version 2.0.8, you know that it is the core of the core 2.0, the stable core, and it is already the ninth time we have published the note from scratch ).
I hate making any assumptions. They often hurt me. So I need to mention some things so that we won't work in the same way. To compile a core, you need something. First, I assume that you have installed the 2.0.x core, and there may be more basic packages, you also need to install gcc 2.7 and all libraries that support gcc. You also need the libc library, binutils, and bin86 packages, which are usually part of the standard sales version ). If you are downloading or copying from a CD, you also need tar and gunzip packages. Of course, you still need disk space. We recommend that you use 7 MB downloading and 20 mb unzipping, more for compilation.
Needless to say, many of the things we have studied need to be logged on as root. If a non-privileged user downloads the core and you have the write power of the/usr/src directory, you can still do a lot before becoming the root user. For new Linux users, I strongly recommend using non-privileged users (type: su-face) only as root is required for some work. One day, you will be glad to have this habit. Remember, there are two types of system administrators who may inadvertently cause installation crashes when logging on as root.
Obtain/upgrade source code
The Linxu core source program can be obtained from a large number of FTP sites and almost every Linux sales CD. New users can go to ftp. funet. fi to find the Linux core on the main site. You can plant the Linux core from a series of mirror sites on the site. Selecting a recent site helps reduce overall internet traffic.
Once you obtain the source program, the/usr/src directory is merged. Create a directory and place the source files that you extract with tar. I recommend that the directory name a version number such as linux-2.0.30 or kernel-2.0.30 and use the following command to create a linux connection for the Directory
Ln-sf linux-2.0.30 linux
I used-f in the connection command because you already have a core source connection in/usr/src, some versions of ln such as 3.13), force option-f) it will not work. You have to cancel the connection before establishing a connection. Run correctly in version 3.16) Now you only have one problem: if linux is a directory, not a connection, if you have this problem, you have to change the directory name before continuing:
Music linux linux-2.0.8
Run the following command:
Tar xzvf linux-kernel-source.tar.gz
I used to always include w in the tar parameter for confirmation ). Next let us see the .tar.gz or. tgz file decompress it to our directory, use ctrl-C to interrupt and then remove w to continue the command. In this way, I can prevent decompression to the current directory.
Once you unlock the core, this is the best time for you to execute the patch if you need it. If you do not want to run 2.0.30 core, but you want to use tcp-sy-cookies. Copy the patch tcp-syn-cookies-pathc-1) to the/usr/src directory and execute the following command:
This command is used to fix the core. Search for files with the extension. rej in the/usr/src directory. These files are not patched strictly. They may be important but need to be carefully read. If you have installed the Red Hat system and installed some not all core source programs, such .), you will see some files. If this is not what you need, you can do it.
Let's give you a piece of advice. Before we go to the Core Source Path directory and start compilation, let's check the required connections. The following connections exist in your/usr/include sub-directory:
Now, you need to know why the standard file search path is required. If you do not put the latest Core into/usr/src/linux (via connection), the above connection will not find the core compilation of the target file and will fail.
How to proceed
Once everything is ready, go to/usr/src/linux. File. h. c. I usually find that they are common and easy to configure. If you don't want to take risks, you don't have. Remember that you can still unmount the tar file (or reinstall the. rpm file) Before restoring the file.
We recommend that you first run the following command:
This command is not required when the core source program is in the previous conditions, but it cultivate a good habit. This command ensures that the old file is not used.
Now you can configure the core. First, you need to know a little about the module. Wedge is like inserting something in the core. If you want to use a small network in your house (but not often), you may want to compile the network card into a module. When using this module, the machine must run and access the modules in/libs, which means the driver (IDE, SCSI, etc., but must be an NFS-supported Nic ), the file system (usually ext2 but also nfs) and core type (preferably elf) must be compiled and cannot be a module. The module takes effect only during core boot, access to the driver (laiwang) and install the file system. These files must be compiled into the core or the start partition can be installed. If you install and start the partition and network, you need the network system file and compiled Nic.
Why use a module? Modularization makes the core simpler, which reduces the amount of protection space released by the core. The space used for module installation and uninstallation can be repeatedly allocated and utilized. If you open the machine for more than 90% of the time to use a module, compile it. Using such modules is a waste of memory because, once you compile the wedge, they will also occupy a large amount of memory, and the core needs some code to mount the module. Remember, the core is protecting space, but the module is not. In this case, I do not often use my devices. I compile it to support only ext2, ide, and elf. While I have been using the NIC, I compile other modules into: out, java, floppy, iso9960, msdos, minix, vfat, smb, nfs, smc-ultra (ethernet card), serial, printer, sound, ppp, and so on. Many of them only take a few minutes here or there.
The next step is to configure the core. In this case, we have three options -- the same purpose. I suggest using a graphical method. In the past, it was a simple input: make config. Start a series of questions. In addition, if you get an error, you only need to press ctrl-c to try again. You cannot even repeat questions in a certain order. Some questions are related to previous questions. If you have an absolute reason not to use any graphical method, you will find me in case of any problems.
We recommend that you use one of make menuconfig or make xconfig. If you use menuconfig, you must install the ncurses-dev and tk4-dev libraries. If you haven't loaded the above library and you don't want to use the following method, I suggest you install the above library now. You can still uninstall them later.
To run xconfig, you must install and configure X. Because X requires a large amount of memory, I install and configure X to only run X in part of the time. When compiling the core, I return to the previous console, memory is required for compilation. In my opinion, the xconfig menu is the best and easiest way to configure the core. In menuconfg, if you remove an option, its slave option will not be displayed. In xconfig, if you remove all options, the options are still displayed, and they are displayed in gray. The reason why I like it is that I can know what is newly added. I can open an option to get a new slave option for trial.
I will spend a little text describing some of the core configurations and telling you something I found.
The first section is the code-maturity-level option. The only question is whether you want to use the developed driver and code. If you have hardware that causes your bleeding, you may have to make a choice. If you choose "no", the test code will be gray or not displayed. If your core needs communication product support, you may choose "no ".
The second section involves modules. If you want to modularize, select "yes" in question 1 and 3 ". If you want to use all the required modules, such as the Netwar Support For Caldera's OpenLinux, you do not need to re-compile the module by answering "yes" in the second question.
Section 3 is general settings. Compile the module into ELF and compile it in binary mode. It is wise not to compile proper support for "gotcha". If your machine structure is Pentium or 486, you will get efficient code, but a 386 core will run on 32-bit compatible clone; a Pentium Core will not. Make an emergency boot disk for most machines, just like the vendor's installation disk) it is best to compile in 386, and 386 cannot run at the core compiled in Pentium.
Next is a block device-do not specify anything here. If your boot device is an IDE hard disk, just compile it.
The network is down. You do not need to stay here for users who are not connected to the network unless you plan to use a computer to dial up to connect to other users. Here, you need to read and follow the suggestions.
Next is SCSI. I don't know why I don't follow Block devices directly. If your boot partition is a SCSI device, do not select SCSI module support.
The common SCSI driver is a SCSI low-level device driver. Again, the module is only used on devices that do not start the partition.
In the next section, we will go back to the network again. I think you will find your special network card again, and support ppp, slip, and so on like others. If you use nfs to install your startup device, compile the NIC.
For those lucky people who need ISDN support, the ISDN slave option needs to be compiled.
The next section supports earlier CD-ROM, and if you use a SCSI or IDE CD-ROM, you can skip it here.
The following is a file system. Similarly, what you need to compile is usually ext2, so that the rest of the modules can be used.
The character device is the next option. Non-serial mouse, supports PS/2. Take a look at your mouse key. Many double-bond mice are PS/2 even if their connections look serial. Of course you want to support serial at the minimum. The List supports normal printers.
The second section is often difficult to create: it is a sound card. Read help files from the list. Make sure you have selected I/O and IRQ for your sound card. The mpu I/O of the sound card is 0. Generally, it is 330. If not, don't worry. The benefit of the module is that after the core compilation, you can re-compile, install the module, and mount the core. Is the module great ?)
In the last section, you must answer "no, kernel hacking" in this way ".
Save your configuration and exit.
Translator: The above is only the core compilation used by the author. If they are different, check your HOWTO.
I am in trouble modifying numbers in menuconfig or xconfig, but I am sure it is correct. In any case, I cannot change the number or the configuration does not accept the number and tell me it is illegal. For example, change the default IRQ value of the sound card from 7 to 5, and the mpu I/O value from 0 to 300. If you have experienced this problem, but everything is still good, don't be disappointed. The file you just saved and exited is an editable text file. You can use your text editor, such as Emacs, vi, criplite, joe, and so on. The configuration file is named. config in the/usr/src/linux directory. The preceding vertices make the common ls) unable to be displayed. You can see it with the-a option. Number that is troublesome during configuration in the editing file. Then, make dep transfers your configuration information from. config to a specific subdirectory to complete installation. Finally, make clean prepares the final core compilation.
Now we are preparing to compile the core. There are several options for this job:
The compression core will be left in the/usr/src/linux/arch/i386/boot directory named zImage.
Copy zImage to the root directory (unless you edit the upper Makefile) and run LILO. If you use this option, you have to make sure that/etc/lilo. conf is configured first.
Write zImage to the floppy disk at/dev/fd0 (that is, the first soft drive in dos :). You must have a disk in the drive before you start. You can also use make zImage to copy it to a floppy cp/usr/src/linux/arch/i386/boot/zImage/dev/fd0. Remember that it is of high density, the K disk at the bottom density won't be able to start the core. Hey, who is still using this player at this time? Don't tell me you have it)
Same as zImage.
Using the same core as zImage, you need to know that using this usually prompts that the image file is too large and fails.
Using the same core as zdisk, you need to know that using this usually prompts that the image file is too large and fails.
Other make options are also available, but they are special and will not appear here. Of course, if you need special support, like RAM disk, SMP, read the appropriate documentation and edit the Makefile in/usr/src/linux, which is also called top-level Makefile ). The options I discussed above are just as basic as the zImage options, and the rest is the easiest way to process make zImage-rebuilding the core.
For those who want to speed up the process, they will not do anything else, such as configuring other applications). We recommend that you check the man manual and use the-j option, for example, 5) and-l options.
If a module is selected during configuration, run the following command:
Put the module in the default search path/lib/modules/2.0.x/, and x is the core number. If you already have this sub-directory and it has sub-directories such as block, net, scsi, cdrom, and so on. Unless you have installed all the modules, you can delete 2.0.x and all of the following. When a module is loaded, the subdirectory is overwritten.
You can simply use the following three commands:
Make zImage: make modules: make modules_install
After the disk is inserted, return to this directory. The semicolon separates the commands on the same line and executes each command. This way, you do not have to wait until the next command is executed.
Once your core is re-built and the module is installed, be careful when necessary. First, copy your core to root or/boot/or/etc/, as you want );
Similarly, you need to copy/usr/src/linux/System. map to the agreed directory as the core image. Change the path cd) to the/etc directory to Configure LILO. This step is important. If pointer is not installed in the new core, it will not start. Generally, the core installation is vmlinuz. In the past, Unix users used this name together. "Z" indicates compression. "v" and "m" mean "virtual" (virtual) and "sticky)", which are respectively memory and disk management. I recommend that you keep the vmlinuz core until you know it works.
Edit the/etc/lilo. conf file and add it to the new core. Use the rows from image =/vmlinuz to the next or last image =. Change the first line to image =/zImage (assuming your core is in the root directory) to label =. select a different name. The first image is the default name. Start them in a specific order. Save and execute the command: lilo
You will see the core tag. The first one is the asterisk. If you do not see the label of the new core or the LILO has an error, You need to review the lilo help page for/etc/LILO. conf ).
We are ready to reboot. At this time, if you know that your system requires only one startup preparation, You can execute:
X is the core number of your reconstruction. This command creates the files required by some modules. Of course you want to be sure that the xdm is not directly started. For the Red Hat system, it means to ensure that the file/etc/inittab is not running at Layer 5th, Or you remember to run it at startup. For the Debian system, you can enter:
Mv/etc/init. d/xdm/eetc/init. d/xdm. orig
Move it back now.
Restart New Core
Restart the machine:
I do not recommend using hot start or ctrl + alt + del. In some cases, if the file system is not fully unloaded, it will damage the opened files. When LILO prompts, if you need to start the old core or use some parameters to start, if you do not see the startup prompt, you can try shift or ctrl, so that the startup prompt appears. Once it appears, press tab to view the core tag. Enter tags and optional parameters to start. Generally, the core is automatically started after the time specified by the/etc/lilo. conf file. At startup, you may see some error messages, such as SIOCADDR. This usually shows that the module is generally a network module) without guidance. It is very easy to handle this problem. If this error occurs, "VFS, cannot mount root", you should not compile the appropriate disk or file system support in the core.
Fault Detection and repair
Since there are multiple allocation methods when starting from/etc/initab, it is difficult to cover all possible causes in this chapter, such as your failure to start normally and its causes.
First, run depmod-a to make sure you have the up-to-date module sub-file (it is created in a specific directory ). if you encounter a series of errors when deciding to attach, if you do not enable "Module Versions" When configuring the core ". this is not a complete error. The module you compile and install is good. check/etc/conf. each line in the modules file points to/lib/modules, which are very complete:
(Note: The uname-r side ~ Symbol, which is located above the TAB key and SHIFT key on the left of the U. S keyboard .)
Make sure that kerneld runs and is started early at startup. if so, the system does not need to clarify the guiding module, and the core will handle it. be careful when the first rc Script calls the core. the core will abort the startup process, hot start or use the reset key or power off, if it is before the system knows the host name. if this happens to you, you can restart LILO and use the-B parameter to prevent any rc Script from using init. then, the rc/etc/rc. d/, rc. sysinit and rc. modules file. there are many ways to point out a directory such as/etc/modules /~ Uname-r ~ /~ Uname-v ~ List the retrieved startup modules. You can overwrite the old directories.
Mkdir/etc/modules/'uname-R'; cp/etc/modules/2.0.xx/g #1 Thu 3 Sep 1997. \ default/etc/modules/'uname-R'/\ 'uname-V '. default ""
Your system will contain modules of different dates, which may or may not use default extensions. In the above example, pay special attention to the use ~ And ~, They need to appear together in a proper place. once you discover the key of the system, you can start a system with special functions. if you go through further problems, the most direct thing is that there are detailed suggestions from experts on a mailing list. They successfully run a special region and are usually very high-tech new users. If you have any problems, you can ask them. Why, because they are a whole person who pays attention to and provides help on many issues. Good luck to you on the list. If your problem has not been mentioned by others, ask it by yourself. First, check whether there are mail-list archives. These files provide answers to common questions.
Customization of the core for your system compilation is a daunting challenge for new administrators, but it is worthwhile to spend some time. Your system will run more efficiently. More importantly, you will be more satisfied with your compilation.
In some cases, you may encounter problems. Remember to install the core and return to LILO. Do not overwrite your old core so that you can recover from LILO prompts to one of them. The vendor-specific problems encountered during the first restart are usually solved early. The seller usually only uses E-mailt for help, but it is not technical support.