Q : 请问WinDriver生成的.sys档案是否可以修改呢?

本文探讨了WinDriver生成的.sys档案是否能够进行修改的问题,并提供了详细的操作指南。

Q :  请问WinDriver生成的.sys档案是否可以修改呢?


A :  可以的,请参阅http://www.jungo.com/st/support/documentation/windriver/10.2.1/wdpci_manual.mhtml/wd_rename_driver.html

#!/bin/python import sys import os import shutil # # action: # 0: add dir # 1: add file # 2: backup file # def install_patch_dir(src, dst, bak, actions): for item in os.scandir(src): if item.is_dir(): dst_dir = os.path.join(dst, item.name) bak_dir = os.path.join(bak, item.name) if not os.path.isdir(dst_dir): shutil.copytree(item.path, dst_dir) actions.append((0, dst_dir)) else: if not os.path.isdir(bak_dir): os.mkdir(bak_dir) actions.append((0, bak_dir)) install_patch_dir(item.path, dst_dir, bak_dir, actions) elif item.is_file(): dst_file = os.path.join(dst, item.name) bak_file = os.path.join(bak, item.name) if os.path.isfile(dst_file): shutil.copy2(dst_file, bak_file) actions.append((2, dst_file, bak_file)) else: actions.append((1, dst_file)) shutil.copy2(item.path, dst_file) wind_base = os.environ.get("WIND_BASE") if not wind_base: print("!!!!!!!!! error !!!!!!!!!!!") print("Please first execute \"wrenv.exe -p vxworks-6.9\" in windriver6.9 install directory.") exit() exe_uninst = os.path.join(wind_base, "uninstall_patch.bat") if os.path.isfile(exe_uninst): print("Uninstall old patch ... ") os.system(exe_uninst) print("Uninstall OK!") actions = [] copy_dir = os.path.join(wind_base, ".uninstall") if os.path.isdir(copy_dir): shutil.rmtree(copy_dir) os.mkdir(copy_dir) actions.append((0, copy_dir)) patch_dir = os.path.join(os.path.split(os.path.realpath(__file__))[0], "patch") install_patch_dir(patch_dir, wind_base, copy_dir, actions) usrcmdline = os.path.join(wind_base, "target", "config", "all", "vxbUsrCmdLine.c") usrcmddir = os.path.join(wind_base, "target", "config", "comps", "src", "hwif") # generate uninstall batch script uninst_bat = ''' @echo off if not defined WIND_BASE ( echo first execute "wrenv.exe -p vxworks-6.9" in windriver6.9 install directory. exit ) ''' with open(exe_uninst, 'w') as fp: print(uninst_bat, file=fp) actions.reverse() for act in actions: if act[0] == 0: print("rd /s /q " + act[1], file=fp) elif act[0] == 1: print("del " + act[1], file=fp) elif act[0] == 2: print("copy /y " + act[2] + " " + act[1], file=fp) print("del " + act[2], file=fp) print("del " + usrcmdline, file=fp) print("cd " + usrcmddir, file=fp) print("make vxbUsrCmdLine.c", file=fp) print("del " + exe_uninst, file=fp) # complie vxbUsrCmdLine.c if os.path.isfile(usrcmdline): os.remove(usrcmdline) os.chdir(usrcmddir) os.system("make vxbUsrCmdLine.c") # @REM cd %WIND_BASE%\target\src\hwif\methods # @REM make vxbMethodDecl.h # compile all of drivers hwif_dir = os.path.join(wind_base, "target", "src", "hwif") os.chdir(hwif_dir) os.system("make TOOL=diab CPU=ARMARCH7") os.system("make TOOL=diab CPU=ARMARCH7 VXBUILD=SMP") print("Install patch done!")帮我解释一下这段python代码
03-31
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值