Porting u-boot
Just some simple guidelines for start porting u-boot to a new board. I'm using an NXP imx8mp as example.
Using u-boot-2021.04 as example. This is not at all a detailed report but just the initial basic steps.
Board files
Copy board/freescale/imx8mp_evk as board/freescale/imx8mp_my_board/
$ ls board/freescale/imx8mp_my_board/
boot.cmd ddr4_timing.c imx8mp_evk.c Kconfig lpddr4_timing.c lpddr4_timing_ndm.c MAINTAINERS Makefile spl.c
Rename
board/freescale/imx8mp_my_board/imx8mp_evk.c
to
board/freescale/imx8mp_my_board/imx8mp_my_board.c
Update Kconfig and Makefile
board/freescale/imx8mp_my_board/Kconfig
config SYS_BOARD
default "imx8mp_my_board"
config SYS_VENDOR
default "freescale"
config SYS_CONFIG_NAME
default "imx8mp_my_board"
source "board/freescale/common/Kconfig"
endif
board/freescale/imx8mp_my_board/Makefile
ifdef CONFIG_SPL_BUILD
obj-y += spl.o
ifdef CONFIG_IMX8M_LPDDR4_FREQ0_3200MTS
obj-y += lpddr4_timing_ndm.o
else
obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
obj-$(CONFIG_IMX8M_DDR4) += ddr4_timing.o
endif
endif
Update arch/arm/mach-imx/imx8m/Kconfig to include the board files
+ bool "imx8mp LPDDR4 my board"
+ select IMX8MP
+ select SUPPORT_SPL
+ select IMX8M_LPDDR4
+ select FSL_CAAM
+ select FSL_BLOB
+ select MISC
+ select SPL_CRYPTO_SUPPORT if SPL
+
+source "board/freescale/imx8mp_my_board/Kconfig"
Board dts files
$ cp arch/arm/dts/imx8mp-evk.dts arch/arm/dts/imx8mp-my-board.dts
$ cp arch/arm/dts/imx8mp-evk-u-boot.dtsi arch/arm/dts/imx8mp-my-board-u-boot.dtsi
Update dts makefile arch/arm/dts/Makefile to add our new dt
+ imx8mp-my-board.dtb
Board config file
Take a copy of configs/imx8mp_evk_defconfig as configs/imx8mp_my_board_defconfig
Then make following changes
CONFIG_TARGET_IMX8MP_EVK=y -> CONFIG_TARGET_IMX8MP_MY_BOARD=y
replace whatever dt files, or you can just use existing ones for now
CONFIG_DEFAULT_DEVICE_TREE="imx8mp-evk" -> CONFIG_DEFAULT_DEVICE_TREE="imx8mp-my-board"
CONFIG_DEFAULT_FDT_FILE="imx8mp-evk.dtb" -> CONFIG_DEFAULT_FDT_FILE="imx8mp-my-board.dtb"
Board header file
$ cp include/configs/imx8mp_evk.h include/configs/imx8mp_my_board.h