summaryrefslogtreecommitdiff
path: root/meta-facebook/conf/recipes/fb-consoles.inc
blob: 47cfcf38a55c8fc6c769e6bb263f029e12eea4f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)}"