Auto-flash AMD/ATI video card firmware: Difference between revisions

From lurkmore wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 5: Line 5:


//created by ugtarmas  
//created by ugtarmas  
//if this is useful, donate to LRv8b23mQSZah7bg16n7tjT5RVDnZtMi4Z
//if this is useful, donate to LRv8b23mQSZah7bg16n7tjT5RVDnZtMi4Z
 
//you must download atiflash from http://liteshack.com/files/atiflash and put into /usr/local/bin/ dir
//you must download atiflash from http://liteshack.com/files/atiflash and put into /usr/local/bin/ dir
//or try your luck here: https://www.google.com/search?q=atiflash+for+linux
//or try your luck here: https://www.google.com/search?q=atiflash+for+linux


//usage:
//usage:
//php flash.php 035
//php flash.php /path/to/bios.rom 035
 
//this will flash /path/to/bios.rom gpu 0, 3 and 5.
//this will flash gpu 0, 3 and 5.
 
//edit this
$path_to_rom = "/home/user/msi.radeon.7950.TF.3GD5.BE.SILVER.V276-18S.voltage.1050.rom";
 
//edit below at your own risk


$gpu_count = $argv[1];
$path_to_rom = $argv[1];
$gpu_count = $argv[2];


$gpu_array = str_split($gpu_count);
$gpu_array = str_split($gpu_count);
Line 42: Line 36:
`atiflash -s $gpu /tmp/flash_$gpu.rom`;
`atiflash -s $gpu /tmp/flash_$gpu.rom`;
echo "backed up gpu $gpu bios to /tmp/flash_$gpu.rom...\n";
echo "backed up gpu $gpu bios to /tmp/flash_$gpu.rom...\n";
`atiflash -unlockrom $gpu`;
`atiflash -unlockrom $gpu`;
echo "unlocked rom on gpu $gpu, flashing bios...\n";
echo "unlocked rom on gpu $gpu, flashing bios...\n";
Line 51: Line 46:
        $result = file_get_contents("/tmp/flash_$gpu");
        $result = file_get_contents("/tmp/flash_$gpu");


        if(eregi("20000/20000h",$result)) { echo " done flashing gpu $gpu\n"; break;}
        if(eregi("Restart",$result)) { echo " done flashing gpu $gpu\n"; break;}
        echo "|";
        echo "|";
Line 57: Line 52:
        }
        }
}
}
echo "You may now save any flash_* backups from /tmp, because anything in /tmp gets deleted upon reboot.\n"
?></pre>
?></pre>


[[Category:Hardware]][[Category:Software]]
[[Category:Hardware]][[Category:Software]]

Revision as of 12:12, 6 June 2014

This page contains a PHP script for auto-flashing an AMD (ATI) video card's (GPU) firmware using a simple command line through Linux:

<?php

//created by ugtarmas 
	//if this is useful, donate to LRv8b23mQSZah7bg16n7tjT5RVDnZtMi4Z
	//you must download atiflash from http://liteshack.com/files/atiflash and put into /usr/local/bin/ dir
	//or try your luck here: https://www.google.com/search?q=atiflash+for+linux

//usage:
	//php flash.php /path/to/bios.rom 035
	//this will flash /path/to/bios.rom gpu 0, 3 and 5.

$path_to_rom = $argv[1];
$gpu_count = $argv[2];

$gpu_array = str_split($gpu_count);

foreach($gpu_array as $gpu){
	if(is_numeric($gpu)){
		$gpus[] = $gpu;
	}
}

$gpu_string = implode(",",$gpus);
$count = count($gpus);

if($count < 1){ exit ("\nyou need to specify the gpus that you want to flash\n\n"); }
if(!file_exists($path_to_rom)){ exit("\nthe file $path_to_rom does not exist\n\n"); }

echo "\nattempting to flash $path_to_rom to gpus $gpu_string:\n\n";

foreach($gpus as $gpu){ 

	`atiflash -s $gpu /tmp/flash_$gpu.rom`;
	echo "backed up gpu $gpu bios to /tmp/flash_$gpu.rom...\n";

	`atiflash -unlockrom $gpu`;
	echo "unlocked rom on gpu $gpu, flashing bios...\n";

	while(true){

        	`atiflash -f -p $gpu $path_to_rom > /tmp/flash_$gpu`;

	        $result = file_get_contents("/tmp/flash_$gpu");

	        if(eregi("Restart",$result)) { echo " done flashing gpu $gpu\n"; break;}
	
	        echo "|";

	        }
}

echo "You may now save any flash_* backups from /tmp, because anything in /tmp gets deleted upon reboot.\n"
?>