Skip to content

Commit

Permalink
powerpc/ps3: Quieten boot wrapper output with run_cmd
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Geoff Levand authored and Michael Ellerman committed Oct 21, 2015
1 parent 1856f50 commit 879c26d
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions arch/powerpc/boot/wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")"
Expand Down

0 comments on commit 879c26d

Please sign in to comment.