> For the complete documentation index, see [llms.txt](https://open-rt.gitbook.io/open-surfacert/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://open-rt.gitbook.io/open-surfacert/surface-rt/firmware/bct.md).

# BCT

Boot Configuration Table

## What is it and how to get it

The boot configuration table contains information about which bootloader to boot. On the Surface RT it is stored on the SPI flash. Go to [SPI flash](/open-surfacert/surface-rt/firmware/spi-flash.md), to dump it directly from SPI. Or do it with nvflash (recommended): `sudo ./utils/nvflash_v1.13.87205 --getbct --bct surfacert.bin --configfile ./utils/flash.cfg`&#x20;

## Decompiling and Compiling

### Decompiling

To decompile your BCT into a configuration file, use the tool bct\_dump.\
Usage: `bct_dump <your-bct-file>`\
Tip you can add  `> <output-file>` to reroute the output to a file.

### Compiling

#### Compiling configuration file

You can compile your bct.cfg file by using the tool cbootimage.\
Usage: `cbootimage -s tegra30 -t 30 -gbct <input-bct-configuration-file> <output-bct-file>`\
Example: `cbootimage -s tegra30 -t 30 -gbct surfacert-custom.bct.cfg surfacert-custom.bct`

#### &#x20;Adding a Bootloader to BCT

To generate a image file with your BCT and provided bootloader, again use cbootimage.\
Usage: `cbootimage -d -s tegra30 -t 30 <input-config-file> <output-image-file>`\
Example: `cbootimage -d -s tegra30 -t 30 surfacert.config surfacert.output`\
\<input-config-file> is a file controlling how the .img file should be created. It has the following structure:

```
# Refernence: https://github.com/NVIDIA/cbootimage-configs/blob/master/tegra30/nvidia/cardhu/cardhu-a05-2gb-emmc.img.cfg

Version       = 0x00000001;
Bctcopy       = 1;
Bctfile       = <your-bct-file>;
BootLoader    = <bootloader-file-name>,<load-address>,<entry-point>,Complete;
```

Example:

```
Version       = 0x00000001;
Bctcopy       = 1;
Bctfile       = surfacert-custom.bct;
BootLoader    = mtd0-bootloader,0x80808000,0x80808000,Complete;
```

\
Doing this will create a image file of your BCT and the bootloader you provided. The BCT will automatically updated with the correct sizes and hashes.
