-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b396203
commit dfb651c
Showing
11 changed files
with
50 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ | |
obj-m = modul.o | ||
正如你所见,在示例中调用 :command:`make` 命令对 :file:`Makefile` 文件进行编译将导致在内核源代码目录(``/lib/modules/`uname -r`/build``)中调用 :command:`make` 并引用当前目录(``M = `pwd``)。该过程最终会读取当前目录中的 :file:`Kbuild` 文件,并按照该文件中的指示编译模块。 | ||
正如你所见,在示例中调用 :command:`make` 命令对 :file:`Makefile` 文件进行编译将导致在内核源代码目录 (``/lib/modules/`uname -r`/build``) 中调用 :command:`make` 并引用当前目录 (``M = `pwd``)。该过程最终会读取当前目录中的 :file:`Kbuild` 文件,并按照该文件中的指示编译模块。 | ||
|
||
.. note:: 对于实验,我们将根据虚拟机的规格配置不同的 :command:`KDIR`: | ||
|
||
|
@@ -469,12 +469,12 @@ addr2line | |
faust:~/lab-01/modul-oops# addr2line -e oops.o 0x5 | ||
/root/lab-01/modul-oops/oops.c:23 | ||
其中``0x5``是生成 oops 的程序计数器的值(``EIP = c89d4005``),减去根据 :file:`/proc/modules` 的信息得出的模块的基地址(``0xc89d4000``),。 | ||
其中 ``0x5`` 是生成 oops 的程序计数器的值(``EIP = c89d4005``),减去根据 :file:`/proc/modules` 的信息得出的模块的基地址(``0xc89d4000``)。 | ||
minicom | ||
------- | ||
:command:`Minicom`(或其他等效程序,例如 :command:`picocom` 以及 :command:`screen` )是一种用于与串行端口(serial port)连接和交互的程序。串行端口是在开发阶段分析内核消息(kernel message)或与嵌入式系统进行交互的基本方法。有两种常见的连接方式: | ||
:command:`Minicom` (或其他等效程序,例如 :command:`picocom` 以及 :command:`screen`) 是一种用于与串行端口(serial port)连接和交互的程序。串行端口是在开发阶段分析内核消息(kernel message)或与嵌入式系统进行交互的基本方法。有两种常见的连接方式: | ||
* 使用串行端口,设备路径为 :file:`/dev/ttyS0` | ||
|
@@ -517,7 +517,7 @@ netconsole | |
alice:~# modprobe netconsole [email protected]/eth0,[email protected]/00:50:56:c0:00:08 | ||
因此,在具有地址 ``192.168.191.130`` 的站点上,调试消息将被发送到 ``eth0`` 接口,源端口为``6666``。消息将被发送到``192.168.191.1``,使用 MAC 地址``00:50:56:c0:00:08``,至端口``6000``上。 | ||
因此,在具有地址 ``192.168.191.130`` 的站点上,调试消息将被发送到 ``eth0`` 接口,源端口为 ``6666``。消息将被发送到 ``192.168.191.1``,使用 MAC 地址 ``00:50:56:c0:00:08``,至端口 ``6000`` 上。 | ||
可以在目标站点上使用 :command:`netcat` 显示消息: | ||
|
@@ -691,9 +691,9 @@ Dyndbg 选项 | |
KDB:内核调试器 | ||
-------------- | ||
内核调试器已被证明在开发和调试过程中非常有用。其主要优势之一是可以进行实时调试。这使得我们能够实时监视对内存的访问,甚至在调试过程中修改内存。内核调试器从版本 2.6.26-rc1 开始,已集成到主线内核中。KDB 不是一个*源代码调试器*,但在进行完整分析时,可以与 gdb 和符号文件并行使用——请参见 :ref:`GDB调试部分 <gdb_intro>` | ||
内核调试器已被证明在开发和调试过程中非常有用。其主要优势之一是可以进行实时调试。这使得我们能够实时监视对内存的访问,甚至在调试过程中修改内存。内核调试器从版本 2.6.26-rc1 开始,已集成到主线内核中。KDB 不是一个 *源代码调试器*,但在进行完整分析时,可以与 gdb 和符号文件并行使用——请参见 :ref:`GDB调试部分 <gdb_intro>` | ||
要使用KDB,你有以下选项: | ||
要使用 KDB,你有以下选项: | ||
* 非 USB 键盘 + VGA 文本控制台 | ||
* 串口控制台 | ||
|
@@ -705,13 +705,13 @@ KDB:内核调试器 | |
echo hvc0 > /sys/module/kgdboc/parameters/kgdboc | ||
KDB 是一种*停止模式调试器*,这意味着在其活动期间,所有其他进程都将停止。可以使用 `SysRq <http://zh.wikipedia.org/wiki/Magic_SysRq組合鍵>`__ 命令强制内核在执行过程中进入 KDB | ||
KDB 是一种 *停止模式调试器*,这意味着在其活动期间,所有其他进程都将停止。可以使用 `SysRq <http://zh.wikipedia.org/wiki/Magic_SysRq組合鍵>`__ 命令强制内核在执行过程中进入 KDB | ||
.. code-block:: bash | ||
echo g > /proc/sysrq-trigger | ||
或者在连接到串口的终端中使用键盘组合键 ``Ctrl+O g``(例如使用 :command:`minicom`)。 | ||
或者在连接到串口的终端中使用键盘组合键 ``Ctrl+O g`` (例如使用 :command:`minicom`)。 | ||
KDB 具有各种命令来控制和定义被调试系统的上下文: | ||
|
@@ -842,7 +842,7 @@ KDB 具有各种命令来控制和定义被调试系统的上下文: | |
生成名为 **3-error-mod** 的任务的框架。编译源代码并得到相应的内核模块。 | ||
为什么会出现编译错误?**提示:**这个模块与前一个模块有什么不同? | ||
为什么会出现编译错误? **提示:** 这个模块与前一个模块有什么不同? | ||
修改该模块以解决这些错误的原因,然后编译和测试该模块。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.