summaryrefslogtreecommitdiffstats
path: root/lib/pb-protocol
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-08-09 16:16:48 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-09-08 14:26:27 +1000
commitd9e70bb63227a683f808a21be20b3d5e1a474f95 (patch)
tree7ff86e842006776e1f124ec1397e28567d39aabf /lib/pb-protocol
parent9f42e56fc5968fcb34edfad017adb73960c2bb61 (diff)
downloadtalos-petitboot-d9e70bb63227a683f808a21be20b3d5e1a474f95.tar.gz
talos-petitboot-d9e70bb63227a683f808a21be20b3d5e1a474f95.zip
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 <sam@mendozajonas.com>
Diffstat (limited to 'lib/pb-protocol')
-rw-r--r--lib/pb-protocol/pb-protocol.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index 0d83bde..47d04a3 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -323,6 +323,7 @@ int pb_protocol_config_len(const struct config *config)
len += 4 + optional_strlen(config->consoles[i]);
len += 4 + optional_strlen(config->boot_console);
+ len += 4; /* manual_console */
len += 4 + optional_strlen(config->lang);
@@ -579,6 +580,8 @@ int pb_protocol_serialise_config(const struct config *config,
pos += pb_protocol_serialise_string(pos, config->consoles[i]);
pos += pb_protocol_serialise_string(pos, config->boot_console);
+ *(uint32_t *)pos = config->manual_console;
+ pos += 4;
pos += pb_protocol_serialise_string(pos, config->lang);
@@ -1124,6 +1127,10 @@ int pb_protocol_deserialise_config(struct config *config,
config->boot_console = str;
+ if (read_u32(&pos, &len, &tmp))
+ goto out;
+ config->manual_console = !!tmp;
+
if (read_string(config, &pos, &len, &str))
goto out;
OpenPOWER on IntegriCloud