同一套代码实现不同的项目使用不同的客制化分区表
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
同一个平台上,有的客户需要内置存储,有的要去掉内置存储; 这样分区表不能共用。
[SOLUTION]
此功能在72平台有实现,其他平台若需要,可以参考72的/mediatek/build/tools/ptgen/MT65**/ptgen.pl进行修改;
对应的分区表在\mediatek\config\${project}\partition_table_MT65**.xls;
主要修改为添加
my $PROJECT_PART_TABLE_FILENAME = "mediatek/config/$PROJECT/partition_table_${PLATFORM}.xls";
my $FULL_PROJECT_PART_TABLE_FILENAME = "mediatek/config/$FULL_PROJECT/partition_table_${PLATFORM}.xls";
注释
#$PartitonBook = SpreADSheet: : ParseExcel->new()- > Parse($PART_TABLE_FILENAME);
修改
sub ReadExcelFile()
{
my $sheet = load_partition_info($SHEET_NAME);
添加
#****************************************************************************************
# subroutine: get_partition_sheet
# return: Excel worksheet no matter it's in merge area or not, and in windows or not
# input: Specified Excel Sheetname
# input: Excel filename
#****************************************************************************************
sub get_partition_sheet {
my ($sheetName, $fileName) = @_;
my $parser = Spreadsheet:: ParseExcel->new();
my $workbook = $parser- > Parse($fileName);
my $sheet;
if(!defined $workbook) {
print "get workbook fROM $fileName failed, error: ", $parser->error, ".\n";
return undef;
} else {
$sheet = get_sheet($sheetName, $workbook);
if(!defined $sheet) {
print "get $sheetName sheet failed.\n";
return undef;
}
return $sheet;
}
}
#****************************************************************************************
# subroutine: load_partition_info
# return: Excel worksheet no matter it's in merge area or not, and in windows or not
# input: Specified Excel Sheetname
#****************************************************************************************
sub load_partition_info {
my ($sheetName) = @_;
my $sheet;
# get from full project path first
$sheet = get_partition_sheet($sheetName, $FULL_PROJECT_PART_TABLE_FILENAME);
if(!defined $sheet) {
print "get partition sheet from $FULL_PROJECT_PART_TABLE_FILENAME failed, try
$PROJECT_PART_TABLE_FILENAME...\n";
# get from project path
$sheet = get_partition_sheet($sheetName, $PROJECT_PART_TABLE_FILENAME);
if(!defined $sheet) {
print "get partition sheet from $PROJECT_PART_TABLE_FILENAME failed, try $PART_TABLE_FILENAME...\n";
# get from default platform path
$sheet = get_partition_sheet($sheetName, $PART_TABLE_FILENAME);
if(!defined $sheet) {
my $error_msg = " Ptgen CAN NOT find sheet=$SHEET_NAME in $PART_TABLE_FILENAME\n";
print $error_msg;
die $error_msg;
}
}
}
return $sheet;
}
同一个平台上,有的客户需要内置存储,有的要去掉内置存储; 这样分区表不能共用。
[SOLUTION]
此功能在72平台有实现,其他平台若需要,可以参考72的/mediatek/build/tools/ptgen/MT65**/ptgen.pl进行修改;
对应的分区表在\mediatek\config\${project}\partition_table_MT65**.xls;
主要修改为添加
my $PROJECT_PART_TABLE_FILENAME = "mediatek/config/$PROJECT/partition_table_${PLATFORM}.xls";
my $FULL_PROJECT_PART_TABLE_FILENAME = "mediatek/config/$FULL_PROJECT/partition_table_${PLATFORM}.xls";
注释
#$PartitonBook = SpreADSheet: : ParseExcel->new()- > Parse($PART_TABLE_FILENAME);
修改
sub ReadExcelFile()
{
my $sheet = load_partition_info($SHEET_NAME);
添加
#****************************************************************************************
# subroutine: get_partition_sheet
# return: Excel worksheet no matter it's in merge area or not, and in windows or not
# input: Specified Excel Sheetname
# input: Excel filename
#****************************************************************************************
sub get_partition_sheet {
my ($sheetName, $fileName) = @_;
my $parser = Spreadsheet:: ParseExcel->new();
my $workbook = $parser- > Parse($fileName);
my $sheet;
if(!defined $workbook) {
print "get workbook fROM $fileName failed, error: ", $parser->error, ".\n";
return undef;
} else {
$sheet = get_sheet($sheetName, $workbook);
if(!defined $sheet) {
print "get $sheetName sheet failed.\n";
return undef;
}
return $sheet;
}
}
#****************************************************************************************
# subroutine: load_partition_info
# return: Excel worksheet no matter it's in merge area or not, and in windows or not
# input: Specified Excel Sheetname
#****************************************************************************************
sub load_partition_info {
my ($sheetName) = @_;
my $sheet;
# get from full project path first
$sheet = get_partition_sheet($sheetName, $FULL_PROJECT_PART_TABLE_FILENAME);
if(!defined $sheet) {
print "get partition sheet from $FULL_PROJECT_PART_TABLE_FILENAME failed, try
$PROJECT_PART_TABLE_FILENAME...\n";
# get from project path
$sheet = get_partition_sheet($sheetName, $PROJECT_PART_TABLE_FILENAME);
if(!defined $sheet) {
print "get partition sheet from $PROJECT_PART_TABLE_FILENAME failed, try $PART_TABLE_FILENAME...\n";
# get from default platform path
$sheet = get_partition_sheet($sheetName, $PART_TABLE_FILENAME);
if(!defined $sheet) {
my $error_msg = " Ptgen CAN NOT find sheet=$SHEET_NAME in $PART_TABLE_FILENAME\n";
print $error_msg;
die $error_msg;
}
}
}
return $sheet;
}
占位。。
学习学习
路过,学习了。