[RK3288][Android6.0] 关于uboot中logo相关知识点小结

Platform: Rockchip
OS: Android 6.0
Kernel: 3.10.92

遇到不少网友找不到uboot logo在哪里,其实一开始我也潜意识地去u-boot目录下去找,但是后来发现是在kernel目录下
[RK3288][Android6.0] 关于uboot中logo相关知识点小结_第1张图片

加载顺序:
1.uboot开机的时候会先去logo分区加载
2.加载失败则尝试从resource分区加载
3.加载失败则尝试从boot分区加载

限制:
1. 只能显示偶数分辨率
2. 输入是24bit图片

经验证测试24bit bmp放进去也能正常显示(2018/04-17)

制作:
#convert -compress rle -colors 256 src.bmp logo.bmp

编译:
替换编译后是在resource.img或者boot.img(包含Resource.img的情况)中

代码调用:

int rk_bitmap_from_resource(unsigned short* fb) 
{
    const char* file_path = "logo.bmp";
    return show_resource_image(file_path) ? 0 : -1;
}

bool show_resource_image(const char* image_path) 
{
    bool ret = false;
#ifdef CONFIG_LCD
    bmp_image_t *bmp = NULL;
    const disk_partition_t* ptn = get_disk_partition(LOGO_NAME);
    resource_content image;
    memset(&image, 0, sizeof(image));
    snprintf(image.path, sizeof(image.path), "%s", image_path);

    if (ptn) {
        printf("Find logo from partition %s\n", LOGO_NAME);
#ifdef CONFIG_DIRECT_LOGO
        bmp = lcd_get_buffer();
#else
        bmp = (void *)gd->arch.rk_boot_buf_addr;
#endif
        read_storage(ptn->start, bmp, CONFIG_MAX_BMP_BLOCKS);
        debug("bmp image at 0x%p, sign:%c%c\n", bmp, bmp->header.signature[0], bmp->header.signature[1]);
    }

    if (ptn && bmp && bmp->header.signature[0] == 'B' && bmp->header.signature[1] == 'M') {
        debug("%s:show logo.bmp from logo partition\n", __func__);
        lcd_display_bitmap_center((uint32_t)(unsigned long)bmp);
        ret = true;
    } else {
        if (get_content(0, &image)) {
            debug("%s:show logo from resource or boot partition\n", __func__);
            int blocks = (image.content_size + BLOCK_SIZE - 1) / BLOCK_SIZE;

            if (image.content_size > CONFIG_RK_BOOT_BUFFER_SIZE) {
                FBTERR("Failed to bmp image too large, %d\n",
                       image.content_size);
                return false;
            }

#ifdef CONFIG_DIRECT_LOGO
            image.load_addr = lcd_get_buffer();
#else
            image.load_addr = (void *)gd->arch.rk_boot_buf_addr;
#endif
            if (!load_content_data(&image, 0, image.load_addr, blocks)) {
                return false;
            }
            FBTDBG("Try to show:%s\n", image_path);
            lcd_display_bitmap_center((uint32_t)(unsigned long)image.load_addr);

            ret = true;
        } else {
            FBTERR("Failed to load image:%s\n", image_path);
        }
    }

#endif
    return ret;
}

参考:
Rockchip uboot开发指南_V3.7

你可能感兴趣的:(子类__Display)