{"id":18326485,"url":"https://github.com/ghosind/hariboteos","last_synced_at":"2025-04-14T19:20:28.754Z","repository":{"id":53115783,"uuid":"342270970","full_name":"ghosind/HariboteOS","owner":"ghosind","description":"《30天自制操作系统》NASM+GCC+QEMU实现","archived":false,"fork":false,"pushed_at":"2024-08-05T13:47:37.000Z","size":238,"stargazers_count":76,"open_issues_count":2,"forks_count":23,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T07:41:26.049Z","etag":null,"topics":["30-days-os","gcc","learning-os","nasm","os","os-dev","qemu","x86-32"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghosind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-25T14:28:16.000Z","updated_at":"2025-03-20T08:13:29.000Z","dependencies_parsed_at":"2024-12-17T15:11:29.195Z","dependency_job_id":"c96c1702-a5d8-487a-925e-4214c8015153","html_url":"https://github.com/ghosind/HariboteOS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghosind%2FHariboteOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghosind%2FHariboteOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghosind%2FHariboteOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghosind%2FHariboteOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghosind","download_url":"https://codeload.github.com/ghosind/HariboteOS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248943428,"owners_count":21186958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["30-days-os","gcc","learning-os","nasm","os","os-dev","qemu","x86-32"],"created_at":"2024-11-05T19:07:03.529Z","updated_at":"2025-04-14T19:20:28.736Z","avatar_url":"https://github.com/ghosind.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HariboteOS\n\n《30天自制操作系统》（川合秀实 著）配套代码改编版。因为作者使用了其自己编写的一套非标准的工具，且无法在非Windows平台下运行，所以本项目在原代码的基础上使用NASM、GCC、Qemu等工具进行编译、运行。\n\n本项目已完成第0～28天内容（除去第28天日文显示部分），项目主要实现已经完成。因为该书后两章内容更偏向于应用层面，所以便不在本项目中实现，有兴趣的朋友可以根据前面的基础上继续完成。\n\n## 项目特色\n\n- 采用GCC、NASM作为工具链，可跨平台使用\n- 基于LinkerScript构建内核\n- 不依赖于作者自定义HRB文件格式，支持ELF文件格式\n- 支持部分C标准库函数的简单实现（libc文件）\n- 头文件拆分，结构更为清晰\n- 中文键盘支持\n\n## 环境依赖\n\n- `nasm`\n- `gcc`\n- `binutils`\n- `qemu-system-i386`\n- `mtools`\n\n### 可选依赖\n\n- `gdb`（调试使用）\n\n### Mac下安装\n\nMacOS下默认Xcode Command Line Tools使用的gcc为clang的别名，在本项目实现中未对clang进行测试，可能会存在问题。\n\n在Mac下推荐使用`x86_64-elf-gcc`工具链进行编译，可使用`brew install x86_64-elf-gcc x86_64-elf-binutils x86_64-elf-gdb`安装。\n\n### 运行\n\n进入对应的文件夹，使用下面的命令运行：\n\n```bash\n$ make qemu\n# 若使用工具链包含前缀，如x86_64-elf-，可以使用GCCPREFIX\n$ make qemu GCCPREFIX=x86_64-elf-\n```\n\n若要使用GDB进行调试，请设置`DEBUG`：\n\n```bash\n$ make qemu DEBUG=1\n```\n\n## 最终目录结构\n\n- `app`：应用程序源码\n- `include`：系统内核头文件\n- `kernel`：系统内核代码\n- `libc`：简单的C标准库部分实现\n\n## C标准库实现\n\n- `strcmp`\n- `strncmp`\n\n参考自xv6实现：\n\n- `vsprintf`\n- `sprintf`\n\n来自《C程序设计语言》：\n\n- `rand`\n\n## 项目进度\n\n- [X] 第1天：Hello world\n- [X] 第2天：汇编与Makefile\n- [X] 第3天：进入32位模式\n- [X] 第4天：画面显示\n- [X] 第5天：GDT/IDT\n- [X] 第6天：中断处理\n- [X] 第7天：FIFO\n- [X] 第8天：鼠标与32位模式\n- [X] 第9天：内存管理\n- [X] 第10天：窗口叠加\n- [X] 第11天：窗口处理\n- [X] 第12天：定时器1\n- [X] 第13天：定时器2\n- [X] 第14天：键盘输入\n- [X] 第15天：多任务1\n- [X] 第16天：多任务2\n- [X] 第17天：命令行窗口\n- [X] 第18天：命令行命令\n- [X] 第19天：应用程序\n- [X] 第20天：API\n- [X] 第21天：保护操作系统\n- [X] 第22天：C语言应用程序（修改为ELF格式）\n- [X] 第23天：应用程序图形处理\n- [X] 第24天：窗口操作\n- [X] 第25天：更多窗口\n- [X] 第26天：窗口操作提速\n- [X] 第27天：LDT与库（未按书上处理）\n- [X] 第28天：文件操作与文字显示（不包含日文显示部分）\n\n本项目不继续添加第29天以及第30天的内容，有兴趣的朋友可继续阅读后续章节。\n\n## 待解决问题\n\n- [ ] 定时器执行若使用`io_sti`而非`io_stihlt`时会卡死\n- [ ] 启动时偶尔黑屏，无法正常绘制界面\n- [ ] 多个命令行同时执行命令时会卡死\n- [ ] 第28天中`__alloca`无效，`sosu2`无法运行\n\n## 博客文章\n\n- [第0天：前言](https://www.ghosind.com/2021/03/31/hariboteos-0)\n- [第1天：Hello world](https://www.ghosind.com/2021/04/28/hariboteos-1)\n\n## 版权信息\n\n项目中代码版权主要归原书作者所有，本人仅针对无法直接运行的部分对该代码作出部分修改。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghosind%2Fhariboteos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghosind%2Fhariboteos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghosind%2Fhariboteos/lists"}