1#!/bin/sh 2 3# Write 1 to /sys/class/watchdog/watchdog1/access_cs0 to reset the boot code 4# selection and reset the chip select, so that the next boot is from the 5# primary chip. 6# This needs to be done in the shutdown script after umount the rootfs, 7# otherwise the filesystem will get error because the content is switched 8# back to CS0 chip. 9 10SHUTDOWN_EXTRA_SCRIPT="/run/initramfs/shutdown_task_after_umount" 11 12cat <<'EOF' >"${SHUTDOWN_EXTRA_SCRIPT}" 13#!/bin/sh 14ACCESS_CS0="/sys/class/watchdog/watchdog1/access_cs0" 15if [ -f "${ACCESS_CS0}" ]; then 16 echo "Reset aspeed chip select" 17 echo 1 > "${ACCESS_CS0}" 18fi 19EOF 20chmod +x "${SHUTDOWN_EXTRA_SCRIPT}" 21 22 23# Insert the shutdown_task_after_umount into the shutdown script 24# This change could be apply to obmc-shutdown.sh in obmc-phosphor-initfs.bb 25# if this is accepted. 26sed -i "s/echo Remaining mounts/\/run\/initramfs\/shutdown_task_after_umount\\necho Remaining mounts/" /run/initramfs/shutdown 27