From d9e70bb63227a683f808a21be20b3d5e1a474f95 Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Tue, 9 Aug 2016 16:16:48 +1000 Subject: Consolidate petitboot,tty and petitboot,console Commit ce54f86 "Add petitboot,tty and track available consoles" added the petitboot,tty parameter, but the petitboot,console parameter is also recognised by Petitboot. These are ultimately handled by the 30-add-offb and 80-set-stdout hooks respectively, but exist for mostly the same purpose. We consolidate these down to just the original petitboot,console parameter. If the contents of petitboot,console have been configured by Petitboot (ie. it is of the form /dev/dev# [ Description ]) we behave as normal, otherwise we assume that petitboot,console contains a full OF path to the intended console device and do not allow it to be modified. This follows petitboot,console's original intent to be a debug aid, and takes precedence over any other use. The 80-set-stdout hook is removed as 30-add-offb now accounts for both use cases. Signed-off-by: Samuel Mendoza-Jonas --- utils/Makefile.am | 3 +-- utils/hooks/30-add-offb.c | 5 ++++- utils/hooks/80-set-stdout | 23 ----------------------- 3 files changed, 5 insertions(+), 26 deletions(-) delete mode 100755 utils/hooks/80-set-stdout (limited to 'utils') diff --git a/utils/Makefile.am b/utils/Makefile.am index 2bbfb9c..453fdbd 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -34,5 +34,4 @@ dist_pkgdata_DATA = \ utils/logrotate.conf \ utils/hooks/01-create-default-dtb \ utils/hooks/20-update-dtb-sample \ - utils/hooks/90-sort-dtb \ - utils/hooks/80-set-stdout + utils/hooks/90-sort-dtb diff --git a/utils/hooks/30-add-offb.c b/utils/hooks/30-add-offb.c index eca9d13..aff3844 100644 --- a/utils/hooks/30-add-offb.c +++ b/utils/hooks/30-add-offb.c @@ -512,7 +512,10 @@ static int set_stdout(struct offb_ctx *ctx) return 0; } - if (strstr(boot_console, "tty") != NULL) { + if (strncmp(boot_console, "/dev/", strlen("/dev/")) != 0) { + /* We already have the full path */ + stdout_path = talloc_strdup(ctx, boot_console); + } else if (strstr(boot_console, "tty") != NULL) { fprintf(stderr, "TTY recognised: %s\n", boot_console); stdout_path = get_vga_path(ctx); } else { diff --git a/utils/hooks/80-set-stdout b/utils/hooks/80-set-stdout deleted file mode 100755 index 92ff030..0000000 --- a/utils/hooks/80-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 -- cgit v1.2.1