BSD 3-Clause "New" or "Revised" License

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

深度分析:Ethereal 操作系统

项目背景与痛点

操作系统的开发是一门充满挑战的艺术。站在巨人肩膀上的前提下,Ethereal 项目却意图从零开始构建一套全新的操作系统。它不只是一款普通的操作系统,更是一个追求无缝用户体验的系统,试图在一个完全自我构建的软件堆栈中提供稳定和高效的执行环境。这样的系统为开发者提供了一个探索操作系统内部机制和优化性能的绝佳实验场。在这个日益复杂的计算世界中,开源社区需要这样的项目来解读系统底层是如何运作的,并为未来的系统设计提供新的见解。

核心技术揭秘

Ethereal 操作系统的核心就如其名字一样,是一套极其精简的设计。该系统采用了极其简单而直接的内存管理,微型内核设计及实现了一个精巧的驱动架构,这些都使其成为一个轻量级、灵活且高度自定义的系统。

graph TD A[用户操作] --> B[系统调用接口] B --> C{"内核模块"} C -->|"文件系统"| D[文件操作] C -->|"网络设备"| E[网络通信] C -->|"设备驱动"| F[硬件交互]

内核设计方面,它采用了微型内核架构,将操作系统的关键服务托管在用户空间,这使得Ethereal可以很方便地实现模块化设计,增强系统的稳定性和安全性。特别之处在于它对驱动架构的设计,将每个驱动封装为可插拔的模块,这使得系统对硬件的支持扩展性极强,并且保证了核心系统的稳定性。

功能亮点与差异

相比传统的操作系统,在Ethereal中,不仅仅是功能上的简单对比,关键在于其设计理念和技术实现上的不同。它不但提供了一个完全透明的底层架构让开发者深入了解系统运行的每一个细节,而且还提供了一个轻量级、可定制性强的操作系统,特别适合对性能要求高、系统环境可预知的应用场景,如嵌入式系统和一些特种应用。

其独特的设计在于其采用的直接映射内存模型与模块化驱动系统。Ethereal还值得一提的特点是它对开源贡献者的高度包容,活跃的社区和完整的文档,使得更多的开发者可以参与到这样一个激动人心的项目中,共同推动项目的演进。

应用场景与落地建议

使用Ethereal的开发者应当了解其设计目标是提供一种研究操作系统设计和实践的试验田。虽然它在某些场景下可以达到生产级应用的性能和稳定性,但需要注意的是,相较于成熟的生态和工具链丰富的商用或更广泛接受的开源操作系统,它仍需要更多的下游支持和生态建设才能支持复杂的生产环境应用。此外,对于总线速率高、设备类型多样化的环境,是否能够充分利用硬件特性,管理更为复杂的硬件设备,将是其在实际落地过程中面临的巨大挑战。

Ethereal的主要应用场景是教育、研究和实验,尤其适合对系统底层感兴趣的研究机构和学校。开发者可以利用它来进行操作系统开发、调试性能瓶颈,它也适用于嵌入式设备开发场景,以及其他对内核定制化和实时性能有高要求的领域。

综合评价

Ethereal 操作系统在自下而上的软件构建和轻量级设计方面提供了卓越的机会和灵活性,虽然在完成度和应用场景的多样性上与成熟的操作系统尚有一定距离,但它成功地展示了未来的可能性。它可以成为学习操作系统的骨骼架构和设计模式的绝佳选择,对于开发者来说,它可以用来深刻理解操作系统核心机制,并通过实践来探索无限的优化空间。

关于

GitHub 原始描述(英文)

A from-scratch operating system attempting to make a full user experience.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
270
价值分
144
活跃状态
活跃

语言占比

Assembly
C
C++
Linker Script
Makefile
Python
Shell

Release

README

Ethereal

A custom all-in-one hobby operating system.

What is Ethereal?

Ethereal is a project with the goal of creating a fully functional OS with all components a modern OS would have.

It is not Linux-based, nor does it share any code with Linux at all. Rather, it uses a custom OS kernel.

Screenshots

Ethereal Latest
Ethereal

image
Modern, 1080p desktop environment

image
Ethereal older main desktop environment with DOOM

Ethereal but REALLY on IRC
Ethereal on Libera chat (#ethereal)

Features

  • Full SMP-enabled kernel
  • Advanced page cache that makes disk syncing fast
  • Custom window manager (Celestial) and userspace
  • USB support for xHCI controllers
  • AHCI/NVMe disk support (technically IDE too, albeit a very poorly written driver)
  • Networking stack with E1000 and RTL8169 network card driver
  • Support for the mlibc C library
  • Full ACPI support with the ACPICA library (with backup MinACPI library that doesn’t have AML parsing)

Project structure

  • base: Contains the base filesystem. Files in base/initrd go in the initial ramdisk (for non-LiveCD boots) and files in base/sysroot go in sysroot.
  • buildscripts: Contains buildscripts for the build system
  • conf: Contains misc. configuration files, such as architecture files, GRUB configs, extra boot files, etc.
  • drivers: Drivers for Hexahedron, copied based on their configuration.
  • external: Contains external projects, such as ACPICA. See External Components.
  • hexahedron: The main kernel project
  • libkstructures: Contains misc. structures, like lists/hashmaps/parsers/whatever
  • libc: Contains mlibc
  • userspace: Contains the userspace libraries and programs in Ethereal

AI policy

Ethereal does not permit coding assisted by LLMs to be present in the online repo.
If such code does make it, it should be removed immediately.

My personal stance on AI is that its a tool with specific usages.

Artificial intelligence is good at:

  • Reading through large codebases (assuming a human double-checks) such as Linux or NetBSD.
  • Generating small, single-use test programs that never make it to upstream.
  • Teaching certain small foreign concepts or asking small questions (when this information is not readily accessible)

Artificial intelligence is horrible at:

  • Generating any type of kernel code
  • Explaining why it is doing something/what something does
  • Not overcomplicating the simplest of topics

Due to the above no AI code should ever be present in Ethereal.

As I have noticed (from myself and others) people tend to “overdose” on AI and become dependent on it.
This only hurts you in the long run, causing your ability to program to falter.

For your own sake, please avoid using AI in the wrong ways.

PRs containing AI-generated or suspected AI-generated code can be closed at any time.

THERE IS NO VIBECODING IN ETHEREAL.

Code notice

Ethereal’s codebase is the result of over 2 years of effort.

In some areas, the code is extremely concise, well-written, and optimized.
In other areas, it isn’t - I learned as I made this project.

Take caution if using Ethereal as a source to learn how to make your own OS.

Building

ACPICA notice (READ THIS BEFORE BUILDING)

If you use ACPICA (it is on by default), you must download the tarfile from here and extract it to external/acpica/acpica-src

Alternatively, you can edit conf/build/<arch>.mk and set USE_ACPICA to 0.

As of now the benefits of ACPICA is the ability to shutdown the system and hibernate, with support for the PCI IRQ routing table coming later (+ batteries).

Building

To build Ethereal, you will need an Ethereal toolchain for your target architecture.
The Ethereal toolchain can be found at the repository

Other packages required: grub-common, xorriso, qemu-system, meson, ninja

Edit buildscripts/build-arch.sh to change the target build architecture.
Running make all will build an ISO in build-output/ethereal.iso

Currently, Ethereal’s lack of filesystem drivers means that LiveCD boots are usually the best option.
The initial ramdisk in a LiveCD is the sysroot, and if the OS detects the boot it will copy the initial ramdisk into RAM.

Kernel arguments

A lot of times, Ethereal fails to load. This is expected. Please start a GitHub issue.

You can solve some problems by using ‘e’ to open a GRUB configuration and adding some kernel arguments to the end of the multiboot entry.
Here is a small list:

  • --debug=: Options are console and none. If console, will redirect kernel debug output to the screen. Useful for debugging
  • --noload=: Comma-separated list of driver (.sys) files to not load. Problematic drivers: usb_xhci.sys, ahci.sys, ps2.sys (if you don’t support PS/2),
  • --no-acpica: Disable the ACPICA library and fallback to MinACPI implementation. Only useful in extreme cases.
  • --no-acpi: Disable all ACPI implementations. Disables SMP as well.
  • --disable-smp: Enable ACPI, but disable SMP
  • --no-psf-font: Don’t load the PSF font from initrd

External components

Certain external components are available in external, libc, and other parts of the kernel. Here is a list of them and their versions:

Certain external components are by the same developer, however may follow a different license:

Credits

A lot of Ethereal’s design was inspired by ToaruOS by klange - thank you!

The “grab” cursor from ToaruOS is used in Celestial (art asset is located at base/sysroot/usr/share/cursors/grab.bmp).

Ethereal’s virtual memory manager design and other parts was inspired by Astral by @mathewnd

Some code from Astral was also used, credited where appropriate. A license file is included in external/.

The Ethereal logo, Mercury theme, as well as all art assets not specified were designed by the artist ArtsySquid

Licensing

Hexahedron and all other non-external components of Ethereal fall under the terms of the BSD 3-clause license (available in LICENSE).
All files, unless specified in the copyright header, fall under this license. Any file without a copyright header is NOT protected by BSD 3-clause.

LICENSING ISSUES: If a file is found without proper commenting, immediately contact me (preferably through a public channel such as GitHub issues for transparency) directly to resolve it.

Ethereal’s goal has NEVER been to take code, however if it does happen please contact me!

评论

暂无评论