powerpc/ps3: Quieten the build when building ps3
Michael Ellerman
reviewerPATCH 1/1 powerpc/ps3: Quieten the build when building ps3
The boot wrapper uses dd when building for ps3, which annoyingly tells us in great detail what it's doing, eg:
512+0 records in
512+0 records out
512 bytes (512 B) copied, 0.000802129 s, 638 kB/s 512+0 records in
512+0 records out
512 bytes (512 B) copied, 0.000745101 s, 687 kB/s
Also annoyingly, there is no "quiet" flag to dd, so our only option is to grab all the output from dd, and iff there is an error print it out.
As it turns out we used to do this, so this is actually a partial revert of commit d47403733403 ("[POWERPC] bootwrapper: Bail from script if any command fails").
--- arch/powerpc/boot/wrapper | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
arch/powerpc/boot/wrapper +20 -6
@@ -456,13 +456,27 @@ ps3) ${CROSS}objcopy -O binary "$ofile" "$ofile.bin" - dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ - skip=$overlay_dest seek=$system_reset_kernel \ - count=$overlay_size bs=1 + set +e - dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ - skip=$system_reset_overlay seek=$overlay_dest \ - count=$overlay_size bs=1 + msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ + skip=$overlay_dest seek=$system_reset_kernel \ + count=$overlay_size bs=1 2>&1) + + if [ $? -ne "0" ]; then + echo $msg + exit 1 + fi + + msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ + skip=$system_reset_overlay seek=$overlay_dest \ + count=$overlay_size bs=1 2>&1) + + if [ $? -ne "0" ]; then + echo $msg + exit 2 + fi + + set -e odir="$(dirname "$ofile.bin")" rm -f "$odir/otheros.bld"
Signature · 1 line
2.5.0
PATCH 1/1 powerpc: Add run_cmd function to boot wrapper
Add a boot wrapper script function run_cmd which will run a shell command quietly and only print the output if either V=1 or an error occurs.
Also, run the ps3 dd commands with run_cmd to clean up the build output.
---
Hi Michael,
How about something like this? It seems a little cleaner.
-Geoff
arch/powerpc/boot/wrapper | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
arch/powerpc/boot/wrapper +21 -4
@@ -63,6 +63,23 @@ usage() { exit 1 } +run_cmd() { + if [ "$V" = 1 ]; then + $* 2>&1 + else + local msg + + set +e + msg=$($* 2>&1) + + if [ $? -ne "0" ]; then + echo $msg + exit 1 + fi + set -e + fi +} + while [ "$#" -gt 0 ]; do case "$1" in -o)
@@ -456,12 +473,12 @@ ps3) ${CROSS}objcopy -O binary "$ofile" "$ofile.bin" - dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ - skip=$overlay_dest seek=$system_reset_kernel \ + run_cmd dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ + skip=$overlay_dest seek=$system_reset_kernel \ count=$overlay_size bs=1 - dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ - skip=$system_reset_overlay seek=$overlay_dest \ + run_cmd dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ + skip=$system_reset_overlay seek=$overlay_dest \ count=$overlay_size bs=1 odir="$(dirname "$ofile.bin")"
Signature · 1 line
2.5.0
Michael Ellerman
reviewerRe: [PATCH] powerpc: Add run_cmd function to boot wrapper
Quoted 10 lines · Geoff Levand
Add a boot wrapper script function
run_cmdwhich will run a shell command quietly and only print the output if either V=1 or an error occurs.Also, run the ps3 dd commands with
run_cmdto clean up the build output.Signed-off-by Geoff Levand <[email protected]>---
Hi Michael,How about something like this? It seems a little cleaner.
Yeah great that's nice, I'll take it.
cheers
Re: powerpc: Add run_cmd function to boot wrapper
In reply to Geoff LevandQuoted 6 lines · Geoff Levand
Add a boot wrapper script function
run_cmdwhich will run a shell command quietly and only print the output if either V=1 or an error occurs.Also, run the ps3 dd commands with
run_cmdto clean up the build output.Signed-off-by Geoff Levand <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/879c26d4f6a2b573d75cc235
cheers
Quoted 10 lines · Michael Ellerman
The boot wrapper uses dd when building for ps3, which annoyingly tells us in great detail what it's doing, eg:
512+0 records in
512+0 records out
512 bytes (512 B) copied, 0.000802129 s, 638 kB/s 512+0 records in
512+0 records out
512 bytes (512 B) copied, 0.000745101 s, 687 kB/s
Quoted 2 lines
Also annoyingly, there is no "quiet" flag to dd, so our only option is to grab all the output from dd, and iff there is an error print it out.
"status=none", but that's not POSIX it seems.
Segher
Michael Ellerman
reviewerQuoted 12 lines · Segher Boessenkool
Quoted 10 lines · Michael Ellerman
The boot wrapper uses dd when building for ps3, which annoyingly tells us in great detail what it's doing, eg:
512+0 records in
512+0 records out
512 bytes (512 B) copied, 0.000802129 s, 638 kB/s 512+0 records in
512+0 records out
512 bytes (512 B) copied, 0.000745101 s, 687 kB/s
Quoted 4 lines
Quoted 2 lines
Also annoyingly, there is no "quiet" flag to dd, so our only option is to grab all the output from dd, and iff there is an error print it out.
"status=none", but that's not POSIX it seems.
Ah darn, that probably would have been fine, I think I just missed it because it's an argument not a flag.
cheers