Skip to content

Commit

Permalink
fake linux
Browse files Browse the repository at this point in the history
  • Loading branch information
BitInit committed Jan 7, 2024
1 parent 41f1268 commit ae9db44
Show file tree
Hide file tree
Showing 52 changed files with 160 additions and 4,306 deletions.
1,308 changes: 0 additions & 1,308 deletions .bochsrc

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ HelloOS

# Prerequisites
*.d
.DS_Store
.vscode/

# Object files
*.o
Expand Down
23 changes: 0 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +0,0 @@
MAKEFLAGS = --no-print-directory

SRC := arch/x86/boot kernel mm drivers

all: clean iso

iso: build
ld -b elf64-x86-64 -z muldefs -o kernel.elf -Map=./kernel.map -T link.lds $(shell find $(SRC) -name "*.o")
@bash build_iso.sh

build: $(SRC)
@for s in $(SRC); do \
make -C $$s build || exit 1; \
done

clean: $(SRC)
@for s in $(SRC); do \
make -C $$s clean || exit 1; \
done
rm -rf *.elf *.iso *.map

qemu-run:
qemu-system-x86_64 -m 2G HelloOS.iso
69 changes: 2 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,2 @@
# HelloOS
基于 x86_64 指令集的实验性操作系统。

## 构建
目前基于 debian/ubuntu 进行构建:

1. 安装依赖

```bash
$ apt install -y make gcc grub git xorriso
```

2. 代码拉取

```bash
$ git clone [email protected]:BitInit/HelloOS.git
```

3. 构建镜像

```bash
$ cd HelloOS

$ make
```

在目录项目主目录下,`HelloOS.iso` 为构建好的镜像文件,`kernel.elf` 为构建好的内核文件。

## 进度

- [x] grub 启动引导

- [x] 基于位图的内存管理

- [ ] 内存管理改造成伙伴算法

- [ ] 支持 slab

- [x] 基于 8259A PIC 的中断处理

- [ ] 基于 APIC 的中断处理

- [x] 基于 8042 的键盘驱动

- [x] 基于 `sysenter``sysexit` 指令的系统调用

- [ ] posix 支持

- [ ] 进程调度

- [ ] 多核处理器支持

- [ ] 磁盘驱动

- [ ] 支持 FAT32 文件系统

- [ ] shell 命令解析器

- [ ] 移植 ls/cat/cp 等常用工具

- [ ] 支持 risc-v 指令集


## 参考资料

* [《x86汇编语言:从实模式到保护模式》](https://book.douban.com/subject/20492528/)
* [《一个64位操作系统的设计与实现》](https://book.douban.com/subject/30222325/)
## HelloOS
以 Linux kernel 2.6.26 源码为模版,实验性从零到一完成一个操作系统
17 changes: 0 additions & 17 deletions arch/x86/boot/Makefile

This file was deleted.

19 changes: 19 additions & 0 deletions arch/x86/boot/header.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#define ASM_FILE
#include <asm/multiboot2.h>

.section .text.head
.global startup
.extern startup_64

.code32
startup:
jmp startup_64

.align 8
multiboot_header:
.long MULTIBOOT2_HEADER_MAGIC /* magic number (multiboot 2) */
.long MULTIBOOT_ARCHITECTURE_I386 /* architecture 0 (protected mode i386) */
.long multiboot_header_end - multiboot_header /* header length */
.long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + (multiboot_header_end - multiboot_header))

multiboot_header_end:
248 changes: 0 additions & 248 deletions arch/x86/boot/multiboot2.S

This file was deleted.

Loading

0 comments on commit ae9db44

Please sign in to comment.