Coder Social home page Coder Social logo

xbook's Introduction

XBOOK简介

书是人类进步的阶梯
--高尔基

X是个很神奇的字母,所以X+BOOK就是XBOOK

xbook是一个基于x86架构的32位操作系统,运行在PC电脑上,目前主要通过虚拟机测试开发。

一次偶然机会看到了操作系统居然可以自制,于是就感兴趣,从入门到放弃,再从放弃到入门,反反复复,折腾了几年,终于在2019年6月份定下了开发xbook。把自己感兴趣的部分,想要实现的部分都添加进来,并且希望在众多自制操作系统中有所突出,在学习他人的基础上,也添加了自己的许多想法。

号外!新的模型的内核xbook2正在开发中,感兴趣可以前来围观!www.github.com/hzcx998/xbook2

目前已经支持的内容在内容总览文件中查看。部分内容如下:

  • 分页机制
  • 物理内存管理
  • 多进程/多线程
  • 块设备驱动
  • 文件系统
  • 字符设备驱动
  • 控制台tty
  • 信号机制
  • 定时器和闹钟

os-structure

操作系统开发指南

工具环境搭建

虚拟机-推荐qemu

  • bochs
  • qemu
  • virtaul box
  • vmware

代码编辑器-任选其一

  • visual studio code
  • notepad++
  • vim
  • eclipse

开发工具

所需工具如下gcc, nasm, ld, dd, ar, make, rm

windows

linux

  • 自己根据以上工具名字安装哦

macos

  • 和linux兄弟类似

注意!工具包和虚拟机都需要配置环境变量,这样无论源码在哪个路径都可以进行编译运行。配置方法参考开发者手册。

编译源码

操作指令 command in makefile

#compile, link(编译并且链接)
make
#compile, link and run os in vm(编译链接写入磁盘并且在虚拟机中运行)
make run
#run in qemu(直接在qemu虚拟机中运行)
make qemu
#run in bochs(在bochs虚拟机中运行)
make bochs 
#run in bochsdbg(运行bochsdbg调试器)
make bochsdbg
#run in virtual box(运行在vbox虚拟机中,需要配置虚拟机名)
make vbox
#clean all .o, .bin, .a file(删除所有产生的临时文件)
make clean
# make a libary file(生成库文件,给应用程序链接)
make lib 
# remove a libary file(删除库文件)
make rmlib 

注意!!!

为了提高每次下载的速度,已经把image镜像从github中移除,但是可以在发布的版本中找到该文件。 如果编译遇到缺少"image/x.img"文件,那么,你就需要下载一个发布的版本,然后将对应的文件复制过去。

window

可以直接运行launch_cmd.bat打开命令行,输入make run即可运行。

linux

xbook目录下打开终端,输入对于指令即可运行。

macos

linux类似

开发交流,群贤聚集,必成大事

BookOS开发QQ官方群:913813452

资助鼓励

如果您觉得我写的系统对您来说是有价值的,并鼓励我进行更多的开源及免费开发,那您可以资助我,就算是一瓶可乐... donate-with-wechat donate-with-alipay

联系我

官方网址:www.book-os.org
电子邮件:[email protected]

xbook's People

Contributors

hzcx998 avatar zhuyu1997 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

xbook's Issues

Compile on Ubuntu

I'm getting this error when trying to run on linux.

marc@marc-Aspire-ES1-531:/XBook$ make qemu > error.txt
1+0 records in
1+0 records out
512 bytes copied, 0,00131748 s, 389 kB/s
8+0 records in
8+0 records out
4096 bytes (4,1 kB, 4,0 KiB) copied, 0,000808064 s, 5,1 MB/s
604+1 records in
604+1 records out
309408 bytes (309 kB, 302 KiB) copied, 0,00900299 s, 34,4 MB/s
WARNING: Image format was not specified for '../developments/image/a.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
qemu-system-i386: -hda ../developments/image/c.img: Could not open '../developments/image/c.img': No such file or directory
make[1]: *** [makefile:193: qemu] Error 1
make: *** [Makefile:10: qemu] Error 2
marc@marc-Aspire-ES1-531:
/XBook$

The os compiled just fine with make

在 mac 上编译问题

你好:
我正在尝试在 mac 上跑 XBook,但是在编译过程中遇到了一个小问题,以下是错误报告:

/Library/Developer/CommandLineTools/usr/bin/make -C arch/x86/ -f /***/XBook/src/Makefile.build
/Library/Developer/CommandLineTools/usr/bin/make -C boot -f /***/XBook/src/Makefile.build
make[2]: Nothing to be done for `__build'.
/Library/Developer/CommandLineTools/usr/bin/make -C kernel -f /***/XBook/src/Makefile.build
[CC] arch/x86/kernel/arch.o
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:13:2: error: instruction requires: Not 64-bit mode
        pushl   %ebp
        ^
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:17:2: error: instruction requires: Not 64-bit mode
        pushl   %ebx
        ^
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:29:2: error: instruction requires: Not 64-bit mode
        pushl   %eax
        ^
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:30:2: error: instruction requires: Not 64-bit mode
        call    *%edx
        ^
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:43:2: error: instruction requires: Not 64-bit mode
        pushl   %eax
        ^
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:44:2: error: instruction requires: Not 64-bit mode
        call    *%edx
        ^
make[2]: *** [arch.o] Error 1
make[1]: *** [kernel] Error 2
make: *** [arch/x86/] Error 2

我对原代码做出了如下修改:

diff --git a/src/makefile b/src/makefile
index a4d771f..f5a3eeb 100644
--- a/src/makefile
+++ b/src/makefile
@@ -14,10 +14,17 @@ all:
 BOCHS_DIR = ../bochs/
 
 # ar 是库打包工具
-AR 	= ar
+ifneq ($(HOSTOS),macos)
+	AR 			= gcc-ar-9
+	CC			= gcc-9
+	LD 			= ld-9
+else
+	AR 			= ar
+	CC			= gcc
+	LD 			= ld
+endif
+
 NASM 		= nasm
-CC			= gcc
-LD 			= ld
 DD 			= dd
 QEMU 		= qemu-system-i386
 BOCHS 		= bochs

 #----dir----
 #arch
@@ -75,7 +82,7 @@ TOPDIR	:= $(CURDIR)
 ifeq ($(OS),Windows_NT)
 	HOSTOS		:= windows
 else
-	ifeq ($(shell uname),Darwin)
+	ifeq ($(shell uname),"Darwin")
 		HOSTOS		:= macos
 	else
 		ifeq ($(shell uname),Linux)

这看起来是目标文件格式不一致导致的,请问你有什么解决思路吗(当然能顺手解决掉更好)

谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.