Patrick Williams | 58cf3be | 2023-10-26 02:38:04 -0500 | [diff] [blame] | 1 | # Default console to use if there is only one host. |
| 2 | OBMC_CONSOLE_HOST_TTY = "ttyS2" |
| 3 | |
| 4 | # TTYs that are reserved for non-console purposes. |
| 5 | OBMC_CONSOLE_TTY_SKIP = "4" |
| 6 | |
| 7 | # Calculate the TTY assignments for the hosts. |
| 8 | def fb_get_consoles(d): |
| 9 | hosts = len(d.getVar('OBMC_HOST_INSTANCES', True).split()) |
| 10 | |
| 11 | if hosts <= 1: |
| 12 | return d.getVar('OBMC_CONSOLE_HOST_TTY', True) |
| 13 | |
| 14 | skipped = \ |
| 15 | [ int(i) for i in d.getVar('OBMC_CONSOLE_TTY_SKIP', True).split() ] |
| 16 | consoles = \ |
| 17 | [ f"ttyS{i}" for i in sorted(set(range(0,16)).difference(skipped)) ] |
| 18 | |
| 19 | return " ".join(consoles[:hosts]) |
| 20 | |
| 21 | OBMC_CONSOLE_TTYS = "${@fb_get_consoles(d)}" |
| 22 | |
| 23 | |