{"id":13672654,"url":"https://github.com/Narasimha1997/rust-kernel-barebones","last_synced_at":"2025-04-27T22:32:31.692Z","repository":{"id":104767826,"uuid":"419660271","full_name":"Narasimha1997/rust-kernel-barebones","owner":"Narasimha1997","description":"A minimal 64-bit rust kernel and a bunch of configuration scripts that can be used to bootstrap Operating system development using Nightly-Rust compiler.","archived":false,"fork":false,"pushed_at":"2021-12-04T13:06:24.000Z","size":37,"stargazers_count":46,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-12T04:39:39.898Z","etag":null,"topics":["cargo","kernel","osdev","rust","rust-osdev","x86-64"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Narasimha1997.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-10-21T09:28:01.000Z","updated_at":"2024-11-26T08:22:29.000Z","dependencies_parsed_at":"2023-05-29T17:45:28.349Z","dependency_job_id":null,"html_url":"https://github.com/Narasimha1997/rust-kernel-barebones","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narasimha1997%2Frust-kernel-barebones","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narasimha1997%2Frust-kernel-barebones/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narasimha1997%2Frust-kernel-barebones/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narasimha1997%2Frust-kernel-barebones/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Narasimha1997","download_url":"https://codeload.github.com/Narasimha1997/rust-kernel-barebones/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251219601,"owners_count":21554444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cargo","kernel","osdev","rust","rust-osdev","x86-64"],"created_at":"2024-08-02T09:01:43.150Z","updated_at":"2025-04-27T22:32:30.050Z","avatar_url":"https://github.com/Narasimha1997.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# rust-kernel-barebones\nA minimal 64-bit rust kernel and a bunch of configuration scripts that can be used to bootstrap Operating system development using Nightly-Rust (x86_64-unkown-linux-gnu host-triple) compiler.\n\nThis repository uses tools built by the awesome Rust OsDev [community](https://github.com/rust-osdev) (like xbuild, bootloader crates) and configures all of these tools to work together so developers can use them without having to worry much on toochain configuration. The toolchain builds and configures the project to use `x86_64-unknwon-none` target. Some features include:\n\n1. A single script that configures the whole environment.\n2. A single script to build the kernel and emulate it using Qemu.\n3. VS Code RLS configuration.\n\n### Tools used by this barebones:\n1. [bootloader](https://github.com/rust-osdev/bootloader) - A bootloader written in Rust.\n3. [cargo-xbuild](https://github.com/rust-osdev/cargo-xbuild) - A tool that takes care of managing nightly rust toolchain.\n\n### Prerequisites\n1. A linux based operating system with bash shell.\n2. apt package manager (if you are using Red hat based distros, modify `tools/setup_env.sh` file.)\n\n### How to set-up?\nFollow these simple steps to bootstrap a working kernel development environment:\n1. Clone the repository with it's submodules:\n\n```\ngit clone --recurse-submodule git@github.com:Narasimha1997/rust-kernel-barebones.git\n```\n\n2. Setup the environment:\nJust run the file:\n```\nbash ./tools/setup_env.sh\n```\n\nThis will check for tools like qemu, kvm, rustc, cargo and jq. Tools which are not present will be installed and you may need to enter few choices while installation. Next it will download and install few rust crates that are required for the toolchain to work properly. Then the script configures VS code editor to make RLS plugin recognize the `x86_64-unknown-none` target.\n\n**Note:**: After running this script you may have to restart the shell before proceeding to step 3 if `cargo` and `rustc` are freshly installed because the `$PATH` needs to be updated to make sure `cargo` and `rustc` are picked up. You can also run `source ~/.bashrc` to manually refresh the shell's env.\n\n3. Build and run the kernel:\nTo build and run the kernel, just run:\n```\nbash tools/run_qemu.sh\n```\nThis will build the kernel with bootloader and creates a bootable image, then spins up the qemu with KVM acceleration. If you want to only build and skip emulation, then:\n\n```\nbash tools/run_qemu.sh --build\n```\nThe build artifcats are generated at `kbin` directory, so build artifacts will be cached for next time. If you want to force a rebuild from scratch again, then:\n```\nbash tools/run_qemu.sh --clean\n```\nYou can use both of these options together as well:\n```\nbash tools/run_qemu.sh --clean --build\n```\n\nIf everything is successful, the kernel should bootup into a blank screen and qemu should create a `serial.out` file where the kernel will write `Hello, World!!` via a serial port.\n\n### UEFI Mode:\nNormally the kernel will be booted in legacy BIOS mode. In order to enable UEFI mode, pass `--uefi` flag to the `run_qemu.sh`.\n```\nbash tools/run_qemu.sh --uefi\n```\nThe UEFI mode uses [Open Virtual Machine Firmware (OVMF)](http://www.linux-kvm.org/downloads/lersek/ovmf-whitepaper-c770f8c.txt) and can be installed via `ovmf` package. The `setup_env.sh` script will install this as well, the UEFI firmware will be added to `qemu-system-x86_64` via `-bios /usr/share/ovmf/OVMF.fd` flag. The `--uefi` flag can be used with other flags as well:\n```\nbash tools/run_qemu.sh --uefi --clean --build\n```\n\n#### Configuring QEMU parameters:\nTo use your own custom parameters for qemu emulation, modify `QEMU_ARGS` variable in `tools/run_qemu.sh` file.\n\n### Contributing:\nFeel free to try this tool, raise issues, suggest changes or make pull requests. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNarasimha1997%2Frust-kernel-barebones","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNarasimha1997%2Frust-kernel-barebones","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNarasimha1997%2Frust-kernel-barebones/lists"}