《实验平台简介》PPT课件.ppt
实验平台简介,操作系统课程组,-2-,内容安排,Windows Academic Program简介WRK简介编译内核启动和调试WRK,-3-,Windows Academic Program简介,Windows Academic Program The Windows Academic Program provides universities with curriculum materials,Windows kernel source code,and a project environment for teaching operating system principles using Windows.Components:Windows Operating System Internals Curriculum Resource KitWindows Research KernelProjectOZ,参考网址:,-4-,WRK简介,Windows Research Kernel(WRK)The WRK packages core Windows XP x64 and Windows Server 2003 SP1 kernel source code with an environment for building and testing experimental versions of the Windows kernel for use in teaching and research.We can use it to:Explore operating system(OS)principlesModify,build,run and test the Windows kernelBetter understand the Windows architecture and implementation.Including:Windows XP x64/Server 2003 SP1 kernel sourcesAn environment for building and testing,-5-,WRK简介,Windows XP x64/Server 2003 SP1 kernel sourcesContains the sources for the core Windows(NTOS)kernel:ProcessesThreadsVirtual memory and cache managersI/O managementThe registryExecutive functions,such as the kernel heap and synchronizationObject managerLocal procedure call mechanismSecurity reference monitorLow-level CPU management(thread scheduling,Asynchronous and Deferred Procedure calls,interrupt/trap handling,exceptions)Not include(loaded into kernel mode as dynamic libraries):The NT Hardware Abstraction LayerFile systemsNetwork stacksDevice drivers,-6-,WRK简介,Use and RestrictionsThe WRK,and all the components of the Windows Academic Program,are for academic,non-commercial use only.Users must accept the terms and conditions of the“Microsoft Windows Research Kernel Source Code License”(),WRK参考网址:,-7-,编译内核,WRK源代码结构打开路径“D:WRK-v1.2basentos”(实验室机器中WRK源代码路径),文件目录组织如下:cache-cache managerconfig-registry implementationdbgk-user-mode debugger supportex-executive functions(kernel heap,synchronization,time)fsrtl-file system run-time supportio-I/O managerke-scheduler,CPU management,low-level synchronizationlpc-local procedure call implementationmm-virtual memory managerob-kernel object managerps-process/thread supportse-security functionswmi-Windows Management Instrumentationinc-NTOS-only include filesrtl-kernel run-time supportinit-kernel startup,-8-,编译内核,编译步骤点击Windows菜单“开始运行”输入cmd,点击“确定”,-9-,编译内核,在“命令提示符窗体”中输入以下命令:set path=D:WRK-v1.2toolsx86;C:WINDOWSsystem32/设置路径set arch=x86/指定编译目标结构D:/更改当前目录到D盘cd D:WRK-v1.2basentos/进入WRK源代码所在目录nmake-nologo%arch%=/编译内核代码,nmake为编译程序dir D:WRK-v1.2basentosBUILDEXE/如果发现文件wrkx86.exe,wrkx86.pdb存在,则编译成功,-10-,启动和调试WRK,安装调试工具WinDbg打开文件夹“D:WRK-v1.2Debugging Tools”(实验室机器中WinDbg安装文件所在路径),按照提示进行操作完成安装(实验室机器WinDbg安装位置“D:WRK-v1.2DebugTools”),-11-,启动和调试WRK,安装Microsoft Virtual PC 2007打开文件夹“D:WRK-v1.2Virtual PC 2007”(实验室机器中VPC安装文件所在路径),双击setup.exe按照提示完成安装,-12-,启动和调试WRK,配置Virtual PC 2007启动Virtual PC 2007,出现向导提示窗,选择Next,-13-,启动和调试WRK,选择Add an existing virtual machine,点击Next,-14-,启动和调试WRK,点击“Browse”按钮,选择文件“D:WRK-v1.2Win2K3SP1 ImageWin2k3 SP1 WRK.vmc”(实验室机器中虚拟机文件所在路径),单击Next,-15-,启动和调试WRK,点击Finish,点击OK,-16-,启动和调试WRK,选择第一项,启动windows Server 2003,Standard,启动Virtual PC,选择Start,-17-,启动和调试WRK,Windows Server 2003 SP1启动后界面,-18-,启动和调试WRK,打开Virtual PC,选择Settings,选择“Shared Folders”点击按钮“Share Folder”,-19-,启动和调试WRK,选择路径“D:WRK-v1.2”(实验室机器中WRK工作目录),选中“Share every time”,点击确定,点击OK,Virtual PC配置完毕,-20-,启动和调试WRK,加载编译后的WRK内核在虚拟机的Windows Server 2003 SP1中点击“Start Run”输入cmd,点击OK在Command Prompt窗体中输入:xcopy y:basentosbuildexewrkx86.exe c:windowssystem32xcopy y:WS03SP1HALSx86halacpimhalacpim.dll c:windowssystem32点击“Start Shut down”,关闭系统,-21-,启动和调试WRK,调试WRK在主机(Host Computer)中选择”开始运行”输入cmd,点击确定在命令提示符窗体中输入以下命令:set _NT_SYMBOL_PATH=D:WRK-v1.2basentosBUILDEXE;D:WRK-v1.2WS03SP1HALSx86halacpimpath D:WRK-v1.2DebugToolswindbg-k com:pipe,port=.pipedebug,resets=0,reconnect,-22-,启动和调试WRK,若出现以下界面说明WinDbg(Host Computer)已经准备好和目标系统(Guest OS)进行连接,-23-,启动和调试WRK,选择第二项,启动虚拟机,选择Start,-24-,启动和调试WRK,WinDbg显示以下提示信息,连接成功,-25-,启动和调试WRK,选择WinDbg菜单“Debug Break”(暂停Guest OS的运作),-26-,启动和调试WRK,出现提示符“kd”,可以开始调试,-27-,References,1 Windows Academic Program.2 Windows Research Kernel.3Brian Burns,Arkady Retik.MSRA Workshop Lab on Building the Windows Research Kernel(WRK).February 2008.,