The xbook2 operating system kernel is a 32-bit processor system kernel based on the Intel x86 platform, which can be run in qemu, bochs, virtual box, vmware and other virtual machines. It can also run on a physical machine (the drivers supported by the system are required)
xbook2 is designed as a cross-processor platform architecture with an ARCH directory where a new processor platform can be added. However, it is currently trying to separate the platform-related parts into arch as much as possible, and it has not been completely separated. Only after several more platforms are implemented can the processor platform and the kernel parts be better separated more optimally.
Schematic diagram of kernel structure:
USER MODE:
+---------------------------+
| libs | apps |
+---------------------------+
KERNEL MODE:
+---------------------------+
| FSAL |
+---------------------------+
+---------------------------+
|task | ipc | vmm | drivers |
+---------------------------+
| arch |
+---------------------------+
/
+---------------------------+
| hardware |
+---------------------------+
| Table of contents | describe |
|---|---|
| develop | Disk mirrors, ROM file system contents, etc. used during development |
| doc | Operating system-related documentation |
| scripts | Used xbuild scripts and other configuration files |
| src | xbook2 kernel source code |
| tools | Tools required for kernel development |
| bin | Command line executable program |
| sbin | The program used by the system |
| libs | User status library |
System function list:
多进程,内核多线程,用户多线程
虚拟内存管理,分页内存管理,物理内存管理
管道通信,共享内存,消息队列,信号量
IDE硬盘驱动,PS/2鼠标,键盘驱动,VBE视频驱动
UART串口驱动
FATFS文件系统
PTHREAD线程库
xbook2 kernel development documentation
整体思路:
1. 用git从仓库克隆源码或者直接下载源码。
2. 配置最基础的工具集:gcc, nasm, ld, dd, rm, objdump, objcopy。
3. 配置虚拟机:qemu(默认),bochs,virtual box, vmware任选其一。
5. 进入xbook2的根目录目录,打开终端或者命令行,输入命令make build先构建环境,然后make run编译运行。
1. Download the toolkit I extracted: BuildTools, and after downloading, configure the decompression directory environment variable into the system environment variable Path. (Note that if you already have a mingw or cygwin environment on your computer, please put the environment variables of this toolkit in the front position, otherwise the programs in the toolkit will not be executed). In addition, since grub is supported, the tool environment for grub needs to be configured separately, which is also in BuildTools. So the directory where environment variables need to be configured is as follows:
BuildTools
BuildTools/genisoimage
BuildTools/grub-2.04
BuildTools/mkfs
BuildTools/mtools
2. Download the latest version of qemu: Qemu. After downloading, install it, configure the installation directory environment variable into the system environment variable Path, or download the version I extracted: Qemu-i386. After downloading, configure the decompression directory environment variable into the system environment variable Path.
3. If you want to use virtual machine acceleration, download the qemu acceleration extension under Windows HAXM v7.6.5: and install it after downloading.
1.安装gcc, nasm:
Ubuntu/Kali Linux: sudo apt-get install gcc nasm truncate
Red hat/Fedora/Centos: sudo yum install gcc nasm truncate
2.安装qemu虚拟机:
Ubuntu/Kali Linux: sudo apt-get install qemu-system-x86
Red hat/Fedora/Centos: sudo yum install qemu-system-x86
3.安装grub引导相关工具:
Ubuntu/Kali Linux: sudo apt-get install grub mtools genisoimage
Red hat/Fedora/Centos: sudo yum install grub mtools genisoimage
# 1.安装 i386-gcc
> brew tap nativeos/i386-elf-toolchain
> brew install i386-elf-binutils i386-elf-gcc
# 2.安装 truncate nasm qemu
> brew install truncate nasm qemu
# 3.安装 grub
> brew install grubIf you encounter an error when compiling the toolchain link, you can try to find a solution in the FAQS.md file.
> make build # 构建环境
> make run # 编译并运行,默认使用qemu虚拟机运行 > make # 只编译源码
> make build # 构建环境
> make debuild # 清理环境
> make run # 编译并运行,默认使用qemu虚拟机运行
> make qemu # 使用qemu虚拟机运行
> make clean # 清除编译产生的对象文件以及可执行文件
> make user # 只编译用户程序(在开发应用时常用)
> make user_clean # 只清除用户态生成的内容Contact information: Open Source official website: www.book-os.org
E-mail: [email protected]
Personal email: [email protected]
Personal QQ: 2323168280
Development and communication QQ group: 913813452