Giter Site home page Giter Site logo

baremetal_hello_world's Introduction

Basic Example

This a minimal example how to create a bootable disk image with the bootloader crate.

This code is based on basic example from repository located at:

https://github.com/rust-osdev/bootloader

The code was separated from the booloader to experiment solely with bareprogramming standalone applications.

Structure

The kernel code is in src/main.rs. It requires some special build instructions to recompile the core library for the custom target defined in x86_64-custom.json. It depends on the bootloader crate for booting..

The simple_boot sub-crate is responsible for combining the kernel with the bootloader to create bootable disk images. It is configured as a custom runner, which means that cargo will automatically invoke it on cargo run. The compiled kernel will hereby be passed as an argument.

Enable Rust nightly

rustup default nightly rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu

Installation Dependencies

  1. rustup update
  2. rustup target add aarch64-unknown-none thumbv7em-none-eabihf
  3. rustup component add llvm-tools-preview
  4. cargo install cargo-binutils cargo-embed
  5. install qemu

based on: https://google.github.io/comprehensive-rust/bare-metal.html

Build Commands

The .cargo/config.toml file defines command aliases for the common commands:

  • To build the kernel, run cargo kbuild.
  • To build the kernel and turn it into a bootable disk image, run cargo kimage (short for "kernel image"). This will invoke our boot sub-crate with an additional --no-run argument so that it just creates the disk image and exits.
  • To additionally run the kernel in QEMU after creating the disk image, run cargo krun.

baremetal_hello_world's People

Contributors

horahh avatar

Stargazers

Matheus Francisco avatar Harun Korkmaz avatar Matthew Orris avatar Juri Hahn avatar Ivan Zvonimir Horvat avatar Vitaliy Yermolenko avatar Aye7 avatar Micah Dubinko avatar Pierre Fenoll avatar Mert Sefa AKGUN avatar Horst Schwarz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.