欢迎Hermes爱好者s署名转载本文,转载请遵循署名-非商业性使用-相同方式共享 2.5协议,注明出自http://www.thinkagain.cn 

You can copy, distribute this article, but dont forget to point a link to my site:http://www.thinkagain.cn

English user please scrolls down for english explanation.
=====================================================

授之以之: 

系列4. 制作OEM包(OEM Package)Part1

OEM Package是ROM模板的关键部分,通过选择不同的OEM Package可以使我们定制出不同的ROM。系列4准备分3类介绍如何制作OEM Package:

1. 如何将软件的cab安装包制成OEM Package 

2. 如何制作绿色软件的OEM Package 

3. 如何制作注册表修改的OEM Package

  

因为内容比较多,所以决定分成2个Parts来介绍。Part1,介绍如何将Cab安装包转换成OEM包(Package)。Part2,介绍如何制作绿色软件的OEM Package和注册表修改的OEM Package,如何将系统自带的软件提取并制成可选择的OEM Package。

一个完整的软件的OEM Package里面应包括如下内容:

1. 软件自身所需文件 

2. 快捷方式(非必要,视软件而定)

3. dsm文件(不可缺)

4. rgu(注册表文件)(非必要,视软件而定) 

5. initflashfiles.txt,主要用于指定刷机文件的存放位置)(非必要,视软件而定)

6. option.xml,用于系统加载该OEM Package以及显示相关内容(不可缺)

  

下面我们以PHM Registry Editor V0.70为例,来介绍如何将该软件的cab安装包regedit.Mrln_ARM.CAB转换成OEM Package。PHM Registry Editor是个免费的PPC注册表编辑软件,你可以其官方网页查看软件介绍,以及下载该软件的Cab安装包(选PocktPC2002,2003(ARM/PXA))。

在将Cab转换成OEM之前,你必须做如下准备:

1. 获取GUID(UUID)码 

2. 解压Cab包的软件。

 

先谈GUID(或称UUID),GUID是Globally Unique IDentifier的缩写,中译全球唯一标识符,每个OEM Package都有一串唯一的GUID号码用于系统识别,你可以在此网站http://www.famkruithof.net/uuid/uuidgen来获取所需的GUID码。进入该网站,在“Get”按钮边上选项内选Version1:Time/Node based或者Version4:Random,然后点击“Get”按钮,会自动生成GUID,该网页也可以一次生成多个GUID码。如图1。将该串GUID码(2e7230bd-1d2e-4c59-8643-85fee5d5f86b)记下 

guid code

Fig.1 GUID码

  

再说说解压Cab包的软件。Ocp Software公司出品的WinceManagerCabWUZ均可以用于解压Cab包,WinceManager的试用版只能试用30次,且不能导出注册表文件。CabWUZ的试用版可以使用30天,同样无法导出注册表文件。

下面开始以CabWUZ为解压软件,regedit.Mrln_ARM.CAB为例介绍如何将Cab安装包转换成OEM Package。

1. 下载regedit.Mrln_ARM.CAB后,用CabWUZ打开。如图2。左边从上到下有Files,Shortcuts和Registry。Files里面包括PHM Registry Editor V0.70软件的自带文件,我们等会儿要将这些文件全部导出。Shortcuts是快捷方式,不必管它。Registry里面是软件运行所需的注册表。右边是该cab文件的属性。 

将软件Cab安装包转换成OEM Package

Fig.2 CabWUZ主界面

  

2. 点击左边的Files签名的”+”,将该目录展开,可以看见里面共有9个文件。见图3。右边窗口内显示的是这9个文件的属性。注意第三栏的Location,指的是该文件的存放位置,请注意,除了regedit.exe的存放位置为%InstallDir%外,其余8个文件的存放位置都是%Windows%。

将软件Cab安装包转换成OEM Package

Fig.3 文件存放位置 

 

3. 点击左边窗口的Files,然后点击工具栏上面的Extract按钮,将Files下面所有9个文件都导出。如图4,将文件导出到桌面/PHM Registry Editor/目录下。点击OK,将文件导出,提示图5。

将软件Cab安装包转换成OEM Package

Fig.4 选择导出文件的存放目录

 

将软件Cab安装包转换成OEM Package

Fig.5. 文件导出完毕

 

4. 打开PHM Registry Editor目录,里面有2个文件夹,分别为[INSTALLDIR]和Windows。如图6。 

将软件Cab安装包转换成OEM Package

Fig.6 PHM Registry Editor文件夹内容

  

打开Windows目录,里面有8个文件,也就是Cab包里面的那些存放位置为%Windows%的文件。见图7。

将软件Cab安装包转换成OEM Package

Fig.7 Windows目录内容 

 

[INSTALLDIR]里面只包括regedit.exe一个文件。如图8。所以cabWUZ是根据cab包里面的文件存放位置信息解压文件的。

将软件Cab安装包转换成OEM Package

Fig.8 [INSTALLDIR]目录内容

 

5. 将2个目录下的9个文件全部复制到PHM Registry Editor目录后,可将这2个目录删除。如图9。 

将软件Cab安装包转换成OEM Package

Fig.9 将[INSTALLDIR]和Windows目录下文件复制到PHM Registry Editor下

  

6. 新建2个txt文件。将一个文件重新命名为2e7230bd-1d2e-4c59-8643-85fee5d5f86b.dsm,另一个txt文件重命名为2e7230bd-1d2e-4c59-8643-85fee5d5f86b.rgu。也就是GUID号码.dsm和.rgu,如图10。切记一定要将扩展名改为dsm和rgu

将软件Cab安装包转换成OEM Package

Fig.10 建立dsm和rgu文件 

 

7. 用记事本或其它文本编辑软件打开rgu文件,然后点击另存为,将其存为Unicode格式文件。这点很重要,否则在BuildOS执行时会出错。如图11。

将软件Cab安装包转换成OEM Package

Fig.11 将rgu文件存为Unicode格式

 

8. 编辑rgu文件 

再回到cabWUZ,用cabWUZ打开regedit.Mrln_ARM.CAB,在左窗口的下部是Registry,点击Registry,右边的窗口会显示”Entries 20″,如图12,说明有20个注册表表项信息。分别点击各个”+”将注册表全部展开。如图13。因为cabWUZ或WinceManager试用版都无法支持导出注册表文件。所以只好手动编制rgu中的注册表信息了。如果你有WinceManager正式版(PS自己百度一下),那么可以很容易通过”Export to reg”(导出reg)功能,直接将注册表信息导出。

将软件Cab安装包转换成OEM Package

Fig.12 注册表表项数目 

 

将软件Cab安装包转换成OEM Package

Fig.13 注册表信息 

 

如图13中,HKEY_CLASSES_ROOT\.rbk键下的表项为:

Name: Default 

Type: REG_SZ

Data:RegBackup

  

应该写为:

[HKEY_CLASSES_ROOT\.rbk]
@=”RegBackup”

  

Default可以用@表示。REG_SZ表示这是个字符串值。如图14。将原注册表中%InstallDIR%(安装目录)替换成\\Windows\\。

 

将软件Cab安装包转换成OEM Package

Fig.14 rgu文件

还有很重要的一点就是,rgu文件最后必须空一行,否则BuildOS运行也会出错。如图15。总结一下,制作rgu文件特别注意4点:

1. 文件必须保存为Unicode格式 

2. 文件第一行必须是:REGEDIT4

3. 文件最后必须空一行

4. 注册表中的单斜杠”\”,必须写成双斜杠:”\\” 

 

将软件Cab安装包转换成OEM Package

Fig.15 rgu文件的最后必须空一行 

 

9. 编制快捷方式

从Files里面可以看出,regedit.exe是个可执行文件。所以我们要为它建立一个快捷方式,并将它放置在程序里面,使之可以方便被调用。因为所有OEM Package的文件都会被放置在Windows目录下。所以regedit.exe的路径就是:\Windows\regedit.exe。 

在PHM Registry Editor目录下,新建一个txt文件,然后用记事本打开,输入:

#”\Windows\regedit.exe”

  

如图16,

将软件Cab安装包转换成OEM Package

Fig.16 建立快捷方式 

 

存盘退出,将该txt文件重命名为:PHM RegEdit.lnk。如图17。

将软件Cab安装包转换成OEM Package

Fig.17 将txt文件更名为*.lnk(快捷方式)

 

10. 编辑initflashfiles.txt 

在PHM Registry Editor目录下,新建一个txt,然后重命名为initflashfiles.txt。用记事本打开。输入以下内容:

; Start PHM RegEdit
;===========================================
Directory(“\Windows\Start Menu\Programs”):-File(“PHM RegEdit.lnk”,“\Windows\PHM RegEdit.lnk”)
;===========================================
; End PHM RegEdit

  

这段代码的意思是将Windows目录下的PHM RegEdit.lnk复制到\Windows\Start Menu\Programs目录(开始菜单里面的程序)下。

红色,是这个快捷方式(蓝色部分)将要被放置的目录(\Windows\Start Menu\Programs),绿色是这个快捷方式的显示名称,其中括号前面的-File指的是这是个文件。蓝色是这个快捷方式的位置。如图18。同样也请将initflashfiles.txt保存为unicode格式。

将软件Cab安装包转换成OEM Package

Fig.18 initflashfiles.txt文件内容

 

11. 编制option.xml 

BuildOS.exe是通过option.xml来加载OEM Package,如果该OEM Package没有option.xml,则该OEM Package将不会被加载。同样,新建一个txt,然后将其重命名为option.xml,用记事本打开,输入如下内容:

<?xml version=”1.0″ encoding=”UTF-16″ standalone=”yes”?>
<Items>
<Item name=”PHM Registry Editor” group=”Applications – 应用程序” checked=”true”>
<Tip>注册表编辑软件</Tip>
  <Guid type=”p”>2e72e0bd-1d2e-4c59-8643-85fee5d5f86b</Guid>
  </Item>
</Items>

其中,<?xml version=”1.0″ encoding=”UTF-16″ standalone=”yes”?>是固定的,所有内容被嵌套在<Items></Items>里面。如果你对xml有所了解,将很容易理解这种节点嵌套结构。<Item name>就是该Package的名字,将显示在BuildOS的option框里面,group是指该Package属于那个群组的,你可以通过给不同Package设定同样的group,使之成为一组,如将所有应用程序归为同一组等。checked有2个值,true和false,true指默认该Package是被选中的,反之则默认为非选状态。<Tip>的内容,是指在BuidOS中,你将鼠标移至该Package上,将会显示的提示信息。<Guid>就是该OEM Package的GUID码,type为p。 

将软件Cab安装包转换成OEM Package   

Fig.19 Option.xml内容

  

11. 至此,PHM Registry Editor的OEM Package已经全部建好。如图20,除了软件本身的9个软件外,加上dsm,rgu,initflashfile和shortcut以及option.xml,总共14个文件。顺便提一下,dsm和option.xml是一定要有的。如果软件本身不带注册表信息,如绿色软件,可以不用建rgu文件。同样快捷方式和iniflashfiles都是可选项。

 

将软件Cab安装包转换成OEM Package

Fig.20 PHM Registry Editor OEM Package内容

 

12. 将PHM Registry Editor文件夹复制到My_ROM_Kitchen\OEM\目录下。如图21。 

将软件Cab安装包转换成OEM Package

Fig.21 复制到OEM目录下

  

13. 回到My_ROM_Kitchen目录下,试运行下BuildOS.exe,如果一切正常的话,PHM Registry Editor已经被BuildOS.exe正确加载了。鼠标悬停在该Package上,显示“注册表编辑软件”。如图22。

将软件Cab安装包转换成OEM Package

Fig.22 运行BuildOS.exe 

 

系列4 Part1,结束。谢谢你坚持看到底,呵呵!:-)

仓促之际,难免出错。DO IT YOURSELF! 

 

软件下载,Tools download

PHM Registry Editor V0.70 

http://www.phm.lu/Products/PocketPC/RegEdit/

CabWUZ http://www.ocpsoftware.com/downloads/cabwuz/CabWUZ_Setup.exe

OR WinceManager 

WinCE CAB Manager 2.1Self-Extracting ExecutableDownload size- 5.3 MB

 

================English explanation=============== 

 

Lesson 4. Make OEM Package. Part2

Building OEM package is the most important thing in making ROM kitchen. We can customize various ROM by choosing different OEM packages. Lesson4 will introduce how to make OEM package, and will includes the following contents:

1. How to make cab to OEM Package. 

2. How to make OEM Package of software which can run without registry. 

3. How to make OEM Package of registy modification.

  

It will divided into 2 parts. Par1 introduces how to make OEM package from Cab. Part2 will introduce how to make OEM package of software which does not need registry and OEM package of registry modification, how to make default system software as selectable OEM package.

A full OEM package contains:

1. Software files 

2. shortcut(Not indispensable, depend on software)

3. dsm file(Necessary)

4. rgu(registry file)(Not indispensable, depend on software) 

5. initflashfiles.txt, used to specify the location of rom file(Not indispensable, depend on software)

6. option.xml, used to load package(Necessary)

  

I would like to use PHM Registry Editor v0.70 as an instance to guide how to change cab to OEM package. PHM Registry Editor is a free PPC registry editor software, you can login its official site for more details and download its cab(Choose PocktPC2002,2003(ARM/PXA)).

Preparations:

1. Obtain GUID(UUID) for OEM Package 

2. Software to extract cab

 

Every OEM package has a only GUID(Globally Unique IDentifier). The GUID or UUID is used to identify OEM Package in system. You can get the GUID from http://www.famkruithof.net/uuid/uuidgen. See Fig.1. Select version1:Time/Node or version4:random in the choose box beside “Get” button, then press “Get”, the site will randomize a GUID. It also can randomize multiple GUID one time. Please note the GUID(2e7230bd-1d2e-4c59-8643-85fee5d5f86b). 

WinceManager or CabWUZ from Ocp Software are commonly used to extract files from cab. However, the demo version of wincemanager can only use 30 times, the one of CabWUZ can use for 30 days, both of them can not export registry.

In this instance, I use cabWUZ to extract regedit.Mrln_ARM.CAB and change it to OEM package.

1. Download regedit.Mrln_ARM.CAB, and open it by cabWUZ. As shown in Fig.2. In the left side, there are Files, shortcuts and Registry. Files include all the software files. Shortcuts is the shortcut, dont care it. Registry include the registry contents that are necessary to run PHM Registry Editor. 

2. Click the “+” of Files in left side to expand the directory. There are 9 files in it. See Fig.3. The attributes of files are shown in right side. The third column is location which indicates the save place of file. Only the location of regedit.exe is %InstallDIR%, while other one’s are all %Windows%.

3. Click Files in left side, then click the “Extract” button on toolbar to extract the 9 files under Files directory. See Fig.4, the files will be extracted into Desktop/PHM Registry Editor/. Click OK, extract files. Fig5. will pop out.

4. Open PHM Registry Editor folder, there are 2 sub folders in it. They are [INSTALLDIR] and Windows. See Fig.6. 

Open Windows directory, there 8 files whose the location attributes are “Windows” in cab property. See Fig.7.

[INSTALLDIR] only contains regedit.exe. See Fig.8. So we know, cabWUZ extract files based on the location information of files in cab.

5. Copy all the 9 files under 2 directory to PHM Registry Editor, delete these 2 folders. See Fig.9. 

6. Newly create 2 txt files. Rename one of them to 2e7230bd-1d2e-4c59-8643-85fee5d5f86b.dsm, and rename another one to 2e7230bd-1d2e-4c59-8643-85fee5d5f86b.rgu. i.e. GUID.dsm and GUID.rgu. See Fig.10. Be sure the extension name is changed to dsm and rgu.

7. Use notepad or other txt editor to open rgu file, and save it as Unicode file. This is very important, otherwise error will happen when BuildOS executes. See Fig.11.

8. Edit rgu file 

Back to cabWUZ, click the Registry in the left side, “Entries 20″ is displayed in right side. See Fig.12. This means there are 20 registry entries in it. Click all the “+” to expand the registy directory. Because the demo version of cabWUZ or wincemanager can not export registry, we have to add registry entries to rgu manually one by one. If you have wincemanager full version already, it is very easily to export registy to reg file by using “export to reg” function.

In Fig13. the entry under HKEY_CLASSES_ROOT\.rbk is

Name: Default 

Type: REG_SZ

Data:RegBackup

  

it should be written as the following in rgu file.

[HKEY_CLASSES_ROOT\.rbk]
@=”RegBackup”

  

@ stands for Default, REG_SZ indicates that it is a string value. See Fig.14. The end of rgu file must be a blank line, otherwise error will happend. See Fig.15.In a word, the following must be cared while you edit rgu file:

1. File must be saved as Unicode.

2. File must start with REGEDIT4 in first line. 

3. File must end in a blank line.

4. Slash “\” in registry must be written as “\\” in rgu file

  

9. Edit shortcut

Regedit.exe is an executable file, therefore we need to make a shortcut for it. Because of all the files of OEM Package will be placed in Windows directory, so the path of regedit.exe is:\Windows\regedit.exe.

Create a txt file under PHM Registry Editor, open it by Notepad, input: 

#”\Windows\regedit.exe”

 

See Fig.16. Save and exit, rename it to PHM RegEdit.lnk, see Fig.17. Save it as unicode file. 

10. Edit initflashfiles.txt

Also create a txt file under PHM Registry Editor, rename it to iniflashfiles.txt. Open it by notepad, and input:

; Start PHM RegEdit 

;===========================================

Directory(“\Windows\Start Menu\Programs”):-File(“PHM RegEdit.lnk”,“\Windows\PHM RegEdit.lnk”)

;=========================================== 

; End PHM RegEdit

 

These codes means copy the PHM RegEdit.lnk under \Windows to \Windows\Start Menu\Programs. Red is where the link will be placed, green is the display name of the link. Blue is the link which needs to be copied. See Fig.18. 

11. Edit option.xml

OEM package is loaded when  BuildOS executes by using option.xml. If OEM package does not have option.xml, then it will not be loaded. Create a txt file, rename it to option.xml, open it by notepad, add the following:

<?xml version=”1.0″ encoding=”UTF-16″ standalone=”yes”?>
<Items>
<Item name=”PHM Registry Editor” group=”Applications – 应用程序” checked=”true”>
<Tip>注册表编辑软件</Tip>
  <Guid type=”p”>2e72e0bd-1d2e-4c59-8643-85fee5d5f86b</Guid>
  </Item>
</Items> 

 

<?xml version=”1.0″ encoding=”UTF-16″ standalone=”yes”?> is fixed, all contents are embeded in <Items></Items>. If you are familiar with xml, it is very simply to understand it. <Item name> is the name of package, it will display in the option of BuildOS. Group indicates which group this package is in. You can arrange different application to one group by assign the same group name to them. Checked has 2 options, true or false. True means the package is chose, otherwise is unchose. The content of <Tip> is the one will be displayed when mouse hovers this package. <Guid> is the guid code of package, and its type is p.

11. Up to now, you have built the OEM Package of PHM Registry Editor. See Fig.20. Total 14 files. 

12. Copy PHM Registy Editor to My_ROM_Kitchen\OEM\, see Fig.21.

13. Run BuildOS.exe in My_ROM_Kitchen. See 22. PHM Registry Editor is a chosed OEM package. When mouse hovers it, the tip is “注册表编辑软件”.

OK, it is the end of Part1 of Lesson 4. 

Feed Me


转载文章请注明转载自:ThinkAgain - Let's Blog!

引用地址:http://www.thinkagain.cn/archives/412.html