rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | #!/usr/bin/perl
|
| 2 | #
|
| 3 | # Copyright Statement:
|
| 4 | # --------------------
|
| 5 | # This software is protected by Copyright and the information contained
|
| 6 | # herein is confidential. The software may not be copied and the information
|
| 7 | # contained herein may not be used or disclosed except with the written
|
| 8 | # permission of MediaTek Inc. (C) 2008
|
| 9 | #
|
| 10 | # BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
|
| 11 | # THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
|
| 12 | # RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
|
| 13 | # AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
|
| 14 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
|
| 15 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
|
| 16 | # NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
|
| 17 | # SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
|
| 18 | # SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
|
| 19 | # THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
|
| 20 | # NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
|
| 21 | # SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
|
| 22 | #
|
| 23 | # BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
|
| 24 | # LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
|
| 25 | # AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
|
| 26 | # OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
|
| 27 | # MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
|
| 28 | #
|
| 29 | # THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
|
| 30 | # WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
|
| 31 | # LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
|
| 32 | # RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
|
| 33 | # THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
|
| 34 | #
|
| 35 | #
|
| 36 | # To process CustImgNamesExt and put image information to ExtractObj.ini.
|
| 37 | #******************************************************************************
|
| 38 | # Subroutine: Usage
|
| 39 | #******************************************************************************
|
| 40 | sub usage {
|
| 41 | print "perl processExtractObj.pl ProcdFile ExtractObj.ini\n";
|
| 42 | exit 1;
|
| 43 | }
|
| 44 |
|
| 45 | #$NvramCustPack = $ARGV[0];
|
| 46 | $NvramLidSize = $ARGV[0];
|
| 47 | $NvramTmp = $ARGV[1];
|
| 48 | $CustomWapCustPack = $ARGV[2];
|
| 49 | $custom = $ARGV[3];
|
| 50 | $project = $ARGV[4];
|
| 51 | $outputdir = $ARGV[5];
|
| 52 | $ExtractObjFile = $ARGV[6];
|
| 53 | $var=0;
|
| 54 | $new_line = "";
|
| 55 | chomp($cwd = `cd`);
|
| 56 | if ($cwd =~ /.*\\$/){
|
| 57 | chop($cwd);
|
| 58 | }
|
| 59 |
|
| 60 | # Process ~nvram_lid_size.log to get custpack needed LID names.
|
| 61 | # Use LID names to get LID variable names from ~nvram_tmp.c.
|
| 62 |
|
| 63 | open (F1,"<$NvramLidSize") || die "Cannot open ~nvram_lid_size.log, please execute nvram_auto_gen first:$!\n";
|
| 64 | while (<F1>)
|
| 65 | {
|
| 66 | if (/(\d+)\s*(\d+)\s*(\w.+\w)\s*\bCUSTPACK\b/){
|
| 67 | $nvram_name{$3} = 1;
|
| 68 | }
|
| 69 | }
|
| 70 | close(F1);
|
| 71 |
|
| 72 | open (nvramtmp,"<$NvramTmp") || die "Cannot open ~nvram_cust_pack.c\n";
|
| 73 | $backup = $/;
|
| 74 | undef $/;
|
| 75 | $reading = <nvramtmp>;
|
| 76 | $/ = $backup;
|
| 77 | close nvramtmp;
|
| 78 |
|
| 79 | open (ExtractObjFile,">$ExtractObjFile") || die "Cannot open $ExtractObjFile:$!\n";
|
| 80 | print ExtractObjFile "[VAR_NAME]\n";
|
| 81 |
|
| 82 | if ($reading =~ /const custpack_nvram_header custpack_nvram_ptr\s*=\s*\{.+?\{(.+?)\}/s) {
|
| 83 | $nvram_variable = $1;
|
| 84 | }
|
| 85 |
|
| 86 | while($nvram_variable =~ /(\w+)[,|\s]/){
|
| 87 | $nvram_variable=$';
|
| 88 | $var++;
|
| 89 | print ExtractObjFile "Var$var = \"$1\"\n";
|
| 90 | }
|
| 91 |
|
| 92 | # Process custom\common\custom_wap_cust_pack.c to get custpack_wap_ptr variable names.
|
| 93 | open (F2,"<$CustomWapCustPack") || die "Cannot open $CustomWapCustPack:$!\n";
|
| 94 | $backup = $/;
|
| 95 | undef $/;
|
| 96 | $reading=<F2>;
|
| 97 | $/ = $backup;
|
| 98 | close(F2);
|
| 99 |
|
| 100 | if ($reading =~ /const wap_custpack_header custpack_wap_ptr\s*=\s*\{([\w|\s|,|&]+)\}/) {
|
| 101 | $custpack_wap_ptr = $1;
|
| 102 | }
|
| 103 |
|
| 104 | while($custpack_wap_ptr =~ /&(.+?)[,|\s]/){
|
| 105 | $custpack_wap_ptr = $';
|
| 106 | $var++;
|
| 107 | print ExtractObjFile "Var$var = \"$1\"\n";
|
| 108 | }
|
| 109 |
|
| 110 | # Write [EXTRACTOBJ_PERL_SCRIPT] section to extractObj.ini
|
| 111 | print ExtractObjFile "\n\[EXTRACTOBJ_PERL_SCRIPT\]\n";
|
| 112 | print ExtractObjFile "CUSTOM = \"$custom\"\n";
|
| 113 | print ExtractObjFile "PROJECT = \"$project\"\n";
|
| 114 | print ExtractObjFile "OUTPUTDIR = \"$cwd\\$outputdir\"\n";
|
| 115 | print ExtractObjFile "OBJ1 = \"custom_wap_cust_pack.obj\"\n";
|
| 116 | print ExtractObjFile "OBJ2 = \"nvram_cust_pack.obj\"\n";
|
| 117 | close(ExtractObjFile);
|
| 118 |
|