Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5175271
  • 博文数量: 1696
  • 博客积分: 10870
  • 博客等级: 上将
  • 技术积分: 18357
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-30 15:16
文章分类
文章存档

2017年(1)

2016年(1)

2015年(1)

2013年(1)

2012年(43)

2011年(17)

2010年(828)

2009年(568)

2008年(185)

2007年(51)

分类: 嵌入式

2010-09-21 11:38:10

Overview of steps to follow:

  • Compile
  • Create .inf file
  • Build .cab files
  • Create setup.ini
  • Test installation
  • Build neat, distributable setup program
First, compile your program for as many platforms as you like. I've done it for three, so I have an exe in three subdirectories; armrel, mipsrel and sh3rel. I've also got another directory for files which will always get installed; no matter which platform you select.
stickies
|
+----ARMRel
| L stickies.exe
|
+----MIPSRel
| L stickies.exe
|
+----SH3Rel
| L stickies.exe
|
+----common
L welcome.sti
Now you need to create a .inf file which contains all the information about which files go where, shortcuts which need creating, and registry entries which need adding to the PPC device. Mine looks like this:

[Version]
Signature = "$Windows NT$"
Provider = "Zhorn"
CESignature = "$Windows CE$"
 
[CEDevice.SH3]
ProcessorType = 10003 ; SH3
 
[CEDevice.MIPS]
ProcessorType = 4000 ; MIPS
 
[CEDevice.ARM]
ProcessorType = 2577 ; ARM
 
[CEStrings]
AppName = "Stickies"
InstallDir = %CE1%\%AppName%
 
[DefaultInstall]
CopyFiles = Files.Common
AddReg = RegSettings
CEShortcuts = Shortcuts
 
[DefaultInstall.ARM]
CopyFiles = Files.ARM
 
[DefaultInstall.MIPS]
CopyFiles = Files.MIPS
 
[DefaultInstall.SH3]
CopyFiles = Files.SH3
 
[Files.Common]
welcome.sti,,,0x00000010
 
[Files.ARM]
stickies.exe,,,0
 
[Files.MIPS]
stickies.exe,,,0
 
[Files.SH3]
stickies.exe,,,0
 
[RegSettings]
 
[Shortcuts]
%AppName%,0,stickies.exe
 
[SourceDisksNames]
1 = ,"Common files",,C:\stickies\common
 
[SourceDisksNames.ARM]
2 = ,"ARM files",,C:\stickies\armrel
 
[SourceDisksNames.MIPS]
2 = ,"MIPS files",,C:\stickies\mipsrel
 
[SourceDisksNames.SH3]
2 = ,"SH3 files",,C:\stickies\sh3rel
 
[SourceDisksFiles]
welcome.sti = 1
 
[SourceDisksFiles.ARM]
stickies.exe = 2
 
[SourceDisksFiles.MIPS]
stickies.exe = 2
 
[SourceDisksFiles.SH3]
stickies.exe = 2
 
[DestinationDirs]
Files.Common = 0,%CE05%\stickies
Files.ARM = 0,%InstallDir%
Files.MIPS = 0,%InstallDir%
Files.SH3 = 0,%InstallDir%
Shortcuts = 0,%CE11%

There are a number of sources on the MS site () which explain how this works. I'm not going to copy and paste them here, but a couple of things of interest are:

Signature = "$Windows NT$"
CESignature = "$Windows CE$"

at the top, these two lines must stay like this.

welcome.sti,,,0x00000010

means don't install this file if it already exists. This is a data file, and if a user is reinstalling the app, it's just possible they created a data file called this, so we don't want to overwrite it!

The following table explains that %CE11% stuff:

%CE1%	\Program Files				\Program Files
%CE2% \Windows \Windows
%CE4% \Windows\StartUp \Windows\StartUp
%CE5% \My Documents \My Documents
%CE6% Not applicable \Program Files\Accessories
%CE7% Not applicable \Program Files\Communication
%CE8% \Program Files\Games \Program Files\Games
%CE11% \Windows\Start Menu\Programs \Windows\Start Menu\Programs
%CE12% Not applicable \Windows\Start Menu\Programs\Accessories
%CE13% Not applicable \Windows\Start Menu\Programs\Communications
%CE14% \Windows\Start Menu\Programs\Games \Windows\Start Menu\Programs\Games
%CE15% \Windows\Fonts \Windows\Fonts
%CE17% \Windows\Start Menu \Windows\Start Menu

You can see that I'm using c:\stickies as the top level directory that you can see above.

I get the cab files built with the following command line. It will change for you depending on where your cabwiz.exe is located:

"C:\Windows CE Tools\wce300\MS Pocket PC\support\ActiveSync\windows ce application
installation\cabwiz\cabwiz.exe" stickies.inf /dest c:\stickies\output /err
errors.log /cpu ARM SH3 MIPS

Now I get these files in c:\stickies\output:

06/11/2003  22:26                1,421 errors.log
06/11/2003 22:26 25,630 stickies.ARM.CAB
06/11/2003 22:26 275 stickies.ARM.DAT
06/11/2003 22:26 29,214 stickies.MIPS.CAB
06/11/2003 22:26 275 stickies.MIPS.DAT
06/11/2003 22:26 26,142 stickies.SH3.CAB
06/11/2003 22:26 275 stickies.SH3.DAT

The errors.log file contains:

Warning: Section [DestinationDirs] key "Files.Common" is not using the string "%InstallDir%"
Warning: Section [DestinationDirs] key "Files.MIPS" is not a valid file list
Warning: Section [DestinationDirs] key "Files.SH3" is not a valid file list
Warning: Section [DestinationDirs] key "Shortcuts" is not using the string "%InstallDir%"
Warning: Section [RegSettings] has no data
Warning: Section [DefaultInstall] key "AddReg" - there are no section entries to process
Warning: Section [DestinationDirs] key "Files.Common" is not using the string "%InstallDir%"
Warning: Section [DestinationDirs] key "Files.ARM" is not a valid file list
Warning: Section [DestinationDirs] key "Files.MIPS" is not a valid file list
Warning: Section [DestinationDirs] key "Shortcuts" is not using the string "%InstallDir%"
Warning: Section [RegSettings] has no data
Warning: Section [DefaultInstall] key "AddReg" - there are no section entries to process
Warning: Section [DestinationDirs] key "Files.Common" is not using the string "%InstallDir%"
Warning: Section [DestinationDirs] key "Files.ARM" is not a valid file list
Warning: Section [DestinationDirs] key "Files.SH3" is not a valid file list
Warning: Section [DestinationDirs] key "Shortcuts" is not using the string "%InstallDir%"
Warning: Section [RegSettings] has no data
Warning: Section [DefaultInstall] key "AddReg" - there are no section entries to process

Don't worry, as far as I can tell, each run through for each CPU complains about the other CPUs. I don't have any registry settings to add, which explains that, and the "%InstallDir%" entry is just a warning

Now create a setup.ini file in that directory. Mine looks like:

[CEAppManager]
Version = 1.0
Component = Stickies
 
[Stickies]
Description = Stickies
CabFiles = stickies.ARM.CAB,stickies.MIPS.CAB,stickies.SH3.CAB

At this point, you can test your application by pointing the ceAppMgr.exe straight at it:

C:\Program Files\Microsoft ActiveSync\ceappmgr.exe c:\stickies\output\setup.ini

This is all that's required, but you might like to make it a little neater for your users. That's where the freeware comes in. Put this somewhere useful and run:

ezsetup -l english -i setup.ini -r readme.txt -e eula.txt -o ppc_stickies.exe

Run ezsetup /? to get all the command line options, but it requires two text files containing a readme and EULA, and will output a self-executing setup program for all the processors you support to ppc_stickies.exe! Don't be fooled into trying to install the exe you download - it's just a single exe, and the icon for it looks like a setup file, but it's not, that's the actual program you've downloaded.

At this point, I had lots of problems when I ran the built installer. The first problem was that in my setup.ini, I'd set a version number "1.00". It would appear that ceappmgr.exe doesn't like this, and kept on and on complaining "Application Manager cannot install this application on your mobile device due to an invalid setup file. Reinstall and try again", until I changed it to "1.0", and it was okay again.

The second error I ran into was that I've not added the:

[CEDevice.ARM]
ProcessorType = 2577 ; ARM

lines to the inf file, and so the cab files were not set to run on any specific processor. Okay, the names were evident, but the computer doesn't look at the names when it's deciding whether it can install to the attached PPC. I was being told that "Zhorn Stickies does not support the connected device type. Application Manager will make the application available for installation when a supported device type is connected". I discovered that I wasn't setting the processor type (a simple error once you know what the problem is of course) by using a program "WinCE CAB Manager" from . This allows you to edit cab files built above directly, and if you can afford/justify the cost, then it's really useful.

I'm no expert, and this is the only PPC setup I've ever built, but I could have really done with reading this document before I started, which is why I wrote it. Hope it gets you started okay.
阅读(824) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~