diff mbox series

[u-boot-test-hooks,1/4] bin/flash.sdwire_common_mount: Switch to sourcing the next writer script

Message ID 20230725210847.1472585-1-trini@konsulko.com
State Accepted
Delegated to: Tom Rini
Headers show
Series [u-boot-test-hooks,1/4] bin/flash.sdwire_common_mount: Switch to sourcing the next writer script | expand

Commit Message

Tom Rini July 25, 2023, 9:08 p.m. UTC
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@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(-)

Comments

Simon Glass July 25, 2023, 10:52 p.m. UTC | #1
On Tue, 25 Jul 2023 at 15:09, Tom Rini <trini@konsulko.com> wrote:
>
> 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@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(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Aug. 9, 2023, 1:45 a.m. UTC | #2
On Tue, 25 Jul 2023 17:08:44 -0400, Tom Rini wrote:
> 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.
> 
> 

Applied, thanks!

[1/4] bin/flash.sdwire_common_mount: Switch to sourcing the next writer script
      commit: 6fcab91ee4cc7d25ccc6452ab8e0b6c64e326e16
[2/4] bin/writer.rpi*mount: Rework to support all current Pi platforms
      commit: 0242dc8b81dc5bb7d86dfeaf8a0ebc02f7cc0f71
[3/4] bin/writer.ti-omap_mount: Add support for TI OMAP-style platforms via mount
      commit: 0c0184ee0e5cecc08a9e60d39d0664f41e41af6e
[4/4] bin/writer.ti-k3_mount: Add support for TI K3 platforms via mount
      commit: bbe462eb91981e266b2980e217fd5a0349acba63

Best regards,
diff mbox series

Patch

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}