ttf-console: ttf-console.sh took logical port name
Megapede cache product machine add SerialInterface for ttf-console
as Hydra, only can provide an integer as port_number.
So we did not use node entity tag name, but define a logical port name,
with the naming schema as port-{port_number}
Tested:
bitbake obmc-console
copy the ttf-console.sh and ttf-console.list to bmc and test
```
root@mvt19-nfd11:~# /tmp/ttf-console.sh
Usage: /tmp/ttf-console.sh <port-name>
Support port:
port-2
port-1
root@mvt19-nfd11:~# /tmp/ttf-console.sh port-1
...
mvt19-n1 login:
```
change only effect ARM
http://fusion2/ci/kokoro/prod%3Agbmc%2Ffirmware-build%2Ffirmware%2Fgerrit_upstreamed_platforms/activity/fa9170e7-57cd-4a04-8964-2c61c827790c
Google-Bug-Id: 330925899
Change-Id: I70a16e7eac5ecf17b2b906564bf800f92c66d988
Signed-off-by: Dan Zhang <zhdaniel@google.com>
diff --git a/classes/ttf-console.bbclass b/classes/ttf-console.bbclass
index 9b0dfff..b9f3419 100644
--- a/classes/ttf-console.bbclass
+++ b/classes/ttf-console.bbclass
@@ -6,18 +6,18 @@
def gen_ttf_console_list():
import shlex
- # node names registered in MIBA policy (go/ttf-console-miba)
- valid_nodes = {
- "host-compute-node-1",
- "host-compute-node-2",
+ # port names registered in MIBA policy (go/ttf-console-miba)
+ valid_ports = {
+ "port-1",
+ "port-2",
}
- console_list = "# node_name to its console config file mapping\n"
+ console_list = "# port_name to its console config file mapping\n"
console_list += "declare -A console_map=("
- for node, conf_file in ttf_console_list().items():
- if node not in valid_nodes:
- raise("%s has not been registered in MIBA policy go/ttf-console-miba" % node)
- console_list += '\n ["%s"]="%s"' % (node, conf_file)
+ for port, conf_file in ttf_console_list().items():
+ if port not in valid_ports:
+ bb.warn("%s has not been registered in MIBA policy go/ttf-console-miba" % port)
+ console_list += '\n ["%s"]="%s"' % (port, conf_file)
console_list += "\n)\n"
return shlex.quote(console_list)
diff --git a/recipes-phosphor/console/obmc-console/ttf-console.sh b/recipes-phosphor/console/obmc-console/ttf-console.sh
index 8415072..309ecdc 100644
--- a/recipes-phosphor/console/obmc-console/ttf-console.sh
+++ b/recipes-phosphor/console/obmc-console/ttf-console.sh
@@ -8,31 +8,31 @@
# ```
# def ttf_console_list():
# return {
-# "host-compute-node-1": "/etc/obmc-console/server.ttyS2.conf",
-# "host-compute-node-2": "/etc/obmc-console/server.ttyS1.conf",
+# "port-1": "/etc/obmc-console/server.ttyS2.conf",
+# "port-2": "/etc/obmc-console/server.ttyS1.conf",
# }
# ```
# shellcheck source=/dev/null
source "$(dirname "$0")/ttf-console.list"
-list_node() {
- echo "Support node:"
- for node in "${!console_map[@]}"; do
- echo "$node"
+list_port() {
+ echo "Support port:"
+ for port in "${!console_map[@]}"; do
+ echo "$port"
done
}
# Check if the correct number of arguments is provided
if [ "$#" -ne 1 ]; then
- echo "Usage: $0 <node-name>"
- list_node
+ echo "Usage: $0 <port-name>"
+ list_port
exit 1
fi
-# Check if the provided node name exists in the console_map array
+# Check if the provided port name exists in the console_map array
if [[ -z "${console_map[$1]}" ]]; then
- echo "Invalid node name:" "$1"
- list_node
+ echo "Invalid port name:" "$1"
+ list_port
exit 1
fi