diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2023-10-26 10:38:04 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2023-11-08 11:31:00 +0300 |
commit | 58cf3bea38b0ebd255fcc7623d190cc2832f5f85 (patch) | |
tree | bed2a1614f82a5f10679c53777d535a8ff02cf9c | |
parent | 61276c1185d0758e760007309a9c3375290fc608 (diff) | |
download | openbmc-58cf3bea38b0ebd255fcc7623d190cc2832f5f85.tar.xz |
meta-facebook: obmc-console: simplify console selection
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I797e6fe38e5db3ae25ab47f94a5cd0549f027c6d
-rw-r--r-- | meta-facebook/conf/recipes/fb-consoles.inc | 23 | ||||
-rw-r--r-- | meta-facebook/recipes-phosphor/console/obmc-console_%.bbappend | 11 |
2 files changed, 27 insertions, 7 deletions
diff --git a/meta-facebook/conf/recipes/fb-consoles.inc b/meta-facebook/conf/recipes/fb-consoles.inc new file mode 100644 index 0000000000..47cfcf38a5 --- /dev/null +++ b/meta-facebook/conf/recipes/fb-consoles.inc @@ -0,0 +1,23 @@ +# Default console to use if there is only one host. +OBMC_CONSOLE_HOST_TTY = "ttyS2" + +# TTYs that are reserved for non-console purposes. +OBMC_CONSOLE_TTY_SKIP = "4" + +# Calculate the TTY assignments for the hosts. +def fb_get_consoles(d): + hosts = len(d.getVar('OBMC_HOST_INSTANCES', True).split()) + + if hosts <= 1: + return d.getVar('OBMC_CONSOLE_HOST_TTY', True) + + skipped = \ + [ int(i) for i in d.getVar('OBMC_CONSOLE_TTY_SKIP', True).split() ] + consoles = \ + [ f"ttyS{i}" for i in sorted(set(range(0,16)).difference(skipped)) ] + + return " ".join(consoles[:hosts]) + +OBMC_CONSOLE_TTYS = "${@fb_get_consoles(d)}" + + diff --git a/meta-facebook/recipes-phosphor/console/obmc-console_%.bbappend b/meta-facebook/recipes-phosphor/console/obmc-console_%.bbappend index 197eb81c98..81c2526c00 100644 --- a/meta-facebook/recipes-phosphor/console/obmc-console_%.bbappend +++ b/meta-facebook/recipes-phosphor/console/obmc-console_%.bbappend @@ -1,17 +1,14 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +require conf/recipes/fb-consoles.inc + # Disable obmc-console ssh ports. PACKAGECONFIG:remove = "ssh" -OBMC_CONSOLE_HOST_TTY = "ttyS2" -OBMC_CONSOLE_TTYS = "${@' '.join(['ttyS{}'.format(i) for i in range(int(d.getVar('OBMC_CONSOLE_INST_CNT', True)) + 1) if 'ttyS{}'.format(i) != d.getVar('OBMC_BMC_TTY', True)])}" OBMC_BMC_TTY = "ttyS4" +SERVER_CONFS = "${@ ' '.join([ f'file://server.{i}.conf' for i in d.getVar('OBMC_CONSOLE_TTYS', True).split() ])}" -OBMC_CONSOLE_INST = "${@d.getVar('OBMC_HOST_INSTANCES', True)}" -OBMC_CONSOLE_INST_CNT = "${@sum([1 for item in d.getVar('OBMC_CONSOLE_INST', True).split() if item.isdigit()])}" -SERVER_CONFS = "${@' '.join(['file://server.ttyS{}.conf'.format(i) for i in range(int(d.getVar('OBMC_CONSOLE_INST_CNT', True)) + 1) if 'ttyS{}'.format(i) != d.getVar('OBMC_BMC_TTY', True)])}" - -SRC_URI:append:fb-compute-singlehost = " file://server.ttyS2.conf" +SRC_URI:append:fb-compute-singlehost = " ${SERVER_CONFS}" SRC_URI:append:fb-compute-multihost = " ${SERVER_CONFS} \ file://client.2200.conf \ |