buildroot-build
How to build Buildroot for AT91
Prerequisites
Host build system should be a Linux system with necessary software installed.
In addition to these required packages, you should also install libssl-dev:
or, depending on your host distribution:
Get sources
To get the source code, you have to clone the buildroot-mchp and buildroot-external-microchip repositories. buildroot-mchp is a fork of Buildroot with a minimal amount of patches, only the ones which have not hit the mainline yet. The external tree provides stuff which won't hit the mainline: additional defconfigs and packages dedicated to our demos.
Cloning into 'buildroot-mchp'...
remote: Enumerating objects: 478163, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 478163 (delta 7), reused 11 (delta 4), pack-reused 478144
Receiving objects: 100% (478163/478163), 105.79 MiB | 3.39 MiB/s, done.
Resolving deltas: 100% (320697/320697), done.
$ ls buildroot-mchp/
arch board boot CHANGES Config.in Config.in.legacy configs COPYING DEVELOPERS docs fs linux Makefile Makefile.legacy package README support system toolchain utils
$ git clone https://github.com/linux4microchip/buildroot-external-microchip.git
Cloning into 'buildroot-external-microchip'...
remote: Counting objects: 571, done.
remote: Compressing objects: 100% (159/159), done.
remote: Total 571 (delta 217), reused 288 (delta 170), pack-reused 225
Receiving objects: 100% (571/571), 94.41 KiB | 76.00 KiB/s, done.
Resolving deltas: 100% (332/332), done.
$ ls buildroot-external-microchip/
board Config.in configs COPYING docs external.desc external.mk package patches README.md system
The source code has been taken from the master branch which is pointing to the latest version of buildroot-mchp and buildroot-external-microchip. We advise you to use linux4sam tags to be sure that there is no mismatch between the versions of these two repositories.
You can list them and use one of them by doing this:
$ git tag | grep linux4microchip
linux4microchip-2023.10
linux4microchip-2023.10-rc1
linux4microchip-2023.10-rc2
linux4microchip-2023.10-rc3
linux4microchip-2023.10-rc4
linux4microchip-2024.04
linux4microchip-2024.04-rc1
linux4microchip-2024.04-rc2
linux4microchip-2024.10
linux4microchip-2024.10-rc1
linux4microchip-2024.10-rc2
linux4microchip-2024.10-rc3
linux4microchip-2025.04
$ git checkout linux4microchip-2025.04 -b buildroot-external-microchip-linux4microchip-2025.04
$ cd ../buildroot-mchp/
$ git tag | grep linux4microchip
linux4microchip-2023.04
linux4microchip-2023.04-rc1
linux4microchip-2023.04-rc2
linux4microchip-2023.10
linux4microchip-2023.10-rc1
linux4microchip-2024.04
linux4microchip-2024.04-rc1
linux4microchip-2024.04-rc2
linux4microchip-2024.10
linux4microchip-2024.10-rc1
linux4microchip-2024.10-rc2
linux4microchip-2024.10-rc3
linux4microchip-2025.04
$ git checkout linux4microchip-2025.04 -b buildroot-mchp-linux4microchip-2025.04
Build the rootfs image
Assuming you are at the Buildroot root directory, you'll find a configs folder containing several default configurations. If you are familiar with kernel configuration, you'll see that it works in the same way.
For the same board, several defconfig files are provided inside the buildroot-mchp. These defconfigs are from upstream and, as said above, without the richness of a full linux4sam release. They can be used for a minimal test image.
- atmel_[soc]_xplained_defconfig
provides at91bootstrap, u-boot, the kernel image and dtb files, a very basic rootfs for NAND flash memory. - atmel_[soc]_xplained_mmc_defconfig
provides the same stuff but for SD card. Moreover a SD card image is done to ease the creation of the bootable SD card. - atmel_[soc]_xplained_dev_defconfig
and atmel_[soc]_xplained_mmc_dev_defconfig
provide a rootfs with additional tools to use SoC devices (I2C, CAN, audio, etc.).
The external provides extra defconfigs in its own configs folder:
- [soc]_[board]_headless_defconfig
provides barely the same stuff as atmel_[soc]_xplained_mmc_dev_defconfig plus AWS greengrass or other command-line tools, but with no graphics related packages. - [soc]_[board]_graphics_defconfig
provides the same stuff plus a full graphics (EGT) demo.
All these defconfigs target the SD card as boot media.
If you want to build the basic rootfs image we provide for sama5d2-xplained for example, you'll have to do:
If you want to build the linux4sam demo rootfs image we provide for sama5d2-xplained, you'll have to do:
Then you can build the rootfs:
Once compilation is done, have a look to output/images to see what has been generated:
at91bootstrap.bin rootfs.ext2 sama5d2_xplained_isc.dtbo sama5d2_xplained_pda4.dtbo sama5d2_xplained_qspi.dtbo zImage
at91-sama5d2_xplained.dtb rootfs.ext4 sama5d2_xplained.itb sama5d2_xplained_pda5.dtbo sama5d2_xplained-sdcardboot-uboot-3.9.0.bin
boot.bin rootfs.tar sama5d2_xplained_ov7670.dtbo sama5d2_xplained_pda7b.dtbo sdcard.img
boot.vfat sama5d2_xplained_i2s0_proto.dtbo sama5d2_xplained_ov7740.dtbo sama5d2_xplained_pda7.dtbo u-boot.bin
You can have a look at the Create a SD card with the demo page to create an SD card from the sdcard.img file. If you want to flash NAND or whatever memory you want with Sam-Ba, please go to the Using SAM-BA to flash components to board section of your board.
Cross toolchain
While creating the rootfs, Buildroot will build a cross toolchain (or will download or use one present on your machine). You can find it under output/host/usr:
2to3 arm-linux-gcc-ranlib fdtoverlay libpng-config python3.7m-config
2to3-3.7 arm-linux-gcov fdtput libtool python3-config
aclocal arm-linux-gcov-dump fincore libtoolize python-config
aclocal-1.15 arm-linux-gcov-tool findmnt linux32 python-freeze-importlib
arm-buildroot-linux-gnueabihf-addr2line arm-linux-gdb fixqt4headers.pl linux64 pyvenv
arm-buildroot-linux-gnueabihf-ar arm-linux-gprof flex linux-dtc qdbuscpp2xml
arm-buildroot-linux-gnueabihf-as arm-linux-ld flex++ logger qdbusxml2cpp
arm-buildroot-linux-gnueabihf-c++ arm-linux-ld.bfd flock look qlalr
arm-buildroot-linux-gnueabihf-c++.br_real arm-linux-nm gapplication lrelease qmake
arm-buildroot-linux-gnueabihf-cc arm-linux-objcopy gawk lsattr qmlcachegen
arm-buildroot-linux-gnueabihf-cc.br_real arm-linux-objdump gdbus lsblk qmlimportscanner
arm-buildroot-linux-gnueabihf-c++filt arm-linux-ranlib gdbus-codegen lscpu qmllint
arm-buildroot-linux-gnueabihf-cpp arm-linux-readelf gdk-pixbuf-csource lsipc qmlmin
arm-buildroot-linux-gnueabihf-cpp.br_real arm-linux-size gdk-pixbuf-pixdata lslocks qt.conf
arm-buildroot-linux-gnueabihf-elfedit arm-linux-strings gdk-pixbuf-query-loaders lsmem qvkgen
arm-buildroot-linux-gnueabihf-g++ arm-linux-strip gdk-pixbuf-thumbnailer lsns rake
arm-buildroot-linux-gnueabihf-g++.br_real attr gem lupdate rcc
arm-buildroot-linux-gnueabihf-gcc autoconf genbrk lzip rdjpgcom
arm-buildroot-linux-gnueabihf-gcc-7.4.0 autoheader gencfu m4 rdoc
arm-buildroot-linux-gnueabihf-gcc-7.4.0.br_real autom4te gencnval makeconv rename
arm-buildroot-linux-gnueabihf-gcc-ar automake gendict makedevs renice
arm-buildroot-linux-gnueabihf-gcc.br_real automake-1.15 genimage mcookie reset
arm-buildroot-linux-gnueabihf-gcc-nm autopoint genrb meson rev
arm-buildroot-linux-gnueabihf-gcc-ranlib autoreconf getfacl mk_cmds ri
arm-buildroot-linux-gnueabihf-gcov autoscan getfattr mkenvimage ruby
arm-buildroot-linux-gnueabihf-gcov-dump autoupdate getopt mkimage script
arm-buildroot-linux-gnueabihf-gcov-tool bison gettextize mkpasswd scriptreplay
arm-buildroot-linux-gnueabihf-gdb cal gio moc setarch
arm-buildroot-linux-gnueabihf-gprof captoinfo gio-querymodules mount setfacl
arm-buildroot-linux-gnueabihf-ld chacl glib-compile-resources mountpoint setfattr
arm-buildroot-linux-gnueabihf-ld.bfd chattr glib-compile-schemas msgfmt setsid
arm-buildroot-linux-gnueabihf-nm choom glib-genmarshal msgmerge sip
arm-buildroot-linux-gnueabihf-objcopy cjpeg glib-gettextize namei smtpd.py
arm-buildroot-linux-gnueabihf-objdump clear glib-mkenums ncurses6-config smtpd.py.7
arm-buildroot-linux-gnueabihf-ranlib cmake gobject-query ninja swig
arm-buildroot-linux-gnueabihf-readelf col gperf node swig3.0
arm-buildroot-linux-gnueabihf-run colcrt gresource npm syncqt.pl
arm-buildroot-linux-gnueabihf-size colrm gsettings npx tabs
arm-buildroot-linux-gnueabihf-strings column gtester openssl tic
arm-buildroot-linux-gnueabihf-strip compile_et gtester-report patchelf toe
arm-linux-addr2line convert-dtsv0 hexdump pcre-config toolchain-wrapper
arm-linux-ar cpack i386 pcregrep torque
arm-linux-as c_rehash icu-config pcretest tput
arm-linux-c++ ctest icuinfo pkgconf tset
arm-linux-c++.br_real djpeg ifnames pkg-config uic
arm-linux-cc dmesg infocmp pkgdata umount
arm-linux-cc.br_real dtc infotocap prlimit uname26
arm-linux-c++filt dtdiff ipcmk pydoc utmpdump
arm-linux-cpp dumpimage ipcrm pydoc3 uuidgen
arm-linux-cpp.br_real easy_install ipcs pydoc3.7 uuidparse
arm-linux-elfedit easy_install-2.7 irb python whereis
arm-linux-g++ easy_install-3.7 isosize python2 wrjpgcom
arm-linux-g++.br_real eject jpegtran python2.7 x86_64
arm-linux-gcc erb kill python2.7-config xgettext
arm-linux-gcc-7.4.0 faked kmod python2-config xmlwf
arm-linux-gcc-7.4.0.br_real fakeroot last python3 yacc
arm-linux-gcc-ar fallocate lastb python3.7
arm-linux-gcc.br_real fdtdump lconvert python3.7-config
arm-linux-gcc-nm fdtget libpng16-config python3.7m
Customizing Buildroot
Before building the rootfs image, you may want to customize it: adding/removing packages, modifying component configurations such as busybox and uclibc, generate the kernel, etc.
Customizing Busybox / Linux / U-boot / uClibc configuration
All the explanations are available in the Buildroot manual Configuration of other components section.
Adding/removing packages from the rootfs
You can easily add or remove packages from the rootfs. You simply have to do:
and to go to the Package Selection for the target menu. Packages are sorted by categories:
You simply have to go in the desired category and to select or deselect the packages you want. Once done, you can build your rootfs.
Updating the rootfs for another nand flash device
The rootfs are configured to run on the nand flash device present on atmel boards. If you use another one you may have to update some parameters. To do it, run make menuconfig and go to Filesystem images:
For a jffs2 root filesystem, you may have to update the page and erase size from Flash Type.
For a ubifs root filesystem, you may have to update the UBI logical erase block size, the UBI minimum I/O size, the Maximum LEB count, the UBI physical erase block size and the UBI sub-page size. You can find more information about these parameters in the ubi documentation.
Add your own software to Buildroot
Builroot is basically a big set of makefiles so you will have to follow some steps to insert your own application to the cross-building system. You should have a look at the official documentation since the procedure depends on the build system used.