Buildroot - Clone with Git
Contents
Introduction
In this topic, you will download Buildroot so you can create binary image files ready to Flash onto an SD memory card using a default or custom configuration for the target: ATSAMA5D27 SOM1 EK1 Evaluation Kit.
The process of getting the Buildroot source code involves copying (git clone) a remote repository onto a local directory on your computer. This is the official repository of the Buildroot project.
You will also copy Microchip Technology-maintained external files that contain additional software packages.
Prerequisites
Git
If you are new to git there are many online resources. One such resource is the online book Pro Git by Scott Chacon and Ben Straub. It is available in several languages and you can also download the book in eBook formats (EPUB and MOBI) and PDF.
Another excellent resource is the Learn Git tutorial by Atlassian®.
Download - Getting Buildroot
Create a Project Directory
It is a good practice to create a project directory to place the source code for a given project. This way, you can archive the contents of the project directory for others and/or for archival purposes.
For the purposes of this how-to tutorial, we’ll name our project directory project_1:
Get Buildroot
You will get Buildroot by copying (git clone) the Buildroot source code from a remote repository to your project directory:
Change the directory to the project directory:
Copy (git clone) the Buildroot source code to your project directory:
When you git clone the Buildroot remote repository git.buildroot.net/buildroot you are creating a copy to your computer’s project directory (also known to git as the working directory or local directory).
When git is finished copying the Buildroot source code to your project directory, you will see a number of files and directories. The contents of each are explained in the Buildroot user manual: How Buildroot Works.
Checkout the LTS Branch (Version)
At this point, the copy of Buildroot in your project directory contains several branches (versions) of Buildroot. Since you just cloned the remote repository, the HEAD pointer is pointing to the “master” branch. You can see this by changing the directory into the buildroot directory and issuing a git status command:
$ git status
On branch master
Your branch is up-to-date with ‘origin/master’.
nothing to commit, working tree clean
The “master” branch is the latest (as of the time you cloned the repository) branch the Buildroot team is developing with. The development branch can be unstable. Instead, we want to use the latest and greatest stable version, known as the Long-Term Support (LTS) version. To do this issue the get checkout command with the version number (also known as checking out the branch):
Now issue a git status command:
HEAD detached at 2019.02.3
nothing to commit, working tree clean
The HEAD pointer has been detached from the master and is now pointing at version 2019.02.3. It is important that you do not commit any changes to your local Buildroot directory in this state. If you do, they will be lost. If you want to make changes, create a new branch.
By the way, if you would like to see a list of the branches (versions) available you can issue the git tag command.
0_0
2009.02
2009.02_rc1
2009.02_rc2
…
Download - Getting the Microchip Buildroot External Tree
Get the Microchip Buildroot External Tree
The Microchip maintained external Buildroot tree contains additional packages and default configuration (defconfig) files for demonstrations running on SAMA5 and SAM9x60 series evaluation kits.
First, change the directory into the project directory:
Copy (git clone) the Microchip Buildroot external source code to your project directory:
Checkout the Latest Linux4SAM demo
The latest version of Linux4SAM demonstration software is located on the Linux4SAM website. Checkout the latest Linux4SAM demonstration branch:
$ git checkout linux4sam_6.0
Alternate Download Method
You may also download Buildroot in a compressed tar file (also known as a tarball) from the official Buildroot project website download page. You can choose two compressed formats from gzip, which has a *.tgz or *.tar.gz, and bzip2 , which has a *.tar.bz2 suffix.
gzip - The command to decompress ( -z ) and extract ( -x ) a file ( -f ) is:
$ tar -zxf buildroot-2019.02.3.tar.gz
bzip2 - The command to decompress ( -j ) and extract ( -x ) a file is ( -f ) is:
$ tar -jxf buildroot-2019.02.3.tar.gz
To download the buildroot-external-microchip file, go to the "Buildroot External for Microchip SoC" page.
Click on the green button Clone or download and select Download ZIP.
The command to decompress the file:
$ unzip buildroot-external-microchip
Summary
In this topic, we explained the process of getting the official Buildroot source code using the git clone command. Next, we explained how to “checkout” the long-term support branch (version).
We also explained the process of getting the Microchip vendor maintained external files, buildroot-external-microchip. These contain additional packages and default configuration (defconfig) files for demonstration programs running on SAMA5 and SAM9x60 series evaluation kits.
What’s Next?
Before you can build the entire embedded system (cross-compilation toolchain, bootloaders, kernel, device tree, and target software packages) Buildroot must first be configured.
There are two methods in which you can perform the configuration:
- From a default configuration (defconfig) file, or
- Manually, creating a custom project.
If you are new to Buildroot, you may want to try a default configuration first to familiarize yourself with the process and ensure everything works. With the knowledge you gain from configuring with a default configuration, you can customize your own Buildroot configuration for a custom project.