Manual Clone of Public Code
来源:互联网 发布:海湾200主机编程 编辑:程序博客网 时间:2024/06/06 02:40
If sysgen_capture doesn't work for some reason you can always manually clone the component you want to modify. By following the instructions on the blog post "Cloning Public Code: An Example" you should be able to get this working, but to help you a bit more here are some step by step instructions for manually cloning public code.
In this blogpost we'll be cloning TELNETD because for some reason sysgen_capture doesn't work for this component. TELNETD is located under the WINCE project tree "servers". I know the exact name of the WINCEPROJ by opening up the makefile in /PUBLIC/SERVERS/CESYSGEN and searching for WINCEPROJ. The correct sysgen_capture command for TELNETD would be:
sysgen_capture -p servers telnetd
The -p parameter indicates the WINCEPROJ, so in this case it's of course not "common", but "servers". Unfortunately for some reason this command doesn't output a sources.telnetd file (in fact it doesn't output any file!). No stress, let's just clone manually:
- Copy the TELNETD folder to your OS Design (
/WINCE500/PBWorkspaces/<MyOSDesign>/TELNETD
or/WINCE600/OSDesigns/<MyOSDesign>/<MyOSDesign>/TELNETD
) - Open the
sources.
file in the folder you just copied - Set
TARGETTYPE
toDYNLINK
- Set
RELEASETYPE
toLOCAL
- Delete
WINCETARGETFILE0=$(_RELEASELIBDIR)/$(TARGETDEFNAME).def
- Open the
makefile.
in<WINCEROOT>/PUBLIC/SERVERS/CESYSGEN
and search fortelnetd
- Copy the line
@set TARGETLIBS...
and@set DLLENTRY...
- Paste into your
sources.
file - Change
@set TARGETLIBS...
in yoursources.
file to:TARGETLIBS=$(_PROJECTROOT)/cesysgen/sdk/lib/$(_CPUINDPATH)/ws2.lib /
$(_PROJECTROOT)/cesysgen/sdk/lib/$(_CPUINDPATH)/coredll.lib /
$(_PROJECTROOT)/cesysgen/sdk/lib/$(_CPUINDPATH)/ceosutil.lib /
$(_PROJECTROOT)/cesysgen/sdk/lib/$(_CPUINDPATH)/authhlp.lib - Change
@set DLLENTRY...
in yoursources.
file to:DLLENTRY=DllEntry - Add the include paths:NOTE: DO NOT PUT SPACES BETWEEN THE PATHS! I know it is confusing because I do it above, but I have to to support line breaking (otherwise this page will look ugly...)._OEMINCPATH=$(_WINCEROOT)/public/common/oak/inc; $(_WINCEROOT)/public/common/sdk/inc; $(_WINCEROOT)/public/common/ddk/inc
- And build...
Easy as that! Now that you have the TELNETD component successfully cloned you can continue following the instructions from step 7 in the blog post "Cloning Public Code: An Example" (of course replacing "netui" with "telnetd" in the text).
Here's the complete sources.
file for reference (don't forget to delete the spaces in the _ISVINCPATH, _OEMINCPATH and INCLUDES macros! I need those spaces here to format the HTML nicely, but you will get compiler error "/I" requires an argument if you leave those spaces):
_OEMINCPATH=$(_WINCEROOT)/public/common/oak/inc; $(_WINCEROOT)/public/common/sdk/inc; $(_WINCEROOT)/public/common/ddk/inc
TARGETNAME=telnetd
TARGETTYPE=DYNLINK
RELEASETYPE=LOCAL
TARGETDEFNAME=$(TARGETNAME)
DEFFILE=$(TARGETNAME).def
CDEFINES=$(CDEFINES) -DwinCE
DLLENTRY=DllEntry
SOURCES=telnetd.cpp telndev.cpp consemu.cpp
TARGETLIBS=$(_PROJECTROOT)/cesysgen/sdk/lib/$(_CPUINDPATH)/ws2.lib /
$(_PROJECTROOT)/cesysgen/sdk/lib/$(_CPUINDPATH)/coredll.lib /
$(_PROJECTROOT)/cesysgen/sdk/lib/$(_CPUINDPATH)/ceosutil.lib /
$(_PROJECTROOT)/cesysgen/sdk/lib/$(_CPUINDPATH)/authhlp.lib
- Michel's blog
- Add new comment
Cloning public code: An example
For some strange reason, people are still changing public code and doing build and sysgen's on their Windows CE tree (read this to learn why this is a bad thing). Changing code in the PUBLIC and PRIVATE trees might seem like a shortcut but actually it is everything but a shortcut. When you clone the code before changing it in place you will save yourself hours and hours of build time. A targeted build of a cloned driver takes seconds, a clean build and sysgen takes hours.
Cloning is not difficult at all, so there is really no reason to change PUBLIC or PRIVATE code. To prove that it is not difficult (once you know what you are doing) I will show you how to clone PUBLIC code in this blog post. Note that there is an article by Steve Maillet and Mike Hall in MSDN about cloning public code too. They split the clone into a "LIB" part and a "DLL" part. I don't really like that method; I just merge the sources file into one that creates the DLL in one go. Have a look at the "split" method here.
I chose to clone NETUI, since this component is responsible for a lot of dialog boxes that you may want to change to match your systems specifications.
I am cloning NETUI on a Windows CE 6.0 tree, but it works exactly the same on a Windows CE 5.0 tree (apart from the OSDesign folder which is called PBWorkspaces in CE 5.0).
Prerequisites: A sysgenned OSDesign with the "Network UI" component included.
Let's start!
- Copy the entire
/WINCE600/PUBLIC/COMMON/OAK/DRIVERS/NETUI
folder to your OSDesign, for instance/WINCE600/OSDesigns/MyOS/MyOS
- Open a build window (in Platform Builder / VS2005 click "Open Release Directory in Build Window" from the menu "Build"
- In the build window, type:cd..
cd..
cd netui - Now type:This command will output a set of files in the current directory.sysgen_capture -p common netui
- Since we only want to build netui, you can delete:sources.btdrt
sources.ceddk
sources.iphlpapi
sources.k.iphlpapi
sources.ws2
sources.ws2k - Now intelligently merge
sources.
withsources.netui
(we make the changes in thesources.
file):- Make a backup of the
sources.
file (copy tosources.org
) so you can always go back if needed - We are trying to build a DLL, so change
TARGETTYPE=LIBRARY
toTARGETTYPE=DYNLINK
- We are building NETUI as a project in our workspace, so set the
RELEASETYPE
toLOCAL
(RELEASETYPE=LOCAL
) - We are not building a LIB anymore, so there's no need to preprocess the def file. Remove the following lines:WINCETARGETFILE0=$(_RELEASELIBDIR)/$(TARGETDEFNAME).def
PREPROCESSDEFFILE=1And add this line to tell the build system to use the local def file for the exports:
DEFFILE=$(TARGETDEFNAME).def - We don't need the resource file later (because we are not creating a lib that has to be transformed into a dll later), so remove the
COPYRES=1
line and theWINCETARGETFILES
line pointing to the res. - OSDesign SubProjects get build last, so we don't need to copy
SYNCHRONIZE_DRAIN=1
fromsources.netui
to oursources.
file - Since we are now building a DLL, copy the
DLLENTRY
line fromsources.netui
tosources.
- Now move the entire
SOURCELIBS
andTARGETLIBS
fromsources.netui
tosources.
- and delete any references to netui (
netui.lib/netui.res
) itself (because we are building that now) - Change the paths to the target libraries from using the PUBLIC sysgened libraries to the libraries sysgened to your workspace, so change
$(_SYSGENSDKROOT)/
to$(_PROJECTROOT)/cesysgen/sdk/
and$(_SYSGENOAKROOT)/
to$(_PROJECTROOT)/cesysgen/oak/
- You can also delete the
#xref
lines, they are remains of older days (CE 2.11 era). - Now try to build (by typing "
build
" in the build window you still have open) - oops! Doesn't build. It can't find the standard include files... Add the following to the top of the sources file:NOTE: DO NOT PUT SPACES BETWEEN THE PATHS! I know it is confusing because I do it above, but I have to to support line breaking (otherwise this page will look ugly...)._ISVINCPATH=$(_WINCEROOT)/public/common/sdk/inc;
_OEMINCPATH=$(_WINCEROOT)/public/common/ddk/inc; $(_WINCEROOT)/public/common/oak/inc; $(_WINCEROOT)/public/common/sdk/inc; - And since this project is building OEM code (a kernel component) set
WINCEOEM=1
to indicate we want to use the _OEMINCPATH (so if you really want to you can delete the_ISVINCPATH
since we don't use that one). - Try to build again:BUILD: [01:0000000048:ERRORE] /WINCE600/OSDesigns/MyOS/MyOS/NETUI/./btmgmtui.cpp(39) : fatal error C1083: Cannot open include file: '../bluetooth/sample/btenum/btenum.hxx': No such file or directory
So, one of the sources files is trying to include a header on a relative path. Since NETUI came from/WINCE600/PUBLIC/COMMON/OAK/DRIVERS/NETUI
this path must be/WINCE600/PUBLIC/COMMON/OAK/DRIVERS/BLUETOOTH
Now there are 3 ways to solving this: Either add the
/WINCE600/PUBLIC/COMMON/OAK/DRIVERS/NETUI
folder to the include path (addINCLUDES=$(INCLUDES);/WINCE600/PUBLIC/COMMON/OAK/DRIVERS/NETUI
) so that the header file can be found off the relative path, or change the source file including the header to use a full path to the header file, or copy thebtenum.hxx
file into the NETUI folder and change the source file including the header to use the local header file. I think the last option is the cleanest, so let's copy/WINCE600/PUBLIC/COMMON/OAK/DRIVERS/BLUETOOTH/SAMPLE/BTENUM/btenum.hxx
to/WINCE600/OSDesigns/MyOS/MyOS/NETUI/btenum.hxx
and changebtmgmtui.cpp
to#include "btenum.hxx"
- Build again:
0 Warnings, 0 Errors.
Whuuhooo! - Now there is one final thing we have to add to the NETUI
sources.
file. We have to tell the build system we want to copy the final binary to the_FLATRELEASEDIR
so ournetui.dll
will overwrite the default one from thePUBLIC/COMMON folder
. AddWINCEREL=1
to the top of thesources.
file.
- Make a backup of the
- Now add the NETUI project to your workspace. In the Platform Builder VS IDE click "Add Existing Subproject..." from the "Project" menu. Browse to the
/WINCE600/OSDesigns/MyOS/MyOS/NETUI
folder, select "Sources/Dirs Files" from the "Files of type" dropdown list, select thesources.
file, and click "Open" - In the Solution Explorer window you can now find your NETUI component under the "SubProjects" node. Right click NETUI and click "Rebuild" to see if you can build the project from the IDE. It should all build fine.
- If all builds fine, you can delete the
sources.netui
and thesources.org
files since you no longer need them now. - The "Insert existing project" action created a couple of files for you. One of those files is a bib file. BIB files are used to indicate which files need to be included in the image. Since we cloned NETUI, but did not remove it from the OSDesign features, we now have 2 references to NETUI in the combined BIB files (one is in
COMMON.BIB
and the other in our newly generatedNETUI.BIB
). We don't need an extra reference in the BIB files, all we want is overwrite the defaultNETUI.DLL
in the_FLATRELEASEDIR
, so you can remove this reference from the newly generatedNETUI.bib
.
Now you can change whatever you need to change in NETUI without worrying about messing up the PUBLIC
portion of the WINCE tree or having to do a "Clean Build and Sysgen".
If you have followed all the steps above your final NETUI sources.
file should look like this (except the spaces in the _ISVINCPATH, _OEMINCPATH and INCLUDES macros!):
_OEMINCPATH=$(_WINCEROOT)/public/common/ddk/inc; $(_WINCEROOT)/public/common/oak/inc; $(_WINCEROOT)/public/common/sdk/inc;
WINCEOEM=1
WINCEREL=1
TARGETNAME=netui
TARGETTYPE=DYNLINK
RELEASETYPE=LOCAL
TARGETDEFNAME=$(TARGETNAME)
DEFFILE=$(TARGETDEFNAME).def
DLLENTRY=_DllEntryCRTStartup
CONDITIONAL_INCLUDES=prshtp.h
SOURCELIBS=
TARGETLIBS=/
$(_PUBLICROOT)/common/oak/lib/$(_CPUINDPATH)/btenum.lib /
$(_PROJECTROOT)/cesysgen/sdk/lib/$(_CPUINDPATH)/iphlpapi.lib /
$(_PROJECTROOT)/cesysgen/oak/lib/$(_CPUINDPATH)/btdrt.lib /
$(_PROJECTROOT)/cesysgen/sdk/lib/$(_CPUINDPATH)/ws2.lib /
$(_PROJECTROOT)/cesysgen/oak/lib/$(_CPUINDPATH)/ceddk.lib /
$(_PROJECTROOT)/cesysgen/sdk/lib/$(_CPUINDPATH)/coredll.lib
SOURCES= /
netui.c /
getip.c /
ipaddr.c /
getuser.c /
linecnfg.c /
wnet.c /
netcard.c /
certui.cpp /
showcert.cpp /
eaptlscfg.cpp /
network.c /
transdlg.c /
reg.c /
util.c /
wzcui.c /
wzcprops.c /
btmgmtui.cpp /
WzcQuickCfgUi.c /
IpQuickCfgUi.c /
QuickConfigUi.c /
WzcLogging.c /
WzcPopup.c /
netui.rc /
wnet_wrapper.cpp /
netui_wrapper.cpp /
getuser_wrapper.cpp /
gwes_wrapper.cpp /
getip_wrapper.cpp /
linecnfg_wrapper.cpp /
transdlg_wrapper.cpp /
network_wrapper.cpp /
netcard_wrapper.cpp
FILE_VIEW_PARAMETER_FOLDER= /
NETUI.bib /
NETUI.reg /
NETUI.dat /
NETUI.db /
ProjSysgen.bat /
FILE_VIEW_ROOT_FOLDER= /
prelink.bat /
postlink.bat /
PRELINK_PASS_CMD=prelink.bat
POSTLINK_PASS_CMD=postlink.bat
- Manual Clone of Public Code
- public code
- Database of Public Bus Service Simulator(Source Code)
- 4 reasons developers are scared of making their code public
- CODE 130: Clone Graph
- clone-graph Java code
- DL Code Editor user manual
- Code Clone and possible solution
- CSDN CODE git clone **.git
- Public availability of PSSCOR2
- Cloning public code: An example
- XCode 4: Manual downloading of Apple documents
- Summary of Manual Memory Management Rules
- A drop of performance testing- manual correlation
- The ability of public speaking
- 解决code.google.com 无法clone代码
- leetcode 日经贴,Cpp code -Clone Graph
- Object中的clone为什么是protected,而不是public?
- What to build when...
- MFC中消息机制
- Longest Increasing Subsequence(LIS)
- 积分?
- 关于C++类库KYLib: 压缩/解压缩类
- Manual Clone of Public Code
- PHP专题相关网站
- Y.L鏶團-江西创始
- 简单的文件分类
- 出学者
- 90后,真的还好
- 奇怪的问题
- 详细介绍ASP.NET状态保存方法
- 软件开发项目风险管理的几点体会