diff --git a/config/u-boot/boot.cmd b/config/u-boot/boot.cmd
index 929d30862..924e34d01 100644
--- a/config/u-boot/boot.cmd
+++ b/config/u-boot/boot.cmd
@@ -48,19 +48,22 @@ if test "${board}" = "sunxi"; then
 	fi;
 fi;
 
+fatload ${boot_dev} ${boot_part} ${fdt_addr_r} dtb-${KVER}/${fdtfile};
+
 # Check if serial console is enabled
 if test "${SERIAL-CONSOLE}" = "ON"; then
 	if test ${console} = ""; then
 		if test "${board}" = "rpi"; then
 			if test ${cpu} = "armv8"; then
-				if test "${fdtfile}" = "broadcom/bcm2837-rpi-3-b-plus.dtb"; then
+				# Use the UART the device tree routes to the pin header:
+				# serial1 is the mini UART (ttyS1), serial0 the PL011 (ttyAMA0)
+				setenv stdout_path;
+				fdt addr ${fdt_addr_r};
+				fdt get value stdout_path /chosen stdout-path;
+				if test "${stdout_path}" = "serial1:115200n8"; then
 					setenv console ttyS1,115200n8;
 				else
-					if test "${fdtfile}" = "broadcom/bcm2837-rpi-3-b.dtb"; then
-						setenv console ttyS1,115200n8;
-					else
-						setenv console ttyAMA0,115200n8;
-					fi;
+					setenv console ttyAMA0,115200n8;
 				fi;
 			fi;
 		else
@@ -79,7 +82,6 @@ if test ${fdt_high} = ""; then
 fi;
 
 fatload ${boot_dev} ${boot_part} ${kernel_addr_r} vmlinuz-${KVER};
-fatload ${boot_dev} ${boot_part} ${fdt_addr_r} dtb-${KVER}/${fdtfile};
 
 if test "${FDTCMDS}" = ""; then
 	echo ;
