#!/bin/bash . run_profile.txt . $base_dir/plans/commands/common.fns kernel_info SUT=`hostname -s` initrd="" if [ "$kconfig" != "" ]; then if grep "CONFIG_BLK_DEV_INITRD=y" $kconfig >/dev/null 2>&1; then filename="/boot/initrd-$kernel_id.img" initrd="--initrd=$filename" echo "using initrd, filename:$filename" fi fi if [ "$kexec_reboot" != "1" ]; then echo boottool --boot-once --title "$kernel_label" "$initrd" boottool --boot-once --title "$kernel_label" "$initrd" err=$? if [ $err -ne 0 ]; then echo "Error: Lilo failed to set next kernel." echo "EXIT STATUS(lilo): $err" return $err fi fi # set autoreboot on kernel panic echo 60 > /proc/sys/kernel/panic # Hack to workaround bug in NFS causing portmap issues if there # is a mounted filesystem and a cronjob writing to it echo Powercycling machine umount -la -t nfs umount -la -t nfs4 if [ "$kexec_reboot" = "1" ]; then # all kexec loading of the new/test kernel & passing control to it are handled here # can add to cmdline as needed: cmdline="$kernel_args" echo "kexec reboot wants to use: kernel=/boot/kernel-$kernel_id + initrd=$initrd + cmdline=$cmdline" kexec --load /boot/kernel-$kernel_id $initrd --append="$cmdline" kex=$? if [ $kex -ne 0 ]; then echo "kexec load failed, error = $kex" exit -10 fi echo "kexec loaded new kernel image, now exec it:" sleep 1 kexec --exec kex=$? if [ $kex -ne 0 ]; then echo "kexec exec new kernel failed, error = $kex" exit -11 fi exit 0 fi echo /sbin/shutdown now -r /sbin/shutdown now -r err=$? if [ $err -ne 0 ]; then echo "Error: Failed to shutdown." echo "EXIT STATUS(shutdown): $err" return $err fi ## Wait for a while as we reboot echo sleep 300 sleep 300 # ## If we haven't rebooted by now, something must be wrong. echo "Warning: Haven't rebooted after 300 sec." sync sleep 30 if [ -f $all_suts_dir/$SUT/bin/power ]; then echo "Initiating a remote power cycle event" echo "$all_suts_dir/$SUT/bin/power cycle" $all_suts_dir/$SUT/bin/power cycle err=$? if [ $? -ne 0 ]; then echo "Error: Remote power of $SUT failed" echo "EXIT STATUS(power): $err" return $err fi fi # Wait for a while as we reboot echo sleep 300 sleep 300 # If we've hit this point, something is extremely broken echo "Error: Cannot restart $SUT. Terminating." echo "EXIT STATUS(boot_kernel): -1" exit -1