Customization of U-Boot and Linux
U-Boot
Most projects can use the Embedded Artists U-Boot with little or no modification. The most common modification is to change the default .dtb file that will be loaded. Some projects might need additional early initialization of hardware and will put this in the board specific file of the U-Boot.
Board specific files
If modification is needed it can in most cases be limited to changes in the board specific file which is located in a sub-directory to <uboot-dir>/board/embeddedartists. The table below lists board specific files for the different SOM boards.
https://github.com/embeddedartists/uboot-rz/tree/ea_v2024.07/board/embeddedartists
| Board | Board specific file |
|---|---|
| RZ/G3E SOM | rzg3e-ea-som/rzg3e-ea-som.c |
Device tree files
The U-Boot is also utilizing device tree files like the Linux kernel. The support for device trees is however (for version 2024.07) not as extensive as it is for the Linux kernel. Not all drivers have full support for device trees. If you need to change initialization of a peripheral or add a new peripheral that should be initialized in the U-Boot you might also need to modify the device tree file used in the U-Boot.
Device tree files are located in the directory <uboot-dir>/arch/arm/dts.
https://github.com/embeddedartists/uboot-rz/tree/ea_v2024.07/arch/arm/dts
The table below lists the device trees used for Embedded Artists COM boards.
| Board | Device tree file |
|---|---|
| RZ/G3E SOM | rzg3e-ea-som.dts |
Configuration files
The configuration of a U-Boot is divided into two files. Historically it used to be an include file that contained all configurations, but more and more are moved to a defconfig file utilizing the same kind of configuration infrastructure (Kconfig) as in the Linux kernel. You will typically modify the defconfig file if you would like to add support for more U-Boot commands or drivers. Defconfig files are located in <uboot-dir>/configs/, see the table below for the files that are used by Embedded Artists COM boards.
Follow the link below to see the defconfig file for the RZ/G3E SOM board.
https://github.com/embeddedartists/uboot-rz/blob/ea_v2024.07/configs/rzg3e-ea-som_defconfig
| Board | Device tree file |
|---|---|
| RZ/G3E SOM | configs/rzg3e-ea-som_defconfig |
If you instead want to modify for example the default U-Boot environment, such as change the default dtb file that is loaded, you need to do this change in the include file which is located in <uboot-dir>/include/configs/. See the table below for a list of all files used with Embedded Artists COM boards.
Follow the link below to see how the dtb file is defined in the U-Boot environment for the RZ/G3E SOM board.
https://github.com/embeddedartists/uboot-rz/blob/ea_v2024.07/include/configs/rzg3e-ea-som.h#L58
| Board | Device tree file |
|---|---|
| RZ/G3E SOM | include/configs/rzg3e-ea-som.h |
Linux
Customizing Linux for your product mostly involves creating or modifying device tree files, read the Device Tree section for more information about device tree files. In some cases, you might also need to modify the kernel configuration and / or add new device drivers. Our Linux kernel repository is available at GitHub: https://github.com/embeddedartists/linux-rz.
Kernel configuration
The default Linux kernel configuration for Embedded Artists COM boards is stored in the kernel sources.
| Board | Configuration file |
|---|---|
| RZ/G3E SOM | <kernel-dir>/arch/arm64/configs/defconfig |
If you need to modify the default kernel configuration it is recommended to use a tool, such as make menuconfig, to do this instead of editing the configuration file manually. Here are instruction for how to run menuconfig from within Yocto: Kernel Configuration. In the section Build Linux kernel from source code you can see how to use menuconfig when building the kernel from source code.
In the example below we want to enable dynamic printk support (CONFIG_DYNAMIC_DEBUG) in the kernel.
- Run the
menuconfigtool.make menuconfig - In the menu go to Kernel hacking > printk and dmesg options > Enable dynamic printk() support
- Click
Exita number of times and when you are asked to save the new configuration clickYes. - You can now build the kernel with the new configurations to make sure there are no errors.
- When you are satisfied with the configuration changes, generate a new
defconfigfile.make savedefconfig - The file will be called
defconfigand stored in the root of the kernel sources. You can replace the current default configurations by copying this file to the location of the default configuration file as shown below.cp defconfig arch/arm64/configs/
Device drivers
Peripherals that you need access to from Linux needs a device driver. The kernel already contains device drivers for many peripherals so the first step is to search in the kernel sources for the peripheral. Device drivers are located in <kernel-dir>/drivers.
In the example below we search for the FocalTech FT5x06 touch controller and find it in the input/touchscreen directory.
cd <kernel-dir/drivers
grep -ri FT5x06
input/touchscreen/Kconfig:config TOUCHSCREEN_EDT_FT5X06
input/touchscreen/Kconfig: tristate "EDT FocalTech FT5x06 I2C Touchscreen support"
input/touchscreen/Kconfig: on the FocalTech FT5x06 family of controllers connected to
input/touchscreen/Kconfig: module will be called edt-ft5x06.
input/touchscreen/Makefile:obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o
input/touchscreen/edt-ft5x06.c:struct edt_ft5x06_ts_data {
...
If the device driver isn't available in the kernel you need to add it. It is out-of-scope for this document to describe how you develop a new device driver and it is actually not that common that you need to develop it from scratch anyways. The most common approach to add a missing device driver to the kernel is as follows.
- Go to the manufacturer of the peripheral and see if they have a device driver available.
- If the manufacturer doesn't have a device driver look in newer versions of the Linux kernel you are using. If it has been added you need to back-port it to the version of the kernel you are using.
- Besides looking in a newer version of the kernel you are using you could look in other kernel source repositories such as the main line kernel.
- If you find a device driver you need to add it to your kernel sources which involves several steps (the exact number of steps can be different for different types of device drivers).
- Copy the device driver file(s).
- Add the new file to the relevant Makefile.
- Add a new configuration to relevant Kconfig file.
- Make sure the new configuration is enabled by adding it to the default configuration file.
- Make sure everything builds.