#!/usr/bin/perl

($range, $info) = split /:/, `grep "Video ROM" /proc/iomem`;
($start, $end) = split /-/, $range;

if( $start eq "" ) {
	print "Couldn't find Video ROM in /proc/iomem\n";
	exit;
}

$offset = hex "0x$start";
$tmp = hex "0x$end";
$size = 1 + $tmp - $offset;

$command = "dd if=/dev/mem of=saved_vgabios.bin bs=1c count=$size skip=$offset";
print "range = $range, start = $start, size = $size\n";
print "$command\n";
system $command;

