mirror of
				https://github.com/brain-hackers/brain-config.git
				synced 2025-11-04 14:38:36 +09:00 
			
		
		
		
	Tweaks to boot ROM setting
This commit is contained in:
		
							
								
								
									
										64
									
								
								raspi-config
									
									
									
									
									
								
							
							
						
						
									
										64
									
								
								raspi-config
									
									
									
									
									
								
							@@ -1245,11 +1245,11 @@ do_boot_order() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
do_eeprom() {
 | 
			
		||||
do_boot_rom() {
 | 
			
		||||
  if [ "$INTERACTIVE" = True ]; then
 | 
			
		||||
    BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "EEPROM Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
 | 
			
		||||
      "E1 Stable" "Use the stable EEPROM software image" \
 | 
			
		||||
      "E2 Critical" "Use the critical EEPROM software image" \
 | 
			
		||||
    BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Boot ROM Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
 | 
			
		||||
      "E1 Stable" "Use the stable boot ROM software image" \
 | 
			
		||||
      "E2 Critical" "Use the critical boot ROM software image" \
 | 
			
		||||
      3>&1 1>&2 2>&3)
 | 
			
		||||
  else
 | 
			
		||||
    BOOTOPT=$1
 | 
			
		||||
@@ -1266,39 +1266,45 @@ do_eeprom() {
 | 
			
		||||
        EETYPE="Critical"
 | 
			
		||||
        ;;
 | 
			
		||||
      *)
 | 
			
		||||
        whiptail --msgbox "Programmer error, unrecognised EEPROM option" 20 60 2
 | 
			
		||||
        whiptail --msgbox "Programmer error, unrecognised boot ROM option" 20 60 2
 | 
			
		||||
        return 1
 | 
			
		||||
        ;;
 | 
			
		||||
    esac
 | 
			
		||||
    if [ "$INTERACTIVE" = True ]; then
 | 
			
		||||
      whiptail --yesno "$EETYPE EEPROM set.\nWould you like to reset EEPROM to defaults?" 20 60 2
 | 
			
		||||
      if [ $? -eq 0 ]; then # yes
 | 
			
		||||
        CURDATE=$(date -d "`vcgencmd bootloader_version |  head -n 1`" +%Y%m%d)
 | 
			
		||||
        FILNAME="none"
 | 
			
		||||
        if grep -q "stable" /etc/default/rpi-eeprom-update ; then
 | 
			
		||||
          EEPATH="/lib/firmware/raspberrypi/bootloader/stable/pieeprom*.bin"
 | 
			
		||||
        else
 | 
			
		||||
          EEPATH="/lib/firmware/raspberrypi/bootloader/critical/pieeprom*.bin"
 | 
			
		||||
      whiptail --yesno "$EETYPE EEPROM set - will be loaded at next reboot.\nWould you like to reset boot ROM to defaults?" 20 60 2
 | 
			
		||||
      DEFAULTS=$?
 | 
			
		||||
     else
 | 
			
		||||
      DEFAULTS=$2
 | 
			
		||||
    fi
 | 
			
		||||
    if [ "$DEFAULTS" -eq 0 ]; then # yes
 | 
			
		||||
      CURDATE=$(date -d "`vcgencmd bootloader_version |  head -n 1`" +%Y%m%d)
 | 
			
		||||
      FILNAME="none"
 | 
			
		||||
      if grep -q "stable" /etc/default/rpi-eeprom-update ; then
 | 
			
		||||
        EEPATH="/lib/firmware/raspberrypi/bootloader/stable/pieeprom*.bin"
 | 
			
		||||
      else
 | 
			
		||||
        EEPATH="/lib/firmware/raspberrypi/bootloader/critical/pieeprom*.bin"
 | 
			
		||||
      fi
 | 
			
		||||
      for filename in $EEPATH ; do
 | 
			
		||||
        FILDATE=$(date -d "`echo $filename | cut -d - -f 2- | cut -d . -f 1`" +%Y%m%d)
 | 
			
		||||
        if [ $FILDATE -eq $CURDATE ]; then
 | 
			
		||||
          FILNAME=$filename
 | 
			
		||||
        fi
 | 
			
		||||
        for filename in $EEPATH ; do
 | 
			
		||||
          FILDATE=$(date -d "`echo $filename | cut -d - -f 2- | cut -d . -f 1`" +%Y%m%d)
 | 
			
		||||
          if [ $FILDATE -eq $CURDATE ]; then
 | 
			
		||||
            FILNAME=$filename
 | 
			
		||||
          fi
 | 
			
		||||
        done
 | 
			
		||||
        if [ "$FILNAME" = "none" ]; then
 | 
			
		||||
          if [ "$INTERACTIVE" = True ]; then
 | 
			
		||||
            whiptail --msgbox "No EEPROM bin file found for version `date -d $CURDATE +%Y-%m-%d` - cannot reset to defaults" 20 60 2
 | 
			
		||||
          fi
 | 
			
		||||
        else
 | 
			
		||||
          rpi-eeprom-update -d -f $FILNAME
 | 
			
		||||
      done
 | 
			
		||||
      if [ "$FILNAME" = "none" ]; then
 | 
			
		||||
        if [ "$INTERACTIVE" = True ]; then
 | 
			
		||||
          whiptail --msgbox "No EEPROM bin file found for version `date -d $CURDATE +%Y-%m-%d` - cannot reset to defaults" 20 60 2
 | 
			
		||||
        fi
 | 
			
		||||
      else
 | 
			
		||||
        rpi-eeprom-update
 | 
			
		||||
        rpi-eeprom-update -d -f $FILNAME
 | 
			
		||||
        if [ "$INTERACTIVE" = True ]; then
 | 
			
		||||
          whiptail --msgbox "Boot ROM reset to defaults" 20 60 2
 | 
			
		||||
        fi
 | 
			
		||||
      fi
 | 
			
		||||
    else
 | 
			
		||||
      # don't set defaults if not interactive
 | 
			
		||||
      rpi-eeprom-update
 | 
			
		||||
      if [ "$INTERACTIVE" = True ]; then
 | 
			
		||||
        whiptail --msgbox "Boot ROM not reset to defaults" 20 60 2
 | 
			
		||||
      fi
 | 
			
		||||
    fi
 | 
			
		||||
    ASK_TO_REBOOT=1
 | 
			
		||||
  fi
 | 
			
		||||
@@ -2503,7 +2509,7 @@ do_boot_menu() {
 | 
			
		||||
      "B2 Wait for Network at Boot" "Choose whether to wait for network connection during boot" \
 | 
			
		||||
      "B3 Splash Screen" "Choose graphical splash screen or text boot" \
 | 
			
		||||
      "B4 Boot Order" "Choose network or USB device boot" \
 | 
			
		||||
      "B5 EEPROM Version" "Select stable or critical EEPROM version" \
 | 
			
		||||
      "B5 Boot ROM Version" "Select stable or critical boot ROM release" \
 | 
			
		||||
      3>&1 1>&2 2>&3)
 | 
			
		||||
  else
 | 
			
		||||
    FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Boot Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
 | 
			
		||||
@@ -2521,7 +2527,7 @@ do_boot_menu() {
 | 
			
		||||
      B2\ *) do_boot_wait ;;
 | 
			
		||||
      B3\ *) do_boot_splash ;;
 | 
			
		||||
      B4\ *) do_boot_order ;;
 | 
			
		||||
      B5\ *) do_eeprom ;;
 | 
			
		||||
      B5\ *) do_boot_rom ;;
 | 
			
		||||
      *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
 | 
			
		||||
    esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
 | 
			
		||||
  fi
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user