Compiling AT91bootstrap 3.9.1

AT91bootstrap is the 2nd level bootloader used by the Microchip ARM MPUs to initializate the internal hardware (clocks, peripherals, DDR DRAM, etc) at startup and load the Linux Kernel image from the first microSD partition. This article illustrates how to compile at91bootstrap for the RoadRunner module

Tested with at91bootstrap version 3.9.1

A new version of this article is available for the following boards:

Toolchain installation

First of all you need to install the toolchain (cross compiler, linker, etc) on your Linux Ubuntu PC following this article (tested on Ubuntu 18.04.4 LTS):

Download the latest AT91bootstrap version from Microchip GitHub repository:

The GitHub repository is available here:

Download the 3.9.1 version:

wget https://github.com/linux4sam/at91bootstrap/archive/refs/tags/v3.9.1.zip
unzip v3.9.1.zip
cd at91bootstrap-3.9.1

Add the AcmeSystems patches:

wget https://www.acmesystems.it/www/at91bootstrap/acme.patch
patch -p1 < acme.patch

Set the board configuration

Roadrunner

make sama5d2_roadrunner_defconfig

Acqua

make acqua-defconfig

Aria

Aria with 128MB of RAM

make aria-128m_defconfig

Aria with 256MB of RAM

make aria-256m_defconfig

Arietta

Arietta with 128MB of RAM

make arietta-128m_defconfig

Arietta with 256MB of RAM

make arietta-256m_defconfig

Change the default configuration

If you want to take a look to the at91bootstrap configuration run:

make menuconfig

This function could be useful to change for example the Kernel line passed by at91bootstrap to the kernel.

Example: Enable the suspend to RAM

To enable the suspend to RAM features it is request to change the flag Enable Backup Mode e add some parameters on the kernel command line:

Type:

make menuconfig

Enable this flag:

[*] Enable Backup Mode

Go to:

Kernel Image Storage Setup  --->  

change the line:

mem=256M console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait consoleblank=0 

in

mem=256M console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait consoleblank=0  atmel.pm_modes=ulp0,backup

Compile and check the command line parameters by typing:

cat /proc/cmdline

Compiling

launch the compilation by typing:

make CROSS_COMPILE=arm-linux-gnueabihf-

it will generate a binary fine in ./binaries directory with a different name for any board type.

A symbolic link is generated automatically during the at91bootstrap compilation so you can refer to it with the name boot.bin.

Copy boot.bin on a bootable MicroSD

If your board boot everything from the MicroSD copy boot.bin on the first microSD partition by typing:

cp binaries/boot.bin /media/$USER/boot

If your are using a Roadrunner be sure that PA30 (MMC1 CD) is wired on GND.

Related articles

Sergio Tanzilli
Systems designer, webmaster of www.acmesystems.it and founder of Acme Systems srl

Personal email: tanzilli@acmesystems.it
Web pages: https://www.acmesystems.it --- https://www.acmestudio.it
Github repositories: https://github.com/tanzilli --- https://github.com/acmesystems
Telegram group dedicated to the Acme Systems boards: https://t.me/acmesystemssrl