首页 > 代码库 > 开机逻辑分析
开机逻辑分析
增加暗码命令切换开关机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
这个文件主要就是写入的暗码修改命令
针对不同的读取状态,进行状态切换
开机逻辑分析