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.
This project will allow you to build complete firmware image for liteboard and LCD sandwich 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.
Download Buildroot release you want to use, for example
Extract downloaded file
tar xf buildroot-2016.11.1.tar.gz
During this demo 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 tree by setting (once per project setup)
BR2_EXTERNAL variable as presented below
cd buildroot-2016-11.1 make BR2_EXTERNAL=/tmp/examples list-defconfigs
/tmp/examples should point to the repository cloned in the 2nd step.
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
To configure Buildroot for liteSOM + LCD + resistive touchscreen configuration please use grinn_liteboard_lcd_res_defconfig
You can compile project in this same way as usual
Like for other Buildroot based projects directory output/images/ contain all files required to program your device.
You can program uSD card via following command
dd if=output/images/sdcard.img of=/dev/<SD-CARD> bs=4M
More details about this customization
. ├── configs │ └── grinn_liteboard_lcd_res_defconfig
Complete configuration for buildroot is available in
Each time when
make grinn_liteboard_lcd_res_defconfig is called Buildroot is configured as defined within this file.
. ├── board │ └── grinn │ └── liteboard-lcd-res │ ├── imx6ul-liteboard-lcd-res.dts │ ├── post-build.sh
Buildroot configuration for liteboard doesn't contain any configuration for LCD nor touchscreen therefore this demo will use 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
Unfortunately on the target during boot procedure U-Boot will try to load
imx6ul-liteboard.dtb file which will be not available on uSD 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.
. ├── 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.
. ├── 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.h - 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 content to the target
root directory used in the next step to generate image for the liteboard.