MTK 6589暗码切换开机LOGO(不适应NAND 的FLASH)

MT6589 暗码更改开机LOGO
一。lk logo 修改
     1.  kernel\kernel\ power\main.c  (创建节点,控制logo切换状态)
#if 1//HIGUA
// for set_env() by mtk
#include <mach/env.h>
#endif

...
#if 1// HIGUA
ssize_t custom_changelogo_show(struct kobject *kobj,
                                       struct kobj_attribute *attr,
                                       char *buf)
{
        char *val = NULL;
        if(NULL != get_env("changelogo")){
                val = get_env("changelogo");
        }
        return sprintf(buf, "%s\n", val);  
}
/*---------------------------------------------------------------------------*/
ssize_t custom_changelogo_store(struct kobject *kobj, struct kobj_attribute *attr,
                         const char *buf, size_t n)
{  
    if(!strncmp(buf,"1",1))
    {   
        set_env("changelogo", "1");
    }   
    else if(!strncmp(buf,"0",1))  
    {   
        set_env("changelogo", "0");
    }   
    return n;
}


static struct kobj_attribute custom_changelogo_attr = {
        .attr        = {
                .name = "custom_changelogo",
                .mode = 0777,
        },
        .show        = custom_changelogo_show,
        .store        = custom_changelogo_store,
};
#endif

     static struct attribute * g[] = {
...
#if 1// HIGUA
        &custom_changelogo_attr.attr,
#endif
        NULL,

     }


   2. mediatek\platform\mt6589\lk\mt_logo.c (根据logo状态显示不同的logo)
//这里的 38 是 自定义logo的显示序号 在下面会介绍
void mt_disp_show_boot_logo(void)
{
...
                #if 1//higua change logo
        if(get_env("changelogo") != NULL && atoi(get_env("changelogo")) == 1){
            show_logo(0);
        }else{
            show_logo(38);   
        }
                #else
                show_logo(0);
                #endif
        mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);

...
}

  3.mediatek\platform\mt6589\lk\platform.c  (现在一进入recovey 就会设置 切换logo的属性,正常的应该是在恢复出厂设置的时候 )
void sw_env()
{

...
#if 1 // higua restore change logo
        if(g_boot_mode == RECOVERY_BOOT){
                set_env("changelogo","1");
        }
#endif

#ifndef USER_BUILD   
    switch (g_boot_mode)
    {
      case META_BOOT:

...
}
   4. mediatek\custom\common\lk\logo\rules.mk (添加 logo 图片)
       上面用到的 38 序列号 就是  RESOURCE_OBJ_LIST 所有文件的顺序, 添加的logo 是第38个位置的图片
            $(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_100.raw \
             $(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_normal_uboot.raw \
            $(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_kernel.raw

      还需要在 对应的 logo目录里添加一张BMP图片
     例: 我们的工程是 cu_hd720 所以在  cu_hd720 文件夹下添加 一张 cu_hd720_normal_uboot.bmp 图片
      mediatek\custom\common\lk\logo\cu_hd720\cu_hd720_normal_uboot.bmp

二。kernel logo 修改
     1.mediatek\external\boot_logo_updater\boot_logo_updater.c (判断是否显示临时的logo文件)
   int main(void)
{
...
    // (3) open logo file
#if 1//higua
    if ((fd = open("/data/mdl/local_boot_logo", O_RDONLY)) < 0) {
        if ((fd = open(LOGO_PATH, O_RDONLY)) < 0) {
                        fprintf(stderr, "failed to open logo file: %s\n", LOGO_PATH);
                        goto done;
                }
    }
#else
    if ((fd = open(LOGO_PATH, O_RDONLY)) < 0) {
        fprintf(stderr, "failed to open logo file: %s\n", LOGO_PATH);
        goto done;
    }
#endif
    // (4) map framebuffer

...
}
三。开机动画 修改
      1.<a class="relatedlink" href="http://bbs.16rd.com/misc.%3Ca%20href=" target="_blank" forum-355-1.html"="" bbs.16rd.com="">php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks\base\cmds\bootanimation\BootAnimation.cpp
status_t BootAnimation::readyToRun() {
...
    if (bBootOrShutDown) {
        status_t err = mZip.open("/data/local/bootanimation.zip");
                XLOGD("[BootAnimation %s %d]err=%d,%s,/data/local/bootanimation.zip",__FUNCTION__,__LINE__,err,strerror(-err));
                #if 1//higua
        if (err != NO_ERROR) {
           err = mZip.open("/data/mdl/bootanimation.zip");
                   XLOGD("[BootAnimation %s %d]err=%d,%s,/data/mdl/bootanimation.zip",__FUNCTION__,__LINE__,err,strerror(-err));
                }
                #endif
        if (err != NO_ERROR) {
           err = mZip.open("/system/media/bootanimation.zip");
                   XLOGD("[BootAnimation %s %d]err=%d,%s,/system/media/bootanimation.zip",__FUNCTION__,__LINE__,err,strerror(-err));
           if (err != NO_ERROR) {
               m androidAnimation = true;
           }
        }
    } else {
        if (!bShutRotate) {
            status_t err = mZip.open("/data/local/shutanimation.zip");
                XLOGD("[BootAnimation %s %d]err=%d,%s,/data/local/shutanimation.zip",__FUNCTION__,__LINE__,err,strerror(-err));
                  #if 1//higua
        if (err != NO_ERROR) {
            err = mZip.open("/data/mdl/shutanimation.zip");
                    XLOGD("[BootAnimation %s %d]err=%d,%s,/data/mdl/shutanimation.zip",__FUNCTION__,__LINE__,err,strerror(-err));
                }
                #endif
                 if (err != NO_ERROR) {
                err = mZip.open("/system/media/shutanimation.zip");
                        XLOGD("[BootAnimation %s %d]err=%d,%s,/system/media/shutanimation.zip",__FUNCTION__,__LINE__,err,strerror(-err));
                if (err != NO_ERROR) {
                        mAndroidAnimation = true;
                }
            }
        } else {
            status_t err = mZip.open("/data/local/shutrotate.zip");

...
}
四。快速开机修改
   1.mediatek\external\ipod\bootlogo.cpp (之前没改到这里,启动快速开机 的时候 lk,kernel 都没生效,今天才解决这问题)
void mt65xx_boot_logo_updater_init(void)
{

...
        // (3) open logo file
#if 1//higua
    if ((fd = open("/data/mdl/local_boot_logo ", O_RDONLY)) < 0) {
        if ((fd = open(LOGO_PATH, O_RDONLY)) < 0) {
                fprintf(stderr, "[ChargingAnimation]failed to open logo file: %s\n", LOGO_PATH);
                        goto done;
                }
    }
#else
        if ((fd = open(LOGO_PATH, O_RDONLY)) < 0) {
        fprintf(stderr, "[ChargingAnimation]failed to open logo file: %s\n", LOGO_PATH);
        goto done;
        }
#endif
        // (5) copy the 2nd logo to surface info

...
}
...
#if 1//higua
static int custom_show_local_logo(void)
{
        int fd = -1;
    if ((fd = open( "/data/mdl/local_boot_logo " , O_RDONLY)) >= 0){
                close(fd);
                return 1;
        }
        return 0;
}
#endif
        
void mt65xx_disp_show_boot_logo(void)
{
        XLOGD("[ChargingAnimation %s %d]index = 0 ,x_virtual=%d, vinfo.yres=%d \n",__FUNCTION__,__LINE__,x_virtual, vinfo.yres);
        
    Region    region(Rect(0, 0, x_virtual, vinfo.yres));
        status_t  lockResult = surface->lock(&info, ®ion);  
        XLOGD("[ChargingAnimation %s %d]info.bits = 0x%08x\n",__FUNCTION__,__LINE__, info.bits);
        XLOGD("[ChargingAnimation %s %d]surface->lock return =  0x%08x,  %d\n",__FUNCTION__,__LINE__,lockResult,lockResult);
        if (0 == lockResult)
        {
                #if 1//higua
                if(1 == custom_show_local_logo()){
                        show_logo_surface(38);
                } else {
                        show_logo_surface(0);
                }
                #else
                show_logo_surface(0);
                #endif
                surface->unlockAndPost();
        }
    return;
}

...



猜你喜欢

转载自blog.csdn.net/ieiqny1/article/details/78772026
MTK
今日推荐