29 lines
603 B
Perl
Executable File
29 lines
603 B
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
#
|
|
# Displays how much room is left in the PROM and causes an error
|
|
# if it is negative.
|
|
#
|
|
|
|
($#ARGV == 0) || die "Usage: check_size ip27prom_elf_file\n";
|
|
(-e $ARGV[0]) || die "check_size: $ARGV[0] not found\n";
|
|
|
|
open(SIZE, "$ENV{TOOLROOT}/usr/bin/size -4F $ARGV[0] |") ||
|
|
die "Error running $ENV{TOOLROOT}/usr/bin/size -4F $ARGV[0]";
|
|
|
|
$_ = <SIZE>;
|
|
($size) = /^ *([0-9]*)/;
|
|
($size eq '') && die "Could not determine size.\n";
|
|
$room = 0xe0000 - $size;
|
|
|
|
print "\nRoom left in PROM: $room bytes";
|
|
|
|
if ($room < 0) {
|
|
print " (fatal)\n";
|
|
exit 1;
|
|
} else {
|
|
print "\n";
|
|
}
|
|
|
|
exit 0;
|