Some of the most useful takeaways from the Buildroot official manual.
Just the kick-off to start the whole journey with the Buildroot latest stable release:
git clone https://github.com/buildroot/buildroot.git
# checkout latest stable release
git fetch --all --tags
git checkout <yyyy.mm>
The steps above will put you in a detached head, which is fine if you’re “just using” buildroot for your builds, without contributing back.
make O=../<buildroot-output> menuconfig # exit without saving
Note! A relative path here, is interpreted relative to the main Buildroot source directory.
When using out-of-tree builds, the Buildroot .config and temporary files are also stored in the output directory.
Buildroot generates a Makefile wrapper in the output directory
This first part is optional if you already have the ext folder.
Let Buildroot know about the ext folder setting the BR2_EXTERNAL variable:
make BR2_EXTERNAL=/path/to/ext/folder menuconfig # exit without saving
Note! If building out-of-tree run the above commands from the Buildroot output folder.
Note! A relative path is interpreted relative to the main Buildroot source directory, not to the Buildroot output directory.
Work with config
# list configurations
# load one of the available configurations (then edit it)
# save at the location specified in .config
# or save overriding the location
make BR2_DEFCONFIG=<whatever/path/to/file_defconfig> savedefconfig
See Buildroot manual, 9.6. Adding custom user accounts. https://buildroot.org/downloads/manual/manual.html#customize-users
Watch out! Each line MUST be terminated and MUST be terminated right, which is each line having a trailing \n, and the last line being an empty one.
Control the (re)build
# build current configuration
TODO: read manual and summarize
Build and Export the toolchain
See 6.1. Cross-compilation toolchain (specifically 6.1.3).
If you need to build application for the system that is built by Buildroot you need a cross-compilation toolchain (and possibly the target rootfs).
The compilation toolchain that comes with your system runs on and generates code for the processor in your host system. As your embedded system has a different processor, you need a cross-compilation toolchain - a compilation toolchain that runs on your host system but generates code for your target system (and target processor).
cp buildroot/output/images/arm-buildroot-linux-gnueabihf_sdk-buildroot.tar.gz .
tar -xvf arm-buildroot-linux-gnueabihf_sdk-buildroot.tar.gz
mv arm-buildroot-linux-gnueabihf_sdk-buildroot rpi-buildroot-sdk
Then fix the simlinks running the relocator script: