Step 2: Set up Build Environment

Step 2.1: Setup a Linux Development System

  • This project has been verified to work with the following software versions:
    • VirtualBox - version 6.1.26
    • VirtualBox Extension Pack (Requires license) - version 6.1.26
    • Ubuntu 20.04.3 64-bit LTS ISO Image
    • This guide assumes the host operating system is Windows®. In addition, Virtualization must be enabled in the Host system’s BIOS to use Ubuntu (64-bit) in VirtualBox. Else, you will encounter an error when you try to start the virtual machine.

If you are using a native Linux host system, proceed to Step 2.2


Install and Configure VirtualBox

1. Install VirtualBox (and Extension Pack, optional).

2. Create a virtual machine.

3. Insert the downloaded Ubuntu ISO image by selecting Choose a disk file…. Please see Figure 1:

Figure 1

4. Set up the virtual machine’s network. We will set up (two) adapters: one for connecting the virtual machine to the Internet, the other for connecting to the SOM1-EK.

  • Set up one adapter for connecting to the SOM1-EK. In this step, we will use Adapter 1 for this purpose. Refer to Figure 2 for accessing the Network settings and to see what settings need to be changed.
  • Make sure to select the Ethernet controller available on your device under Name as this will be used to connect to the SOM1-EK directly.
  • Make sure to select Allow All under Promiscuous Mode.
Figure 2
  • Set up Adapter 2 using most of the same settings used for Adapter 1.
  • However, make sure to select the Wi-Fi controller available for your device under Name as this will be used to connect your virtual machine to the Internet.

5. Then, start the virtual machine. It should boot the Ubuntu Installer automatically.

Figure 3


Install Ubuntu

  1. Click Install Ubuntu. Please refer to Figure 4:
Figure 4

2. Follow the step on each page. There is no specific configuration needed.

3. Wait until the installation has finished.

Figure 5

4. Remove ISO image then reboot to Ubuntu.

After installing and booting Ubuntu, we suggest running sudo apt-get update && sudo apt-get upgrade through the terminal to ensure the latest operating system and software versions are installed. Use Ctrl + Alt + T to easily access the terminal.


Install Guest Additions

Guest Additions are very useful since it includes software that optimizes the Linux client operating system and adds other features such as Shared Folder and Auto-Resize Guest Display. This is only required when using VirtualBox. You can learn more about Guest Additions Features at this link: Chapter 4. Guest Additions (

1. Mount the Guest Additions CD Image by clicking Devices > Insert Guest Additions CD Image….

Figure 6

2. After mounting the image, a CD icon on the left side bar should appear. Click Run when a pop-up prompt like the one in Figure 7 appears.

Figure 7

3. The installer should prompt for a password. After entering the correct user password, Guest Additions should automatically install. Please refer to Figure 8.

Figure 8

4. Reboot the virtual machine after the installation has finished.


Install Required Utilities

The following applications are required to be installed in Ubuntu for the purposes of this demo:

  • balenaEtcher – An application for flashing image onto SD Cards or USB drives.
  • minicom – A serial terminal application for communicating to the SOM1-EK serial port.

1. To install balenaEtcher, use the following commands:

$ sudo apt-get install curl -y
$ curl -1sLf | sudo -E bash
$ sudo apt-get update
$ sudo apt-get install balena-etcher-electron -y

Adding -y at the end of sudo apt-get install allows us to skip the prompt asking for permission whenever we want to install packages.

Figure 9

2. To install minicom, use the command:

$ sudo apt-get install minicom -y


Configure Client Network Interfaces

Configure the Static Network Interface. This network will be used to connect to the SOM1-EK later. Refer to Figure 10 to configure the network interface. After configuring the network interface, reboot the virtual machine.

Figure 10

The static network interface we need to set up should be the interface that’s not connected to the Internet.


Set Up Shared Folder Access

We will be setting up a shared folder to transfer files between the Windows Host and the Ubuntu virtual machine. This will be used in a later step.

For this step, we will refer to your shared folder as <your shared folder>.
We can set up shared folders without having to shut down the virtual machine beforehand.

1. In your Host system, open the Oracle® VirtualBox window, select the virtual machine from the left-hand side of the screen, and navigate to Settings > Shared folders. Your window should appear as shown in Figure 11.

Figure 11

2. Click the + icon on the right side of the window to open the menu shown in Figure 12:

Figure 12

3. On Folder Path, click on the dropdown menu icon, select Other…, and navigate to the location of a folder you would want to access from the virtual machine.

We will leave it up to you to decide where to place the shared folder in your Host system. We suggest placing it somewhere accessible like the Desktop for the purposes of this tutorial.

4. Tick Auto-mount and Make Permanent then click OK. Your shared folder should appear under Machine Folders.

Make Permanent makes sure that the shared folder remains mounted even after shutting down the virtual machine so we can still access it the next time we open the virtual machine.

5. Click OK again. The shared folder should now mount in the virtual machine as shown in Figure 13, with the name displayed as sf_<your shared folder>.

Figure 13

Step 2.2: Install Buildroot Dependencies

The System Requirements chapter of the Buildroot user manual specifies the required packages that must be installed in your host system.

To install optional packages, we can append the package name to the command written below.

  • Install the required dependencies using the following command:

$ sudo apt-get install sed make binutils build-essential gcc g++ bash patch gzip bzip2 perl tar cpio unzip rsync file bc git python3 python libncurses5-dev -y

We install the optional git, python, and libncurses5-devjpackages here since we’ll need these later in the project.

Step 2.3: Create a Project Directory

It is good practice to create a project directory to place source code and specific configurations for a given Buildroot project.

  • For this tutorial, we will name our project directory as the project.

$ mkdir project

  • Change the directory to the project directory by using the following command:

$ cd ~/project

You can use the Tab key to auto-complete file/folder names when using the cd command. For example, you can type "cd ~/pro" and then press Tab to autocomplete the folder name. Note that in some instances, pressing Tab may list files/folders with similar names, so you will need to type more characters so the specific name required can be autocompleted.

Step 2.4: Clone Buildroot

For SAM devices, we can clone buildroot-at91 repository in Linux4SAM Official GitHub. buildroot-at91 is a fork of Buildroot with a minimal number of patches, only the ones which have not hit the mainline yet.

  • Clone Buildroot-at91 using the following command:

$ git clone

Step 2.5: Clone Buildroot-External-Microchip

For SAM devices, we can also clone the buildroot-external-microchip repository. The Microchip-maintained external tree provides additional packages and defconfigs dedicated for our SAM MPU device demos which may not hit the mainline.

  • Clone Buildroot-at91 using the following command:

$ git clone

Step 2.6: Checkout Repository Versions

This project has been verified to work with the linux4sam-2021.04 release tag of buildroot-at91 and the Microchip Buildroot external.

  • Change directory to the Buildroot-at91 directory:

$ git clone
$ cd buildroot-at91

  • To get the available repository versions, use the following command:

$ git tag

  • To find a specific version, use the grep command:

$ git tag | grep <version>

You may sometimes find that using git tag results in a similar screen shown in Figure 14 where a colon is displayed at the bottom of the terminal. When this happens, you can use the up and down arrow keys to navigate the versions available. To exit this menu, simply press Q.

Figure 14

Checking out a remote branch to a new local branch may help users track their changes on the new local branch.

  • Checkout the linux4sam-2021.04 release tag of Buildroot-at91 using the following command:

$ git checkout linux4sam-2021.04 -b buildroot-linux4sam-2021.04

  • Change directory to the Microchip Buildroot external directory:

$ cd ../buildroot-external-microchip

  • Checkout the linux4sam-2021.04 release tag using the following command:

$ git checkout linux4sam-2021.04 -b buildroot-external-linux4sam-2021.04

  • To verify the currently checked out versions, use the following command within each repository’s respective directory:

$ git status

The output of git status, when run in both directories, should look like the following:

  • For Buildroot-at91/ directory
Figure 15
  • For Buildroot-external-microchip/ directory
Figure 16

© 2022 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.