How to configure U-Boot for your board

Revision as of 18:46, 30 April 2020 by Registered User

This page explains how to configure the U-Boot source for your board.

1. introduction[edit source]

Ressources [1] [2] already explain the porting U-Boot on a new board, this page is only a basic guideline.

To summarize, you need to configure U-Boot:

  1. add your board #device tree
  2. create your own board support #board subdirectory
  3. add TARGET_<board> in #Kconfig
  4. create your board #defconfig
  5. add your #config file

2. device tree[edit source]

See U-Boot_overview#Device_tree for details.

  • copy the kernel device tree in arch/arm/dts directory: <board>.dts
  • update arch/arm/dts/Makefile to compile your device tree, for example:
 dtb-$(CONFIG_STM32MP15x) += \
 	<board>.dtb 
  • add a U-Boot device tree for your board n arch/arm/dts directory: <board>-u-boot.dtsi
    This file with all the U-Boot update on kernel device tree is automatically inlcude during <board>.dts
    This should include the <soc>-u-boot.dtsi file provided by STMicroelectronics and add all the properties needed by U-Boot (node /config, attibute u-boot,dm-pre-reloc / u-boot,dm-pre-proper)

At this point you can trying the generic ST defconfig with the ST board directory but any board specific feature are not correctly managed.

For example, on STM32MP15x lines More info.png: make stm32mp15_trusted_defconfig make DEVICE_TREE=<board> all

3. board subdirectory[edit source]

Create your own board support subdirectory = board/<vendor>/<board> and add a Makefile:

You can compile the ST files (in board/st/stm32mp1 or in board/st/common) or just copy as staring point and modify them.

For example in board/dhelectronics/dh_stm32mp1/Makefile:

 ifdef CONFIG_SPL_BUILD
 obj-y += ../../st/stm32mp1/spl.o
 endif
 obj-y += ../../st/stm32mp1/board.o board.o

You can add any files needed for your board.

4. Kconfig[edit source]

You need to support your board new TARGET_<board> in arch/arm/mach-stm32mp/Kconfig:

in arch/arm/mach-stm32mp/Kconfig: 1/ Add new TARGET_<board> 2/ Incluee your board Kconfig

 choice
 	prompt "STM32MP15x board select"
 	optional
 
 [...]
 
 config TARGET_<BOARD>
 	bool "<vendor> <board> board"
 	select STM32MP15x
 	help
 		target the <vendor> <board> board with SOC STM32MP15x
 		managed by board/<vendor>/<board>
 
   endchoice
  [...]
  source "board/st/stm32mp1/Kconfig"
  source "board/dhelectronics/dh_stm32mp1/Kconfig"
  source "board/<vendor>/<board>/Kconfig"
  
  endif

3/ add board/<vendor>/<board>/Kconfig file:

The mininimal content is:

 if TARGET_<VENDOR>_<BOARD>
 
 config SYS_BOARD
 	default "<board>"
 
 config SYS_VENDOR
 	default "<vendor>"
 
 config SYS_CONFIG_NAME
 	default "<config>"
 endif

See for example board/dhelectronics/dh_stm32mp1/Kconfig

CONFIG_SYS_CONFIG_NAME = <config> is used in #config file

5. defconfig[edit source]

6. config file[edit source]

7. board subdirectory[edit source]