Buildroot - Clone with Git

Last modified by Microchip on 2024/06/20 12:43

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:

$ mkdir 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:

$ cd ~/project_1

Copy (git clone) the Buildroot source code to your project directory:

​$ git clone git://git.buildroot.net/buildroot

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:

​$ cd ~/project_1/buildroot
$ 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):

​$ git checkout 2019.02.3

We determine which LTS version we will checkout by referring to the Buildroot download page. The Buildroot project publishes one long-term support release per year and it is maintained for one year – security, bug, and build fixes.

Now issue a git status command:

$ git status
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.

​$ git tag
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:

​$ cd ~/project_1

Copy (git clone) the Microchip Buildroot external source code to your project directory:

$ git clone git://github.com/linux4sam/buildroot-external-microchip

Checkout the Latest Linux4SAM demo

The latest version of Linux4SAM demonstration software is located on the Linux4SAM website. Checkout the latest Linux4SAM demonstration branch:

​$ cd ~/project_1/buildroot-external-microchip
$ git checkout linux4sam_6.0

Recall that you can list the available branches (versions) by issuing the git tag command.

Back to Top


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.

​If you are new to the tar utility, there are many resources online. Try searching: “Linux tar tutorial”.

gzip - The command to decompress ( -z ) and extract ( -x ) a file ( -f ) is:

​$ cd ~/project_1
$ tar -zxf buildroot-2019.02.3.tar.gz

bzip2 - The command to decompress ( -j ) and extract ( -x ) a file is ( -f ) is:

​$ cd ~/project_1
$ tar -jxf buildroot-2019.02.3.tar.gz

​You may want to add the verbose option ( -v ) to watch the progress of the decompress and extract command.

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

Back to Top

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.

Back to Top

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:

  1. From a default configuration (defconfig) file, or
  2. 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.

Back to Top