Embedded path-kernel startup Parameter Parsing

Source: Internet
Author: User
Document directory
  • 1. Four kernel startup parameters are obtained
  • Ii. Format and meaning of kernel startup parameters
  • Iii. References

 

Kernel startup Parameter Parsing

Original statement: the author reserves all power. Please indicate the source for reprinting.

All information is from the Internet. If your rights are violated, please inform us that the author must correct it.

1. Four kernel startup parameters are obtained

>>>>>>>>> Reference

[1] detailed analysis of the kernel parameter transmission mode in Linux

1. The most common method is to modify the "defaultkernel command string" option in the "General setup" sub-menu in make config, and modify this option to include/Linux/Autoconf. config_cmdline macro in the H file.

2. Sometimes, in order to save the time for making menuconfig and the kernel command is fixed, you can write down the kernel ARCH/ARM/setup. file C default_command_line. The variable is originally initialized to config_cmdline.

3. In addition to method 1, another common method is to write the kernel command into the Kernel Parameter table, and then use start_kernel ()-> setup_arch ()-> parse_tags () -> parse_tag ()-> parse_tag_cmdline () function to overwrite the kernel command in the kernel parameter table to the default_command_line variable (of course, you must first have the Kernel Parameter table ).

4. Finally, some boards will directly pass the kernel commands to the kernel through bootloader.

<Q001> how to transfer it?

<A001> [2] Kernel Parameters

You can use the bootm command in uboot to pass the parameter to the kernel (in fact, it is to put the parameter at dram_base + 0x00000100, and then the kernel reads it from it ).

Whether there is a tag list at dram_base + 0x00000100. If yes, read from this location;

If no, default_command_line is used. This is set when kernel make menuconfig is configured, that is, config_cmdline.

>>>>>>>>> Reference

Ii. Format and meaning of kernel startup parameters

The command line format is similar to the following:

Config_cmdline = "mem = 64 m console = ttysac0 root =/dev/Ram initrd = 0xc0800000, 0x00800000 ramdisk_size = 2048 RW"

<Q002> what are the meanings of each keyword and how is the system resolved?

<A002> in principle, the kernel parses strings. First, the entire string is separated by spaces, and each substring is separated by an equal sign. The left side of the equal sign is the predefined keyword of the system, and the right side is the parameter of the corresponding keyword parsing function.

>>>>>>>>> Reference

[3] Linux kernel startup parameters

All types, such as the "name = value" parameter, are not received by the setting function described above [A parsing function that refers to the predefined Keywords of the system, it will be interpreted as the environment variable after the system is started,

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 ".

>>>>>>>>> Reference

<Q003> what keywords does the system support?

<A003>

The most detailed explanation is undoubtedly from the ninth chapter in Linux kernel in a nutshell.

The following is a connection address reposted by the Chinese Blog.

[4] Linux kernel in a nutshell

You can also add custom startup parameters and corresponding parsing functions.

[5] adding custom kernel startup parameters

Iii. References

[1] detailed analysis of the kernel parameter transmission mode in Linux

Http://www.bitscn.com/ OS /linux/200710/116553.html

[2] Kernel Parameters
Http://linux.chinaunix.net/techdoc/system/2007/08/25/966304.shtml

Linux Kernel startup parameters http://edu.codepub.com/2009/1213/18715.php

[4] Linux kernel in a nutshell
Http://blog.chinaunix.net/u2/76263/showart_1212604.html

[5] adding custom kernel startup parameters
Http://linux.chinaunix.net/techdoc/install/2009/08/31/1133192.shtml

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.