[2/2] hooks/set-stdout: move hook to after automatic stdout settings
diff mbox

Message ID 1470380712-3132-2-git-send-email-jk@ozlabs.org
State Accepted
Headers show

Commit Message

Jeremy Kerr Aug. 5, 2016, 7:05 a.m. UTC
If a console is defined in NVRAM, we want it to take precedence over
anything that 30-add-offb calculates automatically. This change shifts
the 20-set-stdout script to later in the hook processing, so that it
will override any automatic settings.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
 utils/hooks/20-set-stdout | 23 -----------------------
 utils/hooks/80-set-stdout | 23 +++++++++++++++++++++++
 2 files changed, 23 insertions(+), 23 deletions(-)
 delete mode 100755 utils/hooks/20-set-stdout
 create mode 100755 utils/hooks/80-set-stdout

Comments

Samuel Mendoza-Jonas Aug. 8, 2016, 7:23 a.m. UTC | #1
On Fri, 2016-08-05 at 15:05 +0800, Jeremy Kerr wrote:
> If a console is defined in NVRAM, we want it to take precedence over
> anything that 30-add-offb calculates automatically. This change shifts
> the 20-set-stdout script to later in the hook processing, so that it
> will override any automatic settings.
> 
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

Thanks! This was missing a corresponding update to the Makefile but I've
added that in and merged asĀ 8f0e069.

> ---
>  utils/hooks/20-set-stdout | 23 -----------------------
>  utils/hooks/80-set-stdout | 23 +++++++++++++++++++++++
>  2 files changed, 23 insertions(+), 23 deletions(-)
>  delete mode 100755 utils/hooks/20-set-stdout
>  create mode 100755 utils/hooks/80-set-stdout
> 
> diff --git a/utils/hooks/20-set-stdout b/utils/hooks/20-set-stdout
> deleted file mode 100755
> index 92ff030..0000000
> --- a/utils/hooks/20-set-stdout
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -#!/bin/sh
> -
> -# Hook to set the linux,stdout-path property from an nvram property
> -# (named $nvram_prop).
> -
> -nvram_prop=petitboot,console
> -
> -# we need to be using a dtb
> -[ -n "$boot_dtb" ] || exit
> -
> -console=$(nvram --print-config="$nvram_prop")
> -
> -[ $? = 0 -a -n "$console" ] || exit
> -
> -dtb_in=$boot_dtb
> -dtb_out=$(mktemp)
> -
> -(
> -	dtc -I dtb -O dts $dtb_in
> -	echo '/ { chosen { linux,stdout-path = "'$console'"; }; }; '
> -) | dtc -I dts -O dtb -o $dtb_out
> -
> -[ $? = 0 ] && mv $dtb_out $dtb_in
> diff --git a/utils/hooks/80-set-stdout b/utils/hooks/80-set-stdout
> new file mode 100755
> index 0000000..92ff030
> --- /dev/null
> +++ b/utils/hooks/80-set-stdout
> @@ -0,0 +1,23 @@
> +#!/bin/sh
> +
> +# Hook to set the linux,stdout-path property from an nvram property
> +# (named $nvram_prop).
> +
> +nvram_prop=petitboot,console
> +
> +# we need to be using a dtb
> +[ -n "$boot_dtb" ] || exit
> +
> +console=$(nvram --print-config="$nvram_prop")
> +
> +[ $? = 0 -a -n "$console" ] || exit
> +
> +dtb_in=$boot_dtb
> +dtb_out=$(mktemp)
> +
> +(
> +	dtc -I dtb -O dts $dtb_in
> +	echo '/ { chosen { linux,stdout-path = "'$console'"; }; }; '
> +) | dtc -I dts -O dtb -o $dtb_out
> +
> +[ $? = 0 ] && mv $dtb_out $dtb_in

Patch
diff mbox

diff --git a/utils/hooks/20-set-stdout b/utils/hooks/20-set-stdout
deleted file mode 100755
index 92ff030..0000000
--- a/utils/hooks/20-set-stdout
+++ /dev/null
@@ -1,23 +0,0 @@ 
-#!/bin/sh
-
-# Hook to set the linux,stdout-path property from an nvram property
-# (named $nvram_prop).
-
-nvram_prop=petitboot,console
-
-# we need to be using a dtb
-[ -n "$boot_dtb" ] || exit
-
-console=$(nvram --print-config="$nvram_prop")
-
-[ $? = 0 -a -n "$console" ] || exit
-
-dtb_in=$boot_dtb
-dtb_out=$(mktemp)
-
-(
-	dtc -I dtb -O dts $dtb_in
-	echo '/ { chosen { linux,stdout-path = "'$console'"; }; }; '
-) | dtc -I dts -O dtb -o $dtb_out
-
-[ $? = 0 ] && mv $dtb_out $dtb_in
diff --git a/utils/hooks/80-set-stdout b/utils/hooks/80-set-stdout
new file mode 100755
index 0000000..92ff030
--- /dev/null
+++ b/utils/hooks/80-set-stdout
@@ -0,0 +1,23 @@ 
+#!/bin/sh
+
+# Hook to set the linux,stdout-path property from an nvram property
+# (named $nvram_prop).
+
+nvram_prop=petitboot,console
+
+# we need to be using a dtb
+[ -n "$boot_dtb" ] || exit
+
+console=$(nvram --print-config="$nvram_prop")
+
+[ $? = 0 -a -n "$console" ] || exit
+
+dtb_in=$boot_dtb
+dtb_out=$(mktemp)
+
+(
+	dtc -I dtb -O dts $dtb_in
+	echo '/ { chosen { linux,stdout-path = "'$console'"; }; }; '
+) | dtc -I dts -O dtb -o $dtb_out
+
+[ $? = 0 ] && mv $dtb_out $dtb_in