diff --git a/docs/extra-build-config.md b/docs/extra-build-config.md index 128753d..5786f3a 100644 --- a/docs/extra-build-config.md +++ b/docs/extra-build-config.md @@ -155,6 +155,16 @@ For further customisation the KERNEL_IMAGETYPE and KERNEL_BOOTCMD variables can be overridden to select the exact kernel image type (eg. zImage) and u-boot command (eg. bootz) to be used. +To operate correctly, U-Boot requires `enable_uart=1` in `config.txt` file for +the following boards: +* Raspberry Pi Zero W +* Raspberry Pi 3 32-bit +* Raspberry Pi 3 64-bit +* Raspberry Pi 4 32-bit +* Raspberry Pi 4 64-bit +It means that, for those boards, `RPI_USE_U_BOOT = "1"` is not compatible with +`ENABLE_UART = "0"`. + ## Image with Initramfs To build an initramfs image: diff --git a/recipes-bsp/bootfiles/rpi-config_git.bb b/recipes-bsp/bootfiles/rpi-config_git.bb index 22fce77..8b7fbb8 100644 --- a/recipes-bsp/bootfiles/rpi-config_git.bb +++ b/recipes-bsp/bootfiles/rpi-config_git.bb @@ -178,13 +178,27 @@ do_deploy() { fi # UART support - if [ "${ENABLE_UART}" = "1" ] || [ "${ENABLE_UART}" = "0" ] ; then + if [ "${ENABLE_UART}" = "1" ] || [ "${ENABLE_UART}" = "0" ]; then echo "# Enable UART" >>$CONFIG echo "enable_uart=${ENABLE_UART}" >>$CONFIG elif [ -n "${ENABLE_UART}" ]; then bbfatal "Invalid value for ENABLE_UART [${ENABLE_UART}]. The value for ENABLE_UART can be 0 or 1." fi + # U-Boot requires "enable_uart=1" for various boards to operate correctly + # cf https://source.denx.de/u-boot/u-boot/-/blob/v2023.04/arch/arm/mach-bcm283x/Kconfig?ref_type=tags#L65 + if [ "${RPI_USE_U_BOOT}" = "1" ] && [ "${ENABLE_UART}" != "1" ]; then + case "${UBOOT_MACHINE}" in + rpi_0_w_defconfig|rpi_3_32b_config|rpi_4_32b_config|rpi_arm64_config) + if [ "${ENABLE_UART}" = "0" ]; then + bbfatal "Invalid configuration: RPI_USE_U_BOOT requires to enable the UART in config.txt for ${MACHINE}" + fi + echo "# U-Boot requires UART" >>$CONFIG + echo "enable_uart=1" >>$CONFIG + ;; + esac + fi + # Infrared support if [ "${ENABLE_IR}" = "1" ]; then echo "# Enable infrared" >>$CONFIG