wince自动生成XIP映像文件的一种方法
2012-06-09 11:54
417 查看
在WINCE做MULTIBIN+XIP方式的启动映像文件时,往往需要分两步走:第一步、生成映像文件;第二步、修改ce.bib然后再romimage一次,以前的做法是手动修改极不方便,后来在网上找到了一些办法并整合到一起就能够做到一步到位。
1、做一个批处理放在BSP的Files/premake目录下供PB调用,文件内容如下:
[cpp] view
plaincopy
echo.
echo %_TGTPLAT%-preri processing...
echo.
if "%IMGMULTIXIP%"=="1" cd %_TARGETPLATROOT%/Files/premake
if "%IMGMULTIXIP%"=="1" copy %_FLATRELEASEDIR%/ce.bib %_TARGETPLATROOT%/Files/premake
if "%IMGMULTIXIP%"=="1" copy ce.bib ce_orig.bib
if "%IMGMULTIXIP%"=="1" oembibhelper multibin.txt ce_orig.bib ce.bib
if "%IMGMULTIXIP%"=="1" copy ce.bib %_FLATRELEASEDIR%
if "%IMGMULTIXIP%"=="1" cd %_FLATRELEASEDIR%
if "%IMGMULTIXIP%"=="1" romimage ce.bib
2、oembibhelper.vbs脚本的内容如下:
[vb] view
plaincopy
'
' Copyright (c) Microsoft Corporation. All rights reserved.
'
'
' Use of this sample source code is subject to the terms of the Microsoft
' license agreement under which you licensed this sample source code. If
' you did not accept the terms of the license agreement, you are not
' authorized to use this sample source code. For the terms of the license,
' please see the license agreement between you and Microsoft or, if applicable,
' see the LICENSE.RTF on your install media or the root of your tools installation.
' THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
'
' Modified this bibhelper.vbs to modify the bib to implement the Multi-Bin
' For example: "nk.exe @XIPKERN" of config file will make nk.exe packed into XIPKERN.bin
'
Public Function SplitEx(InputText,Delimiter)
' This function splits the sentence in InputText into
' words and returns a string array of the words. Each
' element of the array contains one word.
' This constant contains punctuation and characters
' that should be filtered from the input string.
Dim strReplacedText
Dim intIndex
' Replace tab characters with space characters.
' Replace tab characters with space characters.
strReplacedText = Trim(Replace(InputText, vbTab, " "))
' Loop until all consecutive space characters are
' replaced by a single space character.
Do While InStr(strReplacedText, " ")
strReplacedText = Replace(strReplacedText, " ", " ")
Loop
' Split the sentence into an array of words and return
' the array. If a delimiter is specified, use it.
'MsgBox "String:" & strReplacedText
If Len(Delimiter) = 0 Then
SplitEx = Split(strReplacedText)
Else
SplitEx = Split(strReplacedText, Delimiter)
End If
End Function
Private Function LoadConfigFile(Filename)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim LCArray()
LoopVal = 0
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(Filename,ForReading,False)
Do While Not a.AtEndOfStream
FileLine = a.ReadLine()
if Left(FileLine,1) = ";" Then
'Wscript.Echo "Skip ; for comments"'
Else
SubStrings = SplitEx(FileLine," ")
If UBound(SubStrings) = 1 Then
ReDim Preserve LCArray(LoopVal)
LCArray(LoopVal) = SubStrings
LoopVal = LoopVal + 1
Else
'Wscript.Echo "Skip blank lines"'
End If
End If
Loop
a.Close
LoadConfigFile = LCArray
End Function
Private Function CalcRegionString(InString, ConfigArrayElement)
CalcRegionString = InString
For LoopVal = 1 To UBound(ConfigArrayElement)
If Left(ConfigArrayElement(LoopVal), 1) = "@" Then
CalcRegionString = Right(ConfigArrayElement(LoopVal), Len(ConfigArrayElement(LoopVal))-1)
End If
Next
End Function
Private Function FindReplaceStrings(SubStrings, ConfigArray, StringToReplace, ReplaceString)
FindReplaceStrings = False
LoopVal = 0
For LoopVal = 0 To UBound(ConfigArray)
If SubStrings(0) = ConfigArray(LoopVal)(0) Then
If UBound(SubStrings) = 2 Then
TypeString = CalcRegionString("", ConfigArray(LoopVal))
StringToReplace = SubStrings(1)
ReplaceString = SubStrings(2) + " " + TypeString
FindReplaceStrings = True
End If
If UBound(SubStrings) = 3 Then
TypeString = CalcRegionString(SubStrings(3), ConfigArray(LoopVal))
StringToReplace = SubStrings(2)
ReplaceString = TypeString
FindReplaceStrings = True
End If
End If
Next
End Function
' Main Function
'
'
' Read Program Arguments
Set Args = Wscript.Arguments
if Args.count <> 3 then
Wscript.Echo "Error: Invalid Number of arguments"
Wscript.Echo ""
Wscript.Echo "Usage: cscript bibhelper.vbs configfile inbibfile outbibfile"
Wscript.Quit
End if
1、做一个批处理放在BSP的Files/premake目录下供PB调用,文件内容如下:
[cpp] view
plaincopy
echo.
echo %_TGTPLAT%-preri processing...
echo.
if "%IMGMULTIXIP%"=="1" cd %_TARGETPLATROOT%/Files/premake
if "%IMGMULTIXIP%"=="1" copy %_FLATRELEASEDIR%/ce.bib %_TARGETPLATROOT%/Files/premake
if "%IMGMULTIXIP%"=="1" copy ce.bib ce_orig.bib
if "%IMGMULTIXIP%"=="1" oembibhelper multibin.txt ce_orig.bib ce.bib
if "%IMGMULTIXIP%"=="1" copy ce.bib %_FLATRELEASEDIR%
if "%IMGMULTIXIP%"=="1" cd %_FLATRELEASEDIR%
if "%IMGMULTIXIP%"=="1" romimage ce.bib
2、oembibhelper.vbs脚本的内容如下:
[vb] view
plaincopy
'
' Copyright (c) Microsoft Corporation. All rights reserved.
'
'
' Use of this sample source code is subject to the terms of the Microsoft
' license agreement under which you licensed this sample source code. If
' you did not accept the terms of the license agreement, you are not
' authorized to use this sample source code. For the terms of the license,
' please see the license agreement between you and Microsoft or, if applicable,
' see the LICENSE.RTF on your install media or the root of your tools installation.
' THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
'
' Modified this bibhelper.vbs to modify the bib to implement the Multi-Bin
' For example: "nk.exe @XIPKERN" of config file will make nk.exe packed into XIPKERN.bin
'
Public Function SplitEx(InputText,Delimiter)
' This function splits the sentence in InputText into
' words and returns a string array of the words. Each
' element of the array contains one word.
' This constant contains punctuation and characters
' that should be filtered from the input string.
Dim strReplacedText
Dim intIndex
' Replace tab characters with space characters.
' Replace tab characters with space characters.
strReplacedText = Trim(Replace(InputText, vbTab, " "))
' Loop until all consecutive space characters are
' replaced by a single space character.
Do While InStr(strReplacedText, " ")
strReplacedText = Replace(strReplacedText, " ", " ")
Loop
' Split the sentence into an array of words and return
' the array. If a delimiter is specified, use it.
'MsgBox "String:" & strReplacedText
If Len(Delimiter) = 0 Then
SplitEx = Split(strReplacedText)
Else
SplitEx = Split(strReplacedText, Delimiter)
End If
End Function
Private Function LoadConfigFile(Filename)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim LCArray()
LoopVal = 0
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(Filename,ForReading,False)
Do While Not a.AtEndOfStream
FileLine = a.ReadLine()
if Left(FileLine,1) = ";" Then
'Wscript.Echo "Skip ; for comments"'
Else
SubStrings = SplitEx(FileLine," ")
If UBound(SubStrings) = 1 Then
ReDim Preserve LCArray(LoopVal)
LCArray(LoopVal) = SubStrings
LoopVal = LoopVal + 1
Else
'Wscript.Echo "Skip blank lines"'
End If
End If
Loop
a.Close
LoadConfigFile = LCArray
End Function
Private Function CalcRegionString(InString, ConfigArrayElement)
CalcRegionString = InString
For LoopVal = 1 To UBound(ConfigArrayElement)
If Left(ConfigArrayElement(LoopVal), 1) = "@" Then
CalcRegionString = Right(ConfigArrayElement(LoopVal), Len(ConfigArrayElement(LoopVal))-1)
End If
Next
End Function
Private Function FindReplaceStrings(SubStrings, ConfigArray, StringToReplace, ReplaceString)
FindReplaceStrings = False
LoopVal = 0
For LoopVal = 0 To UBound(ConfigArray)
If SubStrings(0) = ConfigArray(LoopVal)(0) Then
If UBound(SubStrings) = 2 Then
TypeString = CalcRegionString("", ConfigArray(LoopVal))
StringToReplace = SubStrings(1)
ReplaceString = SubStrings(2) + " " + TypeString
FindReplaceStrings = True
End If
If UBound(SubStrings) = 3 Then
TypeString = CalcRegionString(SubStrings(3), ConfigArray(LoopVal))
StringToReplace = SubStrings(2)
ReplaceString = TypeString
FindReplaceStrings = True
End If
End If
Next
End Function
' Main Function
'
'
' Read Program Arguments
Set Args = Wscript.Arguments
if Args.count <> 3 then
Wscript.Echo "Error: Invalid Number of arguments"
Wscript.Echo ""
Wscript.Echo "Usage: cscript bibhelper.vbs configfile inbibfile outbibfile"
Wscript.Quit
End if
相关文章推荐
- 自动生成XIP映像文件的一种方法
- ui_*.h文件中自动生成的界面类的使用方法
- 哪些年遇到过的Andriod问题(9)R.java文件不能自动生成解决方法
- intellij自动生成java代码注释(java文件注释和方法注释)
- WinCE 应用程序开机自动运行的又一种方法
- Eclipse中Android项目R.java文件不会自动生成的一种情况的解决方式
- WinCE 应用程序开机自动运行的一种方法
- 关于自动编译iOS工程,生成app及ipa文件的方法-备
- 解决Eclipse项目有红感叹号的方法以及clean完没有自动生成R文件的方法
- WinCE中显示32位色BMP文件的一种方法
- Myeclipse 自动生成可持久化类的映射文件的方法
- WinCE 应用程序开机自动运行的又一种方法[转]
- (jfinal)数据库添加内容后,自动生成model下的Java文件方法
- WinCE 应用程序开机自动运行的又一种方法
- qmake使用方法(自动生成Makefile文件)
- WinCE 应用程序开机自动运行的又一种方法
- 减小VS2012生成的exe的文件大小的一种方法
- qmake使用方法(自动生成Makefile文件)
- 做机械臂导航遇到的问题1:solidworks在生成urdf文件时崩溃的一种解决方法
- VS+QT混合编程中 自动生成Qt的moc文件的方法