* [PATCH] powerpc/ps3: Quieten the build when building ps3
@ 2015-10-19 4:53 Michael Ellerman
2015-10-19 17:53 ` [PATCH] powerpc: Add run_cmd function to boot wrapper Geoff Levand
2015-10-21 16:47 ` [PATCH] powerpc/ps3: Quieten the build when building ps3 Segher Boessenkool
0 siblings, 2 replies; 6+ messages in thread
From: Michael Ellerman @ 2015-10-19 4:53 UTC (permalink / raw)
To: linuxppc-dev; +Cc: geoff
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").
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/boot/wrapper | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 3f50c27ed8f8..b7d353b88029 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -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"
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] powerpc: Add run_cmd function to boot wrapper
2015-10-19 4:53 [PATCH] powerpc/ps3: Quieten the build when building ps3 Michael Ellerman
@ 2015-10-19 17:53 ` Geoff Levand
2015-10-20 0:44 ` Michael Ellerman
2015-10-21 11:41 ` Michael Ellerman
2015-10-21 16:47 ` [PATCH] powerpc/ps3: Quieten the build when building ps3 Segher Boessenkool
1 sibling, 2 replies; 6+ messages in thread
From: Geoff Levand @ 2015-10-19 17:53 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
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>
---
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(-)
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 3f50c27..ceaa75d 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -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")"
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc: Add run_cmd function to boot wrapper
2015-10-19 17:53 ` [PATCH] powerpc: Add run_cmd function to boot wrapper Geoff Levand
@ 2015-10-20 0:44 ` Michael Ellerman
2015-10-21 11:41 ` Michael Ellerman
1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2015-10-20 0:44 UTC (permalink / raw)
To: Geoff Levand; +Cc: linuxppc-dev
On Mon, 2015-10-19 at 10:53 -0700, Geoff Levand wrote:
> 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>
> ---
> Hi Michael,
>
> How about something like this? It seems a little cleaner.
Yeah great that's nice, I'll take it.
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: powerpc: Add run_cmd function to boot wrapper
2015-10-19 17:53 ` [PATCH] powerpc: Add run_cmd function to boot wrapper Geoff Levand
2015-10-20 0:44 ` Michael Ellerman
@ 2015-10-21 11:41 ` Michael Ellerman
1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2015-10-21 11:41 UTC (permalink / raw)
To: Geoff Levand; +Cc: linuxppc-dev
On Mon, 2015-19-10 at 17:53:26 UTC, Geoff Levand wrote:
> 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>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/879c26d4f6a2b573d75cc235
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/ps3: Quieten the build when building ps3
2015-10-19 4:53 [PATCH] powerpc/ps3: Quieten the build when building ps3 Michael Ellerman
2015-10-19 17:53 ` [PATCH] powerpc: Add run_cmd function to boot wrapper Geoff Levand
@ 2015-10-21 16:47 ` Segher Boessenkool
2015-10-21 23:32 ` Michael Ellerman
1 sibling, 1 reply; 6+ messages in thread
From: Segher Boessenkool @ 2015-10-21 16:47 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, geoff
On Mon, Oct 19, 2015 at 03:53:22PM +1100, Michael Ellerman wrote:
> 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.
"status=none", but that's not POSIX it seems.
Segher
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/ps3: Quieten the build when building ps3
2015-10-21 16:47 ` [PATCH] powerpc/ps3: Quieten the build when building ps3 Segher Boessenkool
@ 2015-10-21 23:32 ` Michael Ellerman
0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2015-10-21 23:32 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev, geoff
On Wed, 2015-10-21 at 11:47 -0500, Segher Boessenkool wrote:
> On Mon, Oct 19, 2015 at 03:53:22PM +1100, Michael Ellerman wrote:
> > 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.
>
> "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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-21 23:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-19 4:53 [PATCH] powerpc/ps3: Quieten the build when building ps3 Michael Ellerman
2015-10-19 17:53 ` [PATCH] powerpc: Add run_cmd function to boot wrapper Geoff Levand
2015-10-20 0:44 ` Michael Ellerman
2015-10-21 11:41 ` Michael Ellerman
2015-10-21 16:47 ` [PATCH] powerpc/ps3: Quieten the build when building ps3 Segher Boessenkool
2015-10-21 23:32 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).