270 likes | 442 Views
实验平台简介. 操作系统课程组. 内容安排. Windows Academic Program 简介 WRK 简介 编译内核 启动和调试 WRK. Windows Academic Program 简介. Windows Academic Program
E N D
实验平台简介 操作系统课程组
内容安排 • Windows Academic Program简介 • WRK简介 • 编译内核 • 启动和调试WRK
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 Kit • Windows Research Kernel • ProjectOZ 参考网址: http://www.microsoft.com/resources/sharedsource/windowsacademic/default.mspx
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) principles • Modify, build, run and test the Windows kernel • Better understand the Windows architecture and implementation. • Including: • Windows XP x64/Server 2003 SP1kernel sources • An environment for building and testing
WRK简介 • Windows XP x64/Server 2003 SP1kernel sources • Contains the sources for the core Windows (NTOS) kernel: • Processes • Threads • Virtual memory and cache managers • I/O management • The registry • Executive functions, such as the kernel heap and synchronization • Object manager • Local procedure call mechanism • Security reference monitor • Low-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 Layer • File systems • Network stacks • Device drivers
WRK简介 • Use and Restrictions • The 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” (http://www.microsoft.com/resources/sharedsource/licensing/basics/wrklicense.mspx) WRK参考网址: http://www.microsoft.com/resources/sharedsource/windowsacademic/researchkernelkit.mspx
编译内核 • WRK源代码结构 • 打开路径“D:\WRK-v1.2\base\ntos”(实验室机器中WRK源代码路径),文件目录组织如下: • cache\ - cache manager • config\ - registry implementation • dbgk\ - user-mode debugger support • ex\ - executive functions (kernel heap, synchronization, time) • fsrtl\ - file system run-time support • io\ - I/O manager • ke\ - scheduler, CPU management, low-level synchronization • lpc\ - local procedure call implementation • mm\ - virtual memory manager • ob\ - kernel object manager • ps\ - process/thread support • se\ - security functions • wmi\ - Windows Management Instrumentation • inc\ - NTOS-only include files • rtl\ - kernel run-time support • init\ - kernel startup
编译内核 • 编译步骤 • 点击Windows菜单“开始运行” • 输入cmd,点击“确定”
编译内核 • 在“命令提示符窗体”中输入以下命令: • set path=D:\WRK-v1.2\tools\x86;C:\WINDOWS\system32 //设置路径 • set arch=x86 //指定编译目标结构 • D: //更改当前目录到D盘 • cd D:\WRK-v1.2\base\ntos //进入WRK源代码所在目录 • nmake -nologo %arch%= //编译内核代码,nmake为编译程序 • dir D:\WRK-v1.2\base\ntos\BUILD\EXE //如果发现文件wrkx86.exe, wrkx86.pdb存在,则编译成功
启动和调试WRK • 安装调试工具WinDbg • 打开文件夹“D:\WRK-v1.2\Debugging Tools”(实验室机器中WinDbg安装文件所在路径),双击文件:dbg_x86_6.6.03.5.exe • 按照提示进行操作完成安装(实验室机器WinDbg安装位置“D:\WRK-v1.2\DebugTools”)
启动和调试WRK • 安装Microsoft Virtual PC 2007 • 打开文件夹“D:\WRK-v1.2\Virtual PC 2007”(实验室机器中VPC安装文件所在路径),双击setup.exe • 按照提示完成安装
启动和调试WRK • 配置Virtual PC 2007 • 启动Virtual PC 2007,出现向导提示窗,选择Next
启动和调试WRK • 选择Add an existing virtual machine, 点击Next
启动和调试WRK • 点击“Browse”按钮,选择文件“D:\WRK-v1.2\Win2K3SP1 Image\Win2k3 SP1 WRK.vmc”(实验室机器中虚拟机文件所在路径),单击Next
启动和调试WRK 点击Finish 点击OK
启动和调试WRK 启动Virtual PC,选择Start 选择第一项,启动windows Server 2003, Standard
启动和调试WRK Windows Server 2003 SP1启动后界面
启动和调试WRK 打开Virtual PC,选择Settings 选择“Shared Folders” 点击按钮“Share Folder…”
启动和调试WRK 选择路径“D:\WRK-v1.2”(实验室机器中WRK工作目录),选中“Share every time”,点击确定 点击OK,Virtual PC配置完毕
启动和调试WRK • 加载编译后的WRK内核 • 在虚拟机的Windows Server 2003 SP1中 • 点击“Start Run” • 输入cmd, 点击OK • 在Command Prompt窗体中输入: • xcopy y:\base\ntos\build\exe\wrkx86.exec:\windows\system32 • xcopy y:\WS03SP1HALS\x86\halacpim\halacpim.dllc:\windows\system32 • 点击“Start Shut down”,关闭系统
启动和调试WRK • 调试WRK • 在主机(Host Computer)中 • 选择”开始运行” • 输入cmd,点击确定 • 在命令提示符窗体中输入以下命令: • set _NT_SYMBOL_PATH=D:\WRK-v1.2\base\ntos\BUILD\EXE;D:\WRK-v1.2\WS03SP1HALS\x86\halacpim • path D:\WRK-v1.2\DebugTools • windbg -k com:pipe,port=\\.\pipe\debug,resets=0,reconnect
启动和调试WRK 若出现以下界面说明WinDbg(Host Computer)已经准备好和目标系统(Guest OS)进行连接
启动和调试WRK 启动虚拟机,选择Start 选择第二项
启动和调试WRK WinDbg显示以下提示信息,连接成功
启动和调试WRK 选择WinDbg菜单“Debug Break”(暂停Guest OS的运作)
启动和调试WRK 出现提示符“kd>”,可以开始调试
References [1] Windows Academic Program. http://www.microsoft.com/resources/sharedsource/windowsacademic/default.mspx [2] Windows Research Kernel. http://www.microsoft.com/resources/sharedsource/windowsacademic/researchkernelkit.mspx [3]Brian Burns, Arkady Retik. MSRA Workshop Lab on Building the Windows Research Kernel (WRK). February 2008.