An open API service indexing awesome lists of open source software.

https://github.com/petitstrawberry/scarlet-sdk

Build tools for Scarlet.
https://github.com/petitstrawberry/scarlet-sdk

build-system build-tool cargo-plugin osdev rust scarlet

Last synced: 7 days ago
JSON representation

Build tools for Scarlet.

Awesome Lists containing this project

README

          

# scarlet-sdk

Build tools for [Scarlet](https://github.com/petitstrawberry/Scarlet).

## Installing

```bash
cargo install --git https://github.com/petitstrawberry/scarlet-sdk cargo-scarlet
cargo install --git https://github.com/petitstrawberry/scarlet-sdk cargo-scarlet-plugin-limine
```

Or from a local clone:

```bash
git clone https://github.com/petitstrawberry/scarlet-sdk.git
cd scarlet-sdk
cargo install --path cargo-scarlet
cargo install --path cargo-scarlet-plugin-limine
```

## Tools

| Package | Binary | Description |
|---------|--------|-------------|
| `cargo-scarlet` | `cargo-scarlet` | Build system CLI — reads `scarlet.toml`, builds kernel, composes images |
| `cargo-scarlet-plugin-limine` | `cargo-scarlet-plugin-limine` | Limine UEFI boot image plugin |

## Quick Start: Creating a Project

```bash
# Scaffold a new project with a local kernel source
cargo scarlet new --project my-board --target riscv64gc-unknown-none-elf --kernel-path /path/to/kernel

# Or with a git source (defaults to github.com/petitstrawberry/Scarlet)
cargo scarlet new --project my-board --target riscv64gc-unknown-none-elf
cargo scarlet new --project my-board --target riscv64gc-unknown-none-elf --kernel-rev v0.17.0
```

This generates:

```
my-board/
├── Cargo.toml
├── build.rs
├── scarlet.toml
├── src/main.rs # TODO: implement arch_start_kernel
├── lds/ # TODO: add linker script
├── .cargo/config.toml # TODO: set target, build-std, runner, rustflags
└── .scarlet/scarlet-modules/ # auto-generated by cargo-scarlet — do not edit
├── Cargo.toml
├── src/lib.rs
└── .cargo/config.toml # auto-generated template — do not edit
```

After scaffolding, you need to:

1. Edit `.cargo/config.toml` — set `build.target`, `unstable.build-std`, `runner`, and `rustflags` (linker script path)
2. Add a linker script to `lds/`
3. Implement the boot entry in `src/main.rs` (e.g. call `scarlet::arch::riscv64::boot::limine::limine_entry()`)

Files under `.scarlet/` are auto-generated by cargo-scarlet. Do not edit them.

Then build and run:

```bash
cargo scarlet image --project my-board
cargo scarlet run --project my-board --release
```

## Quick Start: Creating a Loadable Scarlet Module (LSM)

```bash
cargo scarlet new --lsm my-module
```

This generates a loadable scarlet module with `Cargo.toml`, `module.toml`, `build.rs`, and `src/lib.rs`.

```bash
# Build the LSM
cargo scarlet build --lsm my-module --target riscv64gc-unknown-none-elf
```

## Commands

```bash
cargo scarlet build --project # Build kernel binary
cargo scarlet check --project # Type-check without building
cargo scarlet clippy --project # Run clippy
cargo scarlet image --project # Build kernel + compose images
cargo scarlet run --project --release # Build images and launch runner
cargo scarlet update --project # Resolve git/URL sources, write lock
cargo scarlet new --project --target # Scaffold new project
cargo scarlet new --lsm # Scaffold new loadable scarlet module
```

## Documentation

See [Scarlet Build System docs](https://github.com/petitstrawberry/Scarlet/tree/main/docs/build-system) for the full specification.