How to customize Buildroot
Buildroot allows to keep customizations outside Buildroot main project.
We are using this mechanism to extend & customize Buildroot configuration for liteSOM based projects and it is recommenced to start with one of our example to build infrastructure for your project.
Please take into account that below you can find one of the possible way how to customize Buildroot; for more details please read Buildroot User Manual and Customizing the generated target filesystem.
Project description
This project will allow you to build complete firmware image for liteboard and LCD display extension with resistive touchscreen.
Main intention is to keep all customizations outside Buildroot project but still allow user to configure kernel, BusyBox and Buildroot or to modify Device Tree without any problems.
Project setup
Download Buildroot release you want to use, for example
wget https://buildroot.org/downloads/buildroot-2016.11.1.tar.gz
Extract downloaded file
tar xf buildroot-2016.11.1.tar.gz
During this how to we will extend Buildroot setup by customizations from Grinn examples repository, please clone this repository
git clone https://github.com/grinn-pub/examples.git
Tell Buildroot to use additional br2-external
directory by setting (once per project setup) BR2_EXTERNAL
variable as presented below
cd buildroot-2016-11.1 make BR2_EXTERNAL=/tmp/examples list-defconfigs
where /tmp/examples
should point to cloned Grinn examples repository.
Target list-defconfigs
shows list of available defconfigs. After built-in configs you should see configs provided by the external customizations (like Grinn examples).
make BR2_EXTERNAL=/tmp/examples list-defconfigs Built-in configs: acmesystems_aria_g25_128mb_defconfig - Build for acmesystems_aria_g25_128mb acmesystems_aria_g25_256mb_defconfig - Build for acmesystems_aria_g25_256mb [...] External configs in "Grinn examples": grinn_liteboard_lcd_res_defconfig - Build for grinn_liteboard_lcd_res
Project configuration
To configure Buildroot for liteSOM with LCD sandwich please use grinn_liteboard_lcd_res_defconfig
configuration template.
make grinn_liteboard_lcd_res_defconfig
Project compilation
You can compile project in this same way as usual
make all
Project output
Like for other Buildroot based projects directory output/images/
contains all files required to program liteboard.
You can program SD card via following command
dd if=output/images/sdcard.img of=/dev/<SD-CARD> bs=4M
More details about this customization
Buildroot configuration
. ├── configs │ └── grinn_liteboard_lcd_res_defconfig
Complete configuration for Buildroot is available in grinn_liteboard_lcd_res_defconfig file.
Device tree
. ├── board │ └── grinn │ └── liteboard-lcd-res │ ├── imx6ul-liteboard-lcd-res.dts │ ├── post-build.sh
Buildroot configuration for liteboard
doesn't contain any configuration for LCD panel nor touchscreen therefore this demo is using customized device tree file (imx6ul-liteboard-lcd-res.dts).
During kernel compilation this file will be compiled and output will be stored as imx6ul-liteboard-lcd-res.dtb
. You can find this file inside output/images
directory.
Unfortunately on the target during boot procedure U-Boot will try to load imx6ul-liteboard.dtb
file which will be not available on SD card. Therefore every build Buildroot via post-build.sh script will adjust name of the Device Tree Blob
file to the expected by the U-Boot.
Kernel configuration
. ├── board │ └── grinn │ └── liteboard-lcd-res │ ├── linux.defconfig
Customized Linux configuration is stored in linux.defconfig file. It will be used by the Buildroot to initialize proper kernel configuration.
Extra files
. ├── board │ └── grinn │ └── liteboard-lcd-res │ └── rootfs │ └── etc │ ├── profile.d │ │ └── tslib.sh │ └── udev │ └── rules.d │ └── 60-touchscreen.rules
To simplify/unify board setup two config files should be available on running liteboard:
- /etc/profile.d/tslib.sh - to configure device for tslib library,
- /etc/rules.d/60-touchscreen.rules - to guarantee permanent name for the touchscreen device.
Each time when make all
command will be called Buildroot will automatically copy rootfs directory to the output/target
directory used in the next step to generate image for the liteboard.