增加暗码命令切换开关机logo功能





u-boot logo显示原理:

1.————Little Kernel会在platform_early_init阶段首先会获取lcm params,其工作流

程就是透过读id找到现在插入的LCM,根据LCM的分辨率申请相应大小的frame buffer

并确定frame buffer起始地址

2. 为logo.bin预留4M Ram

3. 之后在platform_init阶段,直接将logo.bin载入到4M Ram中

4, 完成载入后,在platform_init中mt_disp_show_boot_logo();会调用

show_logo(0);完成第一张logo显示。其中的index=0代表在logo.bin中压缩的第一张

图片,logo.bin中的图片压缩顺序可以察看文件

mediatek\custom\common\lk\logo\rules.mk





2.————4.2的kernel logo显示原理:

Kernel logo的工作方式与U-boot logo不同,是透过init.rc中注册的

boot_logo_updater service完成读取raw data文件,进行绘画的,所以在kernel

logo只是经过了bmp向raw的转换,在目录mediatek\custom\common\lk\logo\下生成

raw data 文件boot_logo。之后透过脚本文件将boot_logo文件搬移到

out\target\product\xxxx\system\media\images下,打包为system.img,download

到手机种,并存放于/system/media/images目录下。





3.————4.2对于ipo快速开机,请在目录mediatek\external\ipod\bootlogo.cpp中的

mt65xx_disp_show_boot_logo();做相应修改





4.————4.4的kernel logo和ipo快速开机用的是同一个接口。

在boot_logo_updater.c的main中与4.2的方法不同使用了show_kernel_logo函数调用

显示了包在logo.bin中的kernel.logo,修改方法可以在alps\mediatek\external\libshowlogo\charging_animation.cpp

中对这部分代码进行尝试读取nv显示修改,kernel层的logoindex可以查看文件

mediatek\custom\common\lk\logo\rules.mk中kernel.bmp的顺序

void show_kernel_logo()

{

    LOG_ANIM("[charging_animation: %s %d]show kernel logo, index = 38 \n",__FUNCTION__,__LINE__);

    if (error_flag == 0) 

    {

        anim_show_logo(kernel_logo_position); 

    }    

}    

由于快速开关机部分alps\mediatek\external\ipod\bootlogo.cpp

也是使用了此接口,若添加,应该就可以做到暗码修改了。





对于U-boot logo,只需要将不同分辨率的图片压缩至logo.bin中,在读取时根据不

同的NVflag显示相应的图片即可

而对于Kernel logo,我们需要将不同分辨率的boot_logo raw data文件生成出来并

copy到手机中,boot_logo_updater根据不同的分辨率进行识别,读取相应的logo文

件。在boot_logo_updater识别部分对NVflag进行判断,进而调用不同的boot_logo。













一、主要修改文件:

1.mediatek/external.git

boot_logo_custom这部分代码在4.4上是没有编译的,所以不用增加这部分的编译机制

这部分的logo是动画之前的那个logo,可以使用adb shell,cd 到/system/bin,执行

boot_logo_updater查看这个logo具体是哪张图片









diff --git a/boot_logo_updater/Android.mk b/boot_logo_updater/Android.mk

index 5a28913..1b046f8 100755

--- a/boot_logo_updater/Android.mk

+++ b/boot_logo_updater/Android.mk

@@ -66,3 +66,17 @@ LOCAL_SRC_FILES := custom/$(LOCAL_MODULE)

 

 include $(BUILD_PREBUILT)

 endif

+############################################################

+ifneq ($(strip $(MTK_PLATFORM)),)

+include $(CLEAR_VARS)

+

+LOCAL_MODULE := boot_logo_custom

+

+LOCAL_MODULE_CLASS := DATA

+LOCAL_MODULE_PATH := $(TARGET_OUT)/media/images

+

+LOCAL_GENERATE_CUSTOM_FOLDER := custom:lk/logo

+LOCAL_SRC_FILES := custom/$(LOCAL_MODULE)

+

+include $(BUILD_PREBUILT)

+endif





这部分脚本编译是为了将生成的boot_logo_custom搬到system/media/images下的





diff --git a/boot_logo_updater/boot_logo_updater.c b/boot_logo_updater/boot_logo_updater.c

index 5836f21..745d64f 100755

--- a/boot_logo_updater/boot_logo_updater.c

+++ b/boot_logo_updater/boot_logo_updater.c

@@ -93,7 +93,7 @@ extern void bootlogo_fb_init();

 extern void bootlogo_fb_deinit();

 */

 const char LOGO_PATH[] = "/system/media/images/boot_logo";

-

+const char LOGO_CUSTOM_PATH[] = "/system/media/images/boot_logo_custom";// **** add changeLogo 20140508

 #define RGB565_TO_ARGB8888(x)   \

     ((((x) &   0x1F) << 3) |    \

      (((x) &  0x7E0) << 5) |    \

@@ -113,8 +113,8 @@ const char LOGO_PATH[] = "/system/media/images/boot_logo";

 #define LCD_BACKLIGHT_PATH "/sys/class/leds/lcd-backlight/brightness"

 #define BOOT_REASON_SYS_PROPERTY "sys.boot.reason"

 #define BOOT_PACKAGE_SYS_PROPERTY "persist.sys.bootpackage"

-

-

+#define MAX_RETRY_COUNT 20 // **** add changeLogo 20140508

+#define uchar unsigned char

 /*

  * return value:

  * 0: normal

@@ -210,7 +210,61 @@ void set_int_value(const char * path, const int value)

 

 
write_to_file(path, buf, strlen(buf));

 }

-

+// **** add changeLogo 20140508 begin

+int do_read()

+{

+
int fd,of,i=0,n,sectorSize,index;

+

+
char *buffer = NULL;

+
sectorSize=512;

+
buffer = (char*)malloc(sectorSize);

+
if(buffer == NULL)

+
{

+
printf("ERROR buffer malloc fail!");

+
return -1;

+
}

+
memset(buffer, 0, sectorSize);

+
char PN[20];

+
sprintf(PN,"/dev/pro_info");

+
printf("PN:%s\n",PN);//open your raw data partiton

+

+
fd= open(PN,O_RDWR);

+
if(fd<= 0)

+
{

+
printf("ERROR open fail %d\n",fd);

+
return -1;

+
}

+

+
//read

+
buffer = NULL;

+
buffer = (char*)malloc(sectorSize);

+
if(buffer == NULL)

+
{

+
printf("ERROR buffer malloc fail!");

+
return -1;

+
}

+
of=lseek(fd,0,SEEK_SET);

+
printf("lseek offset: %d\n",of);

+
if(of == -1)

+
{

+
printf("ERROR lseek file fail!\n");

+
return -1;

+
}

+
memset(buffer,0,sectorSize);

+
n=read(fd,buffer,sectorSize);

+
if(n != sectorSize)

+
{

+
printf("ERROR read fail\n");

+
close(fd);

+
return -1;

+
}

+
printf("result:%s",buffer);

+
printf("(buffer+104):%s",*(buffer+104));

+
index = atoi(*(buffer+104));

+
close(fd);

+
return index;

+}

+// **** add changeLogo 20140508 end

//读取/dev/pro_info文件内的第104个字节,可以adb pull出来查看

 int main(void)

 {

@@ -279,12 +333,29 @@ int main(void)

     printf("[boot_logo_updater] fbsize= %d\n",fbsize);

     printf("[boot_logo_updater] rgb565_logo_size = %d\n",rgb565_logo_size);

     // (3) open logo file

-

-    if ((fd = open(LOGO_PATH, O_RDONLY)) < 0) {

-        fprintf(stderr, "failed to open logo file: %s\n", LOGO_PATH);

-        goto done;

-    }

-

+// **** add changeLogo 20140508 begin    

+#if  MTK_COMMAND_SWITCH_LOGO

+       if(do_read()==0)

+       {

+        if ((fd = open(LOGO_PATH, O_RDONLY)) < 0) {

+            fprintf(stderr, "failed to open logo file: %s\n", LOGO_PATH);

+            goto done;

+        }

+       }

+       else if(do_read()==1)

+       {

+        if ((fd = open(LOGO_CUSTOM_PATH, O_RDONLY)) < 0) {

+            fprintf(stderr, "failed to open logo file: %s\n", LOGO_CUSTOM_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

+// **** add changeLogo 20140508 end

     // (4) map framebuffer

 

     fbbuf = mmap(0, fbsize*2, PROT_READ|PROT_WRITE, MAP_SHARED, fb, 0);





2. mediatek/platorm.git





diff --git a/mt6572/lk/load_image.c b/mt6572/lk/load_image.c

此处是读取dev/pro_info中第104个字节的值存储到logoindex供mt_logo.c调用

old mode 100644

new mode 100755

index 5c8d0cb..9b0bc5a

--- a mediatek/platorm/mt6572/lk/load_image.c

+++ b mediatek/platorm/mt6572/lk/load_image.c

@@ -28,7 +28,7 @@ unsigned int g_rcimg_sz = 0;

 unsigned int g_fcimg_sz = 0;

 unsigned int g_kimg_sz = 0;

 unsigned int g_rimg_sz = 0;

-

+unsigned char logoindex = 0;

 #if 1

 

 static int mboot_common_load_part_info(part_dev_t *dev, char *part_name, part_hdr_t *part_hdr)

@@ -168,6 +168,74 @@ exit:

 

     return len;

 }

+//Added by Dai@wingtech.com begin ------- **** add changeLogo 20140508 begin

+int mboot_common_load_part_get_logo_index(char *part_name, unsigned long addr)

+{

+    long len;

+
 unsigned long begin;

+#ifdef MTK_EMMC_SUPPORT

+
 unsigned long long start_addr;

+#else

+
 unsigned long start_addr;

+#endif

+    part_t *part;

+    part_dev_t *dev;

+    //part_hdr_t *part_hdr;

+

+    dev = mt_part_get_device();

+    if (!dev)

+    {
return -ENODEV;

+    }

+

+    part = mt_part_get_partition(part_name);

+    if (!part)

+    {
return -ENOENT;

+    }

+

+#ifdef MTK_EMMC_SUPPORT

+
start_addr = (u64)part->startblk * BLK_SIZE;

+#else

+    start_addr = part->startblk * BLK_SIZE;

+#endif

+    printf("dai part_name = %s, start_addr = 0x%x",part_name,start_addr);

+

+    //Marked by Dai@wingtech.com: Not part_hdr in PRO_INFO partition.---------------------

+

+    //part_hdr = (part_hdr_t*)malloc(sizeof(part_hdr_t));

+

+    //if (!part_hdr)

+    //{
return -ENOMEM;

+    //}

+

+    //len = mboot_common_load_part_info(dev, part_name, part_hdr);

+    //if (len < 0) {

+    //    len = -EINVAL;

+    //    goto exit;

+    //}



+    //len = dev->read(dev, start_addr + sizeof(part_hdr_t), (uchar*)addr, part_hdr->info.dsize);

+    //Marked end.--------------------------------------------------------------------------

+

+
begin = get_timer(0);

+

+    len = dev->read(dev, start_addr , (uchar*)addr, 4096);

+    logoindex = (*(unsigned char *)(addr+104));

+    if (len < 0) {

+        printf("dai [%s] %s partition read error. LINE: %d\n", MODULE_NAME, part_name, __LINE__);

+        len = -EIO;

+        //goto exit;

+    }

+

+

+   //exit:

+   // if (part_hdr)

+   // free(part_hdr);

+

+    return len;

+}

+

+unsigned char data_buffer[256] ={0};

+//End of Added by Dai@wingtech.com ----- **** add changeLogo 20140508 end

 

 /**********************************************************

  * Routine: mboot_common_load_logo

@@ -179,6 +247,7 @@ int mboot_common_load_logo(unsigned long logo_addr, char* filename)

 {

     int ret;

     long len;

+    int i;

 

 #if (CONFIG_COMMANDS & CFG_CMD_FAT)

     len = file_fat_read(filename, (unsigned char *)logo_addr, 0);

@@ -186,7 +255,19 @@ int mboot_common_load_logo(unsigned long logo_addr, char* filename)

     if (len > 0)

         return (int)len;

 #endif

-

+// **** add changeLogo 20140508 begin

+#if  MTK_COMMAND_SWITCH_LOGO

+    mboot_common_load_part_get_logo_index(PART_PRO_INFO, logo_addr);

+    //test code begin ++++

+    for(i=0;i<(128);i++)

+    {

+           data_buffer[i] = *(unsigned char*)(logo_addr+i);

+           printf("[Dai]result[%d]:--0x%x\n",i,data_buffer[i]);

+    }

+    printf("[Dai]result[104]:--0x%x\n",data_buffer[104]);

+    //end of test code -----

+#endif

+// **** add changeLogo 20140508 end

     ret = mboot_common_load_part(PART_LOGO, logo_addr);

 

     return ret;

@@ -911,8 +992,8 @@ int mboot_recovery_load_raw_part(char *part_name, unsigned long *addr, unsigned

         len = -EIO;

         goto exit;

 
}

-

-    printf("[%s] Load '%s' partition to 0x%08X (%d bytes in %ld ms)\n", MODULE_NAME, part->name, addr, size, get_timer(begin));

+    // **** add changeLogo 20140508 

+    printf("[%s] Load '%s' start_addr = %x partition to 0x%08X (%d bytes in %ld ms)\n", MODULE_NAME, part->name ,start_addr,addr, size, get_timer(begin));

 

 exit:

     return len;

diff --git a/mt6572/lk/mt_logo.c b/mt6572/lk/mt_logo.c

little kernel层的logo切换显示位置

old mode 100644

new mode 100755

index 36442e1..c10f0fa

--- a/mt6572/lk/mt_logo.c

+++ b/mt6572/lk/mt_logo.c

@@ -60,7 +60,7 @@

 

 //#include <u-boot/zlib.h>

 #include <lib/zlib.h>

-

+extern unsigned char logoindex;

 // ---------------------------------------------------------------------------

 //  Local Variables

 // ---------------------------------------------------------------------------

@@ -731,8 +731,25 @@ void mt_disp_show_boot_logo(void)

     }

     else

     {

-        show_logo(0);

-        mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);

+// **** add changeLogo 20140508 begin        

+#if  MTK_COMMAND_SWITCH_LOGO      

+       if(logoindex==0)

+        {

+            show_logo(0);

+            mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);

+        }

+        else 

+        {

+            show_logo(44);

+            mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);

+        }

+#else  

+        {

+            show_logo(0);

+            mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);

+        }

+#endif  

+// **** add changeLogo 20140508 end

     }

          return;

解释下为什么mt_logo.c下的logo图片都是数字?这就要说明下little kernel的启动原理:





1. Little Kernel会在platform_early_init阶段首先会获取lcm params,其工作流

程就是透过读id找到现在插入的LCM,根据LCM的分辨率申请相应大小的frame buffer

并确定frame buffer起始地址

2. 为logo.bin预留4M Ram

3. 之后在platform_init阶段,直接将logo.bin载入到4M Ram中

4, 完成载入后,在platform_init中mt_disp_show_boot_logo();会调用

show_logo(0);完成第一张logo显示。其中的index=0代表在logo.bin中压缩的第一张

图片,logo.bin中的图片压缩顺序可以察看文件

mediatek\custom\common\lk\logo\rules.mk,如下

RESOURCE_OBJ_LIST := \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_uboot.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_battery.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_low_battery.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_charger_ov.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_num_0.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_num_1.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_num_2.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_num_3.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_num_4.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_num_5.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_num_6.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_num_7.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_num_8.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_num_9.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_num_percent.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_animation_01.raw

\

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_animation_02.raw

\

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_animation_03.raw

\

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_animation_04.raw

\

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_animation_05.raw

\

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_animation_06.raw

\

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_animation_07.raw

\

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_animation_08.raw

\

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_animation_09.raw

\

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_animation_10.raw

\

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_10_01.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_10_02.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_10_03.raw \

1.

2.

1.

2.

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_10_04.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_10_05.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_10_06.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_10_07.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_10_08.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_10_09.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_10_10.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_bg.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_img.raw \

$(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_bat_100.raw \





3. mediatek/custom.git

BOOT_LOGO_CUSTOM_IMAGE这部分代码在4.4上是没有编译的,所以不用增加这部分的编译机制

进入mediatek\custom\common\uboot\logo文件夹运行update $(BOOT_LOGO),

diff --git a/common/lk/logo/custom/kernel.bmp b/common/lk/logo/custom/kernel.bmp

new file mode 100755

index 0000000..65f8d51

Binary files /dev/null and b/common/lk/logo/custom/kernel.bmp differ

diff --git a/common/lk/logo/custom/uboot.bmp b/common/lk/logo/custom/uboot.bmp

new file mode 100755

index 0000000..65f8d51

Binary files /dev/null and b/common/lk/logo/custom/uboot.bmp differ

diff --git a/common/lk/logo/rules.mk b/common/lk/logo/rules.mk

old mode 100644

new mode 100755

index 6e861a7..12a66a9

--- a/common/lk/logo/rules.mk

+++ b/common/lk/logo/rules.mk

@@ -9,6 +9,7 @@ ZPIPE := $(BOOT_LOGO_DIR)/tool/zpipe

 BOOT_LOGO_RESOURCE := $(BUILDDIR)/$(BOOT_LOGO_DIR)/$(BOOT_LOGO).raw

 LOGO_IMAGE := $(BUILDDIR)/logo.bin

 BOOT_LOGO_IMAGE := $(LOCAL_DIR)/../../../../common/lk/logo/boot_logo

+BOOT_LOGO_CUSTOM_IMAGE := $(LOCAL_DIR)/../../../../common/lk/logo/boot_logo_custom

 RESOURCE_OBJ_LIST :=   \

             $(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_uboot.raw \

             $(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_battery.raw \

@@ -53,15 +54,18 @@ RESOURCE_OBJ_LIST :=   \

             $(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_roll_1.raw \

             $(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_roll_2.raw \

             $(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_roll_3.raw \

-            $(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_roll_4.raw 

+            $(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_roll_4.raw \

+            $(BOOT_LOGO_DIR)/custom/uboot.raw \

+            $(BOOT_LOGO_DIR)/custom/kernel.raw

 GENERATED += \

             $(BOOT_LOGO_RESOURCE) \

             $(LOGO_IMAGE) \

             $(BOOT_LOGO_IMAGE) \

+            $(BOOT_LOGO_CUSTOM_IMAGE) \

             $(addprefix $(BUILDDIR)/,$(RESOURCE_OBJ_LIST))

 

 

-all:: $(LOGO_IMAGE) $(BOOT_LOGO_IMAGE)

+all:: $(LOGO_IMAGE) $(BOOT_LOGO_IMAGE) $(BOOT_LOGO_CUSTOM_IMAGE)

 

 $(LOGO_IMAGE):$(MKIMG) $(BOOT_LOGO_RESOURCE)

 
$(NOECHO) if [ ! -x $(MKIMG) ]; then chmod a+x $(MKIMG); fi

@@ -86,3 +90,9 @@ $(BOOT_LOGO_IMAGE): $(BMP_TO_RAW)

 
$(NOECHO) if [ ! -x $(BMP_TO_RAW) ]; then chmod a+x $(BMP_TO_RAW); fi

 
@echo "Compiling_BMP_TO_RAW_BOOT_LOGO"

 
$(BMP_TO_RAW) $(BOOT_LOGO_IMAGE) $(BOOT_LOGO_DIR)/$(BOOT_LOGO)/$(BOOT_LOGO)_kernel.bmp

+

+$(BOOT_LOGO_CUSTOM_IMAGE): $(BMP_TO_RAW)

+
@$(MKDIR)

+
$(NOECHO) if [ ! -x $(BMP_TO_RAW) ]; then chmod a+x $(BMP_TO_RAW); fi

+
@echo "Compiling_BMP_TO_RAW_BOOT_LOGO_CUSTOM"

+
$(BMP_TO_RAW) $(BOOT_LOGO_CUSTOM_IMAGE) $(BOOT_LOGO_DIR)/custom/kernel.bmp





4.build.git

这部分代码在4.4上是没有编译的

4.4把android层的boot_image移动到kernel层,使用logo.bin内

,所以不用增加这部分的编译机制





这部分和新增apk编译方式一样,新增boot_logo_custom的编译





diff --git a/target/product/common.mk b/target/product/common.mk

index 3d97676..e5acf49 100755

--- a/target/product/common.mk

+++ b/target/product/common.mk

@@ -403,6 +403,7 @@ PRODUCT_PACKAGES := \

     ipohctl \

     boot_logo_updater\

     boot_logo\

+    boot_logo_custom\

     bootanimation\

     libtvoutjni \

     libtvoutpattern \

5.packages/apps/Contacts.git

上层暗码切换,对nv进行读写操作

关键点AP_CFG_REEB_PRODUCT_INFO_LID = 35;不同的项目此值是不同的

需要数清楚新平台的Custom_NvRam_LID.h文件中此lid的index为多少,并改为正确的值





diff --git a/src/com/mediatek/contacts/SpecialCharSequenceMgrProxy.java b/src/com/mediatek/contacts/SpecialCharSequenceMgrProxy.java

index 3a0e091..b6ec321 100755

--- a/src/com/mediatek/contacts/SpecialCharSequenceMgrProxy.java

+++ b/src/com/mediatek/contacts/SpecialCharSequenceMgrProxy.java

@@ -33,7 +33,7 @@ import com.android.contacts.R;

 import com.android.contacts.SpecialCharSequenceMgr;

 import com.android.internal.telephony.ITelephony;

 import com.android.internal.telephony.PhoneConstants;

-

+import android.os.IBinder;

 //import com.mediatek.contacts.ContactsFeatureConstants.FeatureOption;

 import com.mediatek.contacts.simcontact.SimCardUtils;

 import com.mediatek.contacts.simcontact.SlotUtils;

@@ -54,10 +54,11 @@ public class SpecialCharSequenceMgrProxy {

     private static final String ADN_PHONE_NUMBER_COLUMN_NAME = "number";

     private static final String ADN_NAME_COLUMN_NAME = "name";

     private static final String ADN_INDEX_COLUMN_NAME = "index";

-    private static final String CHANGE_LOGO = "*#123321#";

-
private static final String MCCANDMNC = "*#1220#";

-
private static final String IMEI1_MODIFY =FeatureOption.WT_IMEI_MODIFY_CODE1; // sunlee add 20131024

-
private static final String IMEI2_MODIFY =FeatureOption.WT_IMEI_MODIFY_CODE2; // sunlee add 20131024

+    private static final String CHANGE_LOGO = FeatureOption.WT_CHANGE_LOGO_CODE;//"*#123321#";

+    private static final String MCCANDMNC = "*#1220#";

+    private static final String IMEI1_MODIFY =FeatureOption.WT_IMEI_MODIFY_CODE1; // sunlee add 20131024

+    private static final String IMEI2_MODIFY =FeatureOption.WT_IMEI_MODIFY_CODE2; // sunlee add 20131024

+    private static final int AP_CFG_REEB_PRODUCT_INFO_LID = 35;

     /**

      * M: [Gemini+] once a slot is ready, it would be put in this list and waiting for information query

      * after this list is empty, it means all slot information has been retrieved.

@@ -84,6 +85,17 @@ public class SpecialCharSequenceMgrProxy {

 

     static boolean handleChangeLogo(Context context, String input) {

         if (input.equals(CHANGE_LOGO)) {

+        /* **** add changeLogo 20140508 begin */

+        if(FeatureOption.MTK_COMMAND_SWITCH_LOGO){

+            if (readData()==0)

+            {

+                writeData(1); 

+            }else 

+            {

+                writeData(0);

+            }

+        }

+        /* **** add changeLogo 20140508 end */

             File iFile = new File("/flag/change.flag");

             if (false == iFile.exists()) {

                 try {

@@ -103,7 +115,79 @@ public class SpecialCharSequenceMgrProxy {

         }

         return false;

     }

-

+


+    /* **** add changeLogo 20140508 begin */

+    private static byte readData()

+
{


+
IBinder binder = ServiceManager.getService("NvRAMAgent");

+
NvRAMAgent agent = NvRAMAgent.Stub.asInterface(binder);

+
byte[] buff = null;

+
byte[] buff2 ={0};

+
try 

+
{

+
buff = agent.readFile(AP_CFG_REEB_PRODUCT_INFO_LID);// read buffer from nvram

+


+
catch (RemoteException e) 

+
{

+
e.printStackTrace();

+
}

+
 buff2[0]= buff[104];

+
 Log.i("readData", "buff:"+buff);

+
 Log.i("readData", "buff[104]:"+buff[104]);

+
 Log.i("readData", "buff2[0]:"+buff2[0]);

+


+
return buff2[0];

+
}

+
private static byte[] getBytes(int data)

+
{

+
byte[] bytes = new byte[4];

+
bytes[0] = (byte)(data&0xff);

+
bytes[1] = (byte)((data&0xff00)>>8);

+
bytes[2] = (byte)((data&0xff0000)>>16);

+
bytes[3] = (byte)((data&0xff000000)>>24);

+
return bytes;

+
}

+
private static void writeData(int n) 

+
{


+
byte[] buff = null;

+
IBinder binder = ServiceManager.getService("NvRAMAgent");

+
NvRAMAgent agent = NvRAMAgent.Stub.asInterface(binder);

+
try 

+
{

+
buff = agent.readFile(AP_CFG_REEB_PRODUCT_INFO_LID);// read buffer from nvram

+


+
catch (RemoteException e) 

+
{

+
e.printStackTrace();

+
}

+
Log.i("writeData", "buff:"+buff);

+
byte[] write_buff = new byte[]{0,0,0,0};

+
int flag1 = n;

+
byte[] by = getBytes(flag1);

+
for(int i=0;i<4;i++)

+
write_buff[i] = by[i];

+
Log.i("writeData", "write_buff:"+buff[104]);

+
try 

+
{
buff[104]=write_buff[0];

+
Log.i("writeData", "buff[104]:"+buff[104]);

+
Log.i("writeData", "write_buff[0]:"+write_buff[0]);

+
int flag = agent.writeFile(AP_CFG_REEB_PRODUCT_INFO_LID, buff);

+
if (flag > 0) 

+
{

+
System.out.println("write success");

+


+
else 

+
{

+
System.out.println("write failed");

+
}


+


+
catch (RemoteException e)

+
{

+
e.printStackTrace();

+
}

+

+
}


+    /* **** add changeLogo 20140508 end */

 
static boolean handleMCCMNC(Context context, String input) {

         if (input.equals(MCCANDMNC)) {

 
TelephonyManager telManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);





A packages/apps/Contacts/src/com/mediatek/contacts/NvRAMAgent.java

这个文件是生成出来的,可以不用增加

packages/apps/Contacts/src/com/mediatek/contacts/SpecialCharSequenceMgrProxy.java

这个文件主要就是写入的暗码修改命令

针对不同的读取状态,进行状态切换

开机logo切换逻辑深入研究的更多相关文章

  1. WinCE开机Logo的实现(USB下载图片到nandflash)

    WinCE开机启动Logo使用Eboot读取NandFlash中的图片数据,然后显示的方式.对于开机logo的方式网友http://jazka.blog.51cto.com/809003/664131 ...

  2. 因为强行关机, 而导致的fedora23 不能重新启动, 卡在开机logo那里的 修复 解决方案

    其实, fedora23的U盘live 也很好用, 很流畅, 主要还是 要用一个比较好的/快的 U盘. 这样live U盘在4GB(3.75GiB)的内存中还是较快的 原来的U盘live系统用得很卡, ...

  3. Android开机logo修改方法 【转】

    本文转载自:http://blog.csdn.net/qq258711519/article/details/7766303 一体机平台开机logo修改方法 1:修改Kernel中的Logo: 若是要 ...

  4. (原)kenel开机logo的制作

    今天项目需要,需要制作一个kernel的开机logo,所以在rk3288的平台上进行测试一番. 第一步:配置kernel:选上CONFIG_LOGO_LINUX_CLUT224选项 make menu ...

  5. 取消开机logo,改成代码刷屏

    将开机logo改成开始时代码刷屏,这样就能很方便看到开始时的一些问题 首先 sudo chmod 666 /etc/default/grub 然后将 GRUB_CMDLINE_LINUX_DEFAUL ...

  6. 八、启动linux内核并修改开机logo

    1. 编译并烧写linux内核 1)先准备好内核源码包urbetter-linux2.6.28-v1.0.tgz,输入命令:tar -zxvf urbetter-linux2.6.28-v1.0.tg ...

  7. 开机logo以及两种修改开机动画方法

    Android开机画面总共有三屏 一.第一屏:开机logo 1.选张png格式的图片,在Linux任意下执行(安装工具): sudo apt-get install pnmtoplainpm 2.在所 ...

  8. 安卓开机logo和开机动画的几种实现方法

    安卓4.2可用方法2-4,第一种方法未验证. 从理论上来说,android 有4个开机启动画面. 第一个应该是U-BOOT的启动画面,有些设备为了满足按动电源即有显示,在UBOOT里加了开机画面,实现 ...

  9. 安卓修改开机logo和开机动画的方法

    第一种和第二种方法亲测可用,安卓版本是4.2和安卓5.1均可.第二种方法待验证 以下三种方法 Android 开机其实总共会出现3个画面: 1.第一个就是 linux 系统启动,出现Linux小企鹅画 ...

随机推荐

  1. C# WinForm动态添加MSChart控件

    添加mschart.dll动态链接库 添加引用 System.Windows.Forms.DataVisualization     MSChart控件作为方便的用户数据展示控件,可以方便的使用控件提 ...

  2. 夺命雷公狗---Thinkphp----14之前台的首页完善

    我们先来完成我们的首页部分,我们首页要先来完成到焊条部分和右侧的导航部分: 我们先来写控制器: 然后在右侧遍历头部遍历出我们所需要的数据: 因为我们的右侧是引入进来的,所以我们需要到右侧视图下进行遍历 ...

  3. 夺命雷公狗---Thinkphp----8之栏目功能的分页显示

    我们开始在列表页写我们的分页功能,我们直接将刚才取的列表页改写下即可: public function lists(){ //$type = M('Type')->select(); //$th ...

  4. 【linux】终端直接执行py文件,不需要python命令

    先将终端所在路径切换到python脚本文件的目录下然后给脚本文件运行权限,一般755就OK,如果完全是自己的私人电脑,也不做服务器什么的,给777的权限问题也不大(具体权限含义参考chmod指令的介绍 ...

  5. oracle的面试问题

    1. Oracle跟SQL Server 2005的区别? 宏观上: 1). 最大的区别在于平台,oracle可以运行在不同的平台上,sql server只能运行在windows平台上,由于windo ...

  6. Windows下USB磁盘开发系列三:枚举系统中U盘、并获取其设备信息

    前面我们介绍了枚举系统中的U盘盘符(见<Windows下USB磁盘开发系列一:枚举系统中U盘的盘符>).以及获取USB设备的信息(见<Windows下USB磁盘开发系列二:枚举系统中 ...

  7. linux用户栈内核栈的设置---进程的创建: fork/execve【转】

    转自:http://blog.csdn.net/u011279649/article/details/18795547 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] 应用层怎 ...

  8. Linux Runtime PM介绍【转】

    转自:http://blog.csdn.net/wlwl0071986/article/details/42677403 一.Runtime PM引言 1. 背景 (1)display的需求 (2)系 ...

  9. Can't create/write to file '/tmp/#sql_887d_0.MYD' (Errcode: 17)

    lsof |grep "#sql_887d_0.MYD" 如果没有被占用就可以删掉 . https://wordpress.org/support/topic/cant-creat ...

  10. PHP常用的数组相关处理函数

    [数组中常用的多种遍历方式] [for 和 foreach 略] [while() . list() .each() 组合循环遍历数组] each()函数 a. 需要一个数组作为参数 b. 返回来的也 ...