Linux operating system kernel startup parameters detailed analysis

  
 The Linux kernel can receive certain command line options or startup parameters when it is started. When the kernel does not recognize certain hardware and thus cannot set hardware parameters or to prevent the kernel from changing the values ​​of certain parameters, you can manually pass these parameters to the kernel in this way.
If you don't use the boot manager, such as directly from the BIOS or booting the kernel file directly from the device with methods such as “cp zImage /dev/fd0”, you can't pass arguments or options to the kernel -- this is probably what we use One of the benefits of boot managers such as LILO.

Linux kernel parameter is a space-separated list of strings, typically has the following form:
name [= value_1] [, value_2] ... [, value_10]
& ldquo; name & rdquo Is a keyword that the kernel uses to identify who should pass the value after the keyword "," that is, how to handle the value, whether it is passed to the processing routine or as an environment variable or thrown to “init”. The number of values ​​is limited to 10, and you can use more than 10 parameters by using the keyword again.

First, the kernel checks keywords are not & ldquo; root = & rdquo;, & ldquo; nfsroot = & rdquo ;, & ldquo; nfsaddrs = & rdquo ;, & ldquo; ro & rdquo ;, & ldquo; rw & rdquo ;, & ldquo; debug & rdquo; or “init”, then the kernel searches the bootsupups array for the registered handler associated with the keyword. If the relevant registered handler is found, then the functions are called and the value following the keyword is passed as a parameter. These functions. For example, if you set the parameters name=a, b, c, d at startup, the kernel searches for the bootsupups array. If it is found that "name" is registered, then the setting function of "name" is called name_setup(), and a, b , c, d are passed to name_setup() for execution.
All types such as “name=value” parameters, if not received by the setup function described above, will be interpreted as environment variables after system startup, such as <quo;TERM=vt100” will be used as a startup parameter.
All parameters that are not received by the kernel setup function and are not set to environment variables are left to the init process, such as “single”.

common device-independent startup parameters.
1, init=...
Set the name of the initialization process executed by the kernel. If the item is not set, the kernel will try /etc/init,
/bin/init, /sbin/init, in order. /bin/sh, if all are not found, the kernel will throw a kernel panic: error.
2, nfsaddrs=...
Set the boot address of NFS when booting from the network, given as a string.
3, nfsroot=...
Set the NFS root name when the network starts, if the string is not started with "/",",",".", the default point is &ldquo ;/tftp-boot”.
The above 2 and 3 are very useful in the diskless station.
4, no387
This option can only be used when CONFIG_BUGi386 is defined. Some i387 coprocessor chips will have a BUG when using 32-bit protection mode, such as some floating-point operations. Use this parameter to make the kernel available. Ignore the 387 coprocessor.
5, no-hlt
This option can only be used when CONFIG_BUGi386 is defined. Some early i486DX-100 chips have problems when processing the "hlt" directive, and cannot be reliably returned after executing this command. u>Operating system
, use this option to let the Linux system not suspend the CPU when the CPU is idle.
6, root=...
This parameter tells the kernel which device to use as the root file system when it starts. For example, you can specify the root file as hda8:root=/dev/hda8.
7, ro and rw
ro parameters tell the kernel to read the root file system read-only mode for file system integrity checks, such as running fsck; rw parameter tells the kernel to read and write the root file system, this Is the default.
8, reserve=...
Retain the port number. Format: reserve=iobase, extent[, iobase, extent]..., to protect the I/O port of a certain area from being automatically detected by the device driver. On some machines, automatic detection will fail, or the device will detect the error or do not want the kernel to initialize the device; for example: reserve=0x300, 32 device=0x300, all device drivers do not detect 0x300 except device=0x300 I/O port in the range -0x31f.
9, mem=...
Limit the amount of memory used by the kernel. Early BIOS was designed to only recognize memory below 64M. If your memory is larger than 64M, you can indicate that if you indicate that the number exceeds the actual installed memory, the system crash is a matter of time. Such as: mem = 0x1000000 means that there is 16M memory, if it is mem = 0x6000000, it is 96M memory.
Note: Many models use part of the memory as a BIOS mapping, so you must reserve space when specifying the memory size. You can also use the mem=nopentium to close the 4M page table on the pentium or newer CPU, which is declared in the kernel configuration.
10, panic=N
By default, the kernel crashes - kernel panic will be down and will not restart, you can set the number of seconds after the machine to restart the machine; also in /proc/sys/kernel/Set in the panic file.
11.reboot=[warm
Copyright © Windows knowledge All Rights Reserved