diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..35f2aec --- /dev/null +++ b/.devcontainer/Dockerfile @@ -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 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..56742a6 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f33a02c --- /dev/null +++ b/.github/dependabot.yml @@ -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 diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 33b9975..ee7ff55 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -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" ] } \ No newline at end of file diff --git a/README.md b/README.md index e0e783d..bab6e40 100644 --- a/README.md +++ b/README.md @@ -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