[ofw] ib_bus.inf example for synchronization of .inf DriverVer and Build date, file ver & svn version number.

Smith, Stan stan.smith at intel.com
Mon Jun 30 10:07:34 PDT 2008


ofw-bounces at lists.openfabrics.org wrote:
> Thank you for the stampinf example.
> For the following reasons I prefer the tighter coupling of .inf
> stamping during the driver build stage:
> 
> 1) stamping the .inf during the build process makes sure the .sys file
> version and .inf stamp version are the same.
> 2) OPENIB_REV may not be defined during the driver signing process,
> hence the loss of the svn version (4th file version field).
> 3) Microsoft WDK examples do the stampinf during the build process.
> 
> Thanks for the stampinf suggestion as it's always good to consider
> alternatives. 
> 
> Stan.
> 
> 
> Anatoly Greenblatt wrote:
>> Hi Stan,
>> 
>> You can also add the digital signature to building process Here is
>> an example of building batch: 
>> 
>> set DDKPATH=c:\winddk\6001.18001
>> set VERSION=2.0.0.0
>> set BINPATH=c:\winof\bin
>> 
>> pushd .
>> call %DDKPATH%\bin\setenv.bat %DDKPATH% fre wlh popd
>> 
>> for %%i in (%BINPATH%\*.sys) do signtool sign /v /ac
>> MSCV-VSClass3.cer
> 
>> /n "voltaire" /t http://timestamp.verisign.com/scripts/timestamp.dll
>> %%i for %%i in (%BINPATH%\*.inf) do stampinf -f %%i -d * -v %VERSION%
>> inf2cat.exe /driver:%BINPATH% /verbose
>> /os:server2003_x86,server2003_x64,vista_x86,vista_x64
>> for %%i in (%BINPATH%\*.cat) do signtool sign /v /ac
>> MSCV-VSClass3.cer
> 
>> /n "voltaire" /t http://timestamp.verisign.com/scripts/timestamp.dll
>> %%i 
>> 
>> Regards,
>> Anatoly.
>> 
>> -----Original Message-----
>> From: ofw-bounces at lists.openfabrics.org
>> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Stan C. Smith
>> Sent: Wednesday, June 25, 2008 22:39
>> To: ofw at lists.openfabrics.org
>> Subject: [ofw] ib_bus.inf example for synchronization of .inf
>> DriverVer andBuild date, file ver & svn version number.
>> 
>> The following new files and mods enable date & version
>> synchronization
> 
>> between ibbus.sys and ib_buf.inf. The makefile and .inx filename
>> conventions are derrived from the WDK examples.
>> IB_{MAJOR/MINOR}VERSION can be overridden from definitions in the
>> SOURCES file. 
>> 
>>>>>> New File trunk\inc\inf_stamp.inc
>>>>>> .inf file created where .sys file resides.
>>>>>> Common makefile fragment included by makfile.inc
>> 
>> # Transform .inx file to .inf file adding date + major/min & svn.ver
>> stamps # Output .inf place is copied to bin\kernel\... folder (where
>> .sys file resides) 
>> 
>> _LNG=$(LANGUAGE)
>> _INX=.
>> STAMP=stampinf -a $(_BUILDARCH)
>> 
>> !INCLUDE mod_ver.def
>> 
>> ..\..\..\bin\kernel\$(O)\$(INF_NAME).inf : $(_INX)\$(INF_NAME).inx
>>     copy $(_INX)\$(@B).inx $@ $(STAMP) -f $@ -d * -v
>> $(IB_MAJORVERSION).$(IB_MINORVERSION).$(IB_F3VERSION).$(OPENIB_REV)
>> 
>> 
>>>>>> New file trunk\inc\mod_ver.def
>> 
>> # Define Major and Minor numbers for the current module build.
>> # This file is included by openib.def & inf_stamp.inc so as to define
>> # major & minor #'s in a single location.
>> #
>> # Major & Minor definitions can be defined in a local SOURCES file #
>> which overrides these definitions thus providing module local
>> version # definitions. 
>> 
>> !IF !DEFINED(IB_MAJORVERSION)
>> IB_MAJORVERSION=2
>> !ENDIF
>> 
>> !IF !DEFINED(IB_MINORVERSION)
>> IB_MINORVERSION=0
>> !ENDIF
>> 
>> # unused File version Field 3, see inf_stamp.inc !IF
>> !DEFINED(IB_F3VERSION) IB_F3VERSION=0 !ENDIF
>> 
>>>>>> Mods to trunk\inc\openib.def
>> 
>> diff C3 C:/Temp/openib.def-revBASE.svn000.tmp.def
>> C:/openIB-windows/SVN/gen1/trunk/inc/openib.def
>> *** C:/Temp/openib.def-revBASE.svn000.tmp.def	Wed Jun 25
12:14:41
>> 2008 --- C:/openIB-windows/SVN/gen1/trunk/inc/openib.def	Wed Jun
25
>> 10:56:01 2008 
>> ***************
>> *** 1,3 ****
>> --- 1,6 ----
>> + !IF !DEFINED(_OPENIB_DEF_)
>> + _OPENIB_DEF_=1
>> +
>>   !INCLUDE $(NTMAKEENV)\makefile.def
>> 
>>   # Allow overriding the company name.
>> ***************
>> *** 10,22 ****
>>   IB_PRODUCTNAME="""OpenFabrics\x20Windows"""
>>   !ENDIF
>> 
>> - !IF !DEFINED(IB_MAJORVERSION)
>> - IB_MAJORVERSION=1
>> - !endif
>> -
>> - !IF !DEFINED(IB_MINORVERSION)
>> - IB_MINORVERSION=0
>> - !endif
>> 
>>   !IF !DEFINED(IB_FILEBUILD)
>>   IB_FILEBUILD=0
>> --- 13,20 ----
>>   IB_PRODUCTNAME="""OpenFabrics\x20Windows"""
>>   !ENDIF
>> 
>> + # get module versions: major, minor & svn.ver !include mod_ver.def
>> 
>>   !IF !DEFINED(IB_FILEBUILD)
>>   IB_FILEBUILD=0
>> ***************
>> *** 24,31 ****
>> 
>>   !IF !DEFINED(IB_FILEREV)
>>   IB_FILEREV=$(OPENIB_REV)
>> -
>> - !endif
>> 
>>   !IFNDEF VER_PROVIDER
>>   VER_PROVIDER="""OpenIB"""
>> --- 22,28 ----
>> 
>>   !IF !DEFINED(IB_FILEREV)
>>   IB_FILEREV=$(OPENIB_REV)
>> + !ENDIF
>> 
>>   !IFNDEF VER_PROVIDER
>>   VER_PROVIDER="""OpenIB"""
>> ***************
>> *** 37,40 ****
>>       -DVER_FILEMINORVERSION=$(IB_MINORVERSION) \
>>       -DVER_FILEBUILD=$(IB_FILEBUILD) \
>>   	-DVER_FILEREV=$(IB_FILEREV) \
>>   	-DVER_PROVIDER=$(VER_PROVIDER)
>> --- 34,39 ----
>>       -DVER_FILEMINORVERSION=$(IB_MINORVERSION) \
>>       -DVER_FILEBUILD=$(IB_FILEBUILD) \
>>   	-DVER_FILEREV=$(IB_FILEREV) \
>>   	-DVER_PROVIDER=$(VER_PROVIDER)
>> +
>> + !ENDIF
>> 
>> 
>>>>>> New file trunk\core\bus\kernel\makefile.inc
>> 
>> #
>> # This file indirects to the common inf_stamp.inf that is # shared by
>> driver components of the OpenIB Windows project.
>> #
>> 
>> !include ..\..\..\inc\inf_stamp.inc
>> 
>> 
>>>>>> Rename trunk\core\bus\kernel\ib_bus.inf -->
>> trunk\core\bus\kernel\ib_bus.inx
>>>>>> If you need the .inf file without stamping, copy ib_bus.inx -->
>>>>>> ib_bus.inf Microsoft defined the .inx convention.
>> 
>>>>>> Mods to trunk\core\bus\kernel\SOURCES
>> 
>> *** C:/Temp/SOURCES-revBASE.svn000.tmp  Wed Jun 25 12:09:33 2008
>> --- C:/openIB-windows/SVN/gen1/trunk/core/bus/kernel/SOURCES  Fri
>> Jun 20 16:35:19 2008 
>> ***************
>> *** 2,7 ****
>> --- 2,17 ----
>>   TARGETPATH=..\..\..\bin\kernel\obj$(BUILD_ALT_DIR)
>> TARGETTYPE=DRIVER 
>> 
>> + # Transform .inx --> .inf adding date & version stamps #
>> + NTTARGETFILES invokes loginc in wdk\xxx\bin\makefile.new to # +
>> include .\makefile.inc + + !if $(_NT_TOOLS_VERSION) != 0x700
>> + # WDK build only.
>> + INF_NAME=ib_bus
>> + NTTARGETFILES=..\..\..\bin\kernel\$(O)\$(INF_NAME).inf +
>> MISCFILES=$(NTTARGETFILES) + !endif
>> 
>>   !if $(FREEBUILD)
>>   ENABLE_EVENT_TRACING=1
>> 
>> 
>> 
>> _______________________________________________
>> ofw mailing list
>> ofw at lists.openfabrics.org
>> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
>> _______________________________________________
>> ofw mailing list
>> ofw at lists.openfabrics.org
>> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
> 
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw



Hello,

Reuven Amitai wrote:
> Hi Stan,
> 
> In inf_stamp.inc, there is a hidden assumption that the current
> directory of .inx file is 3 levels up from root.
> 
>> ..\..\..\bin\kernel\$(O)\$(INF_NAME).inf : $(_INX)\$(INF_NAME).inx
> 
> Is this true for all .inx files or just for ib_bus ?

Currently this is the case for mthca.inf, ib_bus.inf, netipoib.inf,
ib_srp.inf & netvnic.inf. 
I do agree with you that hard coding paths is not a desirable solution
as it is not future flexible. 
BTW, a driver can override inf_stamp.inc by having a driver local
version which would redefine where the target .inf is in relation to
the build folder; a workable solution although I prefer a more flexible
approach as you suggested.   

I'll look into alternatives per your suggestion; I'm not sure if a
build root env var exists today. 

Thanks,

Stan.

> 
> If this is not the situation, one solution is to have it at every
> directory (which this global file tries to avoid)
> Another option is to defined OFW_ROOT and changed the line to
> $(OFW_ROOT)\bin\kernel\$(O)\$(INF_NAME).inf
> Is there already environment variable that holds the root dir ? Is
> this solution acceptable ? 
> 
> Thanks, Reuven.



More information about the ofw mailing list