[install.sh] Fix CPU cstates configuration. (#7222)

The motivation of these changes is to fix (#6051):

- Why I did it
To fix CPU cstates configuration

- How I did it
Updated code to be POSIX compatible

- How to verify it
root@sonic:/home/admin# sonic_installer install sonic-mellanox.bin

Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
This commit is contained in:
Nazarii Hnydyn 2021-04-04 10:40:53 +03:00 committed by Abhishek Dosi
parent b70e47f2c8
commit 8eb26cf18c

View File

@ -542,9 +542,10 @@ trap_push "rm $grub_cfg || true"
[ -r ./platform.conf ] && . ./platform.conf [ -r ./platform.conf ] && . ./platform.conf
# Check if the CPU vendor is 'Intel' and disable c-states if True # Check if the CPU vendor is 'Intel' and disable c-states if True
CPUVENDOR=$(cat /proc/cpuinfo | grep -m 1 vendor_id | awk '{print $3}') CPUVENDOR="$(cat /proc/cpuinfo | grep -m 1 vendor_id | awk '{print $3}')"
echo "Switch CPU vendor is: $CPUVENDOR" echo "Switch CPU vendor is: $CPUVENDOR"
if [[ $(echo $CPUVENDOR | grep -i "Intel") ]] ; then if echo "$CPUVENDOR" | grep -i 'Intel' >/dev/null 2>&1; then
echo "Switch CPU cstates are: disabled"
CSTATES="intel_idle.max_cstate=0" CSTATES="intel_idle.max_cstate=0"
else else
CSTATES="" CSTATES=""