Linux Kernel startup parameters

Source: Internet
Author: User

When the Linux kernel is started, it can receive some command line options or parameters at startup. When the kernel cannot identify some hardware and thus cannot set hardware parameters or manually pass these parameters to the kernel to avoid kernel changes to some parameter values.

If you do not use the start manager, such as directly starting from the BIOS or using the Kernel File "CP zimage/dev/fd0" or other methods directly from the device, you cannot pass parameters or options to the kernel-this may be one of the advantages of using the Boot manager such as Lilo.

The Linux Kernel Parameter isSeparated by SpacesA string list, usually in the following form:

Name [= value_1] [, value_2]... [, value_10]

"Name" is a keyword. The kernel uses it to identify who should pass the value after the "keyword", that is, how to process the value, whether it is passed to the processing routine, as an environment variable, or to "init ". The number of values is limited to 10. You can use this keyword again to use more than 10 parameters.

First, check whether the kernel keyword is 'root = '', 'nfsroot ='', 'nfsaddrs = '', 'ro', 'rw '', 'debug'' or 'init', and then the kernel searches the bootsetups array for the registered processing functions associated with the keyword. If a registered processing function is found, call these functions and pass the values following the keywords as parameters to these functions. For example, when you set the parameter name = A, B, C, D at startup, the kernel searches for the bootsetups array. If "name" is registered, call the "name" setting function, such as name_setup (), and pass A, B, C, and D to name_setup () for execution.

All types, such as the "name = value" parameter, are interpreted as environment variables after the system is started if they are not received by the setup function described above, for example, "term = VT100" is used as a startup parameter.

All parameters that are neither received by the kernel-set function nor set as environment variables will be left to the INIT process for processing, such as "single ".

The common device does not have any parameter for start.

1. init =...

Set the name of the initialization process executed by the kernel. If this item is not set, the kernel will try/etc/init in order,

/Bin/init,/sbin/init,/bin/sh. If none of them are found, the kernel will throw the kernel panic: error.

2. nfsaddrs =...

Sets the NFS start address when starting from the network, which is given in the string format.

3. nfsroot =...

Sets the NFS root name when the network is started. If the string does not start with "/", ".", it points to "/TFTP-Boot" by default ".

The above 2 and 3 are very useful in diskless websites.

4. no387

This option can only be used when config_bugi386 is defined. Some i387 coprocessor chips use 32-bit protection mode, such as some floating point operations, this parameter allows the kernel to ignore the 387 coprocessor.

5. No-hlt

This option is available only when config_bugi386 is defined, and some early i486DX-100 chips have problems in processing the "hlt" command and cannot return reliably to the operating system after executing the command, this option prevents Linux from suspending CPU when the CPU is idle.

6. Root =...

This parameter indicates the device used as the root file system during kernel startup. For example, you can specify the root file as hda8: Root =/dev/hda8.

7. Ro and RW

The RO parameter tells the kernel to load the root file system in read-only mode for file system integrity check, such as running fsck. The RW parameter tells the kernel to load the root file system in read/write mode, which is the default value.

8. Reserve =...

Retain the port number. Format: Reserve = iobase, extent [, iobase, extent]..., used to protect the I/O ports in a certain area from being automatically detected by the device driver. On some machines, automatic detection fails, or the device is faulty or does not want the kernel to initialize the device. For example, reserve = 0x300, 32 device = 0 X, all drivers except device = 0x300 do not detect I/O Ports in the 0x300-0x31f range.

9. mem =...

Limit the amount of memory used by the kernel. In the early stage, BIOS was designed to only recognize memory below 64 mb. If your memory is larger than 64 MB, you can specify that if the number you specify exceeds the actual number of installed memory, system crashes sooner or later. For example, Mem = 0x000000 means 16 MB of memory. If mem = 0x6000000, 96 MB of memory is used.

Note: many models use some memory as BIOS ing, so you must reserve space when specifying the memory size. You can also use mem = nopentium on the Pentium or updated CPU to close the 4 m page table, which must be stated during Kernel configuration.

10. Panic = N

By default, the kernel crashes-the kernel panic will crash without restarting. You can set the number of seconds after the crash to restart the machine; you can also set it in the/proc/sys/kernel/panic file.

11. Reboot = [warm | cold] [, [BIOS | hard]

This option can be used only when config_bugi386 is defined. By default, the kernel restart of 2.0.22 is cool reboot, and warm reboot is faster. You can use "reboot = BIOS" to inherit the BIOS settings.

12. nosmp and maxcpus = N

This option is available only when _ SMP __is defined. It can be used to disable multiple CPUs or specify the maximum number of CPUs supported.

Startup parameters for kernel development and debugging

These parameters are mainly used for kernel development and debugging. If you do not perform similar work, you can simply skip this section.

1. Debug

Linux has many log levels (For details, refer to Linux/kernel. h). Generally, the log daemon klogd only writes logs higher than the debug level to the disk. If this option is used, klogd also writes the debug information of the kernel into the log.

2. Profile = N

During kernel development, if you want to know exactly where the kernel consumes the CPU clock cycle, you can use the core analysis function to set the variable prof_shift to a non-0 value, there are two ways to achieve this: one is to specify at compilation, the other is to specify through "Profile =", and the other is to give a minimum unit-namely the clock cycle; when the system executes the kernel code, the value of profile [Address >;>; prof_shift] is accumulated. You can also get some information about it from/proc/profile.

3. Swap = N1, N2, N3, N4, N5, N6, N7, n8

Set eight kernel switching algorithm parameters: max_page_age, page_advance, page_decline, page_initial_age, age_cluster_fract, age_cluster_min, pageout_weight, and bufferout_weight.

4. Buff = N1, N2, N3, N4, N5, N6

Set six kernel buffer memory management parameters: max_buff_age, buff_advance, buff_decline, buff_initial_age, bufferout_weight, and buffermem_grace.

Ramdisk Parameters

(Only when the kernel is configured and compiled with config_blk_dev_ram ). Generally speaking, using ramdisk is not a good thing, and the system will use available memory more effectively. However, when starting or making a boot disk, using ramdisk can easily Mount images on devices such as floppy disks (especially during installation and startup), because before using a physical disk, some necessary modules, such as file system modules and scsi drivers, must be loaded (see my initrd-x.x.x.img File Analysis-creating root file systems not supported by setup ).

Early ramdisk (such as the core of 1.3.48) was statically allocated and the size of ramdisk must be specified with ramdisk = n. Now ramdisk can be dynamically increased. There are a total of four parameters, two Boolean, and two integers.

1. load_ramdisk = N

If n = 1, ramdisk is loaded. If n = 0, ramdisk is not loaded. The default value is 0.

2. prompt_ramdisk = N

If n = 1, the system prompts you to insert a floppy disk. If n = 0, the system does not prompt you to insert a floppy disk. The default value is 1.

3. ramdisk_size = N or ramdisk = N

Set the maximum ramdisk value to n kb. The default value is 4096kb.

4. ramdisk_start = N

Set the starting block number of ramdisk to N. this parameter is required when ramdisk has a kernel image file.

5. noinitrd

(Only when the options config_blk_dev_ram and config_blk_dev_initrd are configured in the kernel) The current kernel supports initrd. The pilot process first loads the kernel and an initialized ramdisk, then the kernel converts initrd to a normal ramdisk, that is, the root file system device in read/write mode. Then run linuxrc, load the real root file system, unmount ramdisk, and finally run the startup sequence, such as/sbin/init.

The noinitrd option tells the kernel not to perform the above steps. Even if the kernel compiles initrd, it writes the data of initrd to/dev/initrd, which is only a one-time device.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.