2020-02-25 02:25:31 -06:00
|
|
|
From 6aecc8fed8cc78c1fb5c6b52bdfa3d07ca66e652 Mon Sep 17 00:00:00 2001
|
2019-04-18 04:25:10 -05:00
|
|
|
From: Mykola Faryma <mykolaf@mellanox.com>
|
2020-02-25 02:25:31 -06:00
|
|
|
Date: Fri, 21 Feb 2020 12:28:54 +0200
|
|
|
|
Subject: [PATCH 1/1] Make hw-mgmt SimX compatiable
|
2019-04-18 04:25:10 -05:00
|
|
|
|
|
|
|
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
|
|
|
|
---
|
|
|
|
usr/usr/bin/hw-management.sh | 29 +++++++++++++++++++++++++++++
|
|
|
|
1 file changed, 29 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/usr/usr/bin/hw-management.sh b/usr/usr/bin/hw-management.sh
|
2020-02-25 02:25:31 -06:00
|
|
|
index cff10fe..7f3c295 100755
|
2019-04-18 04:25:10 -05:00
|
|
|
--- a/usr/usr/bin/hw-management.sh
|
|
|
|
+++ b/usr/usr/bin/hw-management.sh
|
|
|
|
@@ -646,6 +646,35 @@ do_chip_down()
|
|
|
|
/usr/bin/hw-management-thermal-events.sh change hotplug_asic down %S %p
|
|
|
|
}
|
|
|
|
|
|
|
|
+handle_simx()
|
|
|
|
+{
|
|
|
|
+ local -r onie_platform="$(cat /host/machine.conf | grep onie_platform | cut -d= -f2)"
|
|
|
|
+
|
|
|
|
+ local -r syseeprom_cache_path="/var/cache/sonic/decode-syseeprom/syseeprom_cache"
|
|
|
|
+ local -r syseeprom_hex_path="/usr/share/sonic/device/${onie_platform}/syseeprom.hex"
|
|
|
|
+ local -r syseeprom_vpd_path="/var/run/hw-management/eeprom/vpd_info"
|
|
|
|
+
|
|
|
|
+ case $ACTION in
|
|
|
|
+ start)
|
|
|
|
+ /bin/bash -c "/bin/rm -f ${syseeprom_cache_path}"
|
|
|
|
+ /bin/bash -c "/bin/mkdir -p ${eeprom_path}"
|
|
|
|
+ /bin/bash -c "/usr/bin/xxd -r -p ${syseeprom_hex_path} ${syseeprom_vpd_path}"
|
|
|
|
+ ;;
|
|
|
|
+ stop)
|
|
|
|
+ /bin/bash -c "/bin/rm -fr ${hw_management_path}"
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ echo "Usage: `basename $0` {start|stop}"
|
|
|
|
+ exit 1
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
|
|
+}
|
|
|
|
+
|
2020-02-25 02:25:31 -06:00
|
|
|
+if [[ "$(cat /sys/devices/virtual/dmi/id/sys_vendor)" = "QEMU" ]]; then
|
|
|
|
+ handle_simx
|
|
|
|
+ exit 0
|
2019-04-18 04:25:10 -05:00
|
|
|
+fi
|
|
|
|
+
|
|
|
|
case $ACTION in
|
|
|
|
start)
|
|
|
|
do_start
|
|
|
|
--
|
|
|
|
1.9.1
|
|
|
|
|