Buildroot - Create Project with Default Configuration

Last modified by Microchip on 2024/01/08 16:54

Introduction

In this topic, you will create a project in Buildroot using a default configuration so that you can create binary image files ready to flash onto mass storage for the target: ATSAMA5D27-SOM1-EK1 Evaluation Kit.

If you are learning about new hardware, a vendor-supplied default configuration (defconfig) file is a good place to start. A default configuration is a configuration that has been saved and stored in the Buildroot software package.

In the default configuration file, you can view the settings to gain an understanding of the options available to you for a particular set of hardware and software. You can build the image(s) and write them onto an evaluation kit to ensure everything works and demonstrate its features and functions. Then you can strike out on your own to either customize or start from scratch a Buildroot configuration tailored to your own embedded Linux® project.

Prerequisites

Download

Mandatory Packages for Buildroot

  • Before you can build a project in Buildroot, ensure you have the mandatory software packages required. Mandatory and optional packages required by Buildroot are listed in the Buildroot User Manual: System requirements.

Make Utility

  • Buildroot uses the make utility and shell scripts to operate. There are helpful tips listed in the Buildroot user manual: make tips.

Back to Top

Configure with a Default Configuration

Once you have downloaded Buildroot, the next step in the process is to configure. In this topic, you will use a default configuration file supplied by Microchip Technology. Default configuration files are provided for the many evaluation kits sold by Microchip. Each default configuration file configures the hardware and software packages to demonstrate functionality and features of the evaluation kits.

Your first step in the configuration process is to tell Buildroot that an external tree exists:

Change directory into the buildroot directory:

​$ cd ~/project_1/buildroot

Tell buildroot where the external tree is located.

​$ make BR2_EXTERNAL=~/buildroot-external-microchip

 This command to the make utility will set the BR2_EXTERNAL variable to the path of the external tree.

Information

​You may use the make printvars command to view specific make variables:

$ make -s printvars VARS=’BR2_EXTERNAL’

Load the default configuration file in .config:

The following make utility command will read and write the default configuration file into the .config file:

​$ make atmel_sama5d27_som1_ek_mmc_dev_defconfig

Default configuration files:

You can view the default configuration files by looking in the directory:

~/project_1/buildroot/configs

You will see several files, each ending in _defconfig, supplied by vendors. The files supplied by Microchip begin with at91sam* for the SAM9x60 series and atmel_sama5* for the SAMA5 series of MPUs.

Additional default configuration files are stored in the buildroot-external-microchip tree:

~/project_1/buildroot-external-microchip/configs

You can also get a listing of available default configurations by typing the command:

​$ make list-defconfigs

Start graphical configuration:

$ make menuconfig

The make menuconfig command will read the .config file and display the configuration in a graphical menu as shown:

Buildroot Configuration

 

Back to Top

Target options

Highlight Target options —> and press ENTER.

Target options select the architecture of the embedded device and enables/disables features. The Target options submenu opens as shown:

Target Options


Observe the Target Architecture:

From the menu we can see that the selected Target Architecture is (ARM (little endian)). The selection is shown inside the parentheses “( )“.

​If you are curious, you can see the available architectures by pressing ENTER. The Target Architecture submenu is shown. The selected architecture is shown with an [X] in brackets.

Target Architecture

 Observe the architecture and architectural features selected by the default configuration:

 Target Architecture(ARM (little endian))
 Target Binary Format(ELF)
 Target Architecture Variant(cortex-A5)
[*]Enable NEON SIMD extension support 
[*]Enable VFP extension support 
 Target ABI(EABIhf)
 Floating point strategy(VFPv4-D16)
 ARM instruction set(Thumb2)

Architecture settings are for the chosen CPU/MPU hardware. These settings are for the SAMA5D2 Series Arm®-based MPUs. Default configuration files can set the architecture and features for you.

​To add to your knowledge of CPU/MPU hardware specifics, it is good to learn about each of the features. Click on the links provided in the table above to learn more.

Back to Top

Build Options

Move back to the top menu by typing ESC-ESC.

Highlight Build options —> and press ENTER.

The Build options submenu selects options that Buildroot will use in the downloading and building of the packages and files needed by the host and the target. The Build options submenu opens as shown:

Build Options


Observe the Build options the default configuration file has selected. Observe the three lines below the Commands —> entry.

Location to save buildroot config

The first line is for the save location of the Buildroot default configuration files. We see that the directory

/home/<user>/project_1/buildroot/configs/atmel_sama5d27_som1_ek_dev_defconf
is entered. This is the default configuration file you typed earlier.​

The Help feature can give you more information. From the highlighted line press the “H” key. Here we see the description of the Location to save buildroot config:

Save Configuration

Download Directory

The second line is the save location of the target packages and files Buildroot will download for the build. This directory will contain all of the upstream projects as a compressed archive (*.tar.gz) files.

We see the default location $(TOPDIR)/dl is entered. Recall, you can type the make printvars command to see the expanded directory:

​$ make -s printvars VARS=’TOPDIR’
TOPDIR=/home/<user>/project_1/buildroot

Host Directory

The third line is the save location of the packages and files Buildroot will download, build, and run on the host. This includes the cross-compilation toolchain when building the internal Buildroot toolchain.

We see the default location $(BASE_DIR)/host is entered. Recall, you can type the make printvars command to see the expanded directory:

​$ make -s printvars VARS=’BASE_DIR’
BASE_DIR=/home/<user>/project_1/buildroot/output

Back to Top

Toolchain

Move back to the top menu by typing ESC-ESC.

Highlight Toolchain —> and press ENTER.

The Toolchain submenu opens as shown.

Toolchain selects options for the cross-compilation toolchain. Buildroot provides two solutions: internal or external toolchain.

  • Selecting the internal option, Buildroot will download and build a cross-compilation toolchain.
  • Selecting the external option, Buildroot will download a pre-built cross-compilation toolchain.

To learn more you can read about Cross-compilation toolchain in the Buildroot user manual.

Toolchain


Observe the Toolchain options the default configuration file has selected: internal toolchain option and the following cross-compiler toolchain options:

 Toolchain type(Buildroot toolchain)
 C library(uClibc-ng)
 Kernel Headers(Same as kernel being built)
 Binutils Version(binutils 2.28.1)
 GCC compiler version(gcc 7.x)
[*]Enable MMU support 

Back to Top

System Configuration

Move back to the top menu by typing ESC-ESC.

Highlight System configuration —> and press ENTER.

The System configuration submenu opens as shown. The System configuration submenu selects options for the system such as which INIT to run, root login, root password, and login prompt. Also, support scripts that may be run during the build.

System Configuration


Observe the System configuration options the default configuration file has selected:

 Init system(BusyBox)
[*]Enable root login with password 
( )Root password 
[*]Run a getty () after boot(login prompt)

Notice that root login has been enabled with no password required.

Observe the last two lines:
The (support/scripts/genimage.sh) and
(-c board/atmel/sama5d27_som1_ek_mmc/genimage.cfg)
are support scripts that generate a disk image that can be flashed onto a SD Memory Card.

Back to Top

Kernel

Move back to the top menu by typing ESC-ESC.

Highlight Kernel —> and press ENTER.

The Kernel submenu opens as shown. The Kernel submenu selects the Linux kernel, the location to download the kernel source and options in the build process.

Linux Kernel


Observe the Kernel options the default configuration file has selected:

[*]Linux Kernel 
 Kernel version(Custom tarball)
(sama5)Defconfig name 
[*]Build a Device Tree Blob (DTB) 

The default configuration file has selected a custom Linux kernel from the Linux4SAM GitHub repository. The location and name of the file are shown in the line:

($call github,linux4sam,linux-at91,linux4sam_5.8/linux-linux4sam_5.8.tar.gz)

This custom kernel is a fork of the official Linux kernel with vendor-supplied drivers that may not or in the process of being submitted to the official Linux kernel mainline.

Observe the (sama5) Defconfig name. The selection sama5 is the name of the kernel default config file to use (without the trailing “_defconfig”). Its location is arch/<arch>/configs in the Linux kernel tree.

Observe the [*] Build a Device Tree Blob (DTB) selection. Buildroot will compile the Device Tree Source (DTS) indicated by line:
(at91-sama5d27_som1_ek at91-sama5d27_som1_ek_pda4 at91-sama5d27_som1_ek_pda7 …)
Notice that the trailing *.dts is not included, and multiple DTS files are listed – separated by spaces.

Back to Top

Target packages

Move back to the top menu by typing ESC-ESC.

Highlight Target packages —> and press ENTER.

The Target packages submenu opens as shown. The Target Packages submenu selects from over 2000+ software packages. The submenu lists them by category. For example Audio and Video, Games, Networking Applications, etc.

Target Packages


Observe the Target packages the default configuration file has selected.

Feel free to browse.

Back to Top

Filesystem images

Move back to the top menu by typing ESC-ESC.

Highlight Filesystem images —> and press ENTER.

The Filesystem images submenu opens as shown. The Filesystem images submenu selects the filesystem type and options.

Filesystem Images


Observe the Filesystem images options the default configuration file has selected:

[*]ext2/3/4 root filesystem 
ext2/3/4 root filesystemext2/3/4 variant(ext4)

Back to Top

Bootloaders

Move back to the top menu by typing ESC-ESC.

Highlight Bootloaders —> and press ENTER.

The Bootloaders submenu opens as shown. The Bootloaders submenu selects and configures the choice of bootloaders Buildroot will build.

Bootloaders


Observe the Filesystem images options the default configuration file has selected:

[*]AT91 Bootstrap 3 
 AT91 Bootstrap 3 version(Custom Git repository)
(https://github.com/linux4sam/u-boot-at91.git)URL of custom repository 
(v3.8.10)Custom repository version 
 AT91 Bootstrap 3 configuration(Using a defconfig)
(sama5d27_som1_eksd_uboot)Defconfig name 
[*]U-Boot 
 Build system(Kconfig)
 U-Boot Version(Custom Git repository)
(https://github.com/linux4sam/at91bootstrap.git)URL of custom repository 
(linux4sam_5.8)Custom repository version 
(sama5d27_som1_ek_mmc)Board defconfig 
[*]U-Boot needs dtc

Back to Top

Host utilities

Move back to the top menu by typing ESC-ESC.

Highlight Host utilities —> and press ENTER.

The Host utilities submenu opens as shown. The Host utilities submenu selects utility programs that the host will need to build the target’s binary images.

Host Utilities


Observe the Host utilities the default configuration file has selected:

[*]Host genimage 

The Host genimage utility is a tool to generate flash images from a given root filesystem tree.

Back to Top

Legacy config options

Move back to the top menu by typing ESC-ESC.

Highlight Legacy config options —> and press ENTER.

The Legacy config options submenu opens as shown. The Legacy config options submenu allows the developer to select software that has been removed in the present version of Buildroot. This submenu makes it convenient for the developer to maintain backward compatibility.

Legacy Configuration Options


Observe the Legacy config options the default configuration file has selected: none.

Back to Top

External options

Move back to the top menu by typing ESC-ESC.

Highlight External options —> and press ENTER.

The External options submenu opens as shown. The External options submenu displays options available in the buildroot-external-microchip tree.

External Options


Observe the External options the default configuration file has selected: none.

Move back to the top menu by typing ESC-ESC.

You may exit make menuconfig by typing ESC-ESC. If prompted to save your new configuration, select No.

Back to Top

Summary

The objective of this topic was to show you how Buildroot is configured before building the target’s image(s). The configuration shown was from the default configuration file: atmel_sama5d27_som1_ek_mmc_dev_defconfig

By studying default configuration files supplied by Microchip Technology, you can learn which settings are required and which you can customize for your projects.

Back to Top

What's Next?

Once Buildroot has been configured, the next step is to build the binary image(s) for the system, in this case, the ATSAMA5D27-SOM1-EK1 Evaluation Kit. Instructions on how to perform a build are at: Buildroot - Build.

Back to Top