# linux0.11 **Repository Path**: xinfoo/linux0.11 ## Basic Information - **Project Name**: linux0.11 - **Description**: linux 0.11源码分析、调试,与操作系统原理学习 - **Primary Language**: C - **License**: GPL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2025-10-31 - **Last Updated**: 2025-10-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 一、linux0.11 linux 0.11 源码分析与调试,自学与分享 # 二、勘误: ## 1. B站的视频:[Linux0.11源代码分析之001—— bootsect.s分析与调试](https://www.bilibili.com/video/BV1QcayzGEvn/?spm_id_from=333.337.search-card.all.click&vd_source=3c8de2e5b584f8e7cfe8fcac75b83455) 其中有两个地方讲错了,一个是在框图上面,int 0x19的中断服务地址,写错了0xf8f2d,应该是0xf9ce9; 另一个是从bootsect跳转到setup的地方,不是在原来的0x7c00地址后面,而是0x90000地址后面,具体可以参考[ch01-bootsect.pdf](ch01-bootsect.pdf)中的配图,已经纠正。 ## 2. B站视频:[Linux0.11源代码分析之003-2-head.s分析与调试(2)](https://www.bilibili.com/video/BV1gzWFzFEvR?t=3054.8) 其中50:50秒讲到cs=0x10,这里是手误,应该是0x08,事实上ret语句只是弹出ip, 并不会改变cs,所以可以不提及cs, -:) # 三、文档目录 [第1章 bootsect.s分析与调试](ch01-bootsect.pdf) [第2章 setup.s分析与调试](ch02-setup.pdf) [第3章 head.s分析与调试](ch03-head.pdf) # 四、针对bochs 2.6.9的linux 0.11源代码调试 ## 1. 操作系统 - 本人时间有限,这里介绍的方法,只有在ubuntu 14.04(x86-64位)虚拟机下运行成功,其他系统未尝试过。 . ubuntu 14.04的[下载](http://old-releases.ubuntu.com/releases/14.04.5/ubuntu-14.04-desktop-amd64.iso)地址为 ``` http://old-releases.ubuntu.com/releases/14.04.5/ubuntu-14.04-desktop-amd64.iso ``` - ubuntu 14.04 阿里云镜像源: ``` deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse ``` 将以上内容覆盖/etc/apt/sources.list内容即可,或者这里下载[sourcec.list](sources.list)覆盖,然后使用sudo apt update重新刷新 ``` sudo cp /etc/apt/sources.list /etc/apt/sources.list.bk sudo cp sources.list /etc/apt/sources.list sudo apt update ``` ## 2. 安装环境 ```sh sudo apt-get install -y build-essential libgtk2.0-dev \ libx11-dev xserver-xorg-dev xorg-dev g++ \ pkg-config libxcursor-dev libxrandr-dev \ libxinerama-dev libxi-dev sudo apt-get install -y make bin86 gcc-multilib ``` ## 3. 安装gcc-3.4 - 下载[gcc-3.4.tar](gcc-3.4.tar) - 运行dpkg -i ``` tar xf gcc-3.4.tar sudo dpkg -i gcc-3.4/*.deb ``` ## 4. 安装oslab 0.11 - 下载[oslab.tar.gz](oslab.tar.gz) - 解压oslab.tar.gz ``` gunzip oslab.tar.gz tar xf oslab.tar ``` ## 5. 使用方法 - asm汇编语言调试,主要针对前三个文件,bootsect.s/setup.s/head.s ``` cd oslab ./runasm ``` - c语言调试,使用gdb,针对main.c ``` cd oslab ./rungdb ``` - 如果调试时出现找不到main ``` Breakpoint 1, main () at init/main.c:105 105 init/main.c: 没有那个文件或目录. (gdb) ``` 只要进入linux-0.11目录重新编译一下即可: ``` cd linux-0.11 make ``` ## 6. 重新编译 如果需要修改linux-0.11源代码,需要重新编译以后再调试 ``` cd linux0.11 make ```