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

本文转载自:http://blog.csdn.net/kris_fei/article/details/76256224

Platform: Rockchip 
OS: Android 6.0 
Kernel: 3.10.92

遇到不少网友找不到uboot logo在哪里,其实一开始我也潜意识地去u-boot目录下去找,但是后来发现是在kernel目录下 
这里写图片描述

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

限制: 
1. 只能显示偶数分辨率 
2. 只能显示位深为8bit的bmp图片 
3. 输入是24bit图片

制作: 
#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;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62

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

posted @ 2017-12-13 17:42  请给我倒杯茶  阅读(1434)  评论(0编辑  收藏  举报