// -*- mode:doc; -*-
// vim: set syntax=asciidoc:

=== Step-by-step instructions for storing configuration

To store the configuration for a specific product, device or
application, it is advisable to use the same conventions as for the
board support: put the buildroot defconfig in the +configs+ directory,
and any other files in a subdirectory of the +boards+ directory.  This
section gives step-by-step instructions about how to do that. Of course,
you can skip the steps that are not relevant for your use case.

1. +make menuconfig+ to configure toolchain, packages and kernel.
1. +make linux-menuconfig+ to update the kernel config, similar for
   other configuration.
1. +mkdir -p board/<manufacturer>/<boardname>+
1. Set the following options to +board/<manufacturer>/<boardname>/<package>.config+
   (as far as they are relevant):
   * +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE+
   * +BR2_PACKAGE_BUSYBOX_CONFIG+
   * +BR2_UCLIBC_CONFIG+
   * +BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_CONFIG_FILE+
   * +BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE+
1. Write the configuration files:
   * +make linux-update-defconfig+
   * +make busybox-update-config+
   * +make uclibc-update-config+
   * +cp <output>/build/at91bootstrap3-*/.config board/<manufacturer>/<boardname>/at91bootstrap3.config+
   * +make barebox-update-defconfig+
1. Create +board/<manufacturer>/<boardname>/fs-overlay/+ and fill it
   with additional files you need on your rootfs, e.g.
   +board/<manufacturer>/<boardname>/fs-overlay/etc/inittab+.
   Set +BR2_ROOTFS_OVERLAY+
   to +board/<manufacturer>/<boardname>/fs-overlay+.
1. Create a post-build script
   +board/<manufacturer>/<boardname>/post-build.sh+.  Set
   +BR2_ROOTFS_POST_BUILD_SCRIPT+ to
   +board/<manufacturer>/<boardname>/post-build.sh+
1. If additional setuid permissions have to be set or device nodes have
   to be created, create +board/<manufacturer>/<boardname>/device_table.txt+
   and add that path to +BR2_ROOTFS_DEVICE_TABLE+.
1. +make savedefconfig+ to save the buildroot configuration.
1. +cp defconfig configs/<boardname>_defconfig+
1. To add patches to the linux build, set +BR2_LINUX_KERNEL_PATCH+ to
   +board/<manufacturer>/<boardname>/patches/linux/+ and add your
   patches in that directory. Each patch should be called
   +linux-<num>-<description>.patch+. Similar for U-Boot, barebox,
   at91bootstrap and at91bootstrap3.
1. If you need modifications to other packages, or if you need to add
   packages, do that directly in the +packages/+ directory, following the
   instructions in xref:adding-packages[].
