sonic-buildimage/installer/x86_64/dell-s6000-replace-reboot.sh
2016-09-14 17:08:05 -07:00

24 lines
602 B
Bash
Executable File

#!/bin/sh
echo "Replace ONIE reboot with Dell reset commands"
# set I2C GPIO mux
echo 1 > /sys/class/gpio/export
echo 2 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio1/direction
echo out > /sys/class/gpio/gpio2/direction
echo 0 > /sys/class/gpio/gpio1/value
echo 0 > /sys/class/gpio/gpio2/value
# replace the original reboot binary with the following command
# sync flushes file system buffers
# i2cset command triggers a hard system reboot, required by ASIC to operate correctly
rm /sbin/reboot
cat <<EOF >> /sbin/reboot
#!/bin/sh
sync
i2cset -y 0 0x31 1 0xfd
EOF
chmod a+x /sbin/reboot