Imx6q 由于 bootargs的设置 导致重启问题分析

文章目录

        • 问题复现以及log
        • 问题分析
        • 问题解决

问题复现以及log


在imx6dl上运行OK的镜像,跑在imx6q上跑到android开机动画界面然后内核空指针, 加打印信息发现在函数 fb_get_options()中出现了空指针.

driver/video/fbmem.c

int fb_get_options(char *name, char **option)
{
    char *opt, *options = NULL;
    int retval = 0;
    int name_len = strlen(name), i;
    printk("Jason in func:%s, name:%s\n", __func__, name);
    if (name_len && ofonly && strncmp(name, "offb", 4))
        retval = 1;

    if (name_len && !retval) {
        for (i = 0; i < FB_MAX; i++) {
            if (video_options[i] == NULL)
                continue;
            if (!video_options[i][0])
                continue;
            opt = video_options[i];
            if (!strncmp(name, opt, name_len) &&
                opt[name_len] == ':')
                options = opt + name_len + 1;
        }
    }
    if (options && !strncmp(options, "off", 3))
        retval = 1;
    printk("options: %s\n", optiions);
    if (option) {
        *option = options;
    return retval;
}      

添加打印信息发现

[    1.658330] Jason in fb_get_options, name:mxcfb0
[    1.663046] options: dev=hdmi,1280x720M@60,if=RGB24,bpp=32
[    1.668668] mxc_sdc_fb mxc_sdc_fb.0: register mxc display driver hdmi
[    1.675246] mxc_hdmi mxc_hdmi: Detected HDMI controller 0x13:0xa:0xa0:0xc1
[    1.682289] fbcvt: 1280x720@60: CVT Name - .921M9
[    1.720800] imx-ipuv3 imx-ipuv3.1: IPU DMFC DP HIGH RESOLUTION: 1(0,1), 5B(2~5), 5F(6,7)
[    1.733321] Jason in fb_get_options, name:mxcfb1
[    1.738015] options: off
[    1.740672] mxc_sdc_fb mxc_sdc_fb.1: Can't get fb option for mxcfb1!
[    1.747143] Jason in fb_get_options, name:mxcfb2
[    1.751993] options: off
[    1.754623] mxc_sdc_fb mxc_sdc_fb.2: Can't get fb option for mxcfb2!
[    1.761104] Jason in fb_get_options, name:mxcfb3
[    1.765864] options: (null)
[    1.768739] mxc_sdc_fb mxc_sdc_fb.3: Can't get fb option for mxcfb3!

当name为mxcfb3的时候 出现了空指针,然后将空指针赋值给了*option = options;

问题分析


**arch/arm/mach-mx6/board-mx6q_sabresd.c **

if (cpu_is_mx6q()) {
    imx6q_add_ipuv3(1, &ipu_data[1]);
    for (i = 0; i < 4 && i < ARRAY_SIZE(sabresd_fb_data); i++)
        imx6q_add_ipuv3fb(i, &sabresd_fb_data[i]);   
} else {
    for (i = 0; i < 2 && i < ARRAY_SIZE(sabresd_fb_data); i++)
        imx6q_add_ipuv3fb(i, &sabresd_fb_data[i]);    
}

可知双核的只会注册 mxcfb0 mxcfb1
而四核会注册 mxcfb0 mxcfb1 mxcfb2 mxcfb3
但是我的bootargs 为:

BOARD_KERNEL_CMDLINE := console=ttymxc0,115200 init=/init video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB24,bpp=32 video=mxcfb1:off video=mxcfb2:off vmalloc=400M androidboot.console=ttymxc0 androidboot.hardware=freescale

这里并没有mxcfb3的信息, 从而导致空指针

问题解决

So, we have two measure to solve it.

    a) add video=mxcfb3:off or video=mxcfb3:xxx in bootargs.
    b) add judge in fb_get_options.
        if (options && option) {
                *option = options;
        } else {
                retval = 1;
        }

你可能感兴趣的:(FSL)