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 Boot manager, for example, directly from the BIOS or use the Kernel File "CP zimage
/Dev/fd0 "and other methods are directly started from the device, so you cannot pass parameters or options to the kernel-this may be one of the advantages of using the Boot manager such as Lilo.
Linux Kernel Parameters are a list of strings separated by spaces, usually in the following format:
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''. Then, the kernel searches the bootsetups array for the registered processing functions associated with this keyword, if you find the relevant registered handler functions, 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 parameters, 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 is not
"/", ".", Which defaults to "/TFTP-Boot ".
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. Grid
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 = 0x300, not all drivers except device = 0x300
0x300-0x31f.
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
On the Pentium or updated CPU, use mem = nopentium to close the 4 m page table, which must be stated during Kernel configuration.
10. Panic = N
By default, the kernel crashes-kernel panic
You can set the number of seconds 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. The default kernel Restart for 2.0.22 is cool.
Reboot and warm reboot are faster. You can use "reboot = BIOS" to inherit the BIOS settings.
12. nosmp and maxcpus = N
Only when
_ SMP __, this option is available. 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 specified during compilation, and the other is specified through "Profile =;
It provides a minimum unit, that is, the clock cycle. When the system executes the kernel code, profile [Address
>;>; The value of 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 parameters of the kernel Switching Algorithm
Number: max_page_age, page_advance, page_decline, page_initial_age,
Age_cluster_fract, age_cluster_min, pageout_weight, 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, 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 execute the above steps. Even if the kernel compiles initrd, it writes the data of initrd
/Dev/initrd, which is only a one-time device.

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.