How to pass the parameters in uboot to recovery or Kernel

Source: Internet
Author: User

Address: http://blog.csdn.net/dwyane_zhang/article/details/8441854

Recently, we are working on a LCM two-screen or three-screen compatibility problem. Therefore, we must first read the IDs of each screen in uboot, and then pass the read IDs to recovery and kernel, display the machine properly.

I. First implement the uboot read LCM ID.

1. bootable/bootloader/lk/target/msm7627a_sku3_q6_d/rules. mk is the macro switch in uboot. Open the screen macro displayed.

DEFINES += DISPLAY_MIPI_CMD_PANEL_ILI9487=1DEFINES += DISPLAY_MIPI_CMD_PANEL_HX8357=1

 

2. Read ID. bootable/bootloader/lk/platform/msm_shared/mipi_dsi.c first when you initialize mipi.

In the int mipi_dsi_panel_initialize (struct mipi_dsi_panel_config * pinfo ){...... # If defined (display_mipi_pai_panel_ili9487) | defined (attributes) tables (); dat = mipi_viroyal_manufacture_id (); If (DAT = 0x90) {lcm_flag = 8357; // hx8357-c} else {lcm_flag = 9487; // ili9487} pinfo_tmp = get_panel_info (); memcpy (pinfo, pinfo_tmp, sizeof (struct mipi_dsi_panel_config )); # endif ......}

 

3. initialize the screen after reading the ID

                struct mipi_dsi_panel_config *get_panel_info(void){              .........#elif (DISPLAY_MIPI_CMD_PANEL_ILI9487)||(DISPLAY_MIPI_CMD_PANEL_HX8357)    if (lcm_flag == 8357)        return &hx8357_cmd_panel_info;    else        return &ili9487_cmd_panel_info;#endif               ..........}

 

In this way, the image is successfully displayed in uboot. The following shows how to pass the lcm_flag value to the kernel.

2. Upload lcm_flag to the kernel

1. bootable/bootloader/lk/APP/release T. C

In fact, the original Android system has an example of passing uboot to the kernel, that is, tracking the code static const char * boot_splash = "Splash = 1 ";

What I do is also done by following the example of the system. First, define a string.

static const char *lcm_flg_ili9486 = " lcmflag=9486";static const char *lcm_flg_nt35310 = " lcmflag=5310";

 

Then copy the following function to the kernel

void boot_linux(void *kernel, unsigned *tags,        const char *cmdline, unsigned machtype,        void *ramdisk, unsigned ramdisk_size){   .....        if(!boot_into_recovery)    {        cmdline_len += strlen(boot_splash);        #if DISPLAY_TYPE_MIPI        if (lcm_flag == 8357)        cmdline_len += strlen(lcm_flg_hx8357c);        else         cmdline_len += strlen(lcm_flg_ili9487);        #endif   .....       if (!boot_into_recovery)        {        #if DISPLAY_TYPE_MIPI            if (lcm_flag == 8357)               src = lcm_flg_hx8357c;            else               src = lcm_flg_ili9487;        #endif        if (have_cmdline) --dst;        while ((*dst++ = *src++));       .....}

 

In this way, the operations in uboot are completed, that is, the data in uboot is copied to an array, which can be transmitted from uboot to the kernel.

3. the kernel accepts the string from uboot.

msm7627a/kernel/arch/arm/mach-msm/board-msm7x27a.c

 

Accept in this function (based on your own platform, flexible), also imitate boot_splash, add the accept string in the code, and convert it to a number

/* LK lcm_flag, 0 - off, 1 - on */int lcm_flag = 0;static int __init lk_lcmflag_setup(char *str){    lcm_flag = simple_strtol(str, NULL, 0);    printk("lcmflag = %d\n", lcm_flag);    return 1;}__setup("lcmflag=", lk_lcmflag_setup);

 

In this way, you can get the value of lcm_flag, and then use the extern int lcm_flag in the specific driver. That's simple. In fact, the technology is like that, and people are very afraid of being serious. Haha. Joke.

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.