Browse Source

rpi-config: U-Boot requires "enable_uart=1" to operate correctly.

When RPI_USE_U_BOOT is set to 1, if enable_uart is not set to 1 in config.txt
then the board won't boot (Resolves agherzan#1189).
This requirement only affects the following boards:
- Raspberry Pi Zero W
- Raspberry Pi 3 32 & 64 bit
- Raspberry Pi 4 32 & 64 bit

Signed-off-by: DOLE Olivier <odole@dicksondata.fr>
DOLE Olivier 2 năm trước cách đây
mục cha
commit
8e07f0d328
2 tập tin đã thay đổi với 25 bổ sung1 xóa
  1. 10 0
      docs/extra-build-config.md
  2. 15 1
      recipes-bsp/bootfiles/rpi-config_git.bb

+ 10 - 0
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:

+ 15 - 1
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