[u-boot-test-hooks 2/4] bin/writer.rpi*mount: Rework to support all current Pi platforms

Tom Rini trini at konsulko.com
Tue Jul 25 23:08:45 CEST 2023


Now that we have access to more variables in our "mount" writer scripts,
we can have a single one that covers all Pi variants.

Signed-off-by: Tom Rini <trini at konsulko.com>
---
I use this locally to test a Pi 3 in both 32, 64 and "arm64" mode.

Cc: Simon Glass <sjg at chromium.org>
---
 bin/kea/conf.rpi_3_32b_sjg-rpi_3b           |  2 +-
 bin/kea/conf.rpi_3_sjg-rpi_3b               |  2 +-
 bin/{writer.rpi3_mount => writer.rpi_mount} | 46 +++++++++++++--------
 3 files changed, 31 insertions(+), 19 deletions(-)
 rename bin/{writer.rpi3_mount => writer.rpi_mount} (63%)

diff --git a/bin/kea/conf.rpi_3_32b_sjg-rpi_3b b/bin/kea/conf.rpi_3_32b_sjg-rpi_3b
index 5fe98687221d..020eca2404d8 100644
--- a/bin/kea/conf.rpi_3_32b_sjg-rpi_3b
+++ b/bin/kea/conf.rpi_3_32b_sjg-rpi_3b
@@ -23,7 +23,7 @@ reset_impl=ykush
 flash_impl=sdwire_poweroff_mount
 power_impl=ykush
 
-flash_writer=rpi3_mount
+flash_writer=rpi_mount
 
 ykush_serial=YK17698
 ykush_port=1
diff --git a/bin/kea/conf.rpi_3_sjg-rpi_3b b/bin/kea/conf.rpi_3_sjg-rpi_3b
index 64ffff01737f..d8d2a94f036a 100644
--- a/bin/kea/conf.rpi_3_sjg-rpi_3b
+++ b/bin/kea/conf.rpi_3_sjg-rpi_3b
@@ -23,7 +23,7 @@ reset_impl=ykush
 flash_impl=sdwire_ykush_mount
 power_impl=ykush
 
-flash_writer=rpi3_mount
+flash_writer=rpi_mount
 
 ykush_serial=YK17698
 ykush_port=1
diff --git a/bin/writer.rpi3_mount b/bin/writer.rpi_mount
similarity index 63%
rename from bin/writer.rpi3_mount
rename to bin/writer.rpi_mount
index a63e7999e57b..73fb8bf6af04 100755
--- a/bin/writer.rpi3_mount
+++ b/bin/writer.rpi_mount
@@ -1,4 +1,5 @@
 # Copyright 2019 Google LLC. All rights reserved.
+# Copyright 2024 Konsulko Group. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -18,27 +19,38 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
-# Writes rpi3_b to the board
-
-set -ex
+set -e
 
 build=${U_BOOT_BUILD_DIR}
 
 echo "Writing to ${mount_dir} from build at ${build}"
 
-# First make a copy of the original files if we haven't already
-if [[ ! -e ${mount_dir}/config.orig ]]; then
-    cp ${mount_dir}/config.txt ${mount_dir}/config.orig
-fi
-if [[ ! -e ${mount_dir}/rpi3-u-boot.bin.orig ]]; then
-    cp ${mount_dir}/rpi3-u-boot.bin ${mount_dir}/rpi3-u-boot.bin.orig
-fi
+case "${board_type}" in
+rpi)
+    kernel_dst=kernel.img
+    ;;
+rpi_2)
+    kernel_dst=kernel7.img
+    ;;
+rpi_3|rpi_3b|rpi_3_b_plus|rpi_4|rpi_arm64)
+    kernel_dst=kernel8.img
+    ;;
+rpi_3_32b|rpi_4_32b)
+    kernel_dst=kernel8-32.img
+    ;;
+*)
+    echo Unknown Pi \""${board_type}"\"
+    exit 1
+    ;;
+esac
+
+sudo rm -f ${mount_dir}/kernel*img
+sudo cp -v ${build}/u-boot.bin ${mount_dir}/${kernel_dst}
 
-# Enable the UART and fix the GPU frequency so it works correctly
-sed -i '/enable_uart/c\enable_uart = 1' /media/rpi3_b_boot/config.txt
-if ! grep -q "^gpu_freq=250" /media/rpi3_b_boot/config.txt; then
-    echo 'gpu_freq=250' >>/media/rpi3_b_boot/config.txt
-fi
+echo "enable_uart=1" | sudo tee ${mount_dir}/config.txt
 
-# Copy U-Boot over from the build directory
-cp ${build}/u-boot.bin ${mount_dir}/rpi3-u-boot.bin
+case "${board_ident}" in
+3-32-pl011)
+    echo "dtoverlay=pi3-miniuart-bt" | sudo tee -a ${mount_dir}/config.txt
+    ;;
+esac
-- 
2.34.1



More information about the U-Boot mailing list