# Shelter kernel boot configuration

## Introduction

The Shelter kernel requires a boot configuration in order to start. It doesn't come under the form of a command line but under the form of a C struct. For details on how to transmit the configuration to the kernel, please see [boot contract docs](bootcontract.md).

## Overview

Shelter boot configuration come under the following layout (extracted from `shelter/lib/include/kernel/conf.h`) :
``` C
typedef struct __attribute__((aligned(8))) {
  sh_uint8 sig_start[8];
  sh_uint8 log_level;
  sh_uint16 page_table_allocator_level;
  sh_page_PHYSICAL_ADDRESS page_table_pool_pa;
  sh_page_VIRTUAL_ADDRESS page_table_pool_va;
  sh_bool test_benchmark;
  sh_uint64 bench_iterations;
  sh_bool log_disable_serial_port;
  sh_bool disable_serial_port;
  sh_uint16 log_ring_size;
  sh_uint8 sig_end[8];
} sh_conf_BOOT_CONFIG;
```

The starting signature must be `ShCfgBeg` in ASCII and the starting signature must be `ShCfgEnd` in ASCII. The alignment to respect for the boot config is 8 bytes.

## List of all keys

**log_level:**
- Type: 1 byte unsigned integer
- Description: represent the minimal (inclusive) log level for any log payload to be logged, can range from 0 to 6. The value of this key is provided by the `kernel_log_level` from the Blastproof boot config

**page_table_allocator_level:**
- Type: 2 bytes unsigned integer
- Description: the value of the bumb allocator after all mapping inside the kernel boot PTP

**page_table_pool_pa:**
- Type: physical address, aka 8 bytes unsigned integer
- Description: the physical address of the first page of the kernel boot PTP

**page_table_pool_va:**
- Type: virtual address, aka 8 bytes unsigned integer
- Description: the virtual address of the first page of the kernel boot PTP, inside kernel virtual memory layout

**test_benchmark:**
- Type: boolean, aka 1 byte unsigned integer
- Description: define if the kernel should test and benchmark his subsystems. The value of this key is provided by the `kernel_test_benchmark` from the Blastproof boot config

**bench_iterations:**
- Type: 8 bytes unsigned integer
- Description: define the amount of iterations to apply for compatible benchmarks. Not all benchmarks will follow this value. The value of this key is provided by the `kernel_bench_iterations` from the Blastproof boot config

**log_disable_serial_port:**
- Type: boolean, aka 1 byte unsigned integer
- Description: if true, the kernel will not output his logs on the serial port. The value of this key is provided by the `kernel_log_disable_serial_port` from the Blastproof boot config

**disable_serial_port:**
- Type: boolean, aka 1 byte unsigned integer
- Description: define if the kernel should allow serial port usage. The value of this key is provided by the `kernel_disable_serial_port` from the Blastproof boot config

**log_ring_size:**
- Type: 2 bytes unsigned integer
- Description: define the amount of pages used for logging ring buffer
