From patchwork Fri Aug 5 07:05:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Kerr X-Patchwork-Id: 656047 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s5Hrl5lTVz9t0F for ; Fri, 5 Aug 2016 17:05:43 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3s5Hrl3Hg9zDqV1 for ; Fri, 5 Aug 2016 17:05:43 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3s5Hrh1QZbzDqQ1 for ; Fri, 5 Aug 2016 17:05:40 +1000 (AEST) Received: by ozlabs.org (Postfix, from userid 1023) id 3s5Hrh0pK6z9t0F; Fri, 5 Aug 2016 17:05:40 +1000 (AEST) From: Jeremy Kerr To: petitboot@lists.ozlabs.org Subject: [PATCH 2/2] hooks/set-stdout: move hook to after automatic stdout settings Date: Fri, 5 Aug 2016 15:05:12 +0800 Message-Id: <1470380712-3132-2-git-send-email-jk@ozlabs.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470380712-3132-1-git-send-email-jk@ozlabs.org> References: <1470380712-3132-1-git-send-email-jk@ozlabs.org> X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" 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 --- 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