This repository serves as an example of how to set up an external tree for Buildroot.
When working with Buildroot, it's a good practice to keep custom configurations and packages separate from the Buildroot source tree. This approach ensures:
- Decoupling: Customizations are maintained independently, making it easier to update Buildroot without conflicts.
- Reproducibility: Your configurations and applications are stored in a separate repository, ensuring consistency across different builds.
- Maintainability: Changes to your applications do not interfere with Buildroot's internal structure.
Buildroot allows you to embed your own packages into a custom Linux image. Instead of manually installing each application after boot, you can instruct Buildroot to:
- Download your external packages directly from your GitHub repositories.
- Compile and integrate them automatically into the final root filesystem.
- Provide them as selectable options in the Buildroot
menuconfig.
This repository includes:
✅ Four external repositories with different applications (morning, afternoon, night and simple_stream_server).
✅ Buildroot configuration to fetch and compile these applications automatically.
✅ A menuconfig section named "External Options", where these applications appear as selectable packages.
✅ The ability to generate a Linux image containing these applications pre-installed.
extern/: Contains external configurations and package definitions.buildroot/: Submodule of the Buildroot build system.clear_build.sh: Script to clean the build directory.variables.sh: Script containing environment variables used by other scripts.list_defconfigs.sh: Script to display available defconfigs for Buildroot.menuconfig.sh: Script to run a GUI to display and edit current configuration.save_custom_defconfig.sh: Script to save the current configuration as a custom defconfig.set_custom_defconfig.sh: Script to set up a custom defconfig.set_default_defconfig.sh: Script to set up the default defconfig.rebuild_and_install_external_package.sh: Script to rebuild all external packages, and install in the build image.runqemu.sh: Script to run the built system in QEMU (used when testing in an QEMU defconfig).
To use this external repository with Buildroot:
-
Initialize and update the Buildroot submodule:
git submodule update --init
The next steps (2 to 3) are for creating your external custom configuration (defconfig)
If you already have a external custom configuration (defconfig) that you want to use, do the following:
- place the defconfig file in
extern/configs - in
variables.sh, update the parameterCUSTOM_DEFCONFIG_NAMEwith the defconfig file name - go to step 4
- place the defconfig file in
-
Set up the default predefined configuration
Buildroot supplies many predefined configurations (defconfigs)
In
variables.shunderDEFAULT_DEFCONFIG_NAMEthe current defconfig isqemu_aarch64_virt_defconfigThis provides a starting point to modify Buildroot settings, such as adding external packages.
If you want a different default defconfig, you can search the available ones with the following command, and change
DEFAULT_DEFCONFIG_NAMEaccordingly../list_defconfigs.sh
Finally, to apply the default configuration, run this command:
./set_default_defconfig.sh
Now buildroot applied the configuration using the defconfig set in
DEFAULT_DEFCONFIG_NAMEfromvariables.sh.You could go to step 6 now if you want to build with the default defconfig, but what is the fun in just using a default configuration right?
-
Customize the configuration and Save your own defconfig externally:
-
Run
menuconfig.shto modify settings as needed. -
If you want to add our custom external packages (available in
extern/package), selectExternal options, then select our custom external packages.Note: the external package
simple_stream_serverallows you to configure if its executable should initialize automatically on boot, and what should be its initialization priority.
- Once changes are made, save them externally:
This saves the configuration externally in
./save_custom_defconfig.sh
extern/configswith the name set inCUSTOM_DEFCONFIG_NAMEfromvariables.sh. If you want to save it with another name, just changeCUSTOM_DEFCONFIG_NAMEvalue.
-
-
Verify that Buildroot recognizes the external configuration:
./list_defconfigs.sh
Your custom configuration should appear in the bottom, under "External configs in ROGER_TUTORIAL".
-
Set buildroot to use the external configuration:
./set_custom_defconfig.sh
Now buildroot applied your external custom configuration defined in
variables.sh, in parameterCUSTOM_DEFCONFIG_NAME. -
Build the system:
make -C buildroot
This is going to take several minutes if it is the first build for the selected defconfig.
-
Run the built system:
- If using QEMU:
./runqemu.sh
- If using Raspberry Pi or another board with sdcard image support, flash the generated
sdcard.imgto an SD card.
- If using QEMU:
After building the image and booting into the system you are able to test if everything went as expected.
In this example, we have configured the executable simple_stream_server to init automatically on boot, that's why it shows the message simple_stream_server started on the boot sequence.
Also, after login, you can run the executables morning, afternoon and night by typing their names in the terminal:
This proves that the executables were correctly embedded into the Linux image!
For more details on using external repositories with Buildroot, refer to the Buildroot documentation.


