# Rust로 운영 체제 작성

> Clean Markdown view of GeekNews topic #16779. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=16779](https://news.hada.io/topic?id=16779)
- GeekNews Markdown: [https://news.hada.io/topic/16779.md](https://news.hada.io/topic/16779.md)
- Type: GN+
- Author: [neo](https://news.hada.io/@neo)
- Published: 2024-09-15T13:33:24+09:00
- Updated: 2024-09-15T13:33:24+09:00
- Original source: [github.com/phil-opp](https://github.com/phil-opp/blog_os)
- Points: 7
- Comments: 1

## Topic Body

- 이 저장소는 os.phil-opp.com에서 제공하는 _Writing an OS in Rust_ 시리즈의 소스 코드를 포함함
- 질문이 있으면 이슈를 열거나 Gitter에서 채팅 가능

#### 코드 위치
- 각 포스트의 코드는 별도의 git 브랜치에 있음
- 각 포스트 후의 중간 상태를 확인할 수 있음
- 최신 포스트의 코드는 [여기](https://github.com/phil-opp/blog_os)에서 확인 가능
- 포스트 목록에서 `(source code)` 링크를 따라가면 각 포스트의 브랜치를 찾을 수 있음
- 브랜치는 `post-XX` 형식으로 명명됨 (`XX`는 포스트 번호)
- 예: _VGA Text Mode_ 포스트는 `post-03`, _Hardware Interrupts_ 포스트는 `post-07`
- 빌드 지침은 해당 브랜치의 Readme 참조
- git worktree를 사용하여 서브디렉토리에 브랜치를 체크아웃 가능
  ```bash
  git worktree add code post-10
  ```
- 위 명령어는 `code`라는 서브디렉토리를 생성하고 10번째 포스트("Heap Allocation")의 코드를 포함함

#### 포스트
- 이 프로젝트의 목표는 개별 블로그 포스트에서 단계별 튜토리얼을 제공하는 것
- 현재 다음과 같은 포스트가 있음

**Bare Bones:**
- A Freestanding Rust Binary [(source code)](https://github.com/phil-opp/blog_os/tree/post-01)
- A Minimal Rust Kernel [(source code)](https://github.com/phil-opp/blog_os/tree/post-02)
- VGA Text Mode [(source code)](https://github.com/phil-opp/blog_os/tree/post-03)
- Testing [(source code)](https://github.com/phil-opp/blog_os/tree/post-04)

**Interrupts:**
- CPU Exceptions [(source code)](https://github.com/phil-opp/blog_os/tree/post-05)
- Double Faults [(source code)](https://github.com/phil-opp/blog_os/tree/post-06)
- Hardware Interrupts [(source code)](https://github.com/phil-opp/blog_os/tree/post-07)

**Memory Management:**
- Introduction to Paging [(source code)](https://github.com/phil-opp/blog_os/tree/post-08)
- Paging Implementation [(source code)](https://github.com/phil-opp/blog_os/tree/post-09)
- Heap Allocation [(source code)](https://github.com/phil-opp/blog_os/tree/post-10)
- Allocator Designs [(source code)](https://github.com/phil-opp/blog_os/tree/post-11)

**Multitasking:**
- Async/Await [(source code)](https://github.com/phil-opp/blog_os/tree/post-12)

#### 첫 번째 에디션 포스트
- 현재 블로그 버전은 두 번째 에디션이며, 첫 번째 에디션은 더 이상 유지되지 않음
- 첫 번째 에디션의 포스트는 여전히 유용할 수 있음
- 포스트 목록은 다음과 같음

**Bare Bones:**
- A Minimal x86 Kernel [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)
- Entering Long Mode [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)
- Set Up Rust [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)
- Printing to Screen [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)

**Memory Management:**
- Allocating Frames [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)
- Page Tables [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)
- Remap the Kernel [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)
- Kernel Heap [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)

**Exceptions:**
- Handling Exceptions [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)
- Double Faults [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)

**Additional Resources:**
- Cross Compile Binutils
- Cross Compile libcore
- Set Up GDB
- Handling Exceptions using Naked Functions
- Catching Exceptions [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)
- Better Exception Messages [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)
- Returning from Exceptions [(source code)](https://github.com/phil-opp/blog_os/tree/first-edition)

#### 라이선스
- 이 프로젝트는 `blog/content` 폴더를 제외하고 다음 중 하나로 라이선스됨
  - Apache License, Version 2.0 [(LICENSE-APACHE)](https://www.apache.org/licenses/LICENSE-2.0)
  - MIT license [(LICENSE-MIT)](https://opensource.org/licenses/MIT)
- `blog/content` 폴더의 라이선스는 `blog/content/README.md` 참조

##### 기여
- 명시적으로 달리 언급하지 않는 한, Apache-2.0 라이선스에 정의된 대로 의도적으로 제출된 모든 기여는 위와 같이 이중 라이선스로 포함됨

### GN⁺의 정리
- 이 프로젝트는 Rust로 운영체제를 작성하는 방법을 단계별로 설명하는 튜토리얼을 제공함
- 각 포스트는 독립적인 주제를 다루며, 코드 예제와 함께 설명됨
- 운영체제 개발에 관심 있는 사람들에게 매우 유용한 자료임
- Rust의 안전성과 성능을 활용하여 운영체제를 개발하는 방법을 배울 수 있음
- 비슷한 기능을 가진 다른 프로젝트로는 `Redox OS`가 있음

## Comments



### Comment 28930

- Author: neo
- Created: 2024-09-15T13:33:25+09:00
- Points: 1

###### [Hacker News 의견](https://news.ycombinator.com/item?id=41540362) 
- 몇 년 전에 두 번째 에디션을 완료하고 많은 것을 배움
  - OS 개발에 관한 설명이 좋았고 Rust 학습에도 유용했음
  - 저자가 언어의 관용구를 잘 이해하고 있어 코드 표현 방식이 교육적이었음
  - 블로그의 Rust에서 futures 구현 설명이 특히 인상적이었음
  - Phil이 EFI 기반의 세 번째 에디션 작업을 다시 시작하길 바람
  - 두 번째 에디션은 주말 개발 시간을 보내기에 여전히 훌륭한 방법임

- 5년 전 튜토리얼을 완료한 후 MOROS 작업을 시작했음
  - Rust와 OS 개발에 관심 있는 사람들에게 강력히 추천함
  - Phil이 많은 노력을 기울였고, 그 결과가 잘 드러남
  - 이후에는 osdev 위키를 통해 계속 학습할 수 있음

- Rust로 OS를 작성하는 대신 DML/DDL을 실행할 수 있는 데이터 플랫폼을 만들어야 함

- Rust와 OS 개발에 대해 깊이 탐구한 후 이 자료를 발견했음
  - 이 자료의 품질에 감탄했으며, OS의 역사와 설계뿐만 아니라 Rust의 요소도 배울 수 있었음
  - Phil이 훌륭한 작업을 수행했음

- 이 자료 덕분에 2021년에 Rust를 시작하게 되었음
  - 이 자료가 존재하는 것에 매우 감사함

- Phil의 OS 개발에 관한 글은 항상 훌륭한 읽을거리임

- Harvey OS 팀은 이제 R9OS 프로젝트에서 작업 중임
  - <https://github.com/r9os/r9>

- 원래 에디션의 게시물을 특히 추천함
  - 현재 에디션은 부트로딩 과정을 특수한 crate로 처리하여 너무 많은 도움을 줌

- Rustconf에서 돌아왔는데, 실시간 운영체제에 중점을 둔 주요 OS 릴리스가 약 다섯 개 정도 있음
  - 모두 오픈 소스는 아님

- 또 다른 좋은 자료는 Rust를 사용하여 RISC-V OS를 만드는 것임
  - <https://osblog.stephenmarz.com>
