加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

wince自动生成XIP映像文件的一种方法

发布时间:2020-12-16 22:28:38 所属栏目:大数据 来源:网络整理
导读:在WINCE做MULTIBIN+XIP方式的启动映像文件时,往往需要分两步走:第一步、生成映像文件;第二步、修改ce.bib然后再romimage一次,以前的做法是手动修改极不方便,后来在网上找到了一些办法并整合到一起就能够做到一步到位。 1、做一个批处理放在BSP的Files/

在WINCE做MULTIBIN+XIP方式的启动映像文件时,往往需要分两步走:第一步、生成映像文件;第二步、修改ce.bib然后再romimage一次,以前的做法是手动修改极不方便,后来在网上找到了一些办法并整合到一起就能够做到一步到位。

1、做一个批处理放在BSP的Files/premake目录下供PB调用,文件内容如下:

[cpp] view plain copy
  1. echo.
  2. echo%_TGTPLAT%-preriprocessing...
  3. echo.
  4. if"%IMGMULTIXIP%"=="1"cd%_TARGETPLATROOT%/Files/premake
  5. if"%IMGMULTIXIP%"=="1"copy%_FLATRELEASEDIR%/ce.bib%_TARGETPLATROOT%/Files/premake
  6. if"%IMGMULTIXIP%"=="1"copyce.bibce_orig.bib
  7. if"%IMGMULTIXIP%"=="1"oembibhelpermultibin.txtce_orig.bibce.bib
  8. if"%IMGMULTIXIP%"=="1"copyce.bib%_FLATRELEASEDIR%
  9. if"%IMGMULTIXIP%"=="1"cd%_FLATRELEASEDIR%
  10. if"%IMGMULTIXIP%"=="1"romimagece.bib

2、oembibhelper.vbs脚本的内容如下:
[vb] copy
    '
  1. 'Copyright(c)MicrosoftCorporation.Allrightsreserved.
  2. '
  3. 'USEOfthissamplesourcecodeissubjecttothetermsoftheMicrosoft
  4. 'licenseagreementunderwhichyoulicensedthissamplesourcecode.If
  5. 'youdidnotacceptthetermsofthelicenseagreement,youarenot
  6. 'authorizedtousethissamplesourcecode.Forthetermsofthelicense,
  7. 'pleaseseethelicenseagreementbetweenyouandMicrosoftor,ifapplicable,
  8. 'seetheLICENSE.RTFonyourinstallmediaortherootofyourtoolsinstallation.
  9. 'THESAMPLESOURCECODEISPROVIDED"ASIS",WITHNOWARRANTIES.
  10. 'Modifiedthisbibhelper.vbstomodifythebibtoimplementtheMulti-Bin
  11. 'Forexample:"nk.exe@XIPKERN"ofconfigfilewillmakenk.exepackedintoXIPKERN.bin
  12. PublicFunctionSplitEx(InputText,Delimiter)
  13. 'ThisfunctionsplitsthesentenceinInputTextinto
  14. 'wordsandreturnsastringarrayofthewords.Each
  15. 'elementofthearraycontainsoneword.
  16. 'Thisconstantcontainspunctuationandcharacters
  17. 'thatshouldbefilteredfromtheinputstring.
  18. DimstrReplacedText
  19. DimintIndex
  20. 'Replacetabcharacterswithspacecharacters.
  21. 'Replacetabcharacterswithspacecharacters.
  22. strReplacedText=Trim(Replace(InputText,vbTab,""))
  23. 'Loopuntilallconsecutivespacecharactersare
  24. 'replacedbyasinglespacecharacter.
  25. DoWhileInStr(strReplacedText,"")
  26. strReplacedText=Replace(strReplacedText,"","")
  27. Loop
  28. 'Splitthesentenceintoanarrayofwordsandreturn
  29. 'thearray.Ifadelimiterisspecified,useit.
  30. 'MsgBox"String:"&strReplacedText
  31. IfLen(Delimiter)=0Then
  32. SplitEx=Split(strReplacedText)
  33. Else
  34. SplitEx=Split(strReplacedText,Delimiter)
  35. EndIf
  36. EndFunction
  37. PrivateFunctionLoadConfigFile(Filename)
  38. ConstForReading=1,ForWriting=2,ForAppending=8
  39. DimLCArray()
  40. LoopVal=0
  41. Setfs=CreateObject("Scripting.FileSystemObject")
  42. Seta=fs.OpenTextFile(Filename,ForReading,False)
  43. DoWhileNota.AtEndOfStream
  44. FileLine=a.ReadLine()
  45. ifLeft(FileLine,1)=";"Then
  46. 'Wscript.Echo"Skip;forcomments"'
  47. Else
  48. SubStrings=SplitEx(FileLine,"")
  49. IfUBound(SubStrings)=1Then
  50. ReDimPreserveLCArray(LoopVal)
  51. LCArray(LoopVal)=SubStrings
  52. LoopVal=LoopVal+1
  53. 'Wscript.Echo"Skipblanklines"'
  54. EndIf
  55. a.Close
  56. LoadConfigFile=LCArray
  57. EndFunction
  58. PrivateFunctionCalcRegionString(InString,ConfigArrayElement)
  59. CalcRegionString=InString
  60. ForLoopVal=1ToUBound(ConfigArrayElement)
  61. IfLeft(ConfigArrayElement(LoopVal),1)="@"Then
  62. CalcRegionString=Right(ConfigArrayElement(LoopVal),Len(ConfigArrayElement(LoopVal))-1)
  63. Next
  64. PrivateFunctionFindReplaceStrings(SubStrings,ConfigArray,StringToReplace,ReplaceString)
  65. FindReplaceStrings=False
  66. LoopVal=0
  67. ForLoopVal=0ToUBound(ConfigArray)
  68. IfSubStrings(0)=ConfigArray(LoopVal)(0)Then
  69. IfUBound(SubStrings)=2Then
  70. TypeString=CalcRegionString("",ConfigArray(LoopVal))
  71. StringToReplace=SubStrings(1)
  72. ReplaceString=SubStrings(2)+""+TypeString
  73. FindReplaceStrings=True
  74. IfUBound(SubStrings)=3Then
  75. TypeString=CalcRegionString(SubStrings(3),ConfigArray(LoopVal))
  76. StringToReplace=SubStrings(2)
  77. ReplaceString=TypeString
  78. FindReplaceStrings=True
  79. 'MainFunction
  80. 'ReadProgramArguments
  81. SetArgs=Wscript.Arguments
  82. ifArgs.count<>3then
  83. Wscript.Echo"Error:InvalidNumberofarguments"
  84. Wscript.Echo""
  85. Wscript.Echo"Usage:cscriptbibhelper.vbsconfigfileinbibfileoutbibfile"
  86. Wscript.Quit
  87. Endif

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读