Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM rust:1.91.1

# Install the needed packages
RUN apt update && apt install -y clang-19 llvm-19 lld-19 qemu-system-riscv64 curl lldb-19

# Download OpenBSI (UEFI/BIOS)
# NOTE: Here we're using the version from the latest stable branch. The master branch is for active development, so we'll need to update the url to whatever the current latest is as needed.
RUN curl -LO https://github.com/qemu/qemu/blob/stable-9.2/pc-bios/opensbi-riscv64-generic-fw_dynamic.bin

# Install the needed rust target
RUN rustup target add riscv64gc-unknown-none-elf

# Install recommended cargo utilties
RUN cargo install cargo-binutils && rustup component add llvm-tools
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
"name": "Rust",
"build": {
// Path is relative to the devcontainer.json file.
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer",
"ZixuanWang.linkerscript",
"tamasfe.even-better-toml",
"fill-labs.dependi",
"vadimcn.vscode-lldb",
"github.vscode-github-actions",
"ms-azuretools.vscode-containers",
"ms-vscode-remote.remote-containers"
]
}
},
// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
"mounts": [
{
"source": "devcontainer-cargo-cache-${devcontainerId}",
"target": "/usr/local/cargo",
"type": "volume"
}
]
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
8 changes: 2 additions & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"recommendations": [
"rust-lang.rust-analyzer",
"ZixuanWang.linkerscript",
"tamasfe.even-better-toml",
"fill-labs.dependi",
"vadimcn.vscode-lldb",
"github.vscode-github-actions"
"ms-azuretools.vscode-containers",
"ms-vscode-remote.remote-containers"
]
}
33 changes: 2 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,9 @@ This is a repository of me messing around and learning how operating systems wor

# Setup

We follow the Ubuntu setup from the guide. They've been copied here for convenience, but should they diverge follow the instructions in the guide over the ones here.
We have configured a devcontainer which should configure everything that's needed to get started. We have also configured vscode to recommend the dev containers extension. When prompted, install the extension on your host machine, reload, and then when prompted again select the option to rebuild the container and reopen.

## From the guide

https://osblog.stephenmarz.com/ch0.html
https://operating-system-in-1000-lines.vercel.app/en/01-setting-up-development-environment

Install the needed packages

> sudo apt update && sudo apt install -y clang-19 llvm-19 lld-19 qemu-system-riscv64 curl lldb-19

Download OpenBSI (UEFI/BIOS)

NOTE: Here we're using the version from the latest stable branch. The master branch is for active development, so you'll need to update the url to whatever the current latest is.

> curl -LO https://github.com/qemu/qemu/blob/stable-9.2/pc-bios/opensbi-riscv64-generic-fw_dynamic.bin

Check that clang supports riscv64:

> clang -print-targets | grep riscv64

## Install the needed rust target

> rustup target add riscv64gc-unknown-none-elf

## Install recommended cargo utilties

> cargo install cargo-binutils

> rustup component add llvm-tools

See https://github.com/rust-embedded/cargo-binutils#readme for details
Inside the container, we have pre-installed the cargo-binutils tool to make inspecting the compiled objects easier. See https://github.com/rust-embedded/cargo-binutils#readme for details

## Recommended VSCode Extensions

Expand Down