A detailed configuration of a compiled kernel [4]

xiaoxiao2021-03-06  48

Section 4 to enable the kernel

Usually, the core installation is called VMLinuz. In the past, UNIX users played this name. "Z" indicates compression, "v" and "

M "means" Virtual "and" sticky ", each belongs to memory and disk management.

Leave the VMLinuz core until you know it work.

In order to be able to use the new version of the kernel, you still need to do some changes:

#CP /usR/src/linux/system.map /boot/system.map-2.2.16

#CP / USR / SRC / Linux / Arch / i386 / Bzimage /Boot/Vmlinuz-2.2.16

These two files are newly generated when compiling. Two links under / boot below System.map and VML

INUZ makes it a file to the new kernel:

#CD / boot

#RM -F System.map VMLinuz

#LN -S VMLinuz-2.2.16 Vmlinuz

#LN -S System.map-2.2..16 system.map

Note: To keep the VMLinuz core, the following steps are processed

#CP /usR/src/linux/system.map /boot/system.map-2.2.16

#CP / USR / SRC / Linux / Arch / i386 / Bzimage /Boot/Vmlinuz-2.2.16

#CD / boot

#RM -F System.map

#LN -S System.map-2.2..16 system.map

Now #vi /etc/lilo.conf, increase as follows:

Image = / boot / vmlinuz-2.2.16 is the core set to be installed

Label = Linux2.2.16 is used by lilo to tell you that the core or job system is now

,

Read-only

Root = / dev / hda2 is the root directory of this special job system /

  in which root = / dev / hda2 must be modified as needed.

Run: # / sbin / lilo -v save the execution command: lilo you will see the core label, the first is an asterisk. If you

Didn't see the new core label or LILO error, you need to work back to /etc/lilo.conf (see below)

LILO analysis).

Confirm that the editing of /etc/lilo.conf is correct, and now restart the system:

#SHUTDOWN -R Now

It is not recommended to use hot start or CTRL Alt DEL key. In some cases, the file system is not completely unloaded.

document. At the LILO prompt, if you need to start the old core or start using some parameters, if you have not seen

Start prompt, you can try with Shift or Ctrl keys, so start prompt appears. Once there is, press Tab to see the core

Heart label. Enter the label and optional parameters start. Usually, automatically start after the /etc/lilo.conf file specified

Moving core. When you start, you may see some error messages like SiocAddr. This often displays the module (usually the network

A module) is not guided. Treating this is very simple, if there is this error, "VFS, Cannotmount Root", you

Do not compile appropriate disks or file system support in the core.

Press the Tab while the machine is restarted, press the Tab button, enter Linux2.1.16, and the new kernel work.

Appendix: LILO analysis (technical strength, for reference only)

The first part LILO introduction LILO (Linux Loader) is a good boot manager comes with Linux, which can be easily guided using it.

Multiple operating systems on a machine. LILO boot mode is more likely to be more common than other commonly used guidance loading programs

Artistic, in-depth understanding, will help us to handle multi-operating system, network boot, big hard disk

And many tricky problems such as large memory.

LILO's boot mechanism ------ It is well known that the initial start of the computer is controlled by the BIOS, in some hardware (

Such as: memory, keyboard, etc.) After initialization, it will attempt to load the hard disk's main boot record (MBR) or floppy boot

Sector. The MBR can operate in two ways, which is positioned to the active partition and load the corresponding guiding sector, and then

The guiding sector completes the loading of the basic components of the operating system within the partition; the second is to load the letter directly from a designated partition

Interest, and loaded into any partition operating system, such as Lilo, OS / 2 Boot Loader and Partition Ma

GIC and other boot loaders can be configured to be in this way. The boot sector of the floppy is equivalent to the boot of the hard disk activity partition.

Sector, which is usually used to load the operating system on the floppy disk. It can be seen that as long as LILO is installed in MBR, the activity partition

Or boot the floppy disk, you can take over the control of the computer, and then follow the LILO to complete the boot process. LILO

There is a boot table address code, where it can be positioned to Linux kernel file, this address

The code can be used in accordance with the cylindrical / head / sector (CHS) mode, but also using LBA linear block mode, so even

It can operate well for some SCSI control program LILO.

When LILO is positioned to the configuration file, the prompt is displayed by the pre-boot process: LILO BOOT:

At this point, the system allows selection to boot different operating systems or different kernel configurations, press Tab keys to display options list

, Then enter an option or transfer to the default configuration, if you select boot Linux, you can also transfer

Parameters to the system kernel.

Compared to other system boot loaders, LILO has greater flexibility, and its boot method is also more colorful.

● When LILO is installed on the MBR, active partition or boot floppy disk of the hard disk, it can

Guide any Linux and other operating systems on either partition of any partition; in addition to the guiding sector, it does not have any implicit files

Needless to use a specific partition, its profile can be in any partition, or even stored with Linux.

Under a subdirectory of the coherent DOS partition; it can guide several different kernel configurations, even a few different kernels

It guides multiple Linux versions on the same machine; up to 16.

● It boots Linux from the network.

● LILO flexibility makes its configuration is quite complex, and when there are multiple systems coexisting, it is recommended to install additional operations first.

The system, finally load Linux so that the boot setting of LILO to other systems is relatively simple.

Part II LILO parameters

Usually we talk about LILO, it will involve two aspects - LILO boot procedures and LILO installation commands / sbin / lilo.

In order not to confuse these two concepts, this article will use lilo to represent the LILO boot process, and LILO represents / sbin / lilo

. Generally, LILO uses a text file /etc/lilo.conf as its configuration file. LILO reads lilo.con

f, write a specific LILO to the system boot area according to the parameters. At any time, modify /etc/lilo.conf,

You must re-run the lilo command to ensure that the configuration parameters used by Lilo's normal transport lilo.conf, which is quite complicated. The following is a preliminary discussion as a preliminary discussion with Redhat Linux, and the Redhat's LILO package version is 0.

20, other Linux release versions may have, but will not be too big.

The configuration parameters in the lilo.conf file are divided into two parts, part of the global parameters, and the other part is the boot image parameters.

. The boot image parameters act on each boot image area. If a boot image parameter (for example: Password is

The definition of the global parameter conflicts, the definition of the boot image parameter is subject to the definition of the boot image parameters, but is limited to the boot image area. Li

There are a lot of boot parameters of LO, which is only for some important parameters. Other configurations with Linux systems

Like the file, a line of words after the "#" is commented.

1. "Boot =" This parameter indicates the device name (such as: / dev / had) containing the boot sector. If this item is ignored,

The leading guide sector is read in the front part of the zone.

2. "root =" This parameter tells the kernel which device is used as a root file system when starting, and its set value is within the constructor.

The device name of the root file system is available, and the available equipment name is:

(1) / dev / hdan ~ / dev / hddn: ST-506 compatible hard disk, N partitions on A to D

(2) / DEV / SDAN ~ / DEV / SDEN: SCSI is compatible with hard disk, N partitions on A to E

(3) / dev / xdan ~ / dev / xdbn: XT compatible hard disk, N partitions on A to B

(4) / dev / fdn: floppy disk, A: (n = 0) or B: (n = 1)

(5) / dev / nfs: Sign from the root file system by the network

3. "NFSROOT =" If you need to provide the root file system through NFS to boot the diskless workstation, this parameter is specified for the kernel.

The machine, directory, and NFS where the root file system is located, its format is: nfsroot = (:)

OOT_DIR> (, NFS_OPTIONS))

4. "NFSADDRS =" Sets the various network interface addresses required for network communication, such as no such parameters, the core will try to use

Reverse Address Analysis Agreement (RARP) or Start Agreement (BootP) identity: NFSADDRS =

NOT IP>: : : : :

:

5. "Image =" Specifies the kernel file of Linux.

6. "DELAY =" setting the waiting time before booting the first image.

7. "Disk =" This parameter defines a non-standard parameter for a particular hard disk.

8. "Append =" transmits an optional parameter line for the kernel, and the typical application is to automatically be automatically detected by the system.

Other hard drives specified parameters, such as: append = "hd = 64, 32, 202"

9. "Label =" This parameter specifies a name for each image for booting.

10. "Read-Only" settings in read-only mode to root file system for file system consistency check (FSCK)

.

11. "Install =" Install a specified file as a new boot sector, default to /boot/boot.b.

12. "Loader =" Description The chain loader used, defaults to /boot/chain.b, if not started from the first hard disk or floppy disk, then this option must be explained.

13. "Table =" describes the device name containing the partition table. If this parameter is ignored, the bootloader will not be transmitted.

Area information to the bootable operating system. When the partition table pointed to this parameter is modified, you must re-run / sbin / li

LO.

14. The program executed when the kernel initialization is initialized, and the process is init, getty, rc and sh, version 1.3.4

3 Since the Linux kernel has executed / sbin / init, if you ask during the boot process

The question can be set to the shell directly to the SHELL.

15. "RamDisk_start =" Since the kernel cannot be placed in a compressed memory file system image, in order to make the kernel image

Enough and compressed memory images are placed in a floppy disk, add "ramdisk_start = ", so the kernel

Can begin to execute.

16. One of the purposes of this parameter is the number of memory used for Linux: such as MEM = 96MB, the purpose of the purpose

Is the specified MEM = NOPENTIUM tells the kernel not to use a 4MB paging table.

17. "VGA =" Sets the display mode, such as 80 × 50, 132 × 44, etc.

18. "Linear" generates line for replacing the hard drive sector / head / cylinder address (hard disk geometric parameters)

AR sector address. The LINEAR address is generated at runtime and does not depend on the hard disk geometry. Some SCSI hard drives and one

This parameter may be required to use the IDE hard drive used in LBA mode. Note: When LILO is installed on the floppy disk

You cannot use the "linear" parameter.

19. "Prompt" gives "Boot:" prompts, forced LILO waiting for the user's keyboard input, press Enter Key

Guide the default operating system, and press the Tab key to print the optional operating system. When "PROMPT" is set

"Timeout" is not set, the system will always be waiting for a state without booting any operating system. Not set

When the parameter, LILO does not give "Boot:" prompt and direct the default operating system directly, unless the user presses Shift.

Ctrl, any of the Alt three key. In most cases, if there are multiple operating systems on your hard disk, it is recommended to make

With parameters, it leaves the user a selection room.

20. "Timeout =" Set the length of the time waiting for the keyboard to enter, and the unit is 0.1 seconds. If you have not input it exceeds this time

Timeout, the system will automatically boot the default operating system. If this parameter is not set, the default timeout length is not

Poor.

twenty one. "Other =" settings contain non-Linux operating systems such as DOS, SCO UNIX, Windows 95 and other systems boot

Image of the image or device.

twenty two. Alias ​​= Name gives a alias for the current operating system.

Part III LILO Typical Configuration Method

Typically, Linux's installer itself can complete the installation configuration of LILO, thereby solving multiple

Guide question, if the system cannot automate this configuration, you can modify the configuration file / etc / l

Ilo.conf to achieve guidance under different conditions.

1. When the system can automatically complete the configuration

There is only one suggestion for this situation: install LILO to the root of the Linux partition, not MBR's multi-zone

. Suppose there is a DOS / Windows in the current HDA1, and Linux is installed in HDA2, /etc/lilo.conf is large

The following:

Boot = / dev / hda2 # Specify boot position

Compact

DELAY = 50 # delay 5 seconds

Root = current # root in the current partition

Image = / boot / vmlinuz # Specifies Linux kernel files

Label = Linux # with Linux as a representative name

Other = / dev / hda1 # Subregion in other operating systems

Table = / dev / hda # Specifies a hard disk that contains partition tables

Label = DOS # with DOS representative name

2. When the system does not automatically complete the configuration

The system cannot be automatically completed, and there are two cases:

(1) BIOS can't see the root partition of Linux directly;

(2) BIOS can only read the first 504MB of the standard IDE hard drive.

At this time, you must follow a basic principle: establish a smaller Linux partition that BIOS can access, which contain

The necessary contents such as kernel files, mapping files, and chain loaders, and roots can be another independent partition. to

Typically, Linux's installer itself can complete the installation configuration of LILO, thereby solving multiple

Guide question, if the system cannot automate this configuration, you can modify the configuration file / etc / l

Ilo.conf to achieve guidance under different conditions.

1. When the system can automatically complete the configuration

There is only one suggestion for this situation: install LILO to the root of the Linux partition, not MBR's multi-zone

. Suppose there is a DOS / Windows in the current HDA1, and Linux is installed in HDA2, /etc/lilo.conf is large

The following:

Boot = / dev / hda2 # Specify boot position

Compact

DELAY = 50 # delay 5 seconds

Root = current # root in the current partition

Image = / boot / vmlinuz # Specifies Linux kernel files

Label = Linux # with Linux as a representative name

Other = / dev / hda1 # Subregion in other operating systems

Table = / dev / hda # Specifies a hard disk that contains partition tables

Label = DOS # with DOS representative name

2. When the system does not automatically complete the configuration

The system cannot be automatically completed, and there are two cases:

(1) BIOS can't see the root partition of Linux directly;

(2) BIOS can only read the first 504MB of the standard IDE hard drive.

At this time, you must follow a basic principle: establish a smaller Linux partition that BIOS can access, which contain

The necessary contents such as kernel files, mapping files, and chain loaders, and roots can be another independent partition. to

For additional details on the configuration, we will explain the following examples.

Part IV LILO.CONF Configuration Example

With these basic knowledge, we can easily configure LILO in your own intent.

Example. Lilo.conf file

Boot = / dev / hda # Install LILO in MBR. LILO as the main boot manager

Message = / boot / message # 注释 / / Boot / Message

Compact # produces a smaller "map" file

Map = / boot / map # Specify "map" file for / boot / map

INSTALL = / boot / boot.b

Password = zhoudi # Set the password

VGA = Normal # 80x25 Text Mode

Linear # Use the "Linear" address prompt # prompt user keyboard input

Timeout = 50 # timeout time is 5 seconds

Default = DOS # default boot Label's operating system for DOS

Image = / boot / vmlinuz-2.0.34-1 # Set the core used by Linux

# Set up Linux core boot image

Label = Linux # ID LINUX

Root = / dev / hda1 # Set the root file system

Read-only #lilo loads root file system in read-only mode

# Set MS-DOS or Windows 95

Other = / dev / hda2 #dos partition second partition for the first IDE hard drive

Label = DOS # ID DOS

Table = / dev / hda # master device is the first IDE hard disk

# Set Sco Unix Note: The SCO partition must be set to an Active partition and install LILO on the MBR.

Other = / dev / hda3

Label = SCO

Table = / dev / had

In this example, LILO is the main boot manager to manage all operating systems on the machine. LILO can also be used as two

Level boot manager, this can only be done with the "boot" parameter to the root partition. For example: boot = / dev / h

DA1 When using LILO in this way, the Linux root partition must be set to live with DOS or Linux's FDISK program.

Different partitions, and this way is only valid for the hard disk primary partition (not extended or logical partition).

Example II. LINUX and DOS / Windows are required for a standard IDE big hard drive.

For big hard disk problems, many people only know less than 1024 cylinders, and I don't know why standard IDE hard disks only

Can recognize 504MB before. In fact, the BIOS's INT13 call is a CHS code of three bits, 10 is a column, 8

The bit is a magnetic head number, and 6 is a sector number. The possible cylindrical number is 0 ~ 1023, and the possible head number is 0 ~ 255, and

Possible sector numbers on the track are 1 ~ 63, with this 24-bit address 8455716864 bit tuple (7.875GB)

. But unfortunately, the standard IDE interface allows 256 sectors / tracks, 65536 cylinders and 16 heads. itself

It can access 237 = 137438953472 (128 GB), but add 63 sectors and 1024 cylinders in BIOS.

Level only 528482304 (504MB) after the restriction is derived.

Countermeasure: 350MB (/ dev / hda1) is divided into DOS, 150MB (/ dev / hda2) to Linux in the top 500MB of the hard disk,

The parameters of the hard disk should be explained in the corresponding configuration file.

Boot = / dev / hda

...

Disk = / dev / hda

BIOS = 0x80

Sectors = 63

HEADS = 16

Cylinders = 2100

Image = / vmlunuz

Append = "HD = 2100, 16, 23"

Root = / dev / hda2

Label = Linux

Example three. If you have a big hard disk over 8 g, and you need to install Linux in a relatively post-relying position,

In installation, select the linear mode and give it a hard disk parameter.

The hard disk parameters of the installation can be written like this: HD? = Cyls, heads, the uppercase letters in SECS need to use actual

The hard disk parameters are replaced, these parameters can be found on the label of the hard disk, or see the hard drive in the BIOS settings.

The parameter corresponds to the line of the LBA mode. The question mark is determined according to the hard disk. When it is actually used, it can be one of the four letters of A, B, C, D. such as: HDA = 1869, 63, 255 This is the IBM 15.2G hard drive parameter.

Of course, after Linux, you can add this file by editing /etc/lilo.conf, then run over

LILO reached the same purpose. Below is the contents of lilo.conf before the unpaid parameters:

Boot = / dev / hda

MAP = / boot / map

INSTALL = /BOOT / BOT.B

Prompt

TIMEOUT = 50

Image = / boot / vmlinuz

Label = Linux

Root = / dev / hda1

Initrd = /boot/initrd-2.2.12-20.img

Read-only

After adding the parameters in linear, it is formatted as follows:

Boot = / dev / hda

MAP = / boot / map

INSTALL = /BOOT / BOT.B

Prompt

Linear <----- added this line

TIMEOUT = 50

Image = / boot / vmlinuz

Label = Linux

Root = / dev / hda1

Initrd = /boot/initrd-2.2.12-20.img

Read-only

Append = "HDA = 1869, 63, 255" <------ Added this line Note that the append parameter is for each system

Boot records, be sure to put below the image or below, so that it can play a role.

When the Linux system is started again, LILO is guided by linear mode. In addition to seeing on the hard disk

There is no impact on other ways in other ways.

Chapter 3 Application of Core Compilation

First section embedded Linux technology

What is your Linux? (And practical results)

This is not what I wrote, just used to refer to the manufacturing Small Kernel, the effect is OK.

Minimum Linux kernel

I am using the mandrake core 2.2.15, I did not modify any line of code, completely rely on the modification configuration

This data is obtained.

First, use Make Xconfig to take all options to take.

Don't floppy

Don't be SMP, mtrr

Don't NetWorking, SCSI

Remove all Block Device, leaving only Old IDE Device

Remove all Character Device

Remove all FileSystem, leaving only Minix

Don't support Sound

I believe me, I have been removed by all options. After doing this, I got a core of 188K. Do not

After this core, I am afraid hard to play Linux's function, so I decided to add the network back. Generate

NetWork support is returned, recompile, the core turns 189 K. 10K to change TCP / IP Stack, it seems

It is very calculated business.

However, there is still a stack without Driver is also awkward, so I use the RTL8139 commonly used by Embedded Board.

Driver plus back, 195K. If you need a DOS archive system, that size is 213K. If MiniX is used

EXT2 is replaced, the size is grown to 222K.

However, everyone should pay attention to the size of there refers to the size of the core file. Then, the recollected memory is two things.

. The meaning of this digital representative is that you need more ROM to hold your core.

The memory required by Linux is approximately 600 ~ 800 k. 1MB may be booted, but it may not be useful. Because there may be difficult to connect the C library. 2MB should be done, but may get to 4MB or more

A complete system can be implemented.

Seeing this, if you think that Linux is really a big. Ok! Then let's take a look at these spaces,

The following list is made from the core of 222K.

# wc

Arch / i386 / kernel / kernel.o

ARCH / I386 / MM / mm.o

Kernel / kernel.o

MM / mm.o fs / fs.o

IPC / IPC.O

FS / filesystems.a

NET / NETWORK.A

Drivers / Block / block.a

Drivers / char / char.a

Drivers / Misc / Misc.a

DRIVERS / NET / NET.A Drivers / PNP / PNP.A

/usr/src/smalllinux/arch/i386/lib/lib.a

/usr/src/smalllinux/lib/lib.a

/usr/src/smalllinux/arch/i386/lib/lib.a

The results are as follows:

243 2250 81946 Arch / i386 / kernel / kernel.o

42 316 10569 ARCH / I386 / MM / mm.o

173 1541 74660 kernel / kernel.o

266 2307 68053 mm / mm.o

222 3139 123193 fs / fs.o

49 602 21600 IPC / IPC.O

263 2940 106504 fs / filesystems.a

137 1510 65512 Net / Network.a

92 719 39178 Drivers / Block / block.a

230 2308 87556 Drivers / Char / Char.a

1 1 8 Drivers / Misc / Misc.a

83 721 25680 Drivers / Net / Net.A

1 1 8 Drivers / PNP / PNP.A

20 187 9526 /usr/src/smalllinux/arch/i386/lib/lib.a

23 150 7714 /usr/src/smalllinux/lib/lib.a

20 187 9526 /usr/src/smalllinux/arch/i386/lib/lib.a

1865 18879 731233 Total

Take it first, the size of the size and the final size here are a bit different, but can still be used. Since this

730K is actually about 600K. Obviously, FileSystem is quite large. About 230K

, Accounting for 1/3 volume. Memory management accounted for 80K, and the total part of the core is similar. TCP / IP STA

CK accounted for 65K, the driver accounted for 120K. SYSV IPC accounts for 21K, if necessary, can take it, the core file should

This can be left around 10k. So if you want to reduce the core size, should you move? The answer should be obvious,

Of course, the archive system. Linux's VFS reduces archive system design, Buffer Cache, Directory C

ACHE increases the efficiency of the system. But these Embedded systems that are on Flash is basically on Flash.

It is not large. If you can take them, the core can be left right away from 20K. If you skip the entire VFS,

Putting the archive system into a DRIVER model, you should reduce 230K to about 50K. Entire core

Heart shrinks around 100K.

From the above data, UCLinux reduces MM part is not much, mainly MM except for Virtual Memory, the part of Memory Allocation, this is invincible. If both

Allow, the Linux core below 100K is not impossible.

Practice: successfully compiled 196K core, but can't be used to start Redhat, it is too large. 280K can start, positive

Work hard to a smaller effort.

Conclude

The papers finally finished, and it is necessary to review my graduation design process.

For a non-computer professional student, this topic is more challenging. Today, Today, Linux

The information on the system and network management can be seen everywhere, but the kernel data is scarce, and people don't know what it is. Start as long as it is Linux

The book is seen, and I feel that the horizons open, gradually clear the direction. Collecting translation materials into important content, there is

Time to find information on the Internet, and then constantly check it on the system. The core of thesis ------ Compile process begins with the teacher

Guide, configuring the kernel 21 big items hundreds of knowledge points can be said to be a accumulation, which makes me feel a sense.

In addition to the detailed narrative, the paper also explains the reasons, and even appendices. While I highlight, I will

I am tied to the content other than my topic ------ embedded Linux operating system, because I know that my topic is a comprehensive topic -

---- Design device (theory) with an embedded operating system ------ The previous work.

转载请注明原文地址:https://www.9cbs.com/read-89387.html

New Post(0)