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

From lurkmore wiki
Jump to navigationJump to search
No edit summary
m (6 revisions imported)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
This page contains a PHP script for auto-flashing an AMD or ATI video card's (GPU) firmware using a simple command line:
This page contains a PHP script for auto-flashing an [[AMD]] (ATI) video card's (GPU) firmware using a simple command line through [[Linux]]:


<code>
<pre>
<?php
<?php
 
//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
//atiflash must be located in /usr/local/bin
//or try your luck here: https://www.google.com/search?q=atiflash+for+linux
//download from http://www.techpowerup.com/downloads/2230/atiflash-4-07/
 
//usage:
//usage:
//php flash.php /path/to/bios.rom 035
//php flash.php 035
//this will flash /path/to/bios.rom gpu 0, 3 and 5.
 
//this will flash gpu 0, 3 and 5.
$path_to_rom = $argv[1];
//php cli must be installed
$gpu_count = $argv[2];
 
//edit this
$gpu_array = str_split($gpu_count);
$path_to_rom = "/home/user/firmware/gpufirmware.rom";
 
foreach($gpu_array as $gpu){
if(is_numeric($gpu)){
//edit below at your own risk
$gpus[] = $gpu;
}
if(!$argv[1] && $argv[1] != 0){ exit ("\nopen this file and read the instructions\n\n"); }
}
 
$gpu_count = $argv[1];
$gpu_string = implode(",",$gpus);
$count = count($gpus);
$gpus = str_split($gpu_count);
 
if($count < 1){ exit ("\nyou need to specify the gpus that you want to flash\n\n"); }
echo "attempting to flash $gpu_count:\n";
if(!file_exists($path_to_rom)){ exit("\nthe file $path_to_rom does not exist\n\n"); }
 
foreach($gpus as $gpu){  
echo "\nattempting to flash $path_to_rom to gpus $gpu_string:\n\n";
 
while(true){
foreach($gpus as $gpu){  
 
        `atiflash -f -p $gpu $path_to_rom > /tmp/flash_$gpu`;
`atiflash -s $gpu /tmp/flash_$gpu.rom`;
echo "backed up gpu $gpu bios to /tmp/flash_$gpu.rom...\n";
        $result = file_get_contents("/tmp/flash_$gpu");
 
`atiflash -unlockrom $gpu`;
        if(eregi("20000/20000h",$result)) { echo "\ndone flashing gpu $gpu\n\n"; break;}
echo "unlocked rom on gpu $gpu, flashing bios...\n";
        echo "\nfailed to flash gpu $gpu";
 
while(true){
        }
 
        `atiflash -f -p $gpu $path_to_rom > /tmp/flash_$gpu`;
}
 
        $result = file_get_contents("/tmp/flash_$gpu");
?>
 
</code>
        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"
?></pre>


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

Latest revision as of 00:15, 1 April 2022

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"
?>