[u-boot-test-hooks 1/4] bin/flash.sdwire_common_mount: Switch to sourcing the next writer script
Tom Rini
trini at konsulko.com
Tue Jul 25 23:08:44 CEST 2023
Rather than invoking the script that will write to the mounted directory
as a binary, source it as a script so that it has access to more than
just two parameters. This will allow us to have the same flexibility in
our writers that other flash methods have.
Signed-off-by: Tom Rini <trini at konsulko.com>
---
bin/flash.sdwire_common_mount | 3 ++-
bin/writer.rpi3_mount | 19 +++++++------------
bin/writer.zynq_mount | 15 +++++----------
3 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/bin/flash.sdwire_common_mount b/bin/flash.sdwire_common_mount
index 6c763e62f47d..b76add064fb0 100644
--- a/bin/flash.sdwire_common_mount
+++ b/bin/flash.sdwire_common_mount
@@ -52,7 +52,8 @@ if ! mountpoint -q ${mount_dir}; then
exit 1
fi
-writer.${flash_writer} ${mount_dir} ${U_BOOT_BUILD_DIR}
+# Perform the write, pass along as much environment as possible
+. writer.${flash_writer}
complete=false
for i in {0..9}; do
diff --git a/bin/writer.rpi3_mount b/bin/writer.rpi3_mount
index 97f24a5ac694..a63e7999e57b 100755
--- a/bin/writer.rpi3_mount
+++ b/bin/writer.rpi3_mount
@@ -20,23 +20,18 @@
# Writes rpi3_b to the board
-# Args:
-# $1: Mount point of the sdcard when board is off
-# $2: U-Boot build directory
-
set -ex
-mount=$1
-build=$2
+build=${U_BOOT_BUILD_DIR}
-echo "Writing to ${mount} from build at ${build}"
+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}/config.orig ]]; then
- cp ${mount}/config.txt ${mount}/config.orig
+if [[ ! -e ${mount_dir}/config.orig ]]; then
+ cp ${mount_dir}/config.txt ${mount_dir}/config.orig
fi
-if [[ ! -e ${mount}/rpi3-u-boot.bin.orig ]]; then
- cp ${mount}/rpi3-u-boot.bin ${mount}/rpi3-u-boot.bin.orig
+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
# Enable the UART and fix the GPU frequency so it works correctly
@@ -46,4 +41,4 @@ if ! grep -q "^gpu_freq=250" /media/rpi3_b_boot/config.txt; then
fi
# Copy U-Boot over from the build directory
-cp ${build}/u-boot.bin ${mount}/rpi3-u-boot.bin
+cp ${build}/u-boot.bin ${mount_dir}/rpi3-u-boot.bin
diff --git a/bin/writer.zynq_mount b/bin/writer.zynq_mount
index 9d0958880422..c8395a40680e 100755
--- a/bin/writer.zynq_mount
+++ b/bin/writer.zynq_mount
@@ -20,22 +20,17 @@
# Writes zynq images to the board
-# Args:
-# $1: Mount point of the sdcard when board is off
-# $2: U-Boot build directory
-
set -ex
tmp=$(mktemp -d)
-mount=$1
-build=$2
+build=${U_BOOT_BUILD_DIR}
-echo "Writing to ${mount} from build at ${build}"
+echo "Writing to ${mount_dir} from build at ${build}"
# Copy U-Boot over from the build directory
-cp ${build}/u-boot.bin ${mount}/rpi3-u-boot.bin
+cp ${build}/u-boot.bin ${mount_dir}/rpi3-u-boot.bin
zynq-boot-bin.py -o ${tmp}/boot.bin -u ${build}/spl/u-boot-spl-dtb.bin
-cp ${tmp}/boot.bin ${mount}/BOOT.bin
-cp ${build}/u-boot.img ${mount}/.
+cp ${tmp}/boot.bin ${mount_dir}/BOOT.bin
+cp ${build}/u-boot.img ${mount_dir}/.
rm -rf ${tmp}
--
2.34.1
More information about the U-Boot
mailing list