中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > 综合其它
mingw cross build wdm
作者:未知 时间:2005-07-27 23:10 出处:CSDN 责编:chinaitpower
              摘要:mingw cross build wdm
 Windows NT will not load drivers that do not have a correct checksum.
You can apply this patch to binutils to solve the problem:

http://sources.redhat.com/ml/binutils/2002-01/msg00395.html

It writes a checksum to a PE image.

Alternatively you can search for a tool that will do the same and use it on
an image generated with MinGW.

Here is an example of a makefile that will generate a .sys file that Windows
NT will load (if ld has the checksum patch applied).


TOOLBASE = /usr/local/cross-tools/bin

GCC = $(TOOLBASE)/i386-mingw32msv-gcc
DLLTOOL = $(TOOLBASE)/i386-mingw32msv-dlltool

BASENAME = null

FULLNAME = $(BASENAME).sys
CFLAGS = -I../

OBJECTS = $(BASENAME).o

DDKLIBS = ntoskrnl.a

all: $(FULLNAME)

$(FULLNAME): $(OBJECTS)
$(GCC) -Wl,--base-file,base.tmp \
-Wl,--entry,_DriverEntry \
-nostartfiles -nostdlib \
-o junk.tmp \
$(OBJECTS) $(DDKLIBS)
$(DLLTOOL) --dllname $(FULLNAME) \
--base-file base.tmp \
--output-exp temp.exp
$(GCC) $(TARGET_LFLAGS) \
-Wl,--subsystem,native \
-Wl,--image-base,0x10000 \
-Wl,--file-alignment,0x1000 \
-Wl,--section-alignment,0x1000 \
-Wl,--entry,_DriverEntry \
-Wl,temp.exp \
-mdll -nostartfiles -nostdlib \
-o $(FULLNAME) \
$(OBJECTS) $(DDKLIBS)

%.o: %.c
$(GCC) $(CFLAGS) -c $< -o $@

///////////////////////////////////////////////////////////////////////////////////////////////

Is the use of DLLTOOL really needed ? I though ld could now generate the dll
relocation data automatically. Would this be enough:

$(FULLNAME): $(OBJECTS)
$(GCC) $(TARGET_LFLAGS) \
-Wl,--subsystem,native \
-Wl,--entry,_DriverEntry \
-shared -nostartfiles -nostdlib \
-o $(FULLNAME) \
$(OBJECTS) $(DDKLIBS)

关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有