64位操作系统入门实战教程安装指南

64位操作系统入门实战教程安装指南

64bit-os-tutorial This OS Tutorial expands on the fundamental concepts covered in cfenollosa/os-tutorial and covers entering long mode on the x86_64 architecture. It also uses clang rather than relying on an external crosscompiler. I plan on keeping it up to date, so feel free to submit an issue! 64bit-os-tutorial 项目地址: https://gitcode.com/gh_mirrors/64/64bit-os-tutorial

项目介绍

64bit-os-tutorial 是一个基于x86_64架构的操作系统学习项目,由开发者gmarino2048维护。此教程在cfenollosa/os-tutorial的基础之上扩展,特别关注于引导系统进入长模式,并采用LLVM编译器套件(包括clang)来代替传统的外部交叉编译器。教程旨在为熟悉C语言和汇编语言的用户提供升级版的学习资源,强调可访问性和易理解性,适合希望深入了解操作系统底层实现的开发者。

项目下载位置

要获取该项目,您可以通过以下命令从GitHub克隆源代码:

git clone https://github.com/gmarino2048/64bit-os-tutorial.git

: 克隆操作需要已安装Git工具。

项目安装环境配置

环境需求

  • 操作系统: macOS (Catalina及以上), Ubuntu (20.04及以上),或其他类Unix系统。
  • 编译工具: 需要安装LLVM(包含clang, ld.lld)以及NASM作为汇编器。
  • 模拟器: 使用qemu-system-x86_64进行模拟运行。
  • 调试工具(可选): gdb,但macOS可能需要特殊配置。
  • Shell: 推荐使用bash位于/bin/bash或通过符号链接可达的位置。

配置步骤示意图(文字描述,因环境限制无法提供实际图片)

  1. 安装LLVM: 在Ubuntu上可以使用sudo apt-get install clang lld;macOS可通过Homebrew安装brew install llvm
  2. 安装NASM: 使用sudo apt-get install nasm或macOS下brew install nasm
  3. 安装QEMU: sudo apt-get install qemu-system-x86 或在macOS使用brew install qemu
  4. 检查bash是否默认可用,否则创建或更新路径指向。

项目安装方式

  1. 克隆项目:按照上述“项目下载位置”中的指令执行。

  2. 构建与运行 进入项目目录:

    cd 64bit-os-tutorial
    

    执行提供的构建脚本(确保具有执行权限,必要时使用chmod +x):

    ./build.sh
    

    此脚本将会编译内核并准备启动文件。

  3. 启动模拟器 构建完成后,使用QEMU启动模拟操作系统:

    ./run.sh
    

    系统将在模拟环境中启动,显示教程中提到的初步界面或输出。

    扫描二维码关注公众号,回复: 17526344 查看本文章

项目处理脚本

项目中包含了两个关键脚本:

  • build.sh: 负责编译内核代码,生成所需的二进制文件。
  • run.sh: 调用QEMU模拟器加载并启动编译后的操作系统镜像。

确保正确配置了环境后,这两个脚本是与项目交互的主要入口点,简化了从源代码到运行系统的流程。

请注意,虽然本文档没有提供实际的图片,但在实际操作过程中,每个步骤都应确保相应的终端命令反馈无误,特别是在环境配置和脚本执行阶段。如果遇到任何问题,参考项目文档或直接向项目维护者提交issue请求帮助。

64bit-os-tutorial This OS Tutorial expands on the fundamental concepts covered in cfenollosa/os-tutorial and covers entering long mode on the x86_64 architecture. It also uses clang rather than relying on an external crosscompiler. I plan on keeping it up to date, so feel free to submit an issue! 64bit-os-tutorial 项目地址: https://gitcode.com/gh_mirrors/64/64bit-os-tutorial

猜你喜欢

转载自blog.csdn.net/gitblog_01212/article/details/143049765