diff --git a/.env.example b/.env.example index 5d171ff..146521d 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ KERNEL_NAME=kernel8.img BUILD_PATH=target/aarch64-unknown-none/release -BINARY_NAME=BINARY_NAME +BINARY_NAME=nova TFTP_PATH=/srv/tftp REMOTE_USER=TFTP_HOST_USER REMOTE_HOST=TFTP_HOST_IP diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ef94af2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,26 @@ +MIT NON-AI License + +Copyright (c) 2026, Alexander Neuhäuser + +Permission is hereby granted, free of charge, to any person obtaining a copy of the software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions. + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +In addition, the following restrictions apply: + +1. The Software and any modifications made to it may not be used for the purpose of training or improving machine learning algorithms, + including but not limited to artificial intelligence, natural language processing, or data mining. This condition applies to any derivatives, + modifications, or updates based on the Software code. Any usage of the Software in an AI-training dataset is considered a breach of this License. + +2. The Software may not be included in any dataset used for training or improving machine learning algorithms, + including but not limited to artificial intelligence, natural language processing, or data mining. + +3. Any person or organization found to be in violation of these restrictions will be subject to legal action and may be held liable + for any damages resulting from such use. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 96fdc80..9c1cf7e 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,120 @@ # NovaOS -NovaOS is a expository project where I build a kernel from scratch for a Raspberry PI 3 B+. +![NovaOS banner](docs/banner.png) -## Features +NovaOS is a hobby operating system kernel written in Rust for the Raspberry Pi 3 B+. +It is built as a learning project for low-level systems programming, bare-metal boot flow, and kernel development. -- Delay and sleep ✓ -- UART ✓ -- Switching ELs ✓ -- GPIOs ✓ -- GPIO Interrupts ✓ -- Communicate with peripherals via mailboxes ✓ -- Frame Buffer ✓ -- Heap Memory allocation ✓ -- MMU ✓ -- SVC instructions ~ -- Basic Console over UART ~ -- Multi Applications ~ -- Multi Core -- Dynamic clock speed -- Kernel Independent Applications -- Multiprocessing +## At A Glance + +NovaOS currently includes: + +- UART initialization and logging +- Delay and sleep primitives +- Exception level transitions across EL2, EL1, and EL0 +- GPIO control and interrupt handling +- Peripheral mailbox communication +- Framebuffer drawing primitives +- Heap memory allocation +- MMU initialization and translation table setup + +Work in progress: + +- SVC instruction handling +- Basic UART console improvements +- Multi-application management + +Planned next: + +- Multi-core support +- Dynamic clock speed management +- Kernel-independent applications +- Multiprocessing improvements + +## Project Structure + +- `src/` - kernel source, architecture code, peripherals, interrupts, and runtime +- `workspace/` - supporting crates such as `heap` and `nova_error` +- `tools/` - build, simulation, SD image generation, and deployment scripts +- `firmware_files/` - Raspberry Pi firmware files copied to SD or TFTP +- `link.ld` - linker script for the kernel image + +## Requirements + +You will need: + +- Rust nightly toolchain (`rust-toolchain.toml` pins `nightly`) +- Rust target `aarch64-unknown-none` +- `llvm-objcopy` for generating `kernel8.img` +- `qemu-system-aarch64` for emulation +- `mtools` (`mformat`, `mcopy`) for SD image generation + +Install the Rust target if needed: + +```bash +rustup target add aarch64-unknown-none +``` + +## Build + +Debug image: + +```bash +cd tools +./build_debug.sh +``` + +Release image: + +```bash +cd tools +./build_release.sh +``` + +Both scripts produce a `kernel8.img` under `target/aarch64-unknown-none//`. + +## Run In QEMU + +1. Generate an SD image with firmware files: + +```bash +cd tools +./generate_sd_card.sh +``` + +2. Start the emulator: + +```bash +cd tools +./start_simulator.sh +``` + +For debug mode with the GDB stub enabled (`-S -s`): + +```bash +cd tools +./start_simulator_debug.sh +``` + +## Deploy To Hardware + +Use the TFTP workflow to deploy to a Raspberry Pi: + +1. Copy `.env.example` to `.env` and fill in your values: + - `REMOTE_USER` + - `REMOTE_HOST` + - `TFTP_PATH` + - `BUILD_PATH` + - `BINARY_NAME` + - `KERNEL_NAME` +2. Run: + +```bash +cd tools +./deply_to_hw.sh +``` + +## Notes + +- This is an educational kernel project and is actively evolving. +- Interfaces and boot flow may change as features are added. diff --git a/docs/banner.png b/docs/banner.png new file mode 100644 index 0000000..e4697fb Binary files /dev/null and b/docs/banner.png differ