title: os 001 bochs
tags: [os]
categories:
- os
date: 2021-05-11 20:59:35
make an os -001
- 积攒了这么久,终于要开始写一个操作系统了,加油。
bochs
wget https://cfhcable.dl.sourceforge.net/project/bochs/bochs/2.6.2/bochs-2.6.2.tar.gz
- 解压进入目录中
- configure
./configure --prefix=/lib/bochs --enable-debugger --enable-disasm --enable-iodebug --enable-x86-debugger --with-x --with-x11
- make
make会出现lpthread未链接的信息,则添加以下内容。
修改Makefile 在93行加入以下信息
./configure --prefix=/lib/bochs --enable-debugger --enable-disasm --enable-iodebug --enable-x86-debugger --with-x --with-x11
191行与192行改为$(LIBS) \
-lpthread
# Bochs配置文件
# 机器内存: 32MB
megs: 32
# 对应真实机器的bios
romimage: file=/lib/bochs/share/bochs/BIOS-bochs-latest
# 对应真实机器的VGA bios
vgaromimage: file=/lib/bochs/share/bochs/VGABIOS-lgpl-latest
# 启动方式
boot: disk
log: bochs.out
# 关闭鼠标
mouse: enabled=0
keyboard:keymap=/lib/bochs/share/bochs/keymaps/x11-pc-us.map
# 硬盘设置
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="hd60M.img", mode=flat, cylinders=121, heads=16, spt=63
- 添加环境变量
在 /etc/profile 的最后一行添加
export PATH=/lib/bochs/bin:$PATH
source /etc/profile
- 启动bochs
boshs