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 flash 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 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 that demonstrate functionality and features of the evaluation kits.
Your first step in the configuration process is to tell Buildroot that an external tree exists:
1
Change directory into the buildroot directory:
$ cd ~/project_1/buildroot
2
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.
You may use the make printvars command to view specific make variables:
$ make -s printvars VARS=’BR2_EXTERNAL’
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
3
Load the default fonfiguration 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
Target options
2
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.
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.
Build options
1
Move back to the top menu by typing ESC-ESC.
3
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/steve/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:
$ make -s printvars VARS=’TOPDIR’
TOPDIR=/home/steve/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/steve/project_1/buildroot/output
Toolchain
1
Move back to the top menu by typing ESC-ESC.
2
Highlight Toolchain —> and press ENTER.
The Toolchain submenu opens as shown in the figure below.
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.
3
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
1
Move back to the top menu by typing ESC-ESC.
2
Highlight System configuration —> and press ENTER.
The System configuration submenu opens as shown in the figure below. 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.
3
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
1
Move back to the top menu by typing ESC-ESC.
3
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.
Target packages
1
Move back to the top menu by typing ESC-ESC.
3
Observe the Target packages the default configuration file has selected.
Feel free to browse.
Filesystem images
1
Move back to the top menu by typing ESC-ESC.
3
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
1
Move back to the top menu by typing ESC-ESC.
3
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/at91bootstrap.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
1
Move back to the top menu by typing ESC-ESC.
3
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
1
Move back to the top menu by typing ESC-ESC.
2
Highlight Legacy config options —> and press ENTER.
The Legacy config options submenu opens as shown in the figure below. 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.
3
Observe the Legacy config options the default configuration file has selected: none.
External options
1
Move back to the top menu by typing ESC-ESC.
3
Observe the External options the default configuration file has selected: none.
Summary
1
Move back to the top menu by typing ESC-ESC.
2
You may exit make menuconfig by typing ESC-ESC. If prompted to save your new configuration, select No.
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.