mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Compare commits
62 Commits
post-06-st
...
d9fa84edd6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9fa84edd6 | ||
|
|
9684f75819 | ||
|
|
d6cc562907 | ||
|
|
b44d8ab7fc | ||
|
|
c551fec1ce | ||
|
|
16bbb8f972 | ||
|
|
430e2143f8 | ||
|
|
86ffa24e8e | ||
|
|
c27eb1da9c | ||
|
|
a90a8bea67 | ||
|
|
688a21e4ed | ||
|
|
2265ddecad | ||
|
|
38604da92f | ||
|
|
c6990cb52d | ||
|
|
2bc4490404 | ||
|
|
7959b77ebd | ||
|
|
bebad6d5a9 | ||
|
|
b99c3f6d1d | ||
|
|
66c1792034 | ||
|
|
6393247a3b | ||
|
|
faa8d15cb7 | ||
|
|
26f1f5b896 | ||
|
|
1f49e2e9fe | ||
|
|
8708b54756 | ||
|
|
021762cf30 | ||
|
|
d8f280315f | ||
|
|
066c278277 | ||
|
|
bdb6a424a8 | ||
|
|
96844f6519 | ||
|
|
1501669819 | ||
|
|
1b86d7fd62 | ||
|
|
deb0f63dff | ||
|
|
d658949f5b | ||
|
|
0e52ccbebb | ||
|
|
4e38e7ddf8 | ||
|
|
49dce7ada7 | ||
|
|
c42cee8d89 | ||
|
|
ebb9f0b8a7 | ||
|
|
cde3c8f955 | ||
|
|
6ad573bb11 | ||
|
|
4a4d704384 | ||
|
|
71d8a438f7 | ||
|
|
3a77cbe794 | ||
|
|
3fb4695f6c | ||
|
|
635677d07c | ||
|
|
b276ec4765 | ||
|
|
6f9cfce6f9 | ||
|
|
4bbaae24a4 | ||
|
|
44d7654ef6 | ||
|
|
f135aefae8 | ||
|
|
ffaac76876 | ||
|
|
5ae9f62f4d | ||
|
|
da0ee38f09 | ||
|
|
263e852dcc | ||
|
|
614e5b0e86 | ||
|
|
9ee42e0f5f | ||
|
|
c4672096d4 | ||
|
|
ffe1b6abd0 | ||
|
|
16ffe80fd5 | ||
|
|
07d8a22a53 | ||
|
|
b1bf0873ce | ||
|
|
46264d08ca |
@@ -1,3 +1,7 @@
|
||||
[unstable]
|
||||
build-std = ["core", "compiler_builtins"]
|
||||
build-std-features = ["compiler-builtins-mem"]
|
||||
|
||||
[build]
|
||||
target = "x86_64-blog_os.json"
|
||||
|
||||
70
.github/workflows/build-code.yml
vendored
70
.github/workflows/build-code.yml
vendored
@@ -1,70 +0,0 @@
|
||||
name: Build Code
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
- '!staging.tmp'
|
||||
tags:
|
||||
- '*'
|
||||
schedule:
|
||||
- cron: '40 3 * * *' # every day at 3:40
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: "Test"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [
|
||||
ubuntu-latest,
|
||||
macos-latest,
|
||||
windows-latest
|
||||
]
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Install Rustup
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
|
||||
echo ::add-path::$HOME/.cargo/bin
|
||||
if: runner.os == 'macOS'
|
||||
|
||||
- name: "Print Rust Version"
|
||||
run: |
|
||||
rustc -Vv
|
||||
cargo -Vv
|
||||
|
||||
- name: "Install Rustup Components"
|
||||
run: rustup component add rust-src llvm-tools-preview
|
||||
- name: "Install cargo-xbuild"
|
||||
run: cargo install cargo-xbuild --debug
|
||||
- name: "Install bootimage"
|
||||
run: cargo install bootimage --debug
|
||||
|
||||
- name: "Run cargo xbuild"
|
||||
run: cargo xbuild
|
||||
- name: "Create Bootimage"
|
||||
run: cargo bootimage
|
||||
|
||||
|
||||
check_formatting:
|
||||
name: "Check Formatting"
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 2
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: "Use the latest Rust nightly with rustfmt"
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
profile: minimal
|
||||
components: rustfmt
|
||||
override: true
|
||||
- run: cargo fmt -- --check
|
||||
105
.github/workflows/code.yml
vendored
Normal file
105
.github/workflows/code.yml
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
name: Code
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
- '!staging.tmp'
|
||||
tags:
|
||||
- '*'
|
||||
schedule:
|
||||
- cron: '40 3 * * *' # every day at 3:40
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [
|
||||
ubuntu-latest,
|
||||
macos-latest,
|
||||
windows-latest
|
||||
]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Rust Toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
- name: Install `rust-src` Rustup Component
|
||||
run: rustup component add rust-src
|
||||
- name: Run `cargo check`
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
|
||||
test:
|
||||
name: Test
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [
|
||||
ubuntu-latest,
|
||||
macos-latest,
|
||||
windows-latest
|
||||
]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Install Rust Toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
- name: Install bootimage
|
||||
run: cargo install bootimage --debug
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Rustup Components
|
||||
run: rustup component add rust-src llvm-tools-preview
|
||||
- name: Run `cargo bootimage`
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: bootimage
|
||||
|
||||
check_formatting:
|
||||
name: Check Formatting
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Rust Toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
components: rustfmt
|
||||
override: true
|
||||
- name: Run `cargo fmt`
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --all -- --check
|
||||
|
||||
clippy:
|
||||
name: Clippy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Rust Toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
components: clippy, rust-src
|
||||
override: true
|
||||
- name: Run `cargo clippy`
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -1,5 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "blog_os"
|
||||
version = "0.1.0"
|
||||
@@ -9,6 +11,6 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bootloader"
|
||||
version = "0.8.3"
|
||||
version = "0.9.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d596849a47f28abdea62d7a6a25c4f6e69c3d9b09b0a2877db6e9cda004ca993"
|
||||
checksum = "974e79cf1b0b737839f01330fb5393095daf1124d52693696494e32523ae9ef5"
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
name = "blog_os"
|
||||
version = "0.1.0"
|
||||
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
|
||||
edition = "2018"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
bootloader = "0.8.0"
|
||||
bootloader = "0.9"
|
||||
|
||||
[[bin]]
|
||||
name = "blog_os"
|
||||
test = false
|
||||
bench = false
|
||||
|
||||
20
README.md
20
README.md
@@ -1,6 +1,6 @@
|
||||
# Blog OS (A Minimal Rust Kernel)
|
||||
|
||||
[](https://github.com/phil-opp/blog_os/actions?query=workflow%3A%22Build+Code%22+branch%3Apost-02)
|
||||
[](https://github.com/phil-opp/blog_os/actions?query=workflow%3A%22Code%22+branch%3Apost-02)
|
||||
|
||||
This repository contains the source code for the [A Minimal Rust Kernel][post] post of the [Writing an OS in Rust](https://os.phil-opp.com) series.
|
||||
|
||||
@@ -10,19 +10,23 @@ This repository contains the source code for the [A Minimal Rust Kernel][post] p
|
||||
|
||||
## Building
|
||||
|
||||
You need a nightly Rust compiler. First you need to install the `cargo-xbuild` and `bootimage` tools:
|
||||
This project requires a nightly version of Rust because it uses some unstable features. At least nightly _2020-07-15_ is required for building. You might need to run `rustup update nightly --force` to update to the latest nightly even if some components such as `rustfmt` are missing it.
|
||||
|
||||
You can build the project by running:
|
||||
|
||||
```
|
||||
cargo install cargo-xbuild bootimage
|
||||
cargo build
|
||||
```
|
||||
|
||||
Then you can build the project by running:
|
||||
To create a bootable disk image from the compiled kernel, you need to install the [`bootimage`] tool:
|
||||
|
||||
[`bootimage`]: https://github.com/rust-osdev/bootimage
|
||||
|
||||
```
|
||||
cargo xbuild
|
||||
cargo install bootimage
|
||||
```
|
||||
|
||||
To create a bootable disk image, run:
|
||||
After installing, you can create the bootable disk image by running:
|
||||
|
||||
```
|
||||
cargo bootimage
|
||||
@@ -39,10 +43,10 @@ You can run the disk image in [QEMU] through:
|
||||
[QEMU]: https://www.qemu.org/
|
||||
|
||||
```
|
||||
cargo xrun
|
||||
cargo run
|
||||
```
|
||||
|
||||
Of course [QEMU] needs to be installed for this.
|
||||
[QEMU] and the [`bootimage`] tool need to be installed for this.
|
||||
|
||||
You can also write the image to an USB stick for booting it on a real machine. On Linux, the command for this is:
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use core::panic::PanicInfo;
|
||||
|
||||
static HELLO: &[u8] = b"Hello World!";
|
||||
|
||||
#[no_mangle]
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn _start() -> ! {
|
||||
let vga_buffer = 0xb8000 as *mut u8;
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
{
|
||||
"llvm-target": "x86_64-unknown-none",
|
||||
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
|
||||
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
|
||||
"arch": "x86_64",
|
||||
"target-endian": "little",
|
||||
"target-pointer-width": "64",
|
||||
"target-c-int-width": "32",
|
||||
"target-c-int-width": 32,
|
||||
"os": "none",
|
||||
"executables": true,
|
||||
"linker-flavor": "ld.lld",
|
||||
"linker": "rust-lld",
|
||||
"panic-strategy": "abort",
|
||||
"disable-redzone": true,
|
||||
"features": "-mmx,-sse,+soft-float"
|
||||
"features": "-mmx,-sse,+soft-float",
|
||||
"rustc-abi": "x86-softfloat"
|
||||
}
|
||||
Reference in New Issue
Block a user