3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 # Purpose: extract and gather info from a build and put that in a standard
10 # way in the output file. Meant to be put in rockbox zip package to help and
11 # aid machine installers and more.
14 my $output = $ARGV[0];
18 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
19 $atime,$mtime,$ctime,$blksize,$blocks)
26 my @out=`$c 2>/dev/null`;
36 if($_ =~ / +0x([0-9a-f]+) *_end = \./) {
40 elsif($_ =~ / +0x([0-9a-f]+) *_loadaddress = \./) {
46 # return number of bytes
47 return hex($end) - hex($start);
66 print "Usage: mkinfo.pl <filename>\n";
69 open(O
, ">$output") || die "couldn't open $output for writing";
71 # Variables identifying the target, that should remain the same as long
72 # as the hardware is unmodified
73 printf O
("Target: %s\n", $ENV{'MODELNAME'});
74 printf O
("Target id: %d\n", $ENV{'TARGET_ID'});
75 printf O
("Target define: %s\n", $ENV{'TARGET'});
76 printf O
("Memory: %d\n", $ENV{'MEMORYSIZE'});
77 printf O
("CPU: %s\n", $ENV{'CPU'});
78 printf O
("Manufacturer: %s\n", $ENV{'MANUFACTURER'});
80 # Variables identifying Rockbox and bootloader properties. Possibly changing
81 # every software upgrade.
82 printf O
("Version: %s", `$ENV{TOOLSDIR}/version.sh $ENV{ROOTDIR}`);
83 printf O
("Binary: %s\n", $ENV{'BINARY'});
84 printf O
("Binary size: %s\n", filesize
($ENV{'BINARY'}));
86 if ($ENV{'APPSDIR'} =~ /\/apps$/) {
87 printf O
("Actual size: %s\n", filesize
("rockbox.bin"));
88 printf O
("RAM usage: %s\n", mapscan
("rockbox.map"));
89 printf O
("Features: %s\n", features
("apps/features"));
90 } elsif ($ENV{'APPSDIR'} =~ /\/bootloader
$/) {
91 printf O
("Actual size: %s\n", filesize
("bootloader.bin"));
92 printf O
("RAM usage: %s\n", mapscan
("bootloader.map"));
95 # Variables identifying tool and build environment details
96 printf O
("gcc: %s\n", cmd1line
("$ENV{'CC'} --version"));
97 printf O
("ld: %s\n", cmd1line
("$ENV{'LD'} --version"));
98 printf O
("Host gcc: %s\n", cmd1line
("$ENV{'HOSTCC'} --version"));
99 printf O
("Host system: %s\n", $ENV{'UNAME'});