The GreenOS operating System is a minimal operating system developed as a part of my tutorial series. GreenOS is a bare-metal OS that will run on the BeagleV-Ahead board, using the RISC-V64 ISA. I may add support for additional architectures; however, I am busy and this is a hobby.
When developing an operating system, you'll most liklely want your OS to run on several different architectures (e.g., ARM, RISC-V, i386/x86, x86_64, etc.). Unless you plan on purchasing hardware to test functionality for each architecture, you'll need to familiarize yourself with the process of Cross-Compiling.
Cross-Compiling can be a headache; nevertheless, it's a vital skill for OS Development. As mentioned above, this tutorial will use the BeagleV-Ahead, which uses the RISC-V ISA. Native language compilers for C/C++ on your development machine (Linux, MacOS, Linux, or *BSD) will not produce the target machine code for RISC-V, so you must build a cross-compile environment with a toolchain that can.
Tip
It may be worth it to learn more about toolchains and cross-compiling before beginning. Athough not necessary, it may save you some time. Listed below are a few optional resources.
Follow the official documentation on the RISC-V Getting Started Guide
for running 64- and 32-bit RISC-V Linux.
Cross compiling can present unique challengiFor additional information on cross-compiling read the following: - cross-compiling guide on OSDev Wiki
If you're not already familiar with the OSDev Wiki, you should bookmark it and familiarize yourself with its content. It's not a replacement for manuals and texts, but a very helpful resource when developing an operating system.
Another cool guide is Operating Systems: From 0 to 1. The book author has graciously made the book available to download for free; this resource is especially helpful if you're less familiar with Bare-metal OS. Most books focus on OS concepts and skip hardware interaction, which is essential to developing an OS.
The BrokenThorn OS Development series is older, but still relevant. It includes many interesting tutorials such as DMA programming, using Programmable Interrupt Controllers (PIC), etc.
Please visit my documentation reference page for BeagleV.s
Most of what you need can be found in the Five EmbedDev documentation. If you need any additional help, you can search online.
The build system that you choose will depend on the Language selected to develop your operating system. GreenOS will be developed mostly in C.
-
GNU Make (C/C++)
-
GNU CMake (C/C++, C#, CUDA, Objective-C/C++, Swift)
-
Meson (C/C++, D, Fortran, Java, and Rust)
-
Ninja (C++, C with some work)
-
Gradle (C/C++, Java, JavaScript)
GNU Binutils
GNU Recommended Tools for Compilation
GreenOS - lightweight, secure OS
Copyright (C) 2024 Maurice Green
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.