wince自动生成XIP映像文件的一种方法
来源:互联网 发布:平板产品展示软件 编辑:程序博客网 时间:2024/05/17 08:19
在WINCE做MULTIBIN+XIP方式的启动映像文件时,往往需要分两步走:第一步、生成映像文件;第二步、修改ce.bib然后再romimage一次,以前的做法是手动修改极不方便,后来在网上找到了一些办法并整合到一起就能够做到一步到位。
1、做一个批处理放在BSP的Files/premake目录下供PB调用,文件内容如下:
- 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脚本的内容如下:
- '
- ' 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
- wince自动生成XIP映像文件的一种方法
- 自动生成XIP映像文件的一种方法
- WINCE XIP实现方法
- WINCE XIP实现方法
- WinCE 应用程序开机自动运行的又一种方法
- WinCE 应用程序开机自动运行的又一种方法
- WinCE 应用程序开机自动运行的又一种方法
- WinCE 应用程序开机自动运行的又一种方法[转]
- WinCE 应用程序开机自动运行的又一种方法[zz]
- WinCE 应用程序开机自动运行的又一种方法
- WinCE 应用程序开机自动运行的又一种方法
- WinCE 应用程序开机自动运行的又一种方法
- WinCE 应用程序开机自动运行的又一种方法
- WinCE 应用程序开机自动运行的又一种方法
- WinCE 应用程序开机自动运行的一种方法
- WinCE 应用程序开机自动运行的又一种方法
- WinCE 应用程序开机自动运行的又一种方法
- WinCE 应用程序开机自动运行的又一种方法
- 开始写博客
- android 零散笔记不定期更新 v17
- Android layout layout_weight属性理解
- dojo.xhrPut
- telnet 实现HTTP协议
- wince自动生成XIP映像文件的一种方法
- Eclipse 下 swt designer安装方法
- servlet学习笔记
- CE6下兼容和非兼容位图的深入分析
- Jinja2 简明使用手册(转载)
- installShield for VC6.0生成一个EXE安装包
- WINCE UI显示优化经验:使用GetUpdateRect和GetClipBox的体会
- Antlr中嵌入代码 Action
- OpenGL Overview