分享

Linux 0.11 实验环境

 凤凰苑凶真 2016-10-30

1 项目描述

该项目致力于快速构建一个 Linux 0.11 实验环境,可配合《Linux内核完全注释》 一书使用。

  • 使用文档:README.md
  • 代码仓库:https://github.com/tinyclub/linux-0.11-lab.git
  • 基本特性:
    • 包含所有可用的映像文件: ramfs/floppy/hard disk image。
    • 轻松支持 qemu 和 bochs,可通过配置 tools/vm.cfg 切换。
    • 可以生成任何函数的调用关系,方便代码分析:make cg f=func d=file|dir
    • 支持 Ubuntu 和 Mac OS X,在 VirtualBox 的支持下也可以在 Windows 上工作。
    • 测试过的编译器: Ubuntu: gcc-4.8, Mac OS X:i386-elf-gcc 4.7.2
    • 在解压之前整个大小只有 30M

2 相关文章

3 五分钟教程

3.1 准备

以 Ubuntu 和 Qemu 为例, 对于 Mac OS X 和 Bochs 的用法,请参考 README.md.

  1. apt-get install vim cscope exuberant-ctags gcc gdb binutils qemu

3.2 下载

  1. git clone https://github.com/tinyclub/linux-0.11-lab.git

3.3 编译

  1. make

3.4 从硬盘启动

  1. make start-hd

3.5 调试

打开一个终端并启动进入调试模式:

  1. make debug-hd

打开另外一个终端启动 gdb 开始调试:

  1. gdb images/kernel.sym
  2. (gdb) target remote :1234
  3. (gdb) b main
  4. (gdb) c

3.6 获得帮助

  1. make help
  2. > Usage:
  3. make --generate a kernel floppy Image with a fs on hda1
  4. make start -- boot the kernel in qemu
  5. make start-fd -- boot the kernel with fs in floppy
  6. make start-hd -- boot the kernel with fs in hard disk
  7. make debug -- debug the kernel in qemu & gdb at port 1234
  8. make debug-fd -- debug the kernel with fs in floppy
  9. make debug-hd -- debug the kernel with fs in hard disk
  10. make disk -- generate a kernel Image & copy it to floppy
  11. make cscope -- genereate the cscope index databases
  12. make tags -- generate the tag file
  13. make cg -- generate callgraph of the system architecture
  14. make clean -- clean the object files
  15. make distclean -- only keep the source code files

3.7 生成 main 函数调用关系

  1. make cg
  2. ls calltree/linux-0.11.jpg

See:

Linux 0.11 Calltree

3.8 演示

Linux 0.11 Lab

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多