Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

jewlexx/do-not-enter

Repository files navigation

Do Not Enter

Most code is adapted from rust-raspberrypi-OS-tutorials, under the MIT or Apache-2.0 license, at your discretion.

The following, until specified, is copied from rust-raspberrypi-OS-tutorials, and adapted where necessary

🛠 System Requirements

Building and deploying is primarily targeted at Linux-based distributions. If on Windows, WSL is strongly recommended, using usbipd to connect to the physical hardware.

If developing on Windows, you are on your own...

🚀 The tl;dr Version

  1. Install Docker Engine.

  2. (Linux only) Ensure your user account is in the docker group.

  3. Prepare the Rust toolchain. Most of it will be handled on first use through the rust-toolchain file. What's left for us to do is:

    1. If you need to install Rust from scratch:

      curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
      
      source $HOME/.cargo/env
    2. With Rust installed

      cargo install cargo-binutils rustfilt
  4. In case you use Visual Studio Code, I implore you install the Rust Analyzer extension.

🧰 More Details: Eliminating Toolchain Hassle

This series tries to put a strong focus on user friendliness. Therefore, efforts were made to eliminate the biggest painpoint in embedded development as much as possible: Toolchain hassle.

Rust itself is already helping a lot in that regard, because it has built-in support for cross-compilation. All that we need for cross-compiling from an x86 host to the Raspberry Pi's AArch64 architecture will be automatically installed by rustup. However, besides the Rust compiler, we will use some more tools. Among others:

  • QEMU to emulate our kernel on the host system.
  • A self-made tool called Minipush to load a kernel onto the Raspberry Pi on-demand over UART.
  • OpenOCD and GDB for debugging on the target.

There is a lot that can go wrong while installing and/or compiling the correct version of each tool on your host machine. For example, your distribution might not provide the latest version that is needed. Or you are missing some hard-to-get dependencies for the compilation of one of these tools.

This is why we will make use of Docker whenever possible. We are providing an accompanying container that has all the needed tools or dependencies pre-installed, and it gets pulled in automagically once it is needed. If you want to know more about Docker and peek at the provided container, please refer to the repository's docker folder.

📟 USB Serial Output

Since the kernel developed in the tutorials runs on the real hardware, it is highly recommended to get a USB serial cable to get the full experience.

  • You can find USB-to-serial cables that should work right away at [1] [2], but many others will work too. Ideally, your cable is based on the CP2102 chip.
  • You connect it to GND and GPIO pins 14/15 as shown below.
  • Tutorial 5 is the first where you can use it. Check it out for instructions on how to prepare the SD card to boot your self-made kernel from it.
  • Starting with tutorial 6, booting kernels on your Raspberry is getting really comfortable. In this tutorial, a so-called chainloader is developed, which will be the last file you need to manually copy on the SD card for a while. It will enable you to load the tutorial kernels during boot on demand over UART.

UART wiring diagram

About

A little kernel/os I wrote for a school project

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published