Buildroot - Create Project with Default Configuration
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
- You have downloaded Buildroot following the instructions in the topic: Buildroot – Clone with Git.
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.
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:
Tell buildroot where the external tree is located.
This command to the make utility will set the BR2_EXTERNAL variable to the path of the external tree.
Load the default configuration file in .config:
The following make utility command will read and write the default configuration file into the .config file:
Start graphical configuration:
make menuconfig command will read the .config file and display the configuration in a graphical menu as shown:
The
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:
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 “( )“.
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.
Build Options
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:
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.
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:
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:
BASE_DIR=/home/<user>/project_1/buildroot/output
Toolchain
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.
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 |
System Configuration
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.
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.
Kernel
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.
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:
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.
Target packages
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.
Observe the Target packages the default configuration file has selected.
Feel free to browse.
Filesystem images
Highlight Filesystem images —> and press ENTER.
The Filesystem images submenu opens as shown. The Filesystem images submenu selects the filesystem type and options.
Observe the Filesystem images options the default configuration file has selected:
[*] | ext2/3/4 root filesystem | |
ext2/3/4 root filesystem | ext2/3/4 variant | (ext4) |
Bootloaders
Highlight Bootloaders —> and press ENTER.
The Bootloaders submenu opens as shown. The Bootloaders submenu selects and configures the choice of bootloaders Buildroot will build.
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 |
Host utilities
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.
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.
Legacy config options
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.
External options
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.
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.
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.