No need to have \n here. panicf() won't output it anyway.
[Rockbox.git] / tools / romsizetest.pl
blob4dd8d401afbb005fbd2a7e5231aac6526f844fdc
1 #!/usr/bin/perl
4 # Check that the given file is smaller than the given size and if not, return
5 # an error code. Used to verify that the rombox.ucl file fits on the particular
6 # model you build for.
8 sub filesize {
9 my ($filename)=@_;
10 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
11 $atime,$mtime,$ctime,$blksize,$blocks)
12 = stat($filename);
13 return $size;
16 my $romsize = 256*1024; # 256 KB
18 my $romstart = $ARGV[0];
20 if($romstart =~ /^0x(.*)/i) {
21 $romstart = hex($romstart);
25 my $max = $romsize - $romstart;
27 my $file = filesize($ARGV[1]);
29 if($file > $max ) {
30 printf "Output is %d bytes larger than max ($max)\n", $file-$max;
31 exit 1;