rockbox/tools/romsizetest.pl
Daniel Stenberg 948e384f4d removed the hard-coded size limit from the Makefile with some preprocessor
magic and a modified perl script


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5045 a1c6a512-1295-4272-9138-f99709370657
2004-09-06 08:50:47 +00:00

32 lines
661 B
Perl
Executable file

#!/usr/bin/perl
#
# Check that the given file is smaller than the given size and if not, return
# an error code. Used to verify that the rombox.ucl file fits on the particular
# model you build for.
sub filesize {
my ($filename)=@_;
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);
return $size;
}
my $romsize = 256*1024; # 256 KB
my $romstart = $ARGV[0];
if($romstart =~ /^0x(.*)/i) {
$romstart = hex($romstart);
}
my $max = $romsize - $romstart;
my $file = filesize($ARGV[1]);
if($file > $max ) {
print "Output is larger than max ($max)\n";
exit 1;
}