> For the complete documentation index, see [llms.txt](https://dev.solid-run.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.solid-run.com/marvell/a8040/sbc-platform/a8040-software/a8040-buildroot.md).

# A8040 Buildroot

## Introduction

Intention of this page is to provide the developers a quick page how to build mainline buildroot with MACHIATOBin u-boot, ATF and kernel with simple root filesystem.

## Grabbing source and building instructions

Getting the sources:

```
git clone git://git.busybox.net/buildroot
cd buildroot
```

Download [this mcbin minimal buildroot](https://images.solid-run.com/8040/Buildroot/buildroot_config_minimal.txt.gz) config file, gunzip it and place it buildroot directory as .config

Building the sources - run:

```
make
```

An error will occur almost before building is finished. The reason is that the cloned ATF firmware doesn't include Marvell DDR interface initializations, in order to fix run the following:

```
git clone git@github.com:MarvellEmbeddedProcessors/mv-ddr-marvell.git output/build/arm-trusted-firmware-atf-v1.2-armada-17.02/drivers/marvell/mv_ddr/
make
```

## Using the result images

* Boot from SPI while placing it in the first sector of the flash
* Boot from Micro SD while placing it in the second sector of the Micro SD
* Boot from eMMC while placing it in the first sector of either the first or second boot partitions
* Boot from UART - Can be UART xmodem transmitted on a new board (or bricked). Note that if secure boot is disabled then the in-chip ROM bootrom will try to xmodem boot from UART0 before attempting the real requested boot device

The build produces:

* `output/images/Image` - Kernel image with appended device tree and initramfs
* `output/images/armada-8040-mcbin.dtb` - Kernel device tree

### Sample images

Using [this config file](https://images.solid-run.com/8040/Buildroot/buildroot_config.txt.gz) which is a config file that has much more target packages than the above, we get the following binaries:

* [flash-image.bin file](https://images.solid-run.com/8040/Buildroot/flash-image.bin.gz)
* [mcbin dtb file](https://images.solid-run.com/8040/Buildroot/armada-8040-mcbin.dtb.gz)
* [Kernel with initramfs](https://images.solid-run.com/8040/Buildroot/Image.gz)

In order to use them, download all the files and then gunzip them.

In order to run it, flash flash-image.bin into the SPI and then run it with the following:

```
setenv bootargs console=ttyS0,115200; tftpboot 0x20000000 Image.8040-buildroot; tftpboot 0x1ff00000 armada-8040-mcbin_buildroot.dtb; booti 0x20000000 - 0x1ff00000
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dev.solid-run.com/marvell/a8040/sbc-platform/a8040-software/a8040-buildroot.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
