android10.0(Q) Nvram 新增節點

cczhengv發表於2020-11-30

第一步:nvram lib id定義

vendor\mediatek\proprietary\custom\k71v1_64_bsp\cgen\inc\Custom_NvRam_LID.h

typedef enum
{
	....
    AP_CFG_RDCL_FILE_AUDIO_WB_PARAM_LID,
    AP_CFG_REEB_PRODUCT_INFO_LID,
    AP_CFG_CUSTOM_FILE_LOGO_INDEX_LID,//cczheng add for logo nvram
//	  AP_CFG_RDCL_FILE_META_LID,
//    AP_CFG_CUSTOM_FILE_CUSTOM1_LID,
//    AP_CFG_CUSTOM_FILE_CUSTOM2_LID,
    AP_CFG_RDCL_FILE_HEADPHONE_COMPFLT_LID,
	...
    AP_CFG_CUSTOM_FILE_SMARTPA_CALIB_LID,
    AP_CFG_CUSTOM_FILE_MAX_LID,
} CUSTOM_CFG_FILE_LID;


/* audio acf file version */
#define AP_CFG_RDCL_FILE_AUDIO_COMPFLT_LID_VERNO	"001"
// cczheng add for logo nvram start 
#define AP_CFG_CUSTOM_FILE_LOGO_INDEX_LID_VERNO            "000"
//end

第二步:nvram lib id的資料結構和版本號宣告

vendor\mediatek\proprietary\custom\k71v1_64_bsp\cgen\inc\Custom_NvRam_data_item.h

#ifndef CUSTOM_NVRAM_DATA_ITEM_H
#define CUSTOM_NVRAM_DATA_ITEM_H

#include "custom_cfg_module_file.h"
#include "Custom_NvRam_LID.h"

#include "../cfgfileinc/CFG_LOGO_File.h"

BEGIN_NVRAM_DATA

// cczheng add for logo nvram start 
LID_BIT VER_LID(AP_CFG_CUSTOM_FILE_LOGO_INDEX_LID)
LOGOINDEX_CUSTOM_PARAM_STRUCT *CFG_FILE_LOGO_INDEX_REC_TOTAL
{

};//end

....

第三步:nvram lib資料結構定義

vendor\mediatek\proprietary\custom\k71v1_64_bsp\cgen\cfgfileinc\CFG_LOGO_File.h

//cczheng add for logo nvram start 
#ifndef _CFG_LOGO_FILE_H
#define _CFG_LOGO_FILE_H

typedef struct
{
    unsigned char Array[1024];
}LOGOINDEX_CUSTOM_PARAM_STRUCT;

#define CFG_FILE_LOGO_INDEX_REC_SIZE    sizeof(LOGOINDEX_CUSTOM_PARAM_STRUCT)
#define CFG_FILE_LOGO_INDEX_REC_TOTAL   1
//end

#endif

第四步:nvram lib 預設值定義

vendor\mediatek\proprietary\custom\k71v1_64_bsp\cgen\cfgdefault\CFG_LOGO_Default.h

//cczheng add for logo nvram start 
#ifndef _CFG_LOGO_DEFAULT_FILE_H
#define _CFG_LOGO_DEFAULT_FILE_H

#include "../cfgfileinc/CFG_LOGO_File.h"


LOGOINDEX_CUSTOM_PARAM_STRUCT stLogoDefault =
{
    0x01,0x00,0x00,0x00,0x0,0x0,0x0,0x0
};//end

#endif

第五步:nvram lib內容加入nvram陣列中

vendor\mediatek\proprietary\custom\k71v1_64_bsp\cgen\inc\CFG_file_info_custom.h


//cczheng
#include "../cfgfileinc/CFG_LOGO_File.h"
#include "../cfgdefault/CFG_LOGO_Default.h"


    const TCFG_FILE g_akCFG_File_Custom[]=
    {
	....

    {
        "/mnt/vendor/nvdata/APCFG/APRDEB/PRODUCT_INFO",       VER(AP_CFG_REEB_PRODUCT_INFO_LID),         CFG_FILE_PRODUCT_INFO_SIZE,
        CFG_FILE_PRODUCT_INFO_TOTAL,                   SIGNLE_DEFUALT_REC,                                   (char *)&stPRODUCT_INFOConfigDefault,DataReset, NULL
    },

     //cczheng add for logo nvram start 
    {
        "/mnt/vendor/nvdata/APCFG/APRDEB/LOGO_INDEX",  VER(AP_CFG_CUSTOM_FILE_LOGO_INDEX_LID),  CFG_FILE_LOGO_INDEX_REC_SIZE,
        // CFG_FILE_LOGO_INDEX_REC_TOTAL,   DEFAULT_ZERO,  0, DataReset, NULL
        CFG_FILE_LOGO_INDEX_REC_TOTAL,   SIGNLE_DEFUALT_REC,  (char *)&stLogoDefault, DataReset, NULL
    },//end

	....

第六步:nvram lib id需要備份到BinRegion

vendor\mediatek\proprietary\external\nvram\libcustom_nvram\CFG_file_info.c


FileName aBackupToBinRegion[] = {

	...

#ifndef MTK_PRODUCT_INFO_SUPPORT
	{"PRODUCT_INFO", AP_CFG_REEB_PRODUCT_INFO_LID},
#endif
	{"LOGO_INDEX", AP_CFG_CUSTOM_FILE_LOGO_INDEX_LID},//cczheng add for logo nvram
#ifdef	MTK_SDIORETRY_SUPPORT
	{"SDIO_RETRY", AP_CFG_RDEB_SDIO_RETRY_LID},
#endif
	...
};

pfConvertFunc aNvRamConvertFuncTable[] = {
	....
	NULL,//AP_CFG_RDEB_OMADM_USB_LID
	NULL,//AP_CFG_REEB_PRODUCT_INFO_LID
	NULL,//AP_CFG_CUSTOM_FILE_LOGO_INDEX_LID  cczheng add

	...
};


const TABLE_FOR_SPECIAL_LID g_new_nvram_lid[] = {
#ifdef MTK_MLC_NAND_SUPPORT
	{ AP_CFG_REEB_PRODUCT_INFO_LID, 0, 2 * 1024 * 1024 },
#else
	{ AP_CFG_REEB_PRODUCT_INFO_LID, 0, 1024 * 1024 },
#endif
	{ AP_CFG_CUSTOM_FILE_LOGO_INDEX_LID, 0, 1024 * 1024 },//cczheng add
};

第七步:整編後燒寫驗證

adb shell

cd /mnt/vendor/nvdata/APCFG/APRDEB

可以看到 LOGO_INDEX

BT_Addr GPS LOGO_INDEX WIFI WIFI_CUSTOM

或者過濾日誌

2020-11-30 16:29:16.116 484-484/? D/NVRAM: NVM_Init Max Lid: 79
2020-11-30 16:29:16.116 484-484/? D/NVRAM: [NVRAM]: info nvram_gpt_flag =1
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/FILE_VER,0
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDEB/BT_Addr,1
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/AUXADC,2
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_Para,3
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_3A,4
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING,5
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_DEFECT,6
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SENSOR,7
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_LENS,8
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/UART,9
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/FACTORY,10
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/BWCS,11
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/HWMON_ACC,12
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/HWMON_GYRO,13
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDEB/OMADM_USB,14
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/Voice_Recognize_Param,15
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/Audio_AudEnh_Control_Opt,16
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/Audio_VOIP_Param,17
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/HWMON_PS,18
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/MD_Type,19
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/EXT_MD_Type,20
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/SDIO,21
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_VERSION,22
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_FEATURE,23
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_GEOMETRY,24
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/APCFG/APRDCL/MD_SBP,25
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING2,26
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING3,27
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING4,28
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING5,29
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING6,30
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING7,31
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING8,32
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING9,33
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING10,34
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING11,35
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_SHADING12,36
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE,37
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE2,38
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE3,39
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE4,40
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE5,41
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE6,42
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE7,43
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE8,44
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE9,45
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE10,46
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE11,47
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_PLINE12,48
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_AF,49
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgfile =/mnt/vendor/nvdata/media/CAMERA_FLASH_CALIBRATION,50
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_Sph,51
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/APCFG/APRDEB/GPS,52
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_CompFlt,53
2020-11-30 16:29:16.116 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_Effect,54
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/APCFG/APRDEB/WIFI,55
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/APCFG/APRDEB/WIFI_CUSTOM,56
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_Sph_Med,57
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_Vol_custom,58
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Sph_Dual_Mic,59
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_Wb_Sph,60
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/APCFG/APRDEB/PRODUCT_INFO,61
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/APCFG/APRDEB/LOGO_INDEX,62
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Headphone_CompFlt,63
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_gain_table,64
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_ver1_Vol_custom,65
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_Hd_Record_Param,66
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_Hd_Record_Scene_Table,67
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_Buffer_DC_Calibration_Param,68
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/VibSpk_CompFlt,69
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/MusicDRC_CompFlt,70
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/RingToneDRC_CompFlt,71
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_MAGI_CONFERENCE,72
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_HAC_Param,73
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_Sph_Lpbk,74
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/Audio_BT_Gain,75
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/media/AUDIO_FUNC_SWITCH_Param,76
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/APCFG/APRDCL/FG,77
2020-11-30 16:29:16.117 484-484/? D/NVRAM: deal with cfgcustfile =/mnt/vendor/nvdata/APCFG/APRDCL/smartpa_calib,78

相關文章