mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Compare commits
102 Commits
post-12-wi
...
93d0daa1e0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93d0daa1e0 | ||
|
|
83e6c0bc00 | ||
|
|
2b11ad8397 | ||
|
|
fa51f3adbf | ||
|
|
1f097bba71 | ||
|
|
99fbbad9b0 | ||
|
|
94d14d8d62 | ||
|
|
6f0be666f3 | ||
|
|
d9fa84edd6 | ||
|
|
97de98df33 | ||
|
|
9684f75819 | ||
|
|
d6cc562907 | ||
|
|
b44d8ab7fc | ||
|
|
c551fec1ce | ||
|
|
e2a3e76a32 | ||
|
|
16bbb8f972 | ||
|
|
430e2143f8 | ||
|
|
86ffa24e8e | ||
|
|
df0c0b5783 | ||
|
|
c27eb1da9c | ||
|
|
2a61f88d8a | ||
|
|
a90a8bea67 | ||
|
|
f52872f3b9 | ||
|
|
688a21e4ed | ||
|
|
07d6c9c84e | ||
|
|
2265ddecad | ||
|
|
3bc023ec2d | ||
|
|
38604da92f | ||
|
|
1a53a115da | ||
|
|
c6990cb52d | ||
|
|
ef9bb1a087 | ||
|
|
2bc4490404 | ||
|
|
7288459bdf | ||
|
|
7959b77ebd | ||
|
|
bebad6d5a9 | ||
|
|
6c8fea8b00 | ||
|
|
b99c3f6d1d | ||
|
|
66c1792034 | ||
|
|
3280a0afc7 | ||
|
|
6393247a3b | ||
|
|
a387a00c85 | ||
|
|
faa8d15cb7 | ||
|
|
4c9cd3ae32 | ||
|
|
26f1f5b896 | ||
|
|
cbead25b43 | ||
|
|
1f49e2e9fe | ||
|
|
8708b54756 | ||
|
|
2c25d55810 | ||
|
|
021762cf30 | ||
|
|
ec95ac0e5a | ||
|
|
d8f280315f | ||
|
|
e39c7d8ad8 | ||
|
|
066c278277 | ||
|
|
bdb6a424a8 | ||
|
|
f40717901b | ||
|
|
96844f6519 | ||
|
|
1501669819 | ||
|
|
195f4489e6 | ||
|
|
1b86d7fd62 | ||
|
|
deb0f63dff | ||
|
|
fbdcd45d16 | ||
|
|
d658949f5b | ||
|
|
d12842bcd5 | ||
|
|
0e52ccbebb | ||
|
|
ea5aad0e0c | ||
|
|
4e38e7ddf8 | ||
|
|
1afa3af79d | ||
|
|
49dce7ada7 | ||
|
|
552eb97f75 | ||
|
|
c42cee8d89 | ||
|
|
eace075f2c | ||
|
|
2d5150f2a3 | ||
|
|
ebb9f0b8a7 | ||
|
|
3200b7a68d | ||
|
|
cde3c8f955 | ||
|
|
6ad573bb11 | ||
|
|
f316bd1a08 | ||
|
|
4a4d704384 | ||
|
|
1ddc27ca88 | ||
|
|
71d8a438f7 | ||
|
|
3a77cbe794 | ||
|
|
3fb4695f6c | ||
|
|
635677d07c | ||
|
|
b276ec4765 | ||
|
|
406c406d5f | ||
|
|
6f9cfce6f9 | ||
|
|
651adbc8bd | ||
|
|
4bbaae24a4 | ||
|
|
44d7654ef6 | ||
|
|
f135aefae8 | ||
|
|
ffaac76876 | ||
|
|
5ae9f62f4d | ||
|
|
da0ee38f09 | ||
|
|
263e852dcc | ||
|
|
614e5b0e86 | ||
|
|
9ee42e0f5f | ||
|
|
c4672096d4 | ||
|
|
ffe1b6abd0 | ||
|
|
16ffe80fd5 | ||
|
|
07d8a22a53 | ||
|
|
a004e7da9c | ||
|
|
b1bf0873ce |
@@ -1,3 +1,7 @@
|
|||||||
|
[unstable]
|
||||||
|
build-std = ["core", "compiler_builtins"]
|
||||||
|
build-std-features = ["compiler-builtins-mem"]
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
target = "x86_64-blog_os.json"
|
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
|
||||||
26
Cargo.lock
generated
26
Cargo.lock
generated
@@ -1,28 +1,30 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "blog_os"
|
name = "blog_os"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bootloader",
|
"bootloader",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"spin",
|
"spin 0.5.2",
|
||||||
"volatile",
|
"volatile",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bootloader"
|
name = "bootloader"
|
||||||
version = "0.8.8"
|
version = "0.9.33"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c3ed4f735c4e455ba86a3d2939b1c0729414153642106c9d035693355630a42c"
|
checksum = "7bdfddac270bbdd45903296bc1caf29a7fdce6b326aaf0bbab7f04c5f98b7447"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"spin",
|
"spin 0.9.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -32,7 +34,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "volatile"
|
name = "spin"
|
||||||
version = "0.2.6"
|
version = "0.9.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6af0edf5b4faacc31fc51159244d78d65ec580f021afcef7bd53c04aeabc7f29"
|
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "volatile"
|
||||||
|
version = "0.2.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f6b06ad3ed06fef1713569d547cdbdb439eafed76341820fb0e0344f29a41945"
|
||||||
|
|||||||
@@ -2,13 +2,18 @@
|
|||||||
name = "blog_os"
|
name = "blog_os"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
|
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
|
||||||
edition = "2018"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bootloader = "0.8.0"
|
bootloader = "0.9"
|
||||||
volatile = "0.2.6"
|
volatile = "0.2.6"
|
||||||
spin = "0.5.2"
|
spin = "0.5.2"
|
||||||
|
|
||||||
[dependencies.lazy_static]
|
[dependencies.lazy_static]
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
features = ["spin_no_std"]
|
features = ["spin_no_std"]
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "blog_os"
|
||||||
|
test = false
|
||||||
|
bench = false
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -1,6 +1,6 @@
|
|||||||
# Blog OS (VGA Text Mode)
|
# Blog OS (VGA Text Mode)
|
||||||
|
|
||||||
[](https://github.com/phil-opp/blog_os/actions?query=workflow%3A%22Build+Code%22+branch%3Apost-03)
|
[](https://github.com/phil-opp/blog_os/actions?query=workflow%3A%22Code%22+branch%3Apost-03)
|
||||||
|
|
||||||
This repository contains the source code for the [VGA Text Mode][post] post of the [Writing an OS in Rust](https://os.phil-opp.com) series.
|
This repository contains the source code for the [VGA Text Mode][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 [VGA Text Mode][post] post of t
|
|||||||
|
|
||||||
## Building
|
## 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
|
cargo bootimage
|
||||||
@@ -39,10 +43,10 @@ You can run the disk image in [QEMU] through:
|
|||||||
[QEMU]: https://www.qemu.org/
|
[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:
|
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;
|
|||||||
|
|
||||||
mod vga_buffer;
|
mod vga_buffer;
|
||||||
|
|
||||||
#[no_mangle]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "C" fn _start() -> ! {
|
pub extern "C" fn _start() -> ! {
|
||||||
println!("Hello World{}", "!");
|
println!("Hello World{}", "!");
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
{
|
{
|
||||||
"llvm-target": "x86_64-unknown-none",
|
"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",
|
"arch": "x86_64",
|
||||||
"target-endian": "little",
|
"target-endian": "little",
|
||||||
"target-pointer-width": "64",
|
"target-pointer-width": 64,
|
||||||
"target-c-int-width": "32",
|
"target-c-int-width": 32,
|
||||||
"os": "none",
|
"os": "none",
|
||||||
"executables": true,
|
"executables": true,
|
||||||
"linker-flavor": "ld.lld",
|
"linker-flavor": "ld.lld",
|
||||||
"linker": "rust-lld",
|
"linker": "rust-lld",
|
||||||
"panic-strategy": "abort",
|
"panic-strategy": "abort",
|
||||||
"disable-redzone": true,
|
"disable-redzone": true,
|
||||||
"features": "-mmx,-sse,+soft-float"
|
"features": "-mmx,-sse,+soft-float",
|
||||||
|
"rustc-abi": "x86-softfloat"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user