立即注册
查看: 14572|回复: 44

[MTK软件原创] MT6589 暗码更改开机LOGO,三屏都修改

发表于 2014-5-30 18:24:51 | 显示全部楼层 |阅读模式 来自 广东省深圳市南山区
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.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) {
               mAndroidAnimation = 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, &#174;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;
}

...


五。APP 见附件
boot_logo      开机logo
bootanimation.zip 开机动画
shutanimation.zip  关机动画
这三个文件 在编译后 会拷贝到 /data/mdl/ 目录,之所以拷到这里来,是因为这个目录是 0777 权限的。省了在手动更改权限的问题


如果有问题,可以加QQ (1679988603)。


2014-5-30 18:24 上传
文件大小:
4.16 MB
下载次数:
329
本地下载

16RD supports Paypal , Payment is calculated at the exchange rate of the day. Unable to download please contact 18902843661 (WhatsApp OR wechat number)

关于一牛网在微软浏览器(Microsoft Edge、IE浏览器)警报通告&解决方案!(无法下载直接更换浏览器即可)

*附件为作者发布,与本站无关,如有侵权,请联系客服删除


  • 一牛网商城 一牛网直播
已绑定手机
发表于 2014-5-30 23:49:38 | 显示全部楼层 来自 广东省深圳市
学习,学习,再学习!!!!
已绑定手机
发表于 2014-5-31 11:29:42 | 显示全部楼层 来自 广东省深圳市宝安区
楼主好人   
发表于 2014-5-31 22:23:10 | 显示全部楼层 来自 马来西亚
thanks 学习,学习,再学习!!!!
已绑定手机
发表于 2014-5-31 22:55:02 | 显示全部楼层 来自 广东省深圳市
谢谢楼主,要是有lk的更好了
发表于 2014-6-13 15:37:37 | 显示全部楼层 来自 上海市浦东新区
好东西,正在看这方面的
已绑定手机
发表于 2014-6-14 10:55:58 | 显示全部楼层 来自 广东省深圳市宝安区
真的分享lk了。。。楼主好人
已绑定手机
发表于 2014-6-14 11:36:01 | 显示全部楼层 来自 广东省深圳市福田区
楼主真是个好人
已绑定手机
已实名认证
加微:13682654092
发表于 2014-6-14 15:14:57 | 显示全部楼层 来自 广东省深圳市
好贴,做了实验是是OK的,该方法超级行!!

想请教一下楼主get_env("changelogo")这种方法获取changelogo,那changelogo是以什么样的方式存在系统中的?它是固定的在某个rom里?
已绑定手机
发表于 2014-6-14 15:31:48 | 显示全部楼层 来自 广东省深圳市
非常的好啊!!!!!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

合作/建议

TEL: 19168984579

工作时间:
周一到周五 9:00-11:30 13:30-19:30
  • 扫一扫关注公众号
  • 扫一扫打开小程序
Copyright © 2013-2024 一牛网 版权所有 All Rights Reserved. 帮助中心|隐私声明|联系我们|手机版|粤ICP备13053961号|营业执照|EDI证
在本版发帖搜索
微信客服扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表