1. 程式人生 > >開機邏輯分析

開機邏輯分析

ice else println ddp files extern hand val conf

增加暗碼命令切換開關機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 [email protected]

/* */ 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 [email protected]
/* */: 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 [email protected]
/* */ ----- **** 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
[email protected] "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
這個文件主要就是寫入的暗碼修改命令

針對不同的讀取狀態,進行狀態切換

開機邏輯分析

相關推薦

開機邏輯分析

ice else println ddp files extern hand val conf 增加暗碼命令切換開關機logo功能u-boot logo顯示原理:1.————Little Kernel會在platform_early_init階段首先會獲取lcm param

邏輯分析

問題 最好的 貢獻 就是 我不 pla 老板 生存 智力 唯一在客觀流動的東西就是時間。 社會的組成:人 因為時間是有限的,假如人一直保持一個學習速度, 每個人努力學習一門知識來發揮這門專長,可以通過分工來蓋一座嘆為觀止的摩天大樓。 一個人努力學習各門知識,可以建一座溫馨的

數據處理為樹形結構以及多級菜單的邏輯分析

value data 關系 type 二級 相同 item 樹形結構 調用 菜單數據源處理: //數據源組裝成樹形結構(一級與後面的級邏輯相同)邏輯:遍歷所有數據,上級與下次的聯動關系相等則數據存放,如果不為最後一級,遞歸function getTree(source, d

Linux開機流程分析

開機流程 多重開機 核心檔案       檢視systemV的runlevel與systemd的target的對應關係。 sys

binder新增log引起的不能開機問題分析

2018-9-18  9-19 為了觀察binder的生命週期,添加了log vi frameworks/base/core/java/android/os/Binder.java vi frameworks/base/core/jni/android_util_Binder.

02-JavaWeb專案-郵件啟用功能-底層邏輯分析

郵件啟用功能 【web專案-郵件啟用功能-邏輯分析/前臺後臺/三層架構/原生底層】 【技術實現:JavaScript/Ajax&json/Tomcat/MySQL/Spring-JDBC/Druid連線池】 前臺 使用者登入註冊郵箱,檢視啟用郵件,點選啟用連結,啟用連

01-JavaWeb專案-註冊功能-底層邏輯分析

註冊功能 【web專案-註冊功能-邏輯分析/前臺後臺/三層架構/原生底層】 【技術實現:JavaScript/Ajax&json/Tomcat/MySQL/Spring-JDBC/Druid連線池】 前臺 JavaScript 表單檢驗

微信sdk底層程式碼邏輯分析

1.主掃 呼叫https://api.mch.weixin.qq.com/pay/micropay後 得到的返回碼中關注return_code,trade_state,err_state,當: return_code=FAIL,支付失敗退出; return_code=SUCCESS,

cocos2d-x實現一個PopStar(消滅星星)遊戲的邏輯分析及原始碼

前言 說起PopStar這個遊戲,或許很多人都不知道是啥,但是如果說起消滅星星的話,可能就會有很多人恍然大悟,原來是它。那麼,這個消滅星星長得什麼樣子呢?我們用一張圖來看看: emmm,是的,具體來說,長得就是這樣,我們通過點選圖片上某一個顏色的星星塊,如果,這個顏色塊周圍存在和他相

從零開始之驅動發開、linux驅動(三十八、Linux common clock framework(3)_實現邏輯分析

1. 前言 前面兩篇clock framework的分析文章,分別從clock consumer和clock provider的角度,介紹了Linux kernel怎麼管理系統的clock資源,以及device driver怎麼使用clock資源。本文將深入到clock framework的

【心得】Lattice後端使用經驗小結(ECP5UM,DDR3,Diamond3.10,Reveal邏輯分析

列表 con inf 很難 http type ner jta psc 【博客導航】 【導航】FPGA相關 DDR3 IP例化 LEF5UM器件,應用DDR3控制器IP。主要分幾步:IP獲取,安裝,例化。 1、先在impl1目錄下,右鍵,新建sbx文件,即Clarit

SAP庫存庫齡邏輯分析

庫存賬齡指庫存物料在倉庫的存放時間,可反映出物料週轉率與物料需求計劃的準確性,是反映企業的供應鏈的整體效率的績效指標之一。由於各公司對庫存管理的要求不同,所以SAP沒有提供標準的庫存賬齡分析報表! 首先我們要確定庫齡的計算標準是什麼? A、標準的庫齡計算應該

Android開機時間分析

文章來源:http://blog.csdn.net/huangyabin001/article/details/42777703 一、 關於本篇博文 該文件簡單主要描述瞭如何找出開機各個階段耗時情況,以及對開機各個階段的分析方法和如何優化開機時間,減少耗時。便於讀者可以

FPS遊戲初開發--邏輯分析總結

(圖片來自網路,侵權可刪)FPS遊戲,即First-person Shooting Game,第一人稱射擊遊戲,說到FPS遊戲,相信大家第一個想到都是經典的CS,近幾年優秀的FPS遊戲也是不少,比如CS

Android開機log分析

1.  1. android啟動第一階段:啟動android第一個程序init,通過解析init.rc指令碼,生成檔案系統,啟動vold、media、SurfaceFlinger等Nativie服務。在這個階段你可以看到帶“Android”文字靜態logo和帶“android”文字的開機動畫   2.  [

支付流程簡單邏輯分析

常用的支付方式有: 1、支付寶支付 支付流程: (1)先與支付寶簽約,獲取商戶id(partner)和賬號id(seller) (2)下載相應的公私鑰檔案(加密簽名使用),在客戶端我們可能只需要私鑰 (3)下載支付寶sdk (4)生成訂單資訊,可以直接客戶端或者自己服務端生存都可以,但是大多是服務端生存的

思維邏輯分析相關理論支援:SWOT、PDCA、6W2H、SMART、WBS、時間管理、二八原則

一、SWOT分析法 Strengths:優勢 Weaknesses:劣勢 Opportunities:機會 Threats:威脅 人生工具:SWOT、PDCA、6W2H、SMART、WBS、時間管理、二八原則 意義:幫您清晰地把握全域性,分析自己在資

2048遊戲程式碼邏輯分析

從主類開始走:   -->MainActivity-->找到一些控制元件-->點選開始按鈕時執行GameView中的startGame()方法                                                  

一道有意思的邏輯分析

     題目:      我的分析: Albert:我不知道Cheryl的生日,但是我知道你也不會知道。   分析:說明不可能是2月21號、4月22日,所以排除2月和4月,         就剩

2008/1/31 OSIP協議棧使用入門(續一:純協議棧邏輯分析

http://mbstudio.spaces.live.com/blog/cns!C898C3C40396DC11!2860.entry 2008/1/31OSIP協議棧使用入門(續一:純協議棧邏輯分析)  (CopyLeft by Meineson | www.mbstu