#!/bin/bash # Description : This script will copy and setup the ROM to be # flashed on next boot. # # # Create Date : Thu Nov 13 13:16:11 PST 2014 # # Author : Kim Naru (kim.naru@amd.com) # # Bug Fixs : # # #Thu Sep 10 15:02:32 PDT 2015 # Improved usage message. More error checking. SsiFalshARM64.EFI check # was in the wrong spot, fixed. # # Mon Aug 31 18:10:19 EDT 2015 # Do not assume SsiFlashARM64.EFI is in the EFI dir. Copy # it over. # # Mon Apr 13 12:43:37 PDT 2015 # Cleaned up comments and fixed a bug. # Mon Apr 13 12:43:37 PDT 2015 # # Thu Apr 9 11:58:55 EDT 2015 # Changed named from go72 upBIOS which is more generic. Also # since the location of the rom file changes on weekly needed # to change paths # # Fri Nov 14 14:39:55 PST 2014 # Was not getting the right path to efi grub command. # Fixed for Fedora and Acadia # # # # NOTE: If a zip file has a name similar the following # # Overdrive_AMI_UEFI-VerROD0084E_0378-NDA.zip # # then you will first have to unzip it before running this script. The reason # being there is a zip file within a zip file. bios=$1 file="$bios" zipFile="$file.zip" #romFile="./$file/Binaries/$bios.rom" romFile="./$bios.rom" logFile="./$bios.log" efiDir="/boot/efi" osrel="/etc/os-release" unzip="/usr/bin/unzip" if [ $# -ne 1 ] then echo "Usage : $0 BIOS" echo "Example: If the BIOS version is ROD0084E then: $0 ROD0084E" exit 1 fi if [ ! -f "$zipFile" ] then echo "$zipFile is missing exiting..." exit 2 fi . $osrel echo $ID | grep -i rhel > /dev/null 2>&1 status=$? if [ $status -eq 0 ] then # Acadia grub="FS0:\EFI\redhat\grubaa64.efi" fi echo $ID | grep -i fedora > /dev/null 2>&1 status=$? if [ $status -eq 0 ] then # Fedora grub="FS0:\EFI\fedora\grubaa64.efi" fi SsiFlash="FS0:\SsiFlashARM64.EFI FS0:\\$romFile /U " if [ ! -f $unzip ] then echo "$unzip is missing,installing..." yum install unzip fi if [ ! -f $zipFile ] then echo "[$zipFile] not found..exiting" echo exit 3 else # If files exist unzip prompts which we do not want /bin/rm -f SsiFlashARM64.EFI /bin/rm -f $romFile /bin/rm -f $logFile $unzip $zipFile > /dev/null 2>&1 fi # Force copy the utility. if [ ! -f SsiFlashARM64.EFI ] then echo "SsiFlashARM64.EFI is missing exiting..." exit 4 else cp -f SsiFlashARM64.EFI $efiDir fi if [ ! -f $romFile ] then echo "[$romFile] not found..exiting" echo exit 5 fi if [ ! -d $efiDir ] then echo "[/boot/efi] does not exist..exiting\n" echo exit 6 fi cp $romFile $efiDir echo "Copied $romFile to $efiDir" rm -f $efiDir/flashed #backup original startup.nsh. if [ -f $efiDir/startup.nsh ] then cp $efiDir/startup.nsh $efiDir/startup.nsh.bak fi # ----------------------------------------------------------------- # Create UEFI boot script startup.nsh based on variables above # and place it in the UEFI partition. # ----------------------------------------------------------------- cat << EOF > $efiDir/startup.nsh # If fs0:\flashed doesn't exit it will assume the system needs to be flashed. # Subsequent boots will not reflash. To force a reflash do : # del fs0:\flashed. # # kim naru(kim.naru@amd.com) # `date` @echo -off if exist fs0:\flashed then echo System has already been flashed with $bios goto FOUND endif echo Flashing system with $bios. $SsiFlash echo $bios > fs0:\flashed echo Flashing completed. :REBOOT echo "System has been flashed. Please power cycle." goto END :FOUND exit #$grub :END reset EOF echo "Installation complete, please reboot your system. " echo # ----------------------------------------------------------------- # End # -----------------------------------------------------------------