Auto-flash AMD/ATI video card firmware

From lurkmore wiki
Revision as of 16:24, 23 September 2013 by Kyrio (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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

<?php

//created by ugtarmas 
//if this is useful, donate to LRv8b23mQSZah7bg16n7tjT5RVDnZtMi4Z

//atiflash must be located in /usr/local/bin
//download from http://www.techpowerup.com/downloads/2230/atiflash-4-07/

//usage:
//php flash.php 035

//this will flash gpu 0, 3 and 5.
//php cli must be installed

//edit this
$path_to_rom = "/home/user/firmware/gpufirmware.rom";


//edit below at your own risk

if(!$argv[1] && $argv[1] != 0){ exit ("\nopen this file and read the instructions\n\n"); }

$gpu_count = $argv[1];

$gpus = str_split($gpu_count);

echo "attempting to flash $gpu_count:\n";

foreach($gpus as $gpu){ 

while(true){

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

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

        if(eregi("20000/20000h",$result)) { echo "\ndone flashing gpu $gpu\n\n"; break;}
        echo "\nfailed to flash gpu $gpu";

        }

}

?>