📄 00000063.htm
字号:
support is a definite ``gotcha''. You'll get more efficient code compiling <BR>the kernel for the machine's specific architecture (Pentium
<BR>or 486), but a 386 kernel will run in any 32-bit Intel compatible clone; a <BR>Pentium kernel won't. An emergency boot disk for a large
<BR>number of computers (as well as distribution install disks) is best compiled <BR>as a 386. However, a 386 will not run a kernel compiled
<BR>for a Pentium.
<BR>
<BR>Next comes block devices--nothing special here. If your root device is on an <BR>IDE drive, just make sure you compile it.
<BR>
<BR>Then comes networking. For computers not connected to a network, you won't <BR>need much here unless you plan to use one
<BR>computer to dial-out while others connect through it. In this case, you'll <BR>need to read up on such things as masquerading and follow
<BR>the suggested guidelines.
<BR>
<BR>SCSI support is next, though why it doesn't directly follow block devices I <BR>don't know. If your root partition is on a SCSI device,
<BR>don't choose modules for SCSI support.
<BR>
<BR>SCSI low-level drivers follow general SCSI support. Again, modules only for <BR>devices that don't contain the root partition.
<BR>
<BR>The next section takes us back to networking again. Expect to do a lot of <BR>looking for your particular card here as well as some
<BR>other support such as ppp, slip, etc. If you use nfs to mount your root <BR>device, compile in Ethernet support.
<BR>
<BR>For those lucky enough to be needing ISDN support, the ISDN subsection will <BR>need to be completed.
<BR>
<BR>Older CD-ROMs may require support from the next section. If you're using a <BR>SCSI or IDE CD-ROM, you can skip this one.
<BR>
<BR>Next comes file systems. Again, compile what you need, in most cases ext2 and <BR>use modules for the rest.
<BR>
<BR>Character devices are chosen next. Non-serial mice, like the PS/2 mouse are <BR>supported. Look on the bottom of your mouse. Many
<BR>two-button mice are PS/2 type, even though they look and connect like serial <BR>mice. You'll almost certainly want serial support
<BR>(generic) as a minimum. Generic printer support is also listed here.
<BR>
<BR>The penultimate section is often the most troubling: sound. Choose carefully <BR>from the list and read the available help. Make sure
<BR>you've chosen the correct I/O base and IRQs for your card. The MPU I/O base <BR>for a SoundBlaster card is listed as 0. This is
<BR>normally 330 and your sound module will complain if this value is incorrect. <BR>Don't worry. One of the nice things about modules is
<BR>you can recompile and reinstall the modules as long as the kernel was <BR>compiled with the hook. (Aren't modules great?).
<BR>
<BR>The final section contains one question that should probably be answered as <BR>``no, kernel hacking''.
<BR>
<BR>Save your configuration and exit.
<BR>
<BR>I have, on several occasions, had trouble editing the numbers in menuconfig <BR>or xconfig to values I knew were correct. For
<BR>whatever reason, I couldn't change the number or config wouldn't accept the <BR>number, telling me it was invalid. For example,
<BR>changing the SoundBlaster IRQ from the config default of 7 to 5, and the MPU <BR>base I/O from 0 to 300. If you experience this
<BR>problem, but everything else went well, don't despair. The file you just <BR>wrote when you did a ``Save'' and ``Exit'' is an editable text
<BR>file. You may use your text editor of choice: Emacs, vi, CrispLite, joe, etc. <BR>Your configuration file is in the /usr/src/linux directory
<BR>and is called .config. The leading dot causes the file to be hidden during a <BR>normal directory listing (ls), but it shows up when
<BR>the -a option is specified. Just edit the numbers in this file that you had <BR>trouble with in the configuration process. Next, type
<BR>make dep to propagate your configurations from the .config file to the proper <BR>subdirectories and to complete the setup. Finally,
<BR>type make clean to prepare for the final kernel build.
<BR>
<BR>
<BR>
<BR>Building the Kernel
<BR>
<BR>We're now ready to begin building the kernel. There are several options for <BR>accomplishing this task:
<BR>
<BR> make zImage: makes the basic, compressed kernel and leaves it in the <BR>/usr/src/linux/arch/i386/boot directory as zImage.
<BR> make zlilo: Copies the zImage to the root directory (unless you edited <BR>the top-level Makefile) and runs LILO. If you
<BR> choose to use this option, you'll have to ensure that /etc/lilo.conf is <BR>preconfigured.
<BR> make zdisk: Writes zImage to a floppy disk in /dev/fd0 (the first floppy <BR>drive--the a: drive in DOS). You'll need the disk
<BR> in the drive before you start. You can accomplish the same thing by <BR>running make zImage and copying the image to a
<BR> floppy disk cp /usr/src/linux/arch/i386/boot/zImage /dev/fd0 Note that <BR>you'll need to use a
<BR> high-density disk. The low density 720k disks will reportedly not boot <BR>the kernel.
<BR> make boot: Works just the same as the zImage option.
<BR> make bzImage: Used for big kernels and operates the same as zImage. You <BR>will know if you need this option, because
<BR> make will fail with a message that the image is too big.
<BR> make bzdisk: Used for big kernels and operates the same as zdisk. You <BR>will know if you need this option, because
<BR> make will fail with a message that the image is too big.
<BR>
<BR>Other make options are available, but are specialized, and are not covered <BR>here. Also, if you need specialized support, such as for
<BR>a RAM disk or SMP, read the appropriate documentation and edit the Makefile <BR>in /usr/src/linux (also called the top-level Makefile)
<BR>accordingly. Since all the options I discussed above are basically the same <BR>as the zImage option, the rest of this article deals with
<BR>make zImage--it is the easiest way to build the kernel.
<BR>
<BR>For those of you who wish to speed up the process and won't be doing other <BR>things (such as configuring other applications), I
<BR>suggest you look at the man page for make and try out the -j option (perhaps <BR>with a limit like 5) and also the -l option.
<BR>
<BR>If you chose modules during the configuration process, you'll want to issue <BR>the commands:
<BR>
<BR>make modules
<BR>make modules_install
<BR>
<BR>to put the modules in their default location of /lib/modules/2.0.x/, x being <BR>the kernel minor number. If you already have this
<BR>subdirectory and it has subdirectories such as block, net, scsi, cdrom, etc., <BR>you may want to remove 2.0.x and everything below it
<BR>unless you have some proprietary modules installed, in which case don't <BR>remove it. When the modules are installed, the
<BR>subdirectories are created and populated.
<BR>
<BR>You could just as easily have combined the last three commands:
<BR>
<BR>make zImage; make modules; make modules_install
<BR>
<BR>then returned after all the disk churning finished. The ; (semicolon) <BR>character separates sequential commands on one line and
<BR>performs each command in order so that you don't have to wait around just to <BR>issue the next command.
<BR>
<BR>Once your kernel is built and your modules installed, we have a few more <BR>items to take care of. First, copy your kernel to the root
<BR>(or /boot/ or /etc/, if you wish):
<BR>
<BR>cp /usr/src/linux/arch/i386/boot/zImage /zImage
<BR>
<BR>You should also copy the /usr/src/linux/System.map file to the same directory <BR>as the kernel image. Then change (cd) to the /etc
<BR>directory to configure LILO. This is a very important step. If we don't <BR>install a pointer to the new kernel, it won't boot. Normally,
<BR>an install kernel is called vmlinuz. Old-time Unix users will recognize the <BR>construction of this name. The trailing ``z'' means the
<BR>image is compressed. The ``v'' and ``m'' also have significance and mean <BR>``virtual'' and ``sticky'' respectively and pertain to
<BR>memory and disk management. I suggest you leave the vmlinuz kernel in place, <BR>since you know it works.
<BR>
<BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -