> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/a16z/jolt/llms.txt
> Use this file to discover all available pages before exploring further.

# jolt generate

> Generate target specifications and linker scripts for custom memory layouts

## Overview

The `jolt generate` command provides utilities for advanced users who need to customize the RISC-V target specification or linker script for their guest programs. This is useful when working with custom memory layouts or non-standard build configurations.

## Subcommands

### jolt generate target

Generates a custom RISC-V target specification JSON file.

```bash theme={null}
jolt generate target [OPTIONS]
```

<ParamField path="--profile" type="string">
  Use a predefined target profile
</ParamField>

<ParamField path="--target" type="string">
  Specify a custom target triple
</ParamField>

<ParamField path="--output" type="string" default="<target-triple>.json">
  Output path for the generated target specification (short: `-o`)
</ParamField>

**Example:**

```bash theme={null}
# Generate target spec from a profile
jolt generate target --profile riscv64imac-unknown-none-elf -o my-target.json

# Generate target spec from a custom triple
jolt generate target --target riscv64imac-unknown-none-elf -o custom.json
```

The generated JSON file contains the complete target specification including:

* Architecture settings (data layout, pointer width)
* ABI configuration
* Supported features
* Linker configuration

You can then use this target specification with `rustc --target=my-target.json` for custom builds.

### jolt generate linker

Generates a linker script with custom memory layout.

```bash theme={null}
jolt generate linker [OPTIONS]
```

<ParamField path="--output" type="string" default="linker.ld">
  Output path for the generated linker script (short: `-o`)
</ParamField>

<ParamField path="--ram-start" type="hex">
  Starting address for RAM
</ParamField>

<ParamField path="--ram-size" type="hex">
  Size of RAM region
</ParamField>

<ParamField path="--stack-size" type="hex">
  Size of the stack region
</ParamField>

<ParamField path="--heap-size" type="hex">
  Size of the heap region
</ParamField>

**Example:**

```bash theme={null}
# Generate linker script with custom memory layout
jolt generate linker -o custom-linker.ld

# The generated script will include memory regions and sections
# that match your specified layout
```

The generated linker script defines:

* Memory regions (RAM, ROM, etc.)
* Section placements (.text, .data, .bss, .heap, .stack)
* Entry point and initialization code locations

## Use Cases

### Custom Memory Layout

When you need a specific memory layout for your guest program:

```bash theme={null}
# Generate custom linker script
jolt generate linker -o custom.ld

# Use it with build
RUSTFLAGS="-C link-arg=-Tcustom.ld" jolt build
```

### Cross-Compilation

When targeting a custom RISC-V variant:

```bash theme={null}
# Generate target specification
jolt generate target --target riscv64gc-unknown-linux-gnu -o riscv64gc.json

# Build with custom target
jolt build --target riscv64gc.json
```

### Debugging Build Issues

Generate the default configuration to understand what Jolt uses:

```bash theme={null}
# See the default target spec
jolt generate target --profile riscv64imac-unknown-none-elf

# See the default linker script
jolt generate linker
```

## Notes

<Note>
  Most users do not need these commands. The default target specification and linker script work for typical zkVM programs.
</Note>

<Warning>
  Custom target specifications must be compatible with RV64IMAC instruction set. Jolt requires specific RISC-V features to function correctly.
</Warning>

## Related Commands

* [jolt build](/cli/build) - Build guest programs (uses target specs internally)
* [jolt new](/cli/new) - Create new projects (includes default configuration)
