6200 uboot test version analysis (III)

Source: Internet
Author: User

Summary:

In uboot, _ start starts to execute a program (basic configuration, this section has been executed in 6200 sdboot) and jumps to start_unicoreboot for execution to complete a series of initialization in init_sequence. Note that the Gd (gd_t * type) is assigned a constant value before the initialization sequence, and the BD pointer to the GD is also assigned a constant value. In the initialization sequence, be sure to assign values to GD-> BD-> bi_boot_params (0x40000100) in board_init, because Thekernel (0, machid, BD-> bi_boot_params) is executed near the current time) we will assign all the parameters to be passed to the kernel to the space occupied by the struct tag type pointed to by the Params pointer. However, the address of this space (that is, the value of Params) it is done through the statement Params = (struct tag *) BD-> bi_boot_params; In the setup_start_tag (BD) function, that is, Params can also be considered as a constant value. In the normal process, Run "NAND read XXXXX; bootm XXXX" to load the uimage into the memory, parse the bootm command from the environment variable, parse the parameters, and embed it (check the link script) find and execute the function corresponding to bootm in cmd_tbl_t, that is, do_bootm. The do_bootm function reads the image_head header of the image and obtains the image compression format (the compression format can be obtained based on the image header information, but it may not be compressed, depending on how the image is made. In addition, the image header contains the location where the decompressed operating system should be stored in the memory. The operating system type (6200: Linux) will be executed based on the type of do_bootm_linux, in do_bootm_linux, the system execution entry point is obtained. before entering the line header, some parameters are placed in the struct tag structure for the system to obtain the parameters. Finally, Thekernel (0, machid, BD-> bi_boot_params );

Question:

Default_environment [] is a global variable, which should be placed in the data segment. However, when env_relocate (), gdt-> env_addr is set to 0, especially for void * malloc (INT Len) function. It is hard to understand why null is always returned. Then, the environment variable at default_environment is copied to start 0, and the function for getting the environment variable is changed from env_get_char_init () to env_get_char_memory, in addition, Gd-> env_valid is set to 1. In addition, it is the jumptable_init () function. For this version of code, the malloc function is also used in jumptable_init () and data is written to the allocated space, then our environment variables are washed out.

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.