### Start Buildroot Configuration (Qt) Source: https://buildroot.org/downloads/manual/manual.html Initiates the Qt-based graphical configuration tool for Buildroot. Installation of Qt development packages is necessary. ```bash $ make xconfig ``` -------------------------------- ### Package Build Script Example (pkg-1/pkg-1.mk) Source: https://buildroot.org/downloads/manual/manual.html Specifies version, site, license, and installation steps for 'pkg-1'. It uses autotools for building and includes an init script installation. ```makefile PKG_1_VERSION = 1.2.3 PKG_1_SITE = /some/where/to/get/pkg-1 PKG_1_LICENSE = blabla define PKG_1_INSTALL_INIT_SYSV $(INSTALL) -D -m 0755 $(PKG_1_PKGDIR)/S99my-daemon \ $(TARGET_DIR)/etc/init.d/S99my-daemon endef $(eval $(autotools-package)) ``` -------------------------------- ### Package Dependency Transitivity Example (Initial) Source: https://buildroot.org/downloads/manual/manual.html This example illustrates the initial setup of package dependencies using 'depends on' and 'select', highlighting potential issues with transitivity. ```kconfig config BR2_PACKAGE_A bool "Package A" config BR2_PACKAGE_B bool "Package B" depends on BR2_PACKAGE_A config BR2_PACKAGE_C bool "Package C" depends on BR2_PACKAGE_B config BR2_PACKAGE_D bool "Package D" select BR2_PACKAGE_B config BR2_PACKAGE_E bool "Package E" select BR2_PACKAGE_D ``` -------------------------------- ### Start Buildroot Configuration (Curses) Source: https://buildroot.org/downloads/manual/manual.html Use this command to launch the curses-based configuration utility for Buildroot. Ensure development packages for relevant libraries are installed. ```bash $ make menuconfig ``` -------------------------------- ### Example BusyBox SysV Init Start Script Source: https://buildroot.org/downloads/manual/manual.html This script demonstrates the structure and commands for starting, stopping, and restarting a system daemon using BusyBox and SysV init. It includes handling of PID files and arguments from configuration files. ```shell #!/bin/sh DAEMON="syslogd" PIDFILE="/var/run/$DAEMON.pid" SYSLOGD_ARGS="" # shellcheck source=/dev/null [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" # BusyBox syslogd does not create a pidfile, so pass "-n" in the command line # and use "--make-pidfile" to instruct start-stop-daemon to create one. start() { printf 'Starting %s: ' "$DAEMON" # shellcheck disable=SC2086 # we need the word splitting start-stop-daemon --start --background --make-pidfile \ --pidfile "$PIDFILE" --exec "/sbin/$DAEMON" \ -- -n $SYSLOGD_ARGS status=$? if [ "$status" -eq 0 ]; then echo "OK" else echo "FAIL" fi return "$status" } stop() { printf 'Stopping %s: ' "$DAEMON" start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/sbin/$DAEMON" status=$? if [ "$status" -eq 0 ]; then echo "OK" else echo "FAIL" return "$status" fi while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \ --exec "/sbin/$DAEMON"; do sleep 0.1 done rm -f "$PIDFILE" return "$status" } restart() { stop start } case "$1" in start|stop|restart) "$1";; reload) # Restart, since there is no true "reload" feature. restart;; *) echo "Usage: $0 {start|stop|restart|reload}" exit 1 esac ``` -------------------------------- ### Start Buildroot Configuration (GTK) Source: https://buildroot.org/downloads/manual/manual.html Starts the GTK-based graphical configuration utility for Buildroot. GTK development packages are typically required. ```bash $ make gconfig ``` -------------------------------- ### QMake Package Makefile Example Source: https://buildroot.org/downloads/manual/manual.html This example demonstrates the essential variables needed to define a QMake-based package for Buildroot. It includes version, source, site, configuration options, and dependencies, concluding with the invocation of the `qmake-package` macro. ```makefile ################################################################################ # # libfoo # ################################################################################ LIBFOO_VERSION = 1.0 LIBFOO_SOURCE = libfoo-$(LIBFOO_VERSION).tar.gz LIBFOO_SITE = http://www.foosoftware.org/download LIBFOO_CONF_OPTS = QT_CONFIG+=bar QT_CONFIG-=baz LIBFOO_DEPENDENCIES = bar $(eval $(qmake-package)) ``` -------------------------------- ### Example .hash file content Source: https://buildroot.org/downloads/manual/manual.html This example demonstrates the format of a .hash file, including hashes for source archives, binary blobs, and patches. It shows how to include multiple hash types and comments. ```text # Hashes from: http://www.foosoftware.org/download/libfoo-1.2.3.tar.bz2.{sha1,sha256}: sha1 486fb55c3efa71148fe07895fd713ea3a5ae343a libfoo-1.2.3.tar.bz2 sha256 efc8103cc3bcb06bda6a781532d12701eb081ad83e8f90004b39ab81b65d4369 libfoo-1.2.3.tar.bz2 # md5 from: http://www.foosoftware.org/download/libfoo-1.2.3.tar.bz2.md5, sha256 locally computed: md5 2d608f3c318c6b7557d551a5a09314f03452f1a1 libfoo-data.bin sha256 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b libfoo-data.bin # Locally computed: sha256 ff52101fb90bbfc3fe9475e425688c660f46216d7e751c4bbdb1dc85cdccacb9 libfoo-fix-blabla.patch ``` -------------------------------- ### Install Package (Staging and Target) Source: https://buildroot.org/downloads/manual/manual.html This target performs both staging and target installations for target packages. For host packages, it installs directly into the host directory. ```makefile make -install ``` -------------------------------- ### Package Test Script Output Example Source: https://buildroot.org/downloads/manual/manual.html Example output from the `test-pkg` script showing the build status for various toolchains. Results indicate OK, SKIPPED, or FAILED builds. ```shell $ ./utils/test-pkg -c libcurl.config -p libcurl armv5-ctng-linux-gnueabi [ 1/11]: OK armv7-ctng-linux-gnueabihf [ 2/11]: OK br-aarch64-glibc [ 3/11]: SKIPPED br-arcle-hs38 [ 4/11]: SKIPPED br-arm-basic [ 5/11]: FAILED br-arm-cortex-a9-glibc [ 6/11]: OK br-arm-cortex-a9-musl [ 7/11]: FAILED br-arm-cortex-m4-full [ 8/11]: OK br-arm-full [ 9/11]: OK br-arm-full-nothread [10/11]: FAILED br-arm-full-static [11/11]: OK 11 builds, 2 skipped, 2 build failed, 1 legal-info failed ``` -------------------------------- ### Board Defconfig Example Source: https://buildroot.org/downloads/manual/manual.html A sample defconfig file for a board, setting global patch directories, rootfs overlays, post-image scripts, and custom kernel configuration files. ```makefile BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_BAR_42_PATH)/patches/" BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_BAR_42_PATH)/board/my-board/overlay/" BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_BAR_42_PATH)/board/my-board/post-image.sh" BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_BAR_42_PATH)/board/my-board/kernel.config" ``` -------------------------------- ### Cargo Package Configuration Example Source: https://buildroot.org/downloads/manual/manual.html Example of a Config.in file for a Cargo-based package named 'foo'. It includes basic boolean options and dependencies. ```makefile config BR2_PACKAGE_FOO bool "foo" depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS select BR2_PACKAGE_HOST_RUSTC help This is a comment that explains what foo is. http://foosoftware.org/foo/ ``` -------------------------------- ### Build and Install a Specific Package Source: https://buildroot.org/downloads/manual/manual.html Use this target to build and install a single package along with its dependencies. Replace `` with the name of the package you want to build. ```makefile make ``` -------------------------------- ### Package Configuration Example (pkg-1/Config.in) Source: https://buildroot.org/downloads/manual/manual.html Defines a boolean option for 'pkg-1' and provides help text. This is used in Buildroot's Kconfig system. ```makefile config BR2_PACKAGE_PKG_1 bool "pkg-1" help Some help about pkg-1 ---- ``` -------------------------------- ### Provider's .mk File Example Source: https://buildroot.org/downloads/manual/manual.html Declares the virtual packages a provider package implements in its .mk file. ```makefile SOME_PROVIDER_PROVIDES = something-virtual ``` -------------------------------- ### Example Directory Structure for Layered Customizations Source: https://buildroot.org/downloads/manual/manual.html Illustrates a common directory structure for managing common and project-specific customizations in Buildroot. ```text +-- board/ +-- / +-- common/ | +-- post_build.sh | +-- rootfs_overlay/ | | +-- ... | +-- patches/ | +-- ... | +-- fooboard/ +-- linux.config +-- busybox.config +-- +-- post_build.sh +-- rootfs_overlay/ | +-- ... +-- patches/ +-- ... ``` -------------------------------- ### Download Vagrantfile and Start VM (Linux/Mac) Source: https://buildroot.org/downloads/manual/manual.html Use this command on Linux or Mac OS X to download the Vagrantfile and initiate a virtual machine for an isolated Buildroot environment. ```bash curl -O https://buildroot.org/downloads/Vagrantfile; vagrant up ``` -------------------------------- ### Download Vagrantfile and Start VM (Windows PowerShell) Source: https://buildroot.org/downloads/manual/manual.html This PowerShell command is for Windows users to download the Vagrantfile and start a virtual machine for an isolated Buildroot environment. ```powershell (new-object System.Net.WebClient).DownloadFile( "https://buildroot.org/downloads/Vagrantfile","Vagrantfile"); vagrant up ``` -------------------------------- ### Cargo Package Makefile Example Source: https://buildroot.org/downloads/manual/manual.html Example of a .mk file for a Cargo-based package 'foo'. It defines package metadata and uses the cargo-package infrastructure. ```makefile ################################################################################ # # foo # ################################################################################ FOO_VERSION = 1.0 FOO_SOURCE = foo-$(FOO_VERSION).tar.gz FOO_SITE = http://www.foosoftware.org/download FOO_LICENSE = GPL-3.0+ FOO_LICENSE_FILES = COPYING $(eval $(cargo-package)) ``` -------------------------------- ### Example: Run a single test case Source: https://buildroot.org/downloads/manual/manual.html This example shows how to push a branch to Gitlab to trigger a single, specific test case job. ```bash $ git push gitlab HEAD:foo-tests.init.test_busybox.TestInitSystemBusyboxRo ``` -------------------------------- ### Start Buildroot Build Process Source: https://buildroot.org/downloads/manual/manual.html Execute this command to initiate the build process after configuring your Buildroot system. Parallel build support is experimental. ```bash $ make ``` -------------------------------- ### Start GDB Server on Target Source: https://buildroot.org/downloads/manual/manual.html Run this command on the target to start the GDB server, which will listen on a specified TCP port for connections from the cross GDB. ```bash gdbserver :2345 foo ``` -------------------------------- ### Restart Package Compilation and Installation Source: https://buildroot.org/downloads/manual/manual.html This command restarts the compilation and installation steps for a package without cleaning its build directory. It's faster than a full rebuild if only the compilation or installation stages need to be redone. ```bash make -rebuild ``` -------------------------------- ### Start Buildroot Configuration (New Curses) Source: https://buildroot.org/downloads/manual/manual.html Launches the newer curses-based configuration interface for Buildroot. Development packages for associated libraries may be required. ```bash $ make nconfig ``` -------------------------------- ### Build and Install Package Dependencies Source: https://buildroot.org/downloads/manual/manual.html This target ensures that all necessary dependencies for a package are built and installed before the package itself is processed. ```makefile make -depends ``` -------------------------------- ### Example Package Override Source Directories Source: https://buildroot.org/downloads/manual/manual.html Concrete examples of setting `_OVERRIDE_SRCDIR` for the LINUX and BUSYBOX packages. ```makefile LINUX_OVERRIDE_SRCDIR = /home/bob/linux/ BUSYBOX_OVERRIDE_SRCDIR = /home/bob/busybox/ ``` -------------------------------- ### Configure asciidoc-document with Variables and Hooks Source: https://buildroot.org/downloads/manual/manual.html This example shows how to set up an asciidoc-document in Buildroot using various configuration variables and hooks. It defines sources, resources, TOC depth, and custom post-rsync and dependency check hooks. ```makefile ################################################################################ # # foo-document # ################################################################################ FOO_SOURCES = $(sort $(wildcard $(FOO_DOCDIR)/*)) FOO_RESOURCES = $(sort $(wildcard $(FOO_DOCDIR)/resources)) FOO_TOC_DEPTH = 2 FOO_TOC_DEPTH_HTML = 1 FOO_TOC_DEPTH_SPLIT_HTML = 3 define FOO_GEN_EXTRA_DOC /path/to/generate-script --outdir=$(@D) endef FOO_POST_RSYNC_HOOKS += FOO_GEN_EXTRA_DOC define FOO_CHECK_MY_PROG if ! which my-prog >/dev/null 2>&1; then \ echo "You need my-prog to generate the foo document"; \ exit 1; \ fi endef FOO_CHECK_DEPENDENCIES_HOOKS += FOO_CHECK_MY_PROG define FOO_CHECK_MY_OTHER_PROG if ! which my-other-prog >/dev/null 2>&1; then \ echo "You need my-other-prog to generate the foo document as PDF"; \ exit 1; \ fi endef FOO_CHECK_DEPENDENCIES_PDF_HOOKS += FOO_CHECK_MY_OTHER_PROG $(eval $(call asciidoc-document)) ``` -------------------------------- ### Provider's Config.in File Example Source: https://buildroot.org/downloads/manual/manual.html Defines a package as a provider for a virtual package. It selects the virtual package and sets its providing name. ```kconfig config BR2_PACKAGE_SOME_PROVIDER bool "some-provider" select BR2_PACKAGE_HAS_SOMETHING_VIRTUAL help This is a comment that explains what some-provider is. http://foosoftware.org/some-provider/ if BR2_PACKAGE_SOME_PROVIDER config BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL default "some-provider" endif ``` -------------------------------- ### Get Help for Package Test Script Source: https://buildroot.org/downloads/manual/manual.html Display the help message for the `test-pkg` script to view available options and usage instructions. ```shell $ ./utils/test-pkg -h ``` -------------------------------- ### Install Package to Staging Directory Source: https://buildroot.org/downloads/manual/manual.html For target packages, this installs the built package into the staging directory, which is used for intermediate steps. ```makefile make -install-staging ``` -------------------------------- ### Genimage Configuration Example Source: https://buildroot.org/downloads/manual/manual.html An example of a genimage.cfg file defining the layout for an EFI system partition and a full SD card image. Follows specific indentation and formatting rules. ```genimage.cfg image efi-part.vfat { vfat { file EFI { image = "efi-part/EFI" } file Image { image = "Image" } } size = 32M } image sdimage.img { hdimage { } partition u-boot { image = "efi-part.vfat" offset = 8K } partition root { image = "rootfs.ext2" size = 512M } } ``` -------------------------------- ### Menuconfig: Example br2-external Tree Package Selection Source: https://buildroot.org/downloads/manual/manual.html Shows how an external br2-external tree's packages appear in the Buildroot menuconfig interface. This example includes a custom flash address option. ```menuconfig External options ---> *** Example br2-external tree (in /path/to/br2-ext-tree/) [ ] pkg-1 [ ] pkg-2 (0x10AD) my-board flash address ``` -------------------------------- ### Example: Run multiple test cases in a group Source: https://buildroot.org/downloads/manual/manual.html This example demonstrates pushing a branch to Gitlab to trigger multiple test cases belonging to the same group or category. ```bash $ git push gitlab HEAD:foo-tests.init.test_busybox ``` ```bash $ git push gitlab HEAD:foo-tests.init ``` -------------------------------- ### Create User with Specific UID and Default GID Source: https://buildroot.org/downloads/manual/manual.html This example shows how to create a user with a specific UID, a computed GID for the main group, an empty password, a root home directory, and no additional groups. ```makeusers test 8000 wheel -1 = - /bin/sh - Test user ``` -------------------------------- ### Restart Package Configuration, Compilation, and Installation Source: https://buildroot.org/downloads/manual/manual.html This command forces Buildroot to re-run the configuration, compilation, and installation steps for a specified package. Use this when package configuration options might have changed or need to be reapplied. ```bash make -reconfigure ``` -------------------------------- ### Start Cross GDB on Host Source: https://buildroot.org/downloads/manual/manual.html Execute this command on the build host to launch the cross GDB. Ensure 'foo' is available locally with debugging symbols. The gdbinit script helps the cross GDB locate target libraries. ```bash /output/host/bin/-gdb -ix /output/staging/usr/share/buildroot/gdbinit foo ``` -------------------------------- ### Example Patch Header and Diff Source: https://buildroot.org/downloads/manual/manual.html Illustrates the expected format for a patch header, including a description and Signed-off-by tag, followed by a diff output generated using `diff -purN`. ```diff configure.ac: add C++ support test Signed-off-by: John Doe --- configure.ac.orig +++ configure.ac @@ -40,2 +40,12 @@ AC_PROG_MAKE_SET + +AC_CACHE_CHECK([whether the C++ compiler works], + [rw_cv_prog_cxx_works], + [AC_LANG_PUSH([C++]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + [rw_cv_prog_cxx_works=yes], + [rw_cv_prog_cxx_works=no]) + AC_LANG_POP([C++])]) + +AM_CONDITIONAL([CXX_WORKS], [test "x$rw_cv_prog_cxx_works" = "xyes"]) ``` -------------------------------- ### Start Service with PID File Creation Source: https://buildroot.org/downloads/manual/manual.html Use this when your service does not create its own PID file. start-stop-daemon will create it automatically. Ensure the daemon is executed with appropriate arguments. ```shell start-stop-daemon --start --background --make-pidfile \ --pidfile "$PIDFILE" --exec "/sbin/$DAEMON" \ -- -n $SYSLOGD_ARGS ``` -------------------------------- ### Configuring Getty for Serial Console Login Source: https://buildroot.org/downloads/manual/manual.html Modify 'Run a getty (login prompt) after boot' and 'getty options' in System configuration to ensure a shell starts on the serial console. ```shell System configuration -> Run a getty (login prompt) after boot System configuration -> getty options ``` -------------------------------- ### Creating a Block Device File Source: https://buildroot.org/downloads/manual/manual.html This example demonstrates the creation of a block device file for '/dev/hda'. The parameters specify the device type, permissions, owner, group, major and minor numbers, and batch creation settings. ```makedev /dev/hda b 640 root root 3 0 0 0 - ``` -------------------------------- ### Package Dependency Transitivity Example (Corrected) Source: https://buildroot.org/downloads/manual/manual.html This corrected example demonstrates how to ensure proper transitivity in package dependencies by explicitly adding 'depends on' clauses to resolve issues where 'select' alone might not enforce all requirements. ```kconfig config BR2_PACKAGE_D bool "Package D" depends on BR2_PACKAGE_A select BR2_PACKAGE_B config BR2_PACKAGE_E bool "Package E" depends on BR2_PACKAGE_A select BR2_PACKAGE_D ``` -------------------------------- ### Virtual Package Config.in Example Source: https://buildroot.org/downloads/manual/manual.html Defines configuration options for a virtual package, including whether it's present and which provider is selected. Used in Buildroot's Kconfig system. ```makefile 01: config BR2_PACKAGE_HAS_SOMETHING_VIRTUAL 02: bool 03: 04: config BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL 05: depends on BR2_PACKAGE_HAS_SOMETHING_VIRTUAL 06: string ``` -------------------------------- ### Reset Buildroot Configuration and Build Products Source: https://buildroot.org/downloads/manual/manual.html Deletes all build products as well as the entire Buildroot configuration file. Use this to start fresh for a new target. ```bash $ make distclean ``` -------------------------------- ### Generate Python Packages from PyPI using scanpypi Source: https://buildroot.org/downloads/manual/manual.html Automates the creation of Buildroot packages for Python libraries available on PyPI. Ensure `setuptools` is installed on the host. Packages are generated in the 'package' directory by default. ```bash utils/scanpypi foo bar -o package ``` -------------------------------- ### External Tree Name and Path Variable Example Source: https://buildroot.org/downloads/manual/manual.html Illustrates how a chosen name for an external tree maps to the generated Buildroot path variable. ```text FOO → BR2_EXTERNAL_FOO_PATH BAR_42 → BR2_EXTERNAL_BAR_42_PATH ``` -------------------------------- ### POST_RSYNC Hook Example for Local Sources Source: https://buildroot.org/downloads/manual/manual.html Demonstrates using the POST_RSYNC hook to copy version control directories when using local source directories. It utilizes $(SRCDIR) and $(@D) variables. ```makefile # Example command within the hook (not a complete snippet): # rsync -a $(SRCDIR)/.git $(@D)/ ``` -------------------------------- ### Virtual Package .mk File Example Source: https://buildroot.org/downloads/manual/manual.html A minimal Make fragment for a virtual package that utilizes the 'virtual-package' macro. This macro handles the core logic for managing virtual packages in Buildroot. ```makefile 01: ################################################################################ 02: # 03: # something-virtual 04: # 05: ################################################################################ 06: 07: $(eval $(virtual-package)) ``` -------------------------------- ### Python Package Makefile Example Source: https://buildroot.org/downloads/manual/manual.html This snippet demonstrates the essential variables required for a Buildroot Makefile to build a Python package. It includes version, source, license, environment, dependencies, and build system configuration. ```makefile ################################################################################ # # python-foo # ################################################################################ PYTHON_FOO_VERSION = 1.0 PYTHON_FOO_SOURCE = python-foo-$(PYTHON_FOO_VERSION).tar.xz PYTHON_FOO_SITE = http://www.foosoftware.org/download PYTHON_FOO_LICENSE = BSD-3-Clause PYTHON_FOO_LICENSE_FILES = LICENSE PYTHON_FOO_ENV = SOME_VAR=1 PYTHON_FOO_DEPENDENCIES = libmad PYTHON_FOO_SETUP_TYPE = setuptools $(eval $(python-package)) ``` -------------------------------- ### Build Basic Board Configuration and Build Source: https://buildroot.org/downloads/manual/manual.html Use these commands to configure and build a minimal system for a new board. Ensure you have a working configuration before running. ```bash $ make _defconfig $ make ``` -------------------------------- ### Autotools Package Makefile Example Source: https://buildroot.org/downloads/manual/manual.html This snippet demonstrates the essential variables for defining an autotools-based package in a Buildroot Makefile. It specifies version, source, site, installation behavior, configure options, and dependencies. ```makefile ################################################################################ # # libfoo # ################################################################################ LIBFOO_VERSION = 1.0 LIBFOO_SOURCE = libfoo-$(LIBFOO_VERSION).tar.gz LIBFOO_SITE = http://www.foosoftware.org/download LIBFOO_INSTALL_STAGING = YES LIBFOO_INSTALL_TARGET = NO LIBFOO_CONF_OPTS = --disable-shared LIBFOO_DEPENDENCIES = libglib2 host-pkgconf $(eval $(autotools-package)) ``` -------------------------------- ### Re-run Package Installation Commands Source: https://buildroot.org/downloads/manual/manual.html This target re-executes the installation commands for a package. It's useful if the installation process failed or needs to be reapplied. ```makefile make -reinstall ``` -------------------------------- ### Example Dependency Comment: crda Source: https://buildroot.org/downloads/manual/manual.html An example of a dependency comment for the 'crda' package, specifying a required toolchain feature. ```text crda needs a toolchain w/ threads ``` -------------------------------- ### Example Dependency Comment: mpd Source: https://buildroot.org/downloads/manual/manual.html An example of a dependency comment for the 'mpd' package, specifying required toolchain features. ```text mpd needs a toolchain w/ C++, threads, wchar ``` -------------------------------- ### Testing Live CD Image with QEMU Source: https://buildroot.org/downloads/manual/manual.html Test a generated Live CD ISO image using QEMU for i386 architecture. This command simulates booting from a CD-ROM. ```bash qemu-system-i386 -cdrom output/images/rootfs.iso9660 ``` -------------------------------- ### Backporting Note Example Source: https://buildroot.org/downloads/manual/manual.html Example of a post-commit note in a commit log specifying affected maintenance branches for a bug fix. ```git log package/foo: fix stuff Signed-off-by: Your Real Name --- Backport to: 2020.02.x, 2020.05.x (2020.08.x not affected as the version was bumped) ``` -------------------------------- ### Install Package to Target Directory Source: https://buildroot.org/downloads/manual/manual.html For target packages, this installs the built package into the final target directory, making it available on the embedded system. ```makefile make -install-target ``` -------------------------------- ### Generate Package Information JSON Blurb Source: https://buildroot.org/downloads/manual/manual.html Execute the `make show-info` target to generate a JSON description of enabled packages, their dependencies, licenses, and other metadata. This is useful for understanding the build configuration. ```bash make show-info ``` -------------------------------- ### Display List of Boards with Defconfig Source: https://buildroot.org/downloads/manual/manual.html This command lists all available board configurations (defconfigs) that can be used to set up Buildroot for a specific target. ```bash $ make list-defconfigs ``` -------------------------------- ### Testing Live CD as Hard Disk Image with QEMU Source: https://buildroot.org/downloads/manual/manual.html Test a hybrid Live CD ISO image with QEMU, treating it as a hard disk image. This is useful for verifying hybrid ISO functionality. ```bash qemu-system-i386 -hda output/images/rootfs.iso9660 ``` -------------------------------- ### Create Basic Package Configuration Snippet Source: https://buildroot.org/downloads/manual/manual.html Create a configuration snippet to enable a package like libcurl. This snippet should only contain package enablement options, excluding architecture or toolchain specifics. ```shell $ cat libcurl.config BR2_PACKAGE_LIBCURL=y ``` -------------------------------- ### Perl/CPAN Package Definition Example Source: https://buildroot.org/downloads/manual/manual.html Example of a `.mk` file for a Perl/CPAN package using the `perl-package` infrastructure. It defines version, source, site, dependencies, license, and distribution name before invoking the `perl-package` macro. ```makefile ################################################################################ # # perl-foo-bar # ################################################################################ PERL_FOO_BAR_VERSION = 0.02 PERL_FOO_BAR_SOURCE = Foo-Bar-$(PERL_FOO_BAR_VERSION).tar.gz PERL_FOO_BAR_SITE = $(BR2_CPAN_MIRROR)/authors/id/M/MO/MONGER PERL_FOO_BAR_DEPENDENCIES = perl-strictures PERL_FOO_BAR_LICENSE = Artistic or GPL-1.0+ PERL_FOO_BAR_LICENSE_FILES = LICENSE PERL_FOO_BAR_DISTNAME = Foo-Bar $(eval $(perl-package)) ``` -------------------------------- ### Generate Buildroot Manual Source: https://buildroot.org/downloads/manual/manual.html Commands to clean previous manual builds and then generate the current documentation. The output is placed in _output/docs/manual_. ```bash $ make manual-clean $ make manual ``` -------------------------------- ### Get Help for generate-cyclonedx Script Source: https://buildroot.org/downloads/manual/manual.html Displays the help message for the `generate-cyclonedx` script, allowing customization of its output for your project. ```bash utils/generate-cyclonedx --help ``` -------------------------------- ### Create Rootfs Overlay Directory Source: https://buildroot.org/downloads/manual/manual.html Create a directory for root filesystem overlays and add necessary files. ```bash create `board///rootfs-overlay/` and fill it with additional files you need on your rootfs, e.g. `board///rootfs-overlay/etc/inittab`. ``` -------------------------------- ### List Available Buildroot Runtime Tests Source: https://buildroot.org/downloads/manual/manual.html Execute `support/testing/run-tests -l` to display all available test cases. This command is useful for discovering tests and for individual test development from the console. ```bash $ support/testing/run-tests -l List of tests test_run (tests.utils.test_check_package.TestCheckPackage) test_run (tests.toolchain.test_external.TestExternalToolchainBuildrootMusl) ... ok test_run (tests.toolchain.test_external.TestExternalToolchainBuildrootuClibc) ... ok test_run (tests.toolchain.test_external.TestExternalToolchainCCache) ... ok test_run (tests.toolchain.test_external.TestExternalToolchainCtngMusl) ... ok test_run (tests.toolchain.test_external.TestExternalToolchainLinaroArm) ... ok test_run (tests.toolchain.test_external.TestExternalToolchainSourceryArmv4) ... ok test_run (tests.toolchain.test_external.TestExternalToolchainSourceryArmv5) ... ok test_run (tests.toolchain.test_external.TestExternalToolchainSourceryArmv7) ... ok [snip] test_run (tests.init.test_systemd.TestInitSystemSystemdRoFull) ... ok test_run (tests.init.test_systemd.TestInitSystemSystemdRoIfupdown) ... ok test_run (tests.init.test_systemd.TestInitSystemSystemdRoNetworkd) ... ok test_run (tests.init.test_systemd.TestInitSystemSystemdRwFull) ... ok test_run (tests.init.test_systemd.TestInitSystemSystemdRwIfupdown) ... ok test_run (tests.init.test_systemd.TestInitSystemSystemdRwNetworkd) ... ok test_run (tests.init.test_busybox.TestInitSystemBusyboxRo) ... ok test_run (tests.init.test_busybox.TestInitSystemBusyboxRoNet) ... ok test_run (tests.init.test_busybox.TestInitSystemBusyboxRw) ... ok test_run (tests.init.test_busybox.TestInitSystemBusyboxRwNet) ... ok Ran 157 tests in 0.021s OK ``` -------------------------------- ### Buildroot Config for Python CFFI Runtime Dependency Source: https://buildroot.org/downloads/manual/manual.html Example Buildroot Kconfig entry to select `python-cffi` as a runtime dependency for a Python package. ```kconfig config BR2_PACKAGE_PYTHON_FOO bool "python-foo" select BR2_PACKAGE_PYTHON_CFFI # runtime ``` -------------------------------- ### Example of Reusing Quoted Variable Output Source: https://buildroot.org/downloads/manual/manual.html Demonstrates how to capture and use the output of `make printvars` with `QUOTED_VARS=YES` in a shell script using `eval`. ```bash $ eval $(make -s printvars VARS=BUSYBOX_DEPENDENCIES QUOTED_VARS=YES) $ echo $BUSYBOX_DEPENDENCIES ``` -------------------------------- ### Run a Specific Buildroot Runtime Test Case Source: https://buildroot.org/downloads/manual/manual.html Execute a single test case using `support/testing/run-tests` with specified download and output directories. The `-k` option preserves the output directory after the test completes. ```bash $ support/testing/run-tests -d dl -o output_folder -k tests.init.test_busybox.TestInitSystemBusyboxRw 15:03:26 TestInitSystemBusyboxRw Starting 15:03:28 TestInitSystemBusyboxRw Building 15:08:18 TestInitSystemBusyboxRw Building done 15:08:27 TestInitSystemBusyboxRw Cleaning up . Ran 1 test in 301.140s OK ``` -------------------------------- ### Buildroot Makefile for Python CFFI Build-time Dependency Source: https://buildroot.org/downloads/manual/manual.html Example Buildroot Makefile snippet showing how to declare `host-python-cffi` as a build-time dependency for a Python package. ```makefile ################################################################################ # # python-foo # ################################################################################ ... PYTHON_FOO_DEPENDENCIES = host-python-cffi $(eval $(python-package)) ``` -------------------------------- ### Download All Project Sources Source: https://buildroot.org/downloads/manual/manual.html Execute this command to download all source archives for the packages selected in the Buildroot configuration. This is essential for performing offline builds, allowing you to disconnect from the internet or transfer sources to another machine. ```bash make source ``` -------------------------------- ### Display scanpypi Help Options Source: https://buildroot.org/downloads/manual/manual.html Lists all available command-line options for the `scanpypi` utility. ```bash utils/scanpypi -h ``` -------------------------------- ### Basic Kconfig Package Integration Source: https://buildroot.org/downloads/manual/manual.html Minimal configuration for a Buildroot package using the kconfig infrastructure. Requires specifying the configuration file and evaluating the `kconfig-package` macro. ```makefile FOO_KCONFIG_FILE = reference-to-source-configuration-file $(eval $(kconfig-package)) ``` -------------------------------- ### Adding Extended Attribute Capability to a File Source: https://buildroot.org/downloads/manual/manual.html This example shows how to add a capability, specifically 'cap_sys_admin', to a file using the '|xattr' syntax. This requires the BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES option to be enabled. ```makedev /usr/bin/foo f 755 root root - - - - - |xattr cap_sys_admin+eip ``` -------------------------------- ### Registering a Custom Build Hook Source: https://buildroot.org/downloads/manual/manual.html Shows how to register a custom action for a specific build hook point. This example adds a custom fixup action to the POST_PATCH hook. ```makefile define LIBFOO_POST_PATCH_FIXUP action1 action2 endef LIBFOO_POST_PATCH_HOOKS += LIBFOO_POST_PATCH_FIXUP ``` -------------------------------- ### Performing a Full Rebuild in Buildroot Source: https://buildroot.org/downloads/manual/manual.html To ensure all components are rebuilt from scratch, execute the 'make clean all' command. This is recommended when unsure about the impact of configuration changes or after removing packages. ```bash $ make clean all ``` -------------------------------- ### Create Custom Package Directory Source: https://buildroot.org/downloads/manual/manual.html Create a directory for custom packages specific to a manufacturer and board. ```bash mkdir -p board// ```