Updated to iMaker version 10.24.01, 14-Jun-2010.
Binary file imgtools/imaker/bin/mingw_make.exe has changed
--- a/imgtools/imaker/buildrom_plugins/group/bld.inf Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/buildrom_plugins/group/bld.inf Thu Jun 24 10:35:05 2010 +0300
@@ -18,11 +18,12 @@
PRJ_EXPORTS
-../plugincommon.pm +/tools/ //
-../hide.pm +/tools/ //
-../localise.pm +/tools/ //
-../localise_all_resources.pm +/tools/ //
-../obyparse.pm +/tools/ //
-../override.pm +/tools/ //
+../plugincommon.pm +/tools/rom/imaker/ //
+../hide.pm +/tools/rom/imaker/ //
+../localise.pm +/tools/rom/imaker/ //
+../localise_all_resources.pm +/tools/rom/imaker/ //
+../obyparse.pm +/tools/rom/imaker/ //
+../override.pm +/tools/rom/imaker/ //
+../stubsischeck.pm +/tools/rom/imaker/ //
// END OF BLD.INF
--- a/imgtools/imaker/buildrom_plugins/localise.pm Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/buildrom_plugins/localise.pm Thu Jun 24 10:35:05 2010 +0300
@@ -13,7 +13,7 @@
#
# Description:
# Adds a LOCALISE macro that enables configuration of localised files.
-# The localised language selection is done with a ADD_LANGUAGE macro.
+# The localised language selection is done with a LANGUAGE_CODE macro.
#
@@ -26,14 +26,14 @@
# target => the target file. The section that needs to be localised should be marked with ??.
# languages => a space delimited list of language codes
#
-# Syntax: ADD_LANGUAGE
-# ADD_LANGUAGE lang
+# Syntax: LANGUAGE_CODE
+# LANGUAGE_CODE lang
#
# Example:
# Add languages
-# ADD_LANGUAGE 01
-# ADD_LANGUAGE 02
-# ADD_LANGUAGE 03
+# LANGUAGE_CODE 01
+# LANGUAGE_CODE 02
+# LANGUAGE_CODE 03
#
# Use Case 1:
# Localises a App resoure file.
@@ -45,9 +45,9 @@
#
# Use Case 2:
# Localise all resource files under a section
-# ADD_LANGUAGE 01
-# ADD_LANGUAGE 02
-# ADD_LANGUAGE 03
+# LANGUAGE_CODE 01
+# LANGUAGE_CODE 02
+# LANGUAGE_CODE 03
#
# LOCALISE_ALL_RESOURCES_BEGIN
# // All resource files will be localised
@@ -107,6 +107,7 @@
my $verbose=0;
my $errors=0;
my $localise_all_resource=0;
+my %qt_langs = ();
sub localise_info
{
@@ -120,17 +121,10 @@
my $obydata = shift;
do_localise_all_resources_extension(\@{$obydata});
-
undef @newobydata;
foreach $line (@{$obydata})
{
- # Ignore REM statements, to avoid processing "REM __SCALABLE_IMAGE( ... )"
- if ($line =~ /^\s*REM/i)
- {
- push @newobydata, $line;
- next;
- }
- # ADD_LANGUAGE xx
+ # LANGUAGE_CODE xx
if (is_addlanguage_entry($line))
{
my $code = get_lang_from_addlanguage_entry($line);
@@ -144,10 +138,28 @@
{
print "adding language $code\n" if $verbose;
$languages{$code} = 1;
- push @newobydata, "REM handled $line";
+ push @newobydata, $line;
next;
}
}
+ # Ignore REM statements, to avoid processing "REM __SCALABLE_IMAGE( ... )"
+ if ($line =~ /^\s*REM/i)
+ {
+ push @newobydata, $line;
+ next;
+ }
+ # Read QT to Symbian language id mappings
+ if ($line =~ /^\s*QT_TO_SYMBIAN_LANGID\s+(.+?)\s*$/i)
+ {
+ push(@newobydata, "REM handled $line");
+ open(FILE, $1) or
+ die("ERROR: localise.pm can't open QT to Symbian language id mapping file `$1'\n");
+ map {
+ $qt_langs{$2} = $1 if (!/^\s*#/ && /^\s*(\S+?)\s*=\s*(\d+)\s*$/);
+ } <FILE>;
+ close(FILE);
+ next;
+ }
# LOCALISE macro
if (is_localise_entry($line))
{
@@ -245,14 +257,23 @@
for (my $i=0; $i<$count; $i++) {
push(@data, $lang);
}
- my $output = sprintf($res,@data);
+
+ my $output;
+ if (($res =~ m/\.qm["']?$/i) && %qt_langs)
+ {
+ $output = sprintf($res, $qt_langs{sprintf("%s", @data)});
+ }
+ else
+ {
+ $output = sprintf($res,@data);
+ }
return $output;
}
-# match ADD_LANGUAGE 01
+# match LANGUAGE_CODE 01
sub is_addlanguage_entry($)
{
my $entry = shift;
- if ( $entry =~ m/^\s*ADD_LANGUAGE\s+(\S+)\s*/i )
+ if ( $entry =~ m/^\s*REM\s+handled\s+LANGUAGE_CODE\s+(\S+)\s*$/i )
{
return 1;
}
@@ -262,7 +283,7 @@
sub get_lang_from_addlanguage_entry($)
{
my $entry = shift;
- if ( $entry =~ m/^\s*ADD_LANGUAGE\s+(\S+)/i )
+ if ( $entry =~ m/^\s*REM\s+handled\s+LANGUAGE_CODE\s+(\S+)\s*$/i )
{
return $1;
}
--- a/imgtools/imaker/buildrom_plugins/localise_all_resources.pm Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/buildrom_plugins/localise_all_resources.pm Thu Jun 24 10:35:05 2010 +0300
@@ -13,7 +13,7 @@
#
# Description:
# Adds a LOCALISE macro that enables configuration of localised files.
-# The localised language selection is done with a ADD_LANGUAGE macro.
+# The localised language selection is done with a LANGUAGE_CODE macro.
#
@@ -26,14 +26,14 @@
# target => the target file. The section that needs to be localised should be marked with ??.
# languages => a space delimited list of language codes
#
-# Syntax: ADD_LANGUAGE
-# ADD_LANGUAGE lang
+# Syntax: LANGUAGE_CODE
+# LANGUAGE_CODE lang
#
# Example:
# Add languages
-# ADD_LANGUAGE 01
-# ADD_LANGUAGE 02
-# ADD_LANGUAGE 03
+# LANGUAGE_CODE 01
+# LANGUAGE_CODE 02
+# LANGUAGE_CODE 03
#
# Use Case 1:
# Localises a App resoure file.
@@ -45,9 +45,9 @@
#
# Use Case 2:
# Localise all resource files under a section
-# ADD_LANGUAGE 01
-# ADD_LANGUAGE 02
-# ADD_LANGUAGE 03
+# LANGUAGE_CODE 01
+# LANGUAGE_CODE 02
+# LANGUAGE_CODE 03
#
# LOCALISE_ALL_RESOURCES_BEGIN
# // All resource files will be localised
@@ -64,19 +64,6 @@
#
###############################################################################
-#
-# Version 4
-# Path corrections to widget support.
-#
-# Version 3
-# Support for Idle widgets.
-#
-# Version 2
-# Localises also *.hlp to *.h%s.
-#
-# Version 1
-# Initial version.
-
package localise_all_resources;
use strict;
@@ -169,6 +156,15 @@
push @newobydata, "$line\n";
next;
}
+ # localise all qm files inside the localise_all_resources section
+ # qt resource files .ts
+ if ( is_qt_resource_entry($line) )
+ {
+ # match data/file=foobar.qm resource/foobar.qm
+ $line = create_localise_entry_from_qt_resource($line);
+ push @newobydata, "$line\n";
+ next;
+ }
# help files .hlp
if ( is_help_entry_hlp($line) )
{
@@ -262,6 +258,19 @@
return 0;
}
+sub is_qt_resource_entry($)
+{
+ my $entry = shift;
+ my $type = get_type_from_entry($entry);
+ my $source = get_source_from_entry($entry);
+ my $target = get_target_from_entry($entry);
+ if ($source =~ m/\.qm[\"|\']?$/i &&
+ $target =~ m/\.qm[\"|\']?$/i )
+ {
+ return 1;
+ }
+ return 0;
+}
#
# match
sub is_help_entry_xhtml($)
@@ -270,8 +279,8 @@
my $type = get_type_from_entry($entry);
my $source = get_source_from_entry($entry);
my $target = get_target_from_entry($entry);
- if ($source =~ m/\\01\\/i &&
- $target =~ m/\\01\\/i )
+ if ($source =~ m/[\/\\]01[\/\\]/i &&
+ $target =~ m/[\/\\]01[\/\\]/i )
{
return 1;
}
@@ -301,10 +310,10 @@
my $type = get_type_from_entry($entry);
my $source = get_source_from_entry($entry);
my $target = get_target_from_entry($entry);
- if (($source =~ m/\\01\\.*\.dtd/i &&
- $target =~ m/\\01\\.*\.dtd/i ) ||
- ($source =~ m/\\00\\.*\.dtd/i &&
- $target =~ m/\\00\\.*\.dtd/i ))
+ if (($source =~ m/[\/\\]01[\/\\].*\.dtd/i &&
+ $target =~ m/[\/\\]01[\/\\].*\.dtd/i ) ||
+ ($source =~ m/[\/\\]00[\/\\].*\.dtd/i &&
+ $target =~ m/[\/\\]00[\/\\].*\.dtd/i ))
{
return 1;
}
@@ -390,6 +399,20 @@
return "$type=LOCALISE($source, $target)";
}
+# create localise entry from qt resource entry
+sub create_localise_entry_from_qt_resource($)
+{
+ my $entry = shift;
+ my $type = get_type_from_entry($entry);
+ my $source = get_source_from_entry($entry);
+ my $target = get_target_from_entry($entry);
+ #convert the .qm to _xx.qm
+ $source =~ s/\.qm/\_%s.qm/i;
+ $target =~ s/\.qm/\_%s.qm/i;
+ #print "create_localise_entry_from_resource: $source\n";
+ return "$type=LOCALISE($source, $target)";
+}
+
# create localise entry from resource entry
sub create_localise_entry_from_help($)
{
@@ -398,8 +421,8 @@
my $source = get_source_from_entry($entry);
my $target = get_target_from_entry($entry);
#convert the \\01\\ to \\%02d\\
- $source =~ s/\\01\\/\\%02d\\/i;
- $target =~ s/\\01\\/\\%02d\\/i;
+ $source =~ s/([\/\\])01([\/\\])/$1%02d$2/i;
+ $target =~ s/([\/\\])01([\/\\])/$1%02d$2/i;
#print "create_localise_entry_from_resource: $source\n";
return "$type=LOCALISE($source, $target)";
}
@@ -468,8 +491,8 @@
{
my $entry = shift;
- $entry =~ s/\\01\\/\\%02d\\/ig;
- $entry =~ s/\\00\\/\\%02d\\/ig;
+ $entry =~ s/([\/\\])01([\/\\])/$1%02d$2/ig;
+ $entry =~ s/([\/\\])00([\/\\])/$1%02d$2/ig;
#print "create_localise_entry_from_resource: $source\n";
return $entry;
--- a/imgtools/imaker/buildrom_plugins/obyparse.pm Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/buildrom_plugins/obyparse.pm Thu Jun 24 10:35:05 2010 +0300
@@ -33,87 +33,92 @@
@EXPORT = qw(&obyparse_info &obyparse_init &obyparse_process);
}
-my $conf = "";
+my $conf;
sub obyparse_info()
{
return({
name => "obyparse",
- invocation => "InvocationPoint2",
+ invocation => "InvocationPoint2", # tmp6.oby
initialize => "obyparse::obyparse_init",
single => "obyparse::obyparse_process"});
}
sub obyparse_init($)
{
- plugin_init("obyparse.pm", $conf = shift());
+ plugin_init(&obyparse_info, $conf = shift(), 0);
}
sub obyparse_readconffile($$$$$);
-
+sub obyparse_findincfiles();
+sub obyparse_findspifiles();
sub obyparse_process($)
{
- plugin_start("obyparse.pm", $conf);
+ plugin_start(&obyparse_info, $conf);
- my $obydata = shift();
- my %targets = ();
- my %patchdata = ();
- my ($romfiles, $rofs1files, $udebfiles, $urelfiles) = (undef, undef, "", "");
- my $fname = "";
+ my ($obydata, $romfiles, $rofs1files, $udebfiles, $urelfiles, $fname) = (shift(), undef, undef, "", "", "");
+ my %targets = my %patchdata = ();
+
+ obyparse_findincfiles();
+ obyparse_findspifiles();
+ plugin_reset();
foreach (@$obydata)
{
- next if (my $parse = parse_obyline($_)) < 0;
+ next if !(my $parse = parse_obyline($_));
- if (($parse == 1) && ($gKeyword =~ FILEBITMAPSPECKEYWORD)) {
- ($fname = lc($gTarget)) =~ /^(?:.*\\)?(.+?)$/;
- my $tname = $1;
- $targets{$fname} = $targets{$tname} = [$gLnum - 1, !$gRomid && ($gKeyword =~ ROFSBITMAPFILESPECKEYWORD)];
+ if (($parse == 2) && ($gKeyword =~ FILEBITMAPSPECKEYWORD)) {
+ $targets{$gTgtCmp} = $targets{File::Basename::basename($gTgtCmp)} = [$gLnum - 1,
+ !$gRomid && ($gKeyword =~ ROFSBITMAPFILESPECKEYWORD) && ($gAttrib !~ /paging_unmovable/i)]
+ if ($gImgid == $gRomidCmp);
+ dprint(2, "Removed attribute paging_unmovable: `$_'")
+ if ($gAttrib =~ /paging_unmovable/i) && (s/\s+paging_unmovable\s*(?=\s|^)//i);
next;
}
next if !/^\s*OBYPARSE_(ROM|ROFS1|UDEB|UREL)\s+(.+?)\s*$/i;
(my $rule, $fname) = (uc($1), $2);
+ $_ = "$gHandlestr $_";
+ next if $gRomid && ($gImgid != $gRomidCmp);
+
+ dprint(2, "#$gLnum: `$gLine'");
my $files = ($rule eq "ROM" ? \$romfiles : ($rule eq "ROFS1" ? \$rofs1files :
($rule eq "UDEB" ? \$udebfiles : \$urelfiles)));
$$files = "" if !defined($$files);
- dprint(2, "#$gLnum: `$gLine'");
if ($fname ne "*") {
my $basedir = "";
($basedir, $fname) = ($1, $2) if $fname =~ /^(.*[\/\\])(.+?)$/;
dprint(3, "Found " . obyparse_readconffile($basedir, $fname, $rule, $files, 0) . " entries");
- }
- else {
+ } else {
+ dprint(3, "Move/change all possible components to $rule");
$$files = ".*";
- dprint(3, "Move/change all possible components to $rule");
}
- $_ = "$gHandlestr $_";
}
$romfiles = qr/^($romfiles)$/i if defined($romfiles);
$rofs1files = qr/^($rofs1files)$/i if defined($rofs1files);
($udebfiles, $urelfiles) = (qr/^($udebfiles)$/i, qr/^($urelfiles)$/i);
- ($gLnum, $gRomid) = (0, 0);
- my ($rofs1cnt, $udebcnt, $urelcnt, $offset, @torofs1) = (0, 0, 0, 0, ());
+ my ($rofs1ofs, $udebcnt, $urelcnt, @torofs1) = (0, 0, 0, ());
+ plugin_reset();
foreach (@$obydata)
{
my $parse = parse_obyline($_);
- $offset++ if $gRomid < 2;
- next if $parse != 1;
+ $rofs1ofs++ if ($gRomid < 2);
+ next if ($parse != 2) || ($gImgid != $gRomidCmp);
if ($gKeyword =~ /^patchdata$/i) {
- $gSource =~ /^(.+?)(?:@.+)?$/;
- $fname = lc($1);
+ $gSrcCmp =~ /^(.+?)(?:@.+)?$/;
+ next if !exists($targets{$fname = $1});
$patchdata{$fname} = $targets{$fname}[0] if !exists($patchdata{$fname});
+ next if !$targets{$fname}[1];
}
- else {
- $gTarget =~ /^(?:.*\\)?(.+?)$/;
- $fname = $1;
+ elsif ($gKeyword =~ FILEBITMAPSPECKEYWORD) {
+ $fname = File::Basename::basename($gTgtCmp);
if ($fname =~ $urelfiles && s/(?<=[\/\\])udeb(?=[\/\\])/urel/i) {
$urelcnt++;
dprint(2, "Changed to UREL: `$_'");
@@ -122,67 +127,105 @@
$udebcnt++;
dprint(2, "Changed to UDEB: `$_'");
}
- }
-
- next if $gRomid || !defined($romfiles) && !defined($rofs1files);
-
- if (($gKeyword =~ ROFSBITMAPFILESPECKEYWORD) ||
- ($gKeyword =~ /^patchdata$/i) && exists($targets{$fname}) && $targets{$fname}[1]) {
+ next if !$targets{$gTgtCmp}[1];
}
- elsif ($gKeyword =~ /^(?:alias|rename)/i && exists($targets{lc($gSource)}) && $targets{lc($gSource)}[1]) {
- $gSource =~ /^(?:.*\\)?(.+?)$/;
- $fname = $1;
+ elsif ($gKeyword =~ DIRECTORYKEYWORD) {
+ $fname = File::Basename::basename($gTgtCmp);
+ next if !(exists($targets{$gTgtCmp}) && $targets{$gTgtCmp}[1]) &&
+ !(exists($targets{$fname}) && $targets{$fname}[1]);
}
- else {
- next;
- }
- if (defined($rofs1files) && ($fname =~ $rofs1files) || defined($romfiles) && ($fname !~ $romfiles)) {
- $rofs1cnt++;
+ else { next }
+
+ if (!$gRomid && (defined($rofs1files) && ($fname =~ $rofs1files) || defined($romfiles) && ($fname !~ $romfiles))) {
push(@torofs1, $_);
- $_ = "$gHandlestr =>ROFS1 $_";
+ $_ = "$gHandlestr $_";
}
}
- dprint(3, "Moved $rofs1cnt entries to ROFS1") if $rofs1cnt;
+ dprint(3, "Moved " . scalar(@torofs1) . " entries to ROFS1") if @torofs1;
dprint(3, "Changed $udebcnt components to UDEB") if $udebcnt;
dprint(3, "Changed $urelcnt components to UREL") if $urelcnt;
- dprint(2, "Found " . keys(%patchdata) . " ROM-patched components:") if %patchdata;
+ dprint(3, "Finding ROM-patched components");
foreach (sort({$a <=> $b} values(%patchdata))) {
- ${$obydata}[$_] =~ /^(?:$gHandlestr =>ROFS1 )?(.+)$/;
+ ${$obydata}[$_] =~ /^(?:$gHandlestr )?(.+)$/;
parse_keyline($1);
dprint(2, "`$gSource'");
}
+ dprint(3, "Found " . keys(%patchdata) . " ROM-patched components");
- splice(@$obydata, $offset, 0, @torofs1) if @torofs1;
+ splice(@$obydata, $rofs1ofs, 0, @torofs1) if @torofs1;
plugin_end();
}
+sub obyparse_findincfiles()
+{
+ my ($drive, $indent, $prev, $tmpoby, %files) =
+ (Cwd::cwd() =~ /^([a-z]:)/i ? $1 : "", -2, "", "$gWorkdir/tmp1.oby", ());
+
+ dprint(3, "Finding include hierarchy from `$tmpoby'");
+ open(FILE, $tmpoby) or dprint(-3, "$gPluginname can't open `$tmpoby'"), return;
+
+ while (my $line = <FILE>) {
+ next if ($line !~ /^#\s+\d+\s+"(.+?)"(?:\s+(\d))?$/);
+ my ($file, $flag) = ($1, defined($2) ? $2 : 0);
+ next if ($file =~ /^<.*>$/);
+ $indent -= 2, $prev = $file, next if ($flag == 2);
+ next if (!$flag && $file eq $prev || $flag > 1);
+ $indent += 2 if $flag;
+ ($prev = $file) =~ /^(.*[\/\\])?(.+?)$/;
+ (my $dir, $file) = ("", $2);
+ $dir = abspath(defined($1) ? $1 : ".");
+ dprint(2, ("." x $indent) . "`$prev' !!!"), next if ($dir eq "");
+ $dir =~ s/^$drive|\/$//gi;
+ $files{lc($file = "$dir/$file")} = 1;
+ dprint(2, ("." x $indent) . "`$file'");
+ }
+ close(FILE);
+ dprint(3, "Found " . keys(%files) . " different include files");
+}
+
+sub obyparse_findspifiles()
+{
+ my ($spicnt, $tmpoby) = (0, "$gWorkdir/tmp5.oby");
+
+ dprint(3, "Finding SPI input files from `$tmpoby'");
+ open(FILE, $tmpoby) or dprint(-3, "$gPluginname can't open `$tmpoby'"), return;
+
+ while (my $line = <FILE>) {
+ next if (parse_obyline($line) != 2) || ($gKeyword !~ /^spidata/i);
+ $spicnt++;
+ dprint(2, "`$gSource'" . ($gKeyword =~ /^spidata$/i ? "" : " ($gKeyword)"));
+ }
+ close(FILE);
+ dprint(3, "Found $spicnt SPI input files");
+}
sub obyparse_readconffile($$$$$)
{
my ($basedir, $file, $type, $files, $indent) = @_;
- $file = $basedir . $file;
+ $file = "$basedir$file";
my $filecnt = 0;
- dprint(3, "Reading $type files") if $type;
- dprint(3, ("." x $indent) . "`$file'");
+ dprint(3, "Reading $type files from $file") if $type;
+ dprint(2, ("." x $indent) . "`$file'");
- open(FILE, $file) or die("ERROR: Can't open `$file'\n");
+ open(FILE, $file) or dprint(3, "Error: $gPluginname can't open $file", 1), die("\n");
+ my @files = <FILE>;
+ close(FILE);
- foreach my $line (<FILE>) {
- if ($line =~ /^\s*#include\s+(.+?)\s*$/i) {
+ foreach (@files) {
+ if (/^\s*#include\s+(.+?)\s*$/i) {
$filecnt += obyparse_readconffile($basedir, $1, "", $files, $indent + 2);
next;
}
- next if ($line =~ /^\s*$/) || ($line =~ /^\s*(?:#|\/\/|REM\s)/i);
+ next if (/^\s*$/) || (/^\s*(?:#|\/\/|REM\s)/i);
$filecnt++;
- (my $fname = $line) =~ s/^\s+|\s+$//g;
- $fname =~ s/(.)/{'*' => '.*', '?' => '.', '[' => '[', ']' => ']'}->{$1} || "\Q$1\E"/ge;
+ (my $fname = $_) =~ s/^\s+|\s+$//g;
+ $fname =~ s/(.)/{"*" => ".*", "?" => "."}->{$1} || "\Q$1\E"/eg;
$$files .= ($$files eq "" ? "" : "|") . $fname;
}
- close(FILE);
return($filecnt);
}
--- a/imgtools/imaker/buildrom_plugins/override.pm Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/buildrom_plugins/override.pm Thu Jun 24 10:35:05 2010 +0300
@@ -53,6 +53,7 @@
use strict;
use warnings;
+use File::Basename;
use plugincommon;
# OVERRIDE TARGET FOUND OVERRIDE TARGET NOT FOUND
@@ -70,31 +71,30 @@
@EXPORT = qw(&override_info &override_init &override_process);
}
-my $conf = "";
+my $conf;
sub override_info
{
return({
name => "override",
- invocation => "InvocationPoint2",
+ invocation => "InvocationPoint2", # tmp6.oby
initialize => "override::override_init",
single => "override::override_process"});
}
sub override_init
{
- plugin_init("override.pm", $conf = shift());
+ plugin_init(&override_info, $conf = shift(), 0);
}
sub override_process
{
- plugin_start("override.pm", $conf);
+ plugin_start(&override_info, $conf);
my $obydata = shift();
my %targets = ();
my @overrides = ();
my @oconfstack = (REPLACE_WARN);
- my @romelemcnt = (0, 0, 0, 0, 0, 0, 0, 0);
# Go through all the tmp6.oby (InvocationPoint2) lines and store
# normal targets' data to %targets and override targets' data to @overrides
@@ -103,34 +103,35 @@
foreach (@{$obydata})
{
- my $parse = parse_obyline($_);
+ next if !(my $parse = parse_obyline($_));
- if ($parse == 2) {
- # REM ROM_IMAGE[id]
+ if (($parse == 2) && ($gKeyword =~ /-?override$/i)) {
+ # Override entry
+ $_ = "$gHandlestr $_", next if ($gImgid != $gRomidCmp);
dprint(2, "#$gLnum: `$gLine'");
+ push(@overrides, [$gLnum - 1, $oconfstack[$#oconfstack]]);
+ next;
+ }
+ if (($parse == 2) && ($gKeyword =~ FILEBITMAPSPECKEYWORD)) {
+ # Normal file specification entry
+ $targets{$gTgtCmp} = $targets{File::Basename::basename($gTgtCmp)} = $gLnum - 1
+ if ($gImgid == $gRomidCmp);
+ next;
}
- elsif (/^\s*OVERRIDE_(?:(END)|(REPLACE\/ADD)|(REPLACE\/SKIP)|(REPLACE\/WARN)|SKIP\/ADD)\s*$/i) {
- # Override configuration keyword
- if (defined($1)) {
- # OVERRIDE_END
- pop(@oconfstack);
- } else {
- # OVERRIDE_REPLACE/ADD|REPLACE/SKIP|REPLACE/WARN|SKIP/ADD
- push(@oconfstack, defined($2) ? REPLACE_ADD : (defined($3) ? REPLACE_SKIP : (defined($4) ? REPLACE_WARN : SKIP_ADD)));
- }
- dprint(2, "#$gLnum: `$gLine'");
- $_ = "$gHandlestr $gLine";
+
+ next if !/^\s*OVERRIDE_(?:(END)|(REPLACE\/ADD)|(REPLACE\/SKIP)|(REPLACE\/WARN)|SKIP\/ADD)\s*$/i;
+
+ # Override configuration keyword
+ $_ = "$gHandlestr $_";
+ next if $gRomid && ($gImgid != $gRomidCmp);
+ if (defined($1)) {
+ # OVERRIDE_END
+ pop(@oconfstack);
+ } else {
+ # OVERRIDE_REPLACE/ADD|REPLACE/SKIP|REPLACE/WARN|SKIP/ADD
+ push(@oconfstack, defined($2) ? REPLACE_ADD : (defined($3) ? REPLACE_SKIP : (defined($4) ? REPLACE_WARN : SKIP_ADD)));
}
- elsif ($parse == 1 && $gKeyword =~ /-override/i) {
- # Override entry
- dprint(2, "#$gLnum: `$gLine'");
- push(@overrides, [$gLnum - 1, $gRomid, $oconfstack[$#oconfstack]]);
- }
- elsif ($parse == 1 && $gKeyword =~ FILESPECKEYWORD) {
- # Normal file specification entry
- $targets{lc("$gTarget/$gRomid")} = $gLnum - 1;
- $romelemcnt[$gRomid]++;
- }
+ dprint(2, "#$gLnum: `$gLine'");
}
# Loop through all overrides and handle them
@@ -138,64 +139,50 @@
foreach (@overrides)
{
- my ($lnum, $romid, $type) = @{$_};
- parse_keyline(${$obydata}[$lnum], 1);
- dprint(2, "Handling : `$gLine' ($romid, " . ("REPLACE/ADD", "REPLACE/SKIP", "REPLACE/WARN", "SKIP/ADD")[$type] . ")");
- ${$obydata}[$lnum] = "$gHandlestr $gLine";
- (my $target = $gTarget) =~ s/^"(.*)"$/$1/;
+ my ($tlnum, $olnum, $type) = (0, @$_);
+ parse_keyline(${$obydata}[$olnum]);
+ dprint(2, "Handling : `$gLine' (" . ("REPLACE/ADD", "REPLACE/SKIP", "REPLACE/WARN", "SKIP/ADD")[$type] . ")");
+ ${$obydata}[$olnum] = "$gHandlestr ${$obydata}[$olnum]";
- if (exists($targets{lc("$target/$romid")})) {
+ if (defined($tlnum = $targets{$gTgtCmp}) || defined($tlnum = $targets{File::Basename::basename($gTgtCmp)})) {
# Override target found
-
my ($line, $keyword, $source, $attrib) = ($gLine, $gKeyword, $gSource, $gAttrib);
- parse_keyline(${$obydata}[$lnum = $targets{lc("$target/$romid")}], 1);
- dprint(2, "Target : `$gLine' ($romid, #" . ($lnum + 1) . ")");
+ parse_keyline(${$obydata}[$tlnum]);
+ dprint(2, "Target : `$gLine' (#" . ($tlnum + 1) . ")");
if ($type == SKIP_ADD) {
dprint(2, "Do nothing : Target found and override type SKIP");
}
- elsif ($source =~ /^"?empty"?$/i) {
+ elsif ($source =~ /^empty$/i) {
# Empty keyword -> comment line out
- ${$obydata}[$lnum] = "$gHandlestr $gLine";
- dprint(1, "Remove ROM_IMAGE[$romid] `$gLine' due to `$line'");
- dprint(2, "Replace with: `${$obydata}[$lnum]' (Override source EMPTY)");
+ ${$obydata}[$tlnum] = "$gHandlestr ${$obydata}[$tlnum]";
+ dprint(1, "Remove `$gLine' due to `$line'");
+ dprint(2, "Replace with: `${$obydata}[$tlnum]' (Override source EMPTY)");
}
else {
# Replace existing line with new line
- $keyword =~ s/-override//i;
+ $keyword =~ s/-?override$//i;
$attrib = ($attrib eq "" ? $gAttrib : ($attrib =~ /^\s*empty$/i ? "" : $attrib));
- $line = ${$obydata}[$lnum] = "$keyword=$source $gTarget$attrib\n";
- dprint(1, "Replace ROM_IMAGE[$romid] `$gLine' with `$line'");
+ $line = ${$obydata}[$tlnum] = ($keyword ne "" ? $keyword : $gKeyword) .
+ ($source =~ /\s/ ? "=\"$source\"" : "=$source") . " " .
+ ($gTarget =~ /\s/ ? "\"$gTarget\"" : $gTarget) . "$attrib\n";
+ dprint(1, "Replace `$gLine' with `$line'");
dprint(2, "Replace with: `$line'");
}
}
- else {
- # Override target not found
-
- if (!$romelemcnt[$romid] && $type != REPLACE_ADD && $type != SKIP_ADD) {
- # Ignore override non-XXX/ADD targets on empty ROM_IMAGE sections
- dprint(2, "Do nothing : Target not found, override target's ROM_IMAGE[$romid] section is empty");
- next;
- }
- # Check if override target exists in different ROM section
- my $warn = "";
- foreach my $tromid (0 .. 7) {
- $warn = "Override target `$target' found from ROM_IMAGE[$tromid] while override is for ROM_IMAGE[$romid]", last
- if exists($targets{lc("$target/$tromid")});
- }
+ else { # Override target not found
if ($type == REPLACE_SKIP) {
- dprint(2, "Do nothing : Target not found " . ($warn ? "from ROM_IMAGE[$romid] " : "") . "and override type SKIP");
+ dprint(2, "Do nothing : Target not found and override type SKIP");
}
elsif ($type == REPLACE_WARN) {
- dprint(-3, $warn ? "$warn, ignoring `$target'" : "Ignoring override target `$target', target not found");
+ dprint(-3, "Ignoring override target `$gTarget', target not found");
dprint(2, "Do nothing : Target not found and override type WARN");
}
else {
# OVERRIDE_XXX/ADD
- (my $line = $gLine) =~ s/^(\S+?)-override/$1/i;
- ${$obydata}[$lnum] = $line;
- dprint(-3, $warn) if $warn;
- dprint(1, "Add ROM_IMAGE[$romid] `$line' from `$gLine'");
+ (my $line = $gLine) =~ s/^(\S*?)-?override/$1/i;
+ $line = ${$obydata}[$olnum] = ($1 ne "" ? "" : "data") . $line;
+ dprint(1, "Add `$line' from `$gLine'");
dprint(2, "Add new : `$line' (Target not found, override type ADD)");
}
}
--- a/imgtools/imaker/buildrom_plugins/plugincommon.pm Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/buildrom_plugins/plugincommon.pm Thu Jun 24 10:35:05 2010 +0300
@@ -21,6 +21,8 @@
use strict;
use warnings;
+use Cwd;
+use File::Basename;
use constant FILESPECSTATEMENT => qr/^\s*(\S+?)\s*[=\s]\s*(?:"(.+?)"|(\S+))\s+(?:"(.+?)"|(\S+))(\s+.+?)?\s*$/;
@@ -34,6 +36,10 @@
use constant ROFSBITMAPFILESPECKEYWORD => qr/^(?:data|file|filecompress|fileuncompress|BITMAP|AUTO-BITMAP|COMPRESSED-BITMAP)/i;
+use constant HIDESTATEMENT => qr/^\s*(hide\S*?)\s*[=\s]\s*(?:"(.+?)"|(\S+))()\s*$/;
+
+use constant DIRECTORYKEYWORD => qr/^(?:alias|hide|rename)/i;
+
BEGIN
{
@@ -43,38 +49,62 @@
@ISA = qw(Exporter);
@EXPORT = qw(
FILESPECSTATEMENT FILESPECKEYWORD FILEBITMAPSPECKEYWORD ROFSFILESPECKEYWORD ROFSBITMAPFILESPECKEYWORD
- &dprint &plugin_init &plugin_start &plugin_end &parse_keyline &parse_obyline
+ HIDESTATEMENT DIRECTORYKEYWORD
+ &abspath &dprint &plugin_reset &plugin_init &plugin_start &plugin_end &parse_keyline &parse_obyline
&is_entry &get_type_from_entry &get_source_from_entry &get_target_from_entry
- $gPluginname $gLogfile $gDebug $gHandlestr
- $gLine $gLnum $gRomid $gKeyword $gSource $gTarget $gAttrib);
+ $gPluginname $gImgid $gLogfile $gWorkdir $gDebug $gFeatvar $gHandlestr
+ $gLine $gLnum $gRomid $gRomidCmp $gKeyword $gSource $gTarget $gAttrib $gSrcCmp $gTgtCmp);
$| = 1;
}
-our ($gPluginname, $gLogfile, $gDebug, $gHandlestr) = ("", "", "", 0);
-our ($gLine, $gLnum, $gRomid, $gKeyword, $gSource, $gTarget, $gAttrib) = ("", 0, 0, "", "", "", "");
+our ($gPluginname, $gImgid, $gLogfile, $gWorkdir, $gDebug, $gFeatvar, $gHandlestr);
+our ($gLine, $gLnum, $gRomid, $gRomidCmp, $gKeyword, $gSource, $gTarget, $gAttrib, $gSrcCmp, $gTgtCmp);
my $duration = 0;
-sub dprint($$)
+sub abspath($)
{
- my ($log, $str) = @_;
- $str =~ s/\n//g;
- $str = ($log < 0 ? "Warning: " : "") . "$str\n";
+ my $path = shift();
+ eval { local $SIG{__DIE__}; $path = Cwd::abs_path($path) };
+ return($path);
+}
+
+sub dprint($$;$)
+{
+ my ($log, $str, $nonl) = @_;
+ ($str = ($log < 0 ? "Warning: " : "") . $str) =~ s/\n//g;
+ $str .= "\n" if !$nonl;
$log = abs($log);
print($str) if (($log == 1) && !$gDebug) || (($log == 2) && $gDebug) || ($log > 2);
print(LOG $str) if $gLogfile && ($log > 1);
}
-sub plugin_init($$;$)
+sub plugin_reset()
+{
+ ($gLine, $gLnum, $gRomid, $gRomidCmp, $gKeyword, $gSource, $gTarget, $gAttrib, $gSrcCmp, $gTgtCmp) =
+ ("", 0, 0, 0, "", "", "", "", "", "");
+}
+
+sub plugin_init($$$)
{
- ($gPluginname, $gDebug, my $start) = @_;
- $gDebug = "" if !defined($gDebug);
- $gDebug =~ s/^(?:(.*?);|(.*))//;
- $gLogfile = (defined($1) ? $1 : $2);
- my $warn = "";
+ my ($pluginfo, $opt, $start) = @_;
+ $gPluginname = "$pluginfo->{name}.pm";
+ plugin_reset();
+ ($gImgid, $gLogfile, $gWorkdir, $gDebug, $gFeatvar, my $warn) = (0, "", undef, 0, "", "");
+ foreach (split(/;+/, $opt)) {
+ if (s/^\s*-i//i) { $gImgid = (/^CORE$/ ? 0 : (/^ROFS(\d)$/ ? $1 : -1)) }
+ elsif (s/^\s*-l//i) { $gLogfile = abspath(File::Basename::dirname($_)) . "/" . File::Basename::basename($_) }
+ elsif (s/^\s*-w//i) { $gWorkdir = abspath($_) }
+ elsif (s/^\s*-d//i) { $gDebug = ($_ ? 1 : 0) }
+ elsif (s/^\s*-f//i) { $gFeatvar = $_ }
+ else { $warn .= ", `$_'" }
+ }
+ $warn = "Unknown parameter(s):$warn." if ($warn =~ s/^,//);
(open(LOG, ">>$gLogfile") or
- ($warn = "Can't write to `$gLogfile'.", $gLogfile = "")) if $gLogfile;
+ (($warn .= ($warn ? " " : "") . "Can't write to `$gLogfile'."), $gLogfile = "")) if $gLogfile;
dprint(3, "$gPluginname: " . ($start ? "-" x (77 - length($gPluginname)) :
- "Initializing; logfile = `$gLogfile', debug = " . ($gDebug ? 1 : 0)));
+ "Initializing; $pluginfo->{invocation}, image id = " . ($gImgid < 0 ? "d" : $gImgid) .
+ ", logfile = `$gLogfile'" . (defined($gWorkdir) ? ", workdir = `$gWorkdir'" : "") .
+ ", debug = $gDebug" . ($gFeatvar ne "" ? ", feature variant = `$gFeatvar'" : "")));
dprint(-3, $warn) if $warn;
close(LOG) if !$start;
}
@@ -83,7 +113,7 @@
{
$duration = time();
plugin_init(shift(), shift(), 1);
- ($gHandlestr, $gLnum, $gRomid) = ("REM handled $gPluginname:", 0, 0);
+ $gHandlestr = "REM handled $gPluginname:";
}
sub plugin_end()
@@ -93,27 +123,29 @@
close(LOG);
}
-sub get_keyline($)
+sub parse_keyline(;$)
{
- my $quote = shift();
+ ($gLine = shift()) =~ s/^\s+|\s+$//g if defined($_[0]);
+ return(-1) if ($gLine !~ FILESPECSTATEMENT) && ($gLine !~ HIDESTATEMENT);
($gKeyword, $gSource, $gTarget, $gAttrib) =
- ($1, defined($2) ? ($quote ? "\"$2\"" : $2) : $3, defined($4) ? ($quote ? "\"$4\"" : $4) : $5, defined($6) ? $6 : "");
+ ($1, defined($2) ? $2 : $3, defined($4) ? $4 : $5, defined($6) ? $6 : "");
+ ($gSrcCmp, $gTgtCmp) = (lc($gSource), lc($gTarget));
+ ($gTgtCmp = ($gKeyword =~ DIRECTORYKEYWORD ? $gSrcCmp : $gTgtCmp)) =~ tr/\\/\//;
+ $gTgtCmp =~ s/^\/+//;
+ return(2);
}
-sub parse_keyline($;$)
-{
- ($gLine = shift()) =~ s/^\s+|\s+$//g;
- get_keyline(shift()), return(1) if $gLine =~ FILESPECSTATEMENT;
- return(0);
-}
-
-sub parse_obyline($;$)
+sub parse_obyline($)
{
($gLine = shift()) =~ s/^\s+|\s+$//g;
$gLnum++;
- $gRomid = $1, return(2) if $gLine =~ /^REM\s+ROM_IMAGE\[(\d+)\]/i;
- return(-1) if $gLine eq "" || $gLine =~ /^(?:#|REM\s)/i;
- return(parse_keyline($gLine, shift()));
+ if ($gLine =~ /^REM\s+(ROM|DATA)_IMAGE\[(\d+)\]/i) {
+ $gRomid = $2;
+ $gRomidCmp = ($gImgid >= 0 ? ($1 eq "ROM" ? ($2 != 1 ? $2 : 0) : 99) : ($1 eq "DATA" ? -$2 - 1 : 99));
+ return(1);
+ }
+ return(0) if ($gLine =~ /^(?:#|REM\s)/i) || ($gLine eq "");
+ return(parse_keyline());
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imaker/buildrom_plugins/stubsischeck.pm Thu Jun 24 10:35:05 2010 +0300
@@ -0,0 +1,101 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# Check included sis/sisx file validity.
+#
+
+
+
+package stubsischeck;
+
+use strict;
+use warnings;
+use File::Basename;
+use plugincommon;
+
+BEGIN
+{
+ use Exporter();
+ our($VERSION, @ISA, @EXPORT);
+ $VERSION = 1.00;
+ @ISA = qw(Exporter);
+ @EXPORT = qw(&stubsischeck_info &stubsischeck_init &stubsischeck_process);
+}
+
+my $conf;
+
+sub stubsischeck_info()
+{
+ return({
+ name => "stubsischeck",
+ invocation => "InvocationPoint3", # tmp9.oby
+ initialize => "stubsischeck::stubsischeck_init",
+ single => "stubsischeck::stubsischeck_process"});
+}
+
+sub stubsischeck_init($)
+{
+ plugin_init(&stubsischeck_info, $conf = shift(), 0);
+}
+
+sub stubsischeck_process($)
+{
+ plugin_start(&stubsischeck_info, $conf);
+ my $obydata = shift();
+ my %uids = ();
+
+ dprint(3, "Finding and checking stub sis files...");
+
+ foreach (@{$obydata}) {
+ next if (parse_obyline($_) != 2) || ($gImgid != $gRomidCmp) ||
+ ($gKeyword !~ FILESPECKEYWORD) || ($gSrcCmp !~ /\.sisx?$/) || !-e($gSource);
+
+ my ($basename, $uiddata) = (File::Basename::basename($gSrcCmp), "");
+ dprint(2, "Checking `$gSource'", 1);
+
+ # Find out whether or not this is stub sis file
+ open(FILE, $gSource) or
+ dprint(2, ""), dprint(-3, "$gPluginname can't open `$gSource'"), next;
+ binmode(FILE);
+ sysread(FILE, $uiddata, 0x1C);
+ close(FILE);
+
+ my $uid = unpack("V", substr($uiddata, 0x00, 4));
+ if ($uid == 0x0000000D) {
+ my $puid = sprintf("0x%08X", unpack("V", substr($uiddata, 0x18, 4)));
+ dprint(2, ", pUID: $puid");
+
+ # Quick-and-dirty way to check duplicate UIDs
+ if (exists($uids{$puid}) && ($basename ne $uids{$puid})) {
+ dprint(3, "Error: `$gSource': Duplicate pUID $puid, see `$uids{$puid}'");
+ } else {
+ $uids{$puid} = $basename;
+ }
+ } elsif ($uid == 0x10201A7A) {
+ dprint(2, ": Normal (non-stub) sis file");
+ } else {
+ dprint(2, "");
+ if (unpack("V", substr($uiddata, 0x08, 4)) == 0x10000419) { # UID3
+ dprint(-3, "`$gSource': Legacy (pre Symbian 9.x) sis file");
+ } else {
+ dprint(3, "Error: `$gSource': Sis file with unknown UID ($uid)");
+ }
+ }
+ }
+ plugin_end();
+}
+
+1;
+
+__END__ # OF STUBSISCHECK.PM
--- a/imgtools/imaker/config/example_image_conf_naming.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/config/example_image_conf_naming.mk Thu Jun 24 10:35:05 2010 +0300
@@ -21,4 +21,4 @@
ROFS2_DIR = $(WORKDIR)/$(TYPE)/langpack/$(LANGPACK_NAME)
ROFS2_NAME = $(PRODUCT_TYPE).$(BUILD_NUMBER)_$(LANGPACK_ID)_$(TYPE)
-LANGPACK_SWVERINFO = $(CORE_VERSION).$(LANGPACK_ID)\\\n$(DAY)-$(MONTH)-$(YEAR2)\\\n(c) $(PRODUCT_MANUFACT)
+LANGPACK_SWVERINFO = $(CORE_VERSION).$(LANGPACK_ID)\n$(DAY)-$(MONTH)-$(YEAR2)\n(c) $(PRODUCT_MANUFACT)
Binary file imgtools/imaker/doc/S60_iMaker_User_Guide.pdf has changed
Binary file imgtools/imaker/doc/iMaker_User_Guide.pdf has changed
--- a/imgtools/imaker/group/bld.inf Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/group/bld.inf Thu Jun 24 10:35:05 2010 +0300
@@ -18,26 +18,29 @@
PRJ_EXPORTS
+../src/imaker +/tools/ //
../src/imaker.cmd +/tools/ //
../src/imaker.mk +/tools/rom/imaker/ //
../src/imaker.pl +/tools/rom/imaker/ //
-../src/imaker.pm +/tools/rom/imaker/ //
-../src/imaker_public.mk +/tools/rom/imaker/ //
-../src/imaker_version.mk +/tools/rom/imaker/ //
-
../src/imaker_core.mk +/tools/rom/imaker/ //
+../src/imaker_emmc.mk +/tools/rom/imaker/ //
+../src/imaker_fat.mk +/tools/rom/imaker/ //
../src/imaker_help.mk +/tools/rom/imaker/ //
../src/imaker_image.mk +/tools/rom/imaker/ //
+../src/imaker_memcard.mk +/tools/rom/imaker/ //
../src/imaker_minienv.mk +/tools/rom/imaker/ //
../src/imaker_odp.mk +/tools/rom/imaker/ //
+../src/imaker_rofs.mk +/tools/rom/imaker/ //
../src/imaker_rofs2.mk +/tools/rom/imaker/ //
../src/imaker_rofs3.mk +/tools/rom/imaker/ //
../src/imaker_rofs4.mk +/tools/rom/imaker/ //
+../src/imaker_smr.mk +/tools/rom/imaker/ //
../src/imaker_tools.mk +/tools/rom/imaker/ //
../src/imaker_uda.mk +/tools/rom/imaker/ //
../src/imaker_variant.mk +/tools/rom/imaker/ //
+../src/imaker_version.mk +/tools/rom/imaker/ //
-// GNU make port to mingw32 (http://www.mingw.org/)
+// GNU make port to mingw32 (http://sourceforge.net/projects/mingw/files/ -> GNU Make)
../bin/mingw_make.exe +/tools/rom/imaker/ //
// Buildrom plugins
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imaker/src/imaker Thu Jun 24 10:35:05 2010 +0300
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: iMaker wrapper for Linux (Bash)
+#
+
+
+export IMAKER_CMDARG=
+for arg in "$@"; do
+ if [ -z "$IMAKER_CMDARG" ]; then IMAKER_CMDARG="'$arg'"
+ else IMAKER_CMDARG="$IMAKER_CMDARG '$arg'"; fi
+done
+if [ -z "$IMAKER_DIR" ]; then
+ export IMAKER_DIR="`dirname "$0"`/rom/imaker"
+ if [ -e "`dirname "$0"`/imaker.pl" ]; then IMAKER_DIR="`dirname "$0"`"; fi
+fi
+export IMAKER_TOOL="$0"
+
+if [ -z "$PERL" ]; then export PERL="perl"; fi
+$PERL -x "$IMAKER_DIR/imaker.pl"
+IMAKER_ERROR=$?
+
+if [ $IMAKER_ERROR -ne 0 ]; then
+ $PERL -v >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo "Perl is not properly installed! Environment variable PERL can be used to set the Perl exe."
+ fi
+fi
+
+exit $IMAKER_ERROR
+
+# END OF IMAKER
--- a/imgtools/imaker/src/imaker.cmd Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker.cmd Thu Jun 24 10:35:05 2010 +0300
@@ -1,39 +1,40 @@
-@echo off
-rem
-rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-rem All rights reserved.
-rem This component and the accompanying materials are made available
-rem under the terms of the License "Eclipse Public License v1.0"
-rem which accompanies this distribution, and is available
-rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
-rem
-rem Initial Contributors:
-rem Nokia Corporation - initial contribution.
-rem
-rem Contributors:
-rem
-rem Description: iMaker wrapper for Windows
-rem
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of the License "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description: iMaker wrapper for Windows
+@rem
+@echo off
setlocal
-set MAKE=
set IMAKER_CMDARG=%*
-if "%EPOCROOT%"=="" set EPOCROOT=\
-if "%CONFIGROOT%"=="" set CONFIGROOT=%EPOCROOT%epoc32\rom\config
-if "%ITOOL_DIR%"=="" set ITOOL_DIR=%EPOCROOT%epoc32\tools\rom
-if "%IMAKER_DIR%"=="" set IMAKER_DIR=%ITOOL_DIR%\imaker
-if "%IMAKER_MAKE%"=="" set IMAKER_MAKE=%IMAKER_DIR%\mingw_make.exe
-if "%IMAKER_MAKESHELL%"=="" set IMAKER_MAKESHELL=%COMSPEC%
-if "%IMAKER_MAKESHELL%"=="" set IMAKER_MAKESHELL=cmd.exe
-if "%IMAKER_CYGWIN%"=="" set IMAKER_CYGWIN=0
-if "%PERL%"=="" set PERL=perl
+if "%IMAKER_DIR%"=="" (
+ set IMAKER_DIR=%~dp0rom\imaker
+ if exist %~dp0imaker.pl set IMAKER_DIR=%~dp0
+)
+set IMAKER_TOOL=%~f0
+
+if "%PERL%"=="" set PERL=perl
call %PERL% -x %IMAKER_DIR%\imaker.pl
set IMAKER_ERROR=%errorlevel%
-if %IMAKER_ERROR% geq 1 (
+
+if %IMAKER_ERROR% neq 0 (
call %PERL% -v >nul 2>&1
- if errorlevel 1 echo Perl is not properly installed! Environment variable PERL can be used to set the Perl exe.
+ if errorlevel 1 (
+ echo Perl is not properly installed! Environment variable PERL can be used to set the Perl exe.
+ )
)
+
if 0%IMAKER_EXITSHELL% equ 0 exit /b %IMAKER_ERROR%
exit %IMAKER_ERROR%
endlocal
--- a/imgtools/imaker/src/imaker.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker.mk Thu Jun 24 10:35:05 2010 +0300
@@ -32,8 +32,6 @@
empty :=
space := $(empty) #
$(space) := $(space)
-squot := '\''
-' := '\''
\t := $(empty) # Tabulator!
# Newline
@@ -71,10 +69,11 @@
firstwords = $(if $2,$(wordlist 1,$(words $(wordlist $1,$(words $2),$2)),$2),$(wordlist 1,$(words $(wordlist 2,$(words $1),$1)),$1))
restwords = $(if $2,$(wordlist $1,$(words $2),$2),$(wordlist 2,$(words $1),$1))
restelems = $(call restoreelem,$(subst $( ),|,$(call restwords,$1,$(call getwords,$2))))
+findword = $(and $1,$2,$(if $(filter $1,$(word 1,$2)),$(words $3 +),$(call findword,$1,$(call restwords,$2),$3 +)))
substm = $(eval __i_str := $3)$(strip $(foreach w,$1,$(eval __i_str := $(subst $w,$2,$(__i_str)))))$(__i_str)
substs = $(subst $(ichar)\,$2,$(subst $1,$2,$(subst $2,$(ichar)\,$3)))
-quote = $(call substs,\t,\\\t,$(call substs,\n,\\\n,$1))
-quoteval = $(subst \#,\\\#,$(subst $$,$$$$,$1))
+quote = $(call substs,\t,\\t,$(call substs,\n,\\n,$1))
+quoteval = $(subst \#,\\#,$(subst $$,$$$$,$1))
sstrip = $(subst $( ),,$(strip $1))
strlen = $(call _str2chars,$1)$(words $(__i_str))
@@ -84,43 +83,44 @@
$(foreach c,$(charset)$(ichar),$(eval __i_str := $(subst $c,$c ,$(__i_str)))))
tr =\
- $(strip $(eval __i_tr := $3)\
- $(foreach c,\
- $(join $(addsuffix :,$1),$2),\
- $(eval __i_tr := $(subst $(word 1,$(subst :, ,$c)),$(word 2,$(subst :, ,$c)),$(__i_tr))))$(__i_tr))
+ $(strip $(eval __i_tr := $(subst $( ),$(ichar),$3))\
+ $(foreach c,$(join $(addsuffix :,$1),$2),\
+ $(eval __i_tr := $(subst $(word 1,$(subst :, ,$c)),$(word 2,$(subst :, ,$c)),$(__i_tr)))))$(subst $(ichar),$( ),$(__i_tr))
-pquote = q$(pchar)$1$(pchar)
-peval = @PEVAL{$(call substs,|,\|,$1)}LAVEP@
-phex = $(call peval,sprintf(q(%0$(if $2,$2,8)X),$(subst 0x0x,0x,$1)))
-pabs2rel = $(call peval,GetRelFname($(call pquote,$1$), $(call pquote,$2)))
-pfilesize = $(call peval,-s $(call pquote,$1) || 0)
-prepeat = $(call peval,$(call pquote,$2) x ($1))
-pstr2xml = $(call peval,Str2Xml($(call pquote,$1)))
-pmatch = $(call peval,$(call pquote,$1) =~ m$(pchar)$2$(pchar)m $(if $3,$3,&& $$1 || q(???)))
-pgrep = $(call peval,\
+pquote = q$(pchar)$1$(pchar)
+peval = @PEVAL{$(call substs,|,\|,$1)}LAVEP@
+phex = $(call peval,Int2Hex($(subst 0x0x,0x,$1),$2))
+pfilesize = $(call peval,-s $(call pquote,$1) || 0)
+prepeat = $(call peval,$(call pquote,$2) x ($1))
+pstr2xml = $(call peval,Str2Xml(Quote($(call pquote,$1))))
+pmatch = $(call peval,$(call pquote,$1) =~ m$(pchar)$(subst \\,\,$2)$(pchar)m $(if $3,$3,&& $$1 || q(???)))
+pgrep = $(call peval,\
$(eval __i_notfound := $(call pquote,$(if $4,$4,???)))\
open(F, $(call pquote,$1)) or return($(__i_notfound));\
$$_ = $(if $2,Uni2Ascii)(join(q(), <F>));\
$$_ = Quote($(if $3,m$(pchar)$3$(pchar)m ? $$1 : $(__i_notfound),$$_));\
- s/\n/\\\n/g; s/\t/\\\t/g;\
close(F); return($$_))
-getlastdir = $(foreach file,$1,$(notdir $(patsubst %/,%,$(file))))
-upddrive = $(if $2,$2,$(EPOCDRIVE))$(if $(filter %:,$(call substr,1,2,$1)),$(call substr,3,,$1),$1)
-dir2inc = $(foreach dir,$1,-I$(call upddrive,$(dir)))
-findfile = $(foreach file,$1,$(eval __i_ffile := $(call _findfile,$(addsuffix /$(file),$2)))$(if $(__i_ffile),$(__i_ffile),$(file)))
-_findfile = $(if $1,$(eval __i_ffile := $(wildcard $(word 1,$1)))$(if $(__i_ffile),$(__i_ffile),$(call _findfile,$(call restwords,$1))))
+getlastdir = $(foreach file,$1,$(notdir $(patsubst %/,%,$(file))))
+upddrive = $(if $2,$2,$(EPOCDRIVE))$(if $(filter %:,$(call substr,1,2,$1)),$(call substr,3,,$1),$1)
+updoutdrive = $(call upddrive,$1,$(OUTDRIVE))
+dir2inc = $(foreach dir,$1,-I$(call upddrive,$(dir)))
+findfile = $(foreach file,$1,$(eval __i_ffile := $(call _findfile,$(addsuffix /$(file),$(if $2,$2,$(FEATVAR_IDIR)))))$(if $(__i_ffile),$(__i_ffile),$(if $3,,$(file))))
+_findfile = $(if $1,$(eval __i_ffile := $(wildcard $(word 1,$1)))$(if $(__i_ffile),$(__i_ffile),$(call _findfile,$(call restwords,$1))))
+isabspath = $(if $(filter / \,$(if $(filter %:,$(call substr,1,2,$1)),$(call substr,3,3,$1),$(call substr,1,1,$1))),$1)
+includechk = $(foreach file,$(subst \ ,$(ichar),$1),\
+ $(if $(wildcard $(subst $(ichar),\ ,$(file))),$(eval include $(subst $(ichar),\ ,$(file))),\
+ $(error File `$(subst $(ichar), ,$(file))' not found.$(\n)MAKEFILE_LIST =$(MAKEFILE_LIST))))
filterwcard = $(shell $(PERL) -Xe '\
(my $$re = q$(ichar)$1$(ichar)) =~ s/(.)/{q(*)=>q(.*),q(?)=>q(.),q([)=>q([),q(])=>q(])}->{$$1} || qq(\Q$$1\E)/ge;\
print(map(qq( $$_), sort({lc($$a) cmp lc($$b)} grep(/^$$re$$/, split(/\s+/, q$(ichar)$2$(ichar))))))')
-cppdef2var =\
- $(if $(wildcard $1),\
- $(eval __i_def2var := $(shell $(PERL) -Xe '\
- print(join(q(|), map(/^\s*\#define\s+(\S+)\s*(.*?)\s*$$/ ? qq($$1?=) . ($$2 eq q() ? 1 : $$2) : (),\
- sort({lc($$a) cmp lc($$b)} qx$(pchar)$(CPP) -nostdinc -undef -dM $(call dir2inc,$2) $(call upddrive,$1)$(pchar)))))'))\
- $(foreach assign,$(call getwords,$(__i_def2var)),$(eval $(call restoreelem,$(assign)))),\
+cppdef2var = $(if $(wildcard $1),\
+ $(foreach assign,$(call getwords,$(shell $(CPP) -nostdinc -undef -dM $(call dir2inc,$2) $(call upddrive,$1) |\
+ $(PERL) -Xne $(call iif,$(USE_UNIX),',")print(qq($$1?=) . ($$2 eq q() ? 1 : $$2) . q(|))\
+ if /^\s*\#define\s+($(or $(call sstrip,$3),\S+))\s*(.*?)\s*$$/$(call iif,$(USE_UNIX),',"))),\
+ $(eval $(call restoreelem,$(assign)))),\
$(eval include $1))
mac2cppdef = $(foreach def,$1,$(if\
@@ -128,8 +128,14 @@
$(\n)$(if $(filter -D%,$(def)),\#undef $(word 1,$(__i_def))$(\n)\#define,define ) $(word 1,$(__i_def)) $(word 2,$(__i_def)),\
$(if $(filter -U%,$(def)),$(\n)\#undef $(patsubst -U%,%,$(def)))))
-EPOCDRIVE := $(eval EPOCDRIVE := $(call substr,1,2,$(CURDIR)))$(if $(filter %:,$(EPOCDRIVE)),$(EPOCDRIVE))
-EPOC32 := $(patsubst %/,%,$(subst \,/,$(EPOCROOT)))/epoc32
+USE_UNIX := $(if $(findstring cmd.exe,$(call lcase,$(SHELL)))$(findstring mingw,$(call lcase,$(MAKE))),0,1)
+DONOTHING := $(call iif,$(USE_UNIX),\#,rem)
+NULL := $(call iif,$(USE_UNIX),/dev/null,nul)
+PATHSEPCHAR := $(call iif,$(USE_UNIX),:,;)
+CURDIR := $(CURDIR:/=/.)
+EPOCDRIVE := $(or $(filter %:,$(call substr,1,2,$(EPOCROOT))),$(filter %:,$(call substr,1,2,$(CURDIR))))
+EPOC_ROOT := $(patsubst %/,%,$(subst \,/,$(if $(filter %:,$(call substr,1,2,$(EPOCROOT))),,$(EPOCDRIVE))$(EPOCROOT)))
+EPOC32 := $(EPOC_ROOT)/epoc32
E32ROM := $(EPOC32)/rom
E32ROMCFG := $(E32ROM)/config
E32ROMINC := $(E32ROM)/include
@@ -138,18 +144,15 @@
E32INCCFG := $(E32INC)/config
E32TOOLS := $(EPOC32)/tools
E32GCCBIN := $(EPOC32)/gcc/bin
-
-ITOOL_DIR ?= $(E32TOOLS)/rom
-ITOOL_PATH :=
-IMAKER_DIR ?= $(ITOOL_DIR)/imaker
-IMAKER_TOOL := $(IMAKER_DIR)/imaker.pl
+E32DATA := $(EPOC32)/data
+E32DATAZ := $(E32DATA)/z
-CPP ?= $(if $(wildcard $(E32TOOLS)/scpp.exe),$(E32TOOLS)/scpp.exe,cpp)
-PERL ?= perl
-PYTHON ?= python
-USE_UNIX := $(if $(findstring cmd.exe,$(call lcase,$(SHELL)))$(findstring mingw,$(call lcase,$(MAKE))),0,1)
-NULL := $(call iif,$(USE_UNIX),/dev/null,nul)
-DONOTHING := $(call iif,$(USE_UNIX),\#,rem)
+IMAKER_TOOL := $(IMAKER_DIR)/imaker.pl
+IMAKER_CONFMK =
+IMAKER_DEFAULTMK = $(call findfile,image_conf_default.mk,,1)
+
+CPP ?= cpp
+PYTHON ?= python
YEAR := $(call substr,1,4,$(TIMESTAMP))
YEAR2 := $(call substr,3,4,$(TIMESTAMP))
@@ -157,18 +160,33 @@
DAY := $(call substr,7,8,$(TIMESTAMP))
WEEK := $(call substr,15,,$(TIMESTAMP))
-CURDIR := $(call substr,$(call select,$(call substr,1,2,$(CURDIR)),$(EPOCDRIVE),3,1),,$(CURDIR))
-CURDIR := $(CURDIR:/=/.)
-USER := $(or $(USERNAME),$(shell $(PERL) -Xe 'print(getlogin())'))
+.DEFAULT_GOAL = help
+DEFAULT_GOALS =
-MAKECMDGOALS ?= $(.DEFAULT_GOAL)
-TARGET = $(word 1,$(MAKECMDGOALS))
-TARGETNAME = $(word 1,$(subst -, ,$(TARGET)))
-TARGETID = $(subst $( ),_,$(call restwords,$(subst _, ,$(TARGETNAME))))
-TARGETEXT = $(findstring -,$(TARGET))$(subst $( ),-,$(call restwords,$(subst -, ,$(TARGET))))
+TARGET = $(word 1,$(subst [, [,$(MAKECMDGOALS)))
+TARGETNAME = $(word 1,$(subst -, ,$(TARGET)))
+TARGETID = $(subst $( ),_,$(call restwords,$(subst _, ,$(TARGETNAME))))
+TARGETID1 = $(word 2,$(subst _, ,$(TARGETNAME)))
+TARGETID2 = $(word 3,$(subst _, ,$(TARGETNAME)))
+TARGETID2- = $(subst $( ),_,$(call restwords,3,$(subst _, ,$(TARGETNAME))))
+TARGETID3 = $(word 4,$(subst _, ,$(TARGETNAME)))
+TARGETID3- = $(subst $( ),_,$(call restwords,4,$(subst _, ,$(TARGETNAME))))
+TARGETEXT = $(addprefix -,$(subst $( ),-,$(call restwords,$(subst -, ,$(TARGET)))))
+TARGETEXT2 = $(word 3,$(subst -, ,$(TARGET)))
+TARGETEXT2- = $(addprefix -,$(subst $( ),-,$(call restwords,3,$(subst -, ,$(TARGET)))))
+TARGETEXT3 = $(word 4,$(subst -, ,$(TARGET)))
+TARGETEXT3- = $(addprefix -,$(subst $( ),-,$(call restwords,4,$(subst -, ,$(TARGET)))))
+
+TOPTARGET = $(TARGET)
+TOPTARGETNAME = $(word 1,$(subst -, ,$(TOPTARGET)))
+TOPTARGETID = $(subst $( ),_,$(call restwords,$(subst _, ,$(TOPTARGETNAME))))
+TOPTARGETEXT = $(addprefix -,$(subst $( ),-,$(call restwords,$(subst -, ,$(TOPTARGET)))))
+
+TARGET_EXPORT = TOPTARGET? IMAGE_TYPE
CLEAN = 1
BUILD = 1
+FILTERCMD =
KEEPGOING = 0
KEEPTEMP = 0
PRINTCMD = 0
@@ -177,35 +195,38 @@
SKIPPOST = 0
VERBOSE = 1
-CONFIGROOT ?= $(E32ROMCFG)
+NAME = imaker
+WORKDIR = $(CURDIR)
+WORKTMPDIR = $($(or $(addsuffix _,$(IMAGE_TYPE)),WORK)DIR)/temp# To be removed!
-LABEL =
-NAME = $(PRODUCT_NAME)$(LABEL)
-WORKDIR = $(if $(PRODUCT_NAME),$(E32ROMBLD)/$(PRODUCT_NAME),$(CURDIR))
-WORKPREFIX = $(WORKDIR)/$(NAME)
-WORKNAME = $(WORKPREFIX)
+OUTDIR = $(WORKDIR)
+OUTPREFIX = $(OUTDIR)/$(NAME)# Temporary?
+OUTDRIVE = $(or $(filter %:,$(call substr,1,2,$(OUTDIR))),$(filter %:,$(call substr,1,2,$(CURDIR))))
+OUTTMPDIR = $($(or $(addsuffix _,$(IMAGE_TYPE)),OUT)DIR)/temp
-CLEAN_WORKAREA = del | $(WORKDIR)/* | deldir | $(WORKDIR)/*
-ALL.CLEAN.STEPS = $(ALL.IMAGE.STEPS) WORKAREA
+ALL.CLEAN.STEPS = $(ALL.IMAGE.STEPS)
###############################################################################
#
-CMDFILE = $(WORKPREFIX)$(if $(notdir $(WORKPREFIX)),_)$(call substm,* : ?,@,$(TARGET)).icmd
-#LOGFILE = $(if $(IMAGE_TYPE),$($(IMAGE_TYPE)_PREFIX)_$(call lcase,$(IMAGE_TYPE))_imaker,$(WORKDIR)/log/$(basename $(notdir $(CMDFILE)))).log
-export LOGFILE ?= $(WORKDIR)/log/$(basename $(notdir $(CMDFILE))).log
+LOGFILE = $($(or $(addsuffix _,$(IMAGE_TYPE)),WORK)PREFIX)_imaker_$(call substm,* / : ? \,@,$(TARGET)).log
BUILD_EMPTY = echo-q | Empty target, nothing to build.
-CLEAN_IMAKERPRE = $(CLEAN_IMAKEREVAL) | del | "$(CMDFILE)" "$(IMAKER_VARXML)"
BUILD_IMAKERPRE =\
- $(call testnewapi,$(strip $(API_TEST))) |\
- $(if $(filter help% print-%,$(MAKECMDGOALS)),,$(if $(and $(IMAKER_VARXML),$(IMAKER_VARLIST)),\
- write | $(IMAKER_VARXML) | $(call def2str,$(IMAKER_XMLINFO))))
+ $(BUILD_TOOLSET) |\
+ logfile | "$(LOGFILE)" |\
+ filtercmd | $(FILTERCMD)
-IMAKER_VARXML = $(if $(IMAGE_TYPE),$($(IMAGE_TYPE)_PREFIX)_$(TARGET)_config.xml)
-IMAKER_VARLIST = NAME WORKDIR
+CLEAN_IMAKERPOST = $(call iif,$(KEEPTEMP),,deldir | "$(OUTTMPDIR)" |) del | "$(IMAKER_VARXML)"
+BUILD_IMAKERPOST = $(and $(subst IMAKERPRE EMPTY IMAKERPOST,,$(IMAKER_STEPS)),$(IMAKER_VARXML),$(IMAKER_VARLIST),\
+ write | "$(IMAKER_VARXML)" | $(call def2str,$(IMAKER_XMLINFO))\n)
+
+IMAKER_VARXML = $(if $(IMAGE_TYPE),$($(IMAGE_TYPE)_PREFIX)_$(TARGET).iconfig.xml)
+IMAKER_VARLIST = PRODUCT_NAME TYPE\
+ $(and $(IMAGE_TYPE),$(filter $(call lcase,$(IMAGE_TYPE) $(IMAGE_TYPE))-%,$@),\
+ $(addprefix $(IMAGE_TYPE)_,NAME ID VERSION DIR IMG))
define IMAKER_XMLINFO
<?xml version="1.0" encoding="utf-8"?>
@@ -217,101 +238,64 @@
</build>
endef
-BUILD_PRINTVAR = $(call peval,DPrint(1,\
- $(foreach var1,$(subst $(,), ,$(subst print-,,$(filter print-%,$(MAKECMDGOALS)))),\
- $(foreach var2,$(call filterwcard,$(var1),$(filter-out BUILD_PRINTVAR,$(filter $(word 1,$(call substm,* ? [, ,$(var1)))%,$(.VARIABLES)))),\
- $(call pquote,$(var2) = `$(call def2str,$($(var2)))$').qq(\n),))); return(q()))
-
IMAKER_EVAL = $(strip\
- $(foreach file,$(call getwords,$(value MKFILE_LIST)),$(eval __i_file := $(call restoreelem,$(file)))$(eval -include $(__i_file)))\
- $(foreach file,$(call getwords,$(value CPPFILE_LIST)),$(eval __i_file := $(call restoreelem,$(file)))$(call cppdef2var,$(__i_file),$(FEATVAR_IDIR)))\
$(LANGUAGE_EVAL)\
- $(eval ITOOL_PATH := $(if $(ITOOL_PATH),$(ITOOL_PATH)$(,))$(ITOOL_DIR)$(,))\
- $(eval ITOOL_PATH := $(ITOOL_PATH)$(call iif,$(USE_IINTPRSIS),$(USE_IINTPRSIS)$(,))$(call iif,$(USE_IREADIMG),$(USE_IREADIMG)$(,))$(call iif,$(USE_IROMBLD),$(USE_IROMBLD)$(,)))\
- $(eval ITOOL_PATH := $(call pathconv,$(subst $(,),$(call iif,$(USE_UNIX),:,;),$(ITOOL_PATH)$(call upddrive,$(E32TOOLS))$(,)$(call upddrive,$(E32GCCBIN)))))\
- $(eval PATH := $(ITOOL_PATH)$(call iif,$(USE_UNIX),:,;)$(PATH)))
+ $(foreach file,$(call getwords,$(value CPPFILE_LIST)),$(eval __i_file := $(call restoreelem,$(file)))$(call cppdef2var,$(__i_file),$(FEATVAR_IDIR),$(CPPFILE_FILTER))))
-IMAKER_CMDARG := $(value IMAKER_CMDARG)
-IMAKER_MAKECMD := $(value IMAKER_MAKECMD)
-IMAKER_PERLCMD :=
-IMAKER_SUBMAKE :=
+IMAKER_EXPORT = PATH
+IMAKER_PRINTVAR = 17 $$@|@ IMAKER_STEPS IMAKER_MKLEVEL IMAKER_MKRESTARTS MAKELEVEL MAKE_RESTARTS MAKEFILE_LIST CPPFILE_LIST FEATVAR_IDIR
+
+__i_evaled :=
+__i_tgtind :=
define IMAKER
- $(if $(and $(filter-out help-config,$(filter help-% print-%,$(MAKECMDGOALS))),$(IMAKER_PERLCMD)),-$(DONOTHING),
- $(if $(IMAKER_PERLCMD),,$(IMAKER_EVAL))
- $(eval __i_steps := $1)
- $(if $(findstring |,$(__i_steps)),
- $(eval IMAKER_PERLCMD := -)
- $(foreach target,$(call getwords,$(__i_steps)),$(if $(call restoreelem,$(target)),
- $(eval IMAKER_SUBMAKE += $(words $(IMAKER_SUBMAKE) x))
- $(subst $(MAKECMDGOALS) |,,$(IMAKER_MAKECMD) |)IMAKER_SUBMAKE="$(IMAKER_SUBMAKE)" $(call restoreelem,$(target)) $(call restwords,$(MAKECMDGOALS))$(\n))),
- $(eval __i_steps := $(if $(strip $(__i_steps)),$(foreach step,$(__i_steps),\
- $(eval __i_step := $(word 1,$(subst :, ,$(step))))$(eval __i_attrib := $(word 2,$(subst :, ,$(step))))\
- $(if $(call defined,STEPS_$(__i_step)),\
- $(foreach step2,$(STEPS_$(__i_step)),$(if $(__i_attrib),$(word 1,$(subst :, ,$(step2))):$(__i_attrib),$(step2))),\
- $(step))),EMPTY:b))
- $(eval __i_steps := IMAKERPRE:cbk$(call sstrip,$(foreach step,$(__i_steps),\
- $(eval __i_step := $(word 1,$(subst :, ,$(step))))$(eval __i_attrib := $(word 2,$(subst :, ,$(step))))\
- -$(__i_step):$(or $(findstring c,$(__i_attrib)),$(call iif,$(CLEAN),c))$(or $(findstring b,$(__i_attrib)),$(call iif,$(BUILD),b))\
- $(or $(findstring k,$(__i_attrib)),$(call iif,$(KEEPGOING),k)))))
- $(eval IMAKER_STEPS := $(__i_steps))
- $(eval __i_steps :=\
- $(if $(filter print-%,$(MAKECMDGOALS)),IMAKERPRE:cbk-PRINTVAR:b,\
- $(if $(filter-out help-config,$(filter help-%,$(MAKECMDGOALS))),IMAKERPRE:cbk-HELPDYNAMIC:b-HELP:b,$(__i_steps))))
- $(eval IMAKER_PERLCMD := $(PERL) -x $(IMAKER_TOOL)\
- --cmdfile "$(CMDFILE)"\
- $(if $(LOGFILE),--logfile "$(if $(word 2,$(IMAKER_SUBMAKE))$(IMAKER_PERLCMD)$(MAKE_RESTARTS),>>$(LOGFILE:>>%=%),$(LOGFILE))")\
- $(call iif,$(PRINTCMD),--printcmd)\
- --step "$(__i_steps)"\
- $(if $(VERBOSE),--verbose "$(call select,$(VERBOSE),debug,127,$(VERBOSE))")\
- $(if $(WORKDIR),--workdir "$(WORKDIR)"))
- -$(PERL) -Xe '$(if $(wildcard $(WORKDIR)),,use File::Path; eval { mkpath(q$(ichar)$(WORKDIR)$(ichar)) };)\
- open(ICMD, q$(ichar)>$(CMDFILE)$(ichar));\
- $(eval __i_submake := $(words $(IMAKER_SUBMAKE)))\
- print(ICMD $(foreach var,IMAKER_VERSION IMAKER_CMDARG IMAKER_MAKECMD IMAKER_PERLCMD $(if $(IMAKER_SUBMAKE),IMAKER_SUBMAKE|__i_submake)\
- IMAKER_EXITSHELL SHELL MAKE MAKEFLAGS MAKECMDGOALS $$@|@ MAKELEVEL MAKE_RESTARTS MAKEFILE_LIST .INCLUDE_DIRS FEATVAR_IDIR CPPFILE_LIST\
- EPOCROOT ITOOL_DIR IMAKER_DIR ITOOL_PATH PATH,\
- sprintf(qq(\# %-17s),q($(word 1,$(subst |, ,$(var))))).q$(ichar)= `$($(or $(word 2,$(subst |, ,$(var))),$(var)))$'$(ichar).qq(\n),));\
- close(ICMD)'
- $(foreach step,$(subst -, ,$(__i_steps)),\
- $(eval __i_step := $(word 1,$(subst :, ,$(step))))$(eval __i_attrib := $(subst $(__i_step),,$(step)))\
- $(eval __i_clean := $(findstring c,$(__i_attrib)))$(eval __i_build := $(findstring b,$(__i_attrib)))\
- -$(PERL) -Xe 'open(ICMD, q$(ichar)>>$(CMDFILE)$(ichar));\
- print(ICMD qq(\n)\
- $(if $(eval __i_imgtype := $(IMAGE_TYPE))$(__i_imgtype),,\
- $(eval IMAGE_TYPE += $(foreach type,CORE ROFS2 ROFS3 ROFS4 ROFS5 ROFS6 UDA,$(findstring $(type),$(step))))\
- $(eval IMAGE_TYPE := $(word 1,$(IMAGE_TYPE))))\
- $(if $(__i_clean),.q$(ichar)CLEAN_$(__i_step)=$(CLEAN_$(__i_step))$(ichar).qq(\n))\
- $(if $(__i_build),.q$(ichar)BUILD_$(__i_step)=$(BUILD_$(__i_step))$(ichar).qq(\n)));\
- $(eval IMAGE_TYPE := $(__i_imgtype))\
- close(ICMD)'$(\n))
- $(IMAKER_PERLCMD)
- $(eval IMAKER_CMDARG :=))
- )
+ $(if $(and $(filter-out help-config,$(filter help-% print-%,$(MAKECMDGOALS))),$(__i_evaled)),,
+ $(info #iMaker$(ichar)BEGIN)
+ $(if $(__i_evaled),,$(IMAKER_EVAL))
+ $(eval __i_evaled := 1)
+ $(eval __i_steps := $(if $(MAKECMDGOALS),$1,$(or\
+ $(if $(DEFAULT_GOALS),$(if $(PRODUCT_NAME),,$(TARGET_PRODUCT)) $(DEFAULT_GOALS)),$(filter help,$(.DEFAULT_GOAL)))))
+ $(if $(call restoreelem,$(call getwords,$(__i_steps))),,$(eval __i_steps :=))
+ $(if $(__i_tgtind),$(eval __i_steps := $(call getelem,$(__i_tgtind),$(__i_steps))))
+ $(eval __i_tgts := $(subst $(__i_steps),,$(call ucase,$(__i_steps))))
+ $(if $(or $(filter-out help-config,$(filter help-% print-%,$(MAKECMDGOALS))),$(call not,$(__i_tgts))),
+ $(eval IMAKER_STEPS := $(if $(filter help% print-%,$(TARGET))$(__i_tgts),,IMAKERPRE )$(or $(strip\
+ $(eval __i_ind := $(call findword,RESTART,$(__i_steps)))$(if $(__i_ind),$(call iif,$(IMAKER_MKRESTARTS),\
+ $(call restwords,$(call restwords,$(__i_ind),$(__i_steps))),$(wordlist 1,$(__i_ind),$(__i_steps))),$(__i_steps))),EMPTY))
+ $(if $(filter-out IMAKERPRE,$(word 1,$(IMAKER_STEPS)))$(filter RESTART,$(lastword $(IMAKER_STEPS))),,
+ $(eval IMAKER_STEPS += IMAKERPOST))
+ $(eval __i_steps := $(if $(filter print-%,$(MAKECMDGOALS)),PRINTVAR,\
+ $(if $(filter-out help-config,$(filter help-%,$(MAKECMDGOALS))),HELP,$(IMAKER_STEPS))))
+ ,
+ $(if $(and $(__i_tgts),$(__i_tgtind)),$(eval IMAKER_STEPS := $(__i_steps)),
+ $(eval __i_ind :=)
+ $(eval IMAKER_STEPS :=)
+ $(foreach step,$(call getwords,$(__i_steps)),
+ $(eval __i_ind += +)
+ $(eval __i_steps := $(call restoreelem,$(step)))
+ $(if $(__i_steps),$(eval IMAKER_STEPS += $(if $(IMAKER_STEPS),|)\
+ $(if $(subst $(__i_steps),,$(call ucase,$(__i_steps))),$(__i_steps),$(TARGETNAME)[$(words $(__i_ind))])))))
+ $(eval __i_steps :=)
+ )
+ $(foreach var,VERBOSE IMAGE_TYPE KEEPGOING PRINTCMD,$(info #iMaker$(ichar)$(var)=$($(var))))
+ $(foreach var,$(sort $(IMAKER_EXPORT)),$(info #iMaker$(ichar)env $(var)=$($(var))))
+ $(foreach var,$(TARGET_EXPORT),$(info #iMaker$(ichar)var $(var)=$($(patsubst %?,%,$(or $(word 2,$(subst :, ,$(var))),$(var))))))
+ $(foreach var,$(call restwords,$(IMAKER_PRINTVAR)),$(info #iMaker$(ichar)print $(word 1,$(IMAKER_PRINTVAR))\
+ $(word 1,$(subst |, ,$(var)))=$($(or $(word 2,$(subst |, ,$(var))),$(var)))))
+ $(info #iMaker$(ichar)STEPS=$(or $(__i_steps),target:$(IMAKER_STEPS)))
+ $(foreach step,$(__i_steps),
+ $(if $(call defined,INIT_$(step)),$(info #iMaker$(ichar)INIT_$(step)=$(INIT_$(step))))
+ $(if $(call true,$(CLEAN)),$(info #iMaker$(ichar)CLEAN_$(step)=$(CLEAN_$(step))))
+ $(if $(call true,$(BUILD)),
+ $(info #iMaker$(ichar)BUILD_$(step)=$(BUILD_$(step)))
+ $(if $(REPORT_$(step)),$(info #iMaker$(ichar)REPORT_$(step)=$(REPORT_$(step)))))
+ )
+ $(info #iMaker$(ichar)END)
+ )-@$(DONOTHING)
endef
###############################################################################
-# Test if old variables are in use
-
-define API_TEST
-# OLD_VARIABLE1 NEW_VARIABLE1
-# OLD_VARIABLEn NEW_VARIABLEn
-
- CUSTVARIANT_MKNAME VARIANT_MKNAME
- CUSTVARIANT_CONFML VARIANT_CONFML
- CUSTVARIANT_CONFCP VARIANT_CONFCP
-endef
-
-testnewapi = $(if $1,\
- $(if $(call defined,$(word 1,$1)),\
- warning | 1 | ***************************************\n |\
- warning | 1 | Old-style variable found: $(word 1,$1) ($(origin $(word 1,$1)))\n |\
- warning | 1 | Instead$(,) start using $(word 2,$1)\n |)\
- $(call testnewapi,$(call restwords,3,$1)))
-
-
-###############################################################################
# Targets
.PHONY: version clean
@@ -326,25 +310,36 @@
clean:\
;@$(call IMAKER,$$(ALL.CLEAN.STEPS))
-print-%: ;@$(call IMAKER)
-
-step-% : ;@$(call IMAKER,$(subst -, ,$*))
+step-%: ;@$(call IMAKER,$(subst -, ,$*))
#==============================================================================
-include $(addprefix $(IMAKER_DIR)/imaker_,$(addsuffix .mk,help image minienv public tools version))
+$(call includechk,$(addprefix $(IMAKER_DIR)/imaker_,$(addsuffix .mk,help image minienv tools version)))
+include $(wildcard $(IMAKER_DIR)/imaker_extension.mk)
+include $(wildcard $(IMAKER_EXPORTMK))
--include $(IMAKER_DIR)/imaker_extension.mk
-
+$(call includechk,$(LANGPACK_SYSLANGMK))
+$(call includechk,$(IMAKER_DEFAULTMK))
+$(call includechk,$(IMAKER_CONFMK))
+$(call includechk,$(BUILD_INFOMK))
+$(call includechk,$(BUILD_NAMEMK))
+$(call includechk,$(LANGPACK_MK))
+$(call includechk,$(VARIANT_MK))
+$(call includechk,$(call select,$(USE_CONE),mk,$(if $(filter cone-pre,$(TARGET)),,$(subst $( ),\ ,$(CONE_MK)))))
-###############################################################################
-#
+.DEFAULT_GOAL := $(if $(DEFAULT_GOALS),help,$(.DEFAULT_GOAL))
+
+%-dir: FILTERCMD = ^cd\|mkcd\|mkdir$$
+%-dir: $$* ;
-else
-ifeq ($(__IMAKER_MK__),1)
-__IMAKER_MK__ := 2
+$(foreach ind,1 2 3 4 5 6 7 8 9,\
+ $(eval %[$(ind)]: __i_tgtind = $(ind))\
+ $(eval %[$(ind)]: $$$$* ;))
--include $(IMAKER_DIR)/imaker_extension.mk
+include $(wildcard $(IMAKER_DIR)/imaker_extension.mk)
+include $(wildcard $(IMAKER_EXPORTMK))
+
+$(sort $(MAKEFILE_LIST)): ;
###############################################################################
@@ -352,8 +347,8 @@
else
$(error Do not include imaker.mk, it is handled by iMaker!)
-endif
endif # __IMAKER_MK__
+
# END OF IMAKER.MK
--- a/imgtools/imaker/src/imaker.pl Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker.pl Thu Jun 24 10:35:05 2010 +0300
@@ -11,157 +11,2183 @@
#
# Contributors:
#
-# Description: iMaker main Perl script
+# Description: iMaker main Perl script & common routines
#
#
-$(error >>>MAKECMDGOALS=$(MAKECMDGOALS)<<<)
+$(error |MAKE=$(MAKE)|MAKE_VERSION=$(MAKE_VERSION)|SHELL=$(SHELL)|MAKECMDGOALS=$(MAKECMDGOALS)|)
#
#!perl
+#line 24
+
+use subs qw(CORE::GLOBAL::die);
use strict;
use warnings;
-use Getopt::Long qw(:config pass_through no_auto_abbrev);
+use Cwd;
+use Digest::MD5 qw(md5_hex);
+use File::Basename;
+use File::Copy;
+use File::Find;
+use File::Path;
+use File::Spec;
+use File::Temp qw(tempfile);
+use POSIX qw(strftime);
+use Text::ParseWords;
+use Time::Local;
-my $error = "";
-my $perlver;
-my $start;
+sub InitMkglobals();
+sub PrintEnv($);
+sub Max(@);
+sub Min(@);
+sub Trim($;$);
+sub Quote($);
+sub Unquote($);
+sub Int2Hex($;$);
+sub Byte2Str($@);
+sub Str2Byte($);
+sub Str2Xml($);
+sub Ascii2Uni($);
+sub Uni2Ascii($);
+sub GetTimestamp();
+sub Sec2Min($);
+sub Wcard2Restr($);
+sub Wcard2Regex($);
+sub ParseCmdWords($);
+sub DPrint($@);
+sub Echo($$$);
+sub PathConv($;$$$);
+sub ParseFiles($);
+sub GlobFiles($;$);
+sub GetBasename($);
+sub GetDirname($);
+sub GetAbsDirname($;$$$);
+sub GetAbsFname($;$$$);
+sub GetRelFname($;$$);
+sub GetWriteFname($);
+sub GetFreeDrive(;$);
+sub SubstDrive($$);
+sub UnsubstDrive($);
+sub Search($$$$$$\@\$);
+sub Find($$$$$\$);
+sub ChangeDir($);
+sub DeleteDir($;$);
+sub FindDir($$$$);
+sub MakeDir($);
+sub MakeChangeDir($);
+sub SetWorkdir($);
+sub OpenFile(*$$;$);
+sub Test($);
+sub CutFile($$$$$);
+sub Copy($$;$);
+sub CopyIby($$);
+sub DeleteFile($;$);
+sub FindFile($$$$);
+sub HeadFile($$$);
+sub TailFile($$$);
+sub TypeFile($;$);
+sub ReadFile($$);
+sub WriteFile($$$;$$);
+sub UnzipFile($$);
+sub Zip($$$$@);
+sub Move($$);
+sub Touch($@);
+sub SetLogfile($);
+sub RunSystemCmd($;$$$);
+sub ParseSystemCmd($$$$$);
+sub GenExclfile($$$$$);
+sub GenIbyfile($$$);
+sub GenObyfile($$$$@);
+sub GenMakefile($$$$$);
+sub GenWidgetConf($$$$);
+sub AddImageHeader($$$$$);
+sub Sleep($);
+sub FindSOSFiles($$$$);
+sub CheckTool(@);
+sub OpCacheInstall($$$);
+sub SisInstall($$$$$$$$);
+sub GetIPar(;$);
+sub PEval($);
+sub PeekICmd($);
+sub SkipICmd();
+sub GetICmd();
+sub EndICmd();
+sub SplitStep($);
+sub RunStep($);
+sub RunIExtCmd($);
+sub GetConfmkList(;$);
+sub GetFeatvarIncdir($);
+sub SetVerbose($;$);
+sub CloseLog();
+sub RunIMakerCmd($$$$$@);
+sub RunMakeCmd($$);
+sub HandleCmdArg($);
+sub HandleExtCmdArg($);
+sub MenuRuncmd($);
+sub Menu($);
+sub Install($$$);
+
+use constant READBUFSIZE => 2097152; # 2 MB
+use constant STARTSTR => '>>>[START]=========8<==========8<==========8<==========8<==========8<==========';
+use constant ENDSTR => '==========>8==========>8==========>8==========>8==========>8===========[END]<<<';
+
+# device[VARID]==... !!
+#
+use constant BOOTBINARYSTATEMENT => qr/^\s*bootbinary\s*(?:=+|\s)\s*(?:"(.+?)"|(\S+))/i;
+
+use constant FILESPECSTATEMENT =>
+ qr/^\s*(?:data|device|dll|extension|file|primary|secondary|variant)\S*?\s*(?:=+|\s)\s*(?:"(.+?)"|(\S+))\s+(?:"(.+?)"|(\S+))(\s+.+?)?\s*$/i;
+
+our ($gArgv, $gCmdcnt, @gCmdoutbuf, %gConfmkList, $gEpocdrive, $gEpocroot, $gError, $gErrwarn, $gEvalerr,
+ %gExportvar, $gFiltercmd, @gFindresult, $gICmd, @gIcmd, $gImakerext, $gImgtype, $gKeepgoing, @gLogbuf,
+ $gLogfile, %gLogfiles, $gMakecmd, @gMakeinfo, $gOutfilter, $gParamcnt, $gPrintcmd, @gReport, $gStartmk,
+ $gStarttime, $gStep, @gStepDur, %gStepIcmd, %gSubstdrv, $gTgterr, %gTool, $gVerbose, $gWinOS, $gWorkdir,
+ $gWorkdrive, @iVar);
+
+
+###############################################################################
+#
+
+sub InitMkglobals()
+{
+ $gCmdcnt = 0;
+ @gCmdoutbuf = ();
+ $gFiltercmd = qr/\S/;
+ @gFindresult = ();
+ $gICmd = "";
+ @gIcmd = ();
+ $gImgtype = "";
+ $gOutfilter = "";
+ $gParamcnt = 0;
+ $gPrintcmd = 0;
+ $gStep = "";
+ @gStepDur = ();
+ %gStepIcmd = ();
+ @iVar = (); # General purpose variable to be used from $(call peval,...)
+}
BEGIN {
- ($start, $perlver) = (time(), sprintf("%vd", $^V));
+ ($gArgv, $gEvalerr, $gStarttime, $gWinOS) = (scalar(@ARGV), 0, time(), $^O =~ /MSWin/i);
+ $_ = "default input and pattern-searching space";
+ eval("use Archive::Zip qw(:ERROR_CODES)");
+ eval("use constant AZ_OK => -1") if $@;
+ eval("use Archive::Zip::Tree");
+ if ($gWinOS) { eval("
+ use Win32API::File qw(:DDD_);
+ use Win32::File;
+ use constant WIN32_FILE_HIDDEN => Win32::File::HIDDEN");
+ } else { eval("
+ use constant DDD_REMOVE_DEFINITION => -1;
+ use constant WIN32_FILE_HIDDEN => -1");
+ }
+}
+
+INIT {
+ $gWorkdir = Cwd::cwd();
+ $gWorkdrive = ($gWorkdir =~ /^([a-z]:)/i ? uc($1) : "");
+ $ENV{EPOCROOT} = ($gWinOS ? "\\" : "$gWorkdir/") if !$ENV{EPOCROOT};
+ $ENV{IMAKER_CMDARG} = "" if !defined($ENV{IMAKER_CMDARG});
+ $ENV{IMAKER_CYGWIN} = 0 if !$ENV{IMAKER_CYGWIN};
+
+ InitMkglobals();
+ %gConfmkList = ();
+ $gEpocdrive = ($ENV{EPOCROOT} =~ /^([a-z]:)/i ? uc($1) : $gWorkdrive);
+ ($gEpocroot = GetAbsDirname($ENV{EPOCROOT})) =~ s/\/+$//;
+ $gError = 0;
+ $gErrwarn = 0;
+ %gExportvar = (); $gExportvar{""} = 0;
+ $gKeepgoing = 0;
+ @gLogbuf = ();
+ $gLogfile = "";
+ %gLogfiles = ();
+ $gMakecmd = "";
+ @gMakeinfo = ("?", "?", "?");
+ @gReport = ();
+ $gStartmk = 0;
+ %gSubstdrv = ();
+ $gTgterr = 0;
+ %gTool = (); map{ $gTool{$_} => $_ } ("cpp", "elf2e32", "interpretsis", "opcache", "unzip");
+ $gVerbose = 1;
+
select(STDERR); $|++;
select(STDOUT); $|++;
- if (!@ARGV) {
- warn("Warning: iMaker is running under Cygwin!\n")
+
+ # Overload die
+ *CORE::GLOBAL::die = sub {
+ $gError = 1 if !$gEvalerr;
+ return if (PeekICmd("iferror") && !$gEvalerr);
+ CORE::die(@_) if ($gEvalerr || !$gKeepgoing);
+ $gErrwarn = 1;
+ warn(@_);
+ };
+
+ # Handler for __DIE__ signal
+ $SIG{__DIE__} = sub {
+ return if $gEvalerr;
+ $gErrwarn = 1;
+ warn(@_);
+ exit(1);
+ };
+
+ # Handler for __WARN__ signal
+ $SIG{__WARN__} = sub {
+ if (($gEvalerr != 1) && ($gKeepgoing < 3) && ($_[0] ne "\n")) {
+ select(STDERR);
+ my $msg = ($gStep ? "($gStep): " : "") . $_[0];
+ if ($gErrwarn && ($gKeepgoing < 2)) {
+ DPrint(0, "*** Error: $msg") }
+ else { DPrint(127, "Warning: $msg") }
+ select(STDOUT);
+ }
+ $gErrwarn = 0;
+ };
+
+ if (!$gArgv) {
+ warn("iMaker is running under Cygwin!\n")
if (!$ENV{IMAKER_CYGWIN} && $^O =~ /cygwin/i);
- warn("Warning: iMaker uses Perl version $perlver! Recommended versions are 5.6.1 and 5.8.8.\n")
- if ($perlver !~ /^5\.(6\.1|8\.8)$/);
+ my $perlver = sprintf("%vd", $^V);
+ warn("iMaker uses Perl version $perlver! Recommended versions are 5.6.1, 5.8.x and 5.10.x.\n")
+ if ($perlver !~ /^5\.(?:6\.1|(?:8|10)\.\d+)$/);
}
- unshift(@INC, defined($ENV{IMAKER_DIR}) ? $ENV{IMAKER_DIR} : ($0 =~ /^(.*)[\/\\]/ ? $1 : "."));
}
-use imaker;
-
###############################################################################
# Main program
{
- if (!@ARGV) {
- $ENV{CONFIGROOT} = imaker::GetAbsDirname($ENV{CONFIGROOT});
- $ENV{ITOOL_DIR} = imaker::GetAbsDirname($ENV{ITOOL_DIR}, 0, 1);
- $ENV{IMAKER_DIR} = imaker::GetAbsDirname($ENV{IMAKER_DIR}, 0, 1);
- $ENV{PATH} = join(";", grep(!/[\\\/]cygwin[\\\/]/i, split(/;+/, $ENV{PATH})))
- if $imaker::gWinOS && !$ENV{IMAKER_CYGWIN};
+ if ($gArgv) {
+ my $iopt = shift(@ARGV);
+ print(map("$_\n", GetFeatvarIncdir("@ARGV"))), exit(0) if ($iopt eq "--incdir");
+ print(map("$_\n", @ARGV)), exit(0) if ($iopt eq "--splitarg");
+ die("Unknown internal imaker.pl option: `$iopt'.\n");
+ }
+
+ delete($ENV{MAKE}) if $gWinOS;
+ map { delete($ENV{$_}) } qw(MAKECMDGOALS MAKEFILES MAKEFLAGS MAKELEVEL MAKE_VERSION);
+
+ $ENV{CONFIGROOT} = GetAbsDirname($ENV{CONFIGROOT} || "$gEpocroot/epoc32/rom/config");
+ $ENV{ITOOL_DIR} = GetAbsDirname($ENV{ITOOL_DIR} || "$gEpocroot/epoc32/tools/rom");
+ $ENV{IMAKER_DIR} = GetAbsDirname($ENV{IMAKER_DIR});
+
+ $ENV{IMAKER_EXPORTMK} = "";
+ $ENV{IMAKER_MAKE} = ($gWinOS ? "$ENV{IMAKER_DIR}/mingw_make.exe" : $ENV{MAKE} || "make") if !$ENV{IMAKER_MAKE};
+ $ENV{IMAKER_MAKESHELL} = ($ENV{COMSPEC} || "cmd.exe") if (!$ENV{IMAKER_MAKESHELL} && $gWinOS);
+ $ENV{IMAKER_MKCONF} = $ENV{CONFIGROOT} . ',image_conf_(.+?)\.mk$,_(?:ncp)?\d+\.mk$,1' if !$ENV{IMAKER_MKCONF};
+
+ my $pathsep = ($gWinOS ? ";" : ":");
+ $ENV{PATH} = join(";", grep(!/[\\\/]cygwin[\\\/]/i, split(/;+/, $ENV{PATH}))) if (!$ENV{IMAKER_CYGWIN} && $gWinOS);
+ ($ENV{PATH} = Trim($ENV{PATH})) =~ s/"$/";/ if $gWinOS; # http://savannah.gnu.org/bugs/index.php?25412
+ $ENV{PATH} = PathConv("$ENV{ITOOL_DIR}", $gWinOS) . $pathsep . PathConv("$gEpocroot/epoc32/tools", $gWinOS) .
+ $pathsep . ($gWinOS ? PathConv("$gEpocroot/epoc32/gcc/bin", 1) . ";" : "") . $ENV{PATH};
+
+ $ENV{PERL5LIB} = $ENV{IMAKER_DIR} . ($ENV{PERL5LIB} ? "$pathsep$ENV{PERL5LIB}" : "");
+
+ die($@) if !defined($gImakerext = do("$ENV{IMAKER_DIR}/imaker_extension.pm")) && $@;
+
+ my ($version, $verfile) = ("", "$ENV{IMAKER_DIR}/imaker_version.mk");
+ open(FILE, "<$verfile") and map { $version = $1 if /^\s*IMAKER_VERSION\s*[+:?]?=\s*(.*?)\s*$/ } <FILE>;
+ close(FILE);
+ if ($version) { DPrint(1, "$version\n") }
+ else { warn("Can't read iMaker version from `$verfile'.\n") }
+
+ if ($ENV{IMAKER_CMDARG} =~ /^\s*--?(install|clean)=?(.*?)\s*$/i) {
+ Install(lc($1) eq "clean", "$ENV{IMAKER_DIR}/../group/bld.inf", $2);
+ exit(0);
+ }
+
+ $gMakecmd = "$ENV{IMAKER_MAKE} -R --no-print-directory" .
+ ($ENV{IMAKER_MAKESHELL} ? " SHELL=\"$ENV{IMAKER_MAKESHELL}\"" : "");
+ my $cmdout = qx($gMakecmd -f "$0" 2>&1);
+ ($cmdout = (defined($cmdout) ? $cmdout : "")) =~ s/\n+$//;
+ die("Can't run Make properly: `$cmdout'\n")
+ if ($cmdout !~ /\|MAKE=(.*?)\|MAKE_VERSION=(.*?)\|SHELL=(.*?)\|/);
+ @gMakeinfo = ($1, $2, $3);
+ warn(($gMakeinfo[1] eq "" ? "Can't resolve Make version" : "iMaker uses Make version $gMakeinfo[1]") .
+ ", recommended version is 3.81.\n") if ($gMakeinfo[1] !~ /^\s*3\.81/);
+
+ RunIMakerCmd("$gMakecmd TIMESTAMP=" . GetTimestamp() .
+ " -I \"$ENV{CONFIGROOT}\" -f \"$ENV{IMAKER_DIR}/imaker.mk\"", $ENV{IMAKER_CMDARG}, "", 0, 0, ());
+}
+
+
+###############################################################################
+#
+
+sub PrintEnv($)
+{
+ return if !@gMakeinfo;
+ DPrint(shift(), "=" x 79 . "\n" .
+ "User : " . (getlogin() || "?") . "@" . ($ENV{HOSTNAME} || $ENV{COMPUTERNAME} || "?") . " on $^O\n" .
+ "Time : " . localtime() . "\n" .
+ "Current dir : `$gWorkdir'\n" .
+ "iMaker tool : `$ENV{IMAKER_TOOL}' -> `$0'\n" .
+ "Cmdline args: `$ENV{IMAKER_CMDARG}'\n" .
+ "Perl : `$^X' version " . sprintf("%vd\n", $^V) .
+ "PERL5LIB : `$ENV{PERL5LIB}'\n" .
+ "PERL5OPT : `" . (defined($ENV{PERL5OPT}) ? "$ENV{PERL5OPT}'\n" : "'\n") .
+ "Make : `$gMakeinfo[0]' version $gMakeinfo[1]\n" .
+ "Make shell : `$gMakeinfo[2]'\n" .
+ "EPOCROOT : `$ENV{EPOCROOT}'\n" .
+ "CONFIGROOT : `$ENV{CONFIGROOT}'\n" .
+ "PATH : `$ENV{PATH}'\n");
+ @gMakeinfo = ();
+}
+
+sub Max(@)
+{
+ my $max = (shift() || 0);
+ map { $max = $_ if $_ > $max } @_;
+ return($max);
+}
+
+sub Min(@)
+{
+ my $min = (shift() || 0);
+ map { $min = $_ if $_ < $min } @_;
+ return($min);
+}
+
+sub Trim($;$)
+{
+ (my $str = shift()) =~ s/^\s+|\s+$//g;
+ $str =~ s/\s+(?=\s)//g if shift();
+ return($str);
+}
+
+sub Quote($)
+{
+ local $_ = shift();
+ return("") if !defined();
+ s/\\( |n|t)/\\\\$1/g;
+ return($_);
+}
+
+sub Unquote($)
+{
+ local $_ = shift();
+ return("") if !defined();
+ s/(?<!\\)(?<=\\n)\s+(\\n)?//g;
+ s/(?<!\\)\s+(?=\\n)//g;
+ s/(?<!\\)\\ / /g;
+ s/(?<!\\)\\n/\n/g;
+ s/(?<!\\)\\t/\t/g;
+ s/\\\\( |n|t)/\\$1/g;
+ s/\x00//g;
+ return($_);
+}
+
+sub Int2Hex($;$)
+{
+ my ($int, $len) = @_;
+ return((defined($len) ? $len : ($len = ($int < 4294967296 ? 8 : 16))) < 9 ? sprintf("%0${len}X", $int) :
+ sprintf("%0" . ($len - 8) . "X%08X", int($int / 4294967296), $int % 4294967296)); # 4294967296 = 4 G
+}
+
+sub Byte2Str($@)
+{
+ my ($base, @byte) = @_;
+ return(join("", map(($_ % 16 ? "" : sprintf("%04X:", $base + $_)) . sprintf(" %02X", $byte[$_]) .
+ (!(($_ + 1) % 16) || ($_ == (@byte - 1)) ? "\n" : ""), (0 .. (@byte - 1)))));
+}
+
+sub Str2Byte($)
+{
+ my ($str, $ind, @byte) = (shift(), 0, ());
+ $str =~ s/,$/, /;
+ map {
+ $ind++;
+ s/^\s+|\s+$//g;
+ if (/^\d+$/ && $_ < 256) {
+ push(@byte, $_);
+ } elsif (/^0x[0-9A-F]+$/i && hex() < 256) {
+ push(@byte, hex());
+ } else {
+ die("Invalid $ind. byte: `$_'.\n");
+ return;
+ }
+ } split(/,/, $str);
+ return(@byte);
+}
+
+sub Str2Xml($)
+{
+ my $str = shift();
+ $str =~ s/(.)/{'"'=>'"', '&'=>'&', "'"=>''', '<'=>'<', '>'=>'>'}->{$1} || $1/ge;
+ return($str);
+}
+
+sub Ascii2Uni($)
+{
+ (local $_ = shift()) =~ s/(?<!\r)\n/\r\n/g; # Use CR+LF newlines
+ s/(.)/$1\x00/gs;
+ return("\xFF\xFE$_");
+}
+
+sub Uni2Ascii($)
+{
+ (local $_ = shift()) =~ s/(.)\x00/$1/gs;
+ s/\r\n/\n/g;
+ return(substr($_, 2));
+}
+
+sub GetTimestamp()
+{
+ my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = localtime();
+ return(sprintf("%04d%02d%02d%02d%02d%02d%02d",
+ $year + 1900, $mon + 1, $mday, $hour, $min, $sec, int(($yday + ($year == 109 ? 3 : -3)) / 7) + 1));
+}
+
+sub Sec2Min($)
+{
+ my $sec = shift();
+ return(sprintf("%02d:%02d", $sec / 60, $sec % 60));
+}
+
+sub Wcard2Restr($)
+{
+ (my $wcard = shift()) =~ s/(.)/{"*"=>".*", "?"=>"."}->{$1} || "\Q$1\E"/ge;
+ return($wcard);
+}
+
+sub Wcard2Regex($)
+{
+ my $restr = Wcard2Restr(shift());
+ return(qr/$restr/i);
+}
+
+sub ParseCmdWords($)
+{
+ my $line = Trim(shift());
+ $line =~ s/\\/\\\\/g if $gWinOS;
+ return(Text::ParseWords::parse_line('\s+', 0, $line));
+}
+
+
+###############################################################################
+#
+
+sub DPrint($@)
+{
+ my ($verbose, @outlist) = @_;
+ map { tr/\x00\x1F/#/ } @outlist;
+ print(@outlist) if !$verbose || ($verbose & $gVerbose);
+ push(@gLogbuf, @outlist) if ($verbose < 32) || ($verbose & $gVerbose);
+ return if ($gLogfile eq "" || !@gLogbuf);
+ print(LOG @gLogbuf);
+ @gLogbuf = ();
+}
- my ($version, $verfile) = ("", "$ENV{IMAKER_DIR}/imaker_version.mk");
- open(FILE, "<$verfile") and map { $version = $1 if /^\s*IMAKER_VERSION\s*[+:?]?=\s*(.*?)\s*$/ } <FILE>;
- close(FILE);
- $version and print("$version\n") or
- warn("Can't read iMaker version from `$verfile'.\n");
+sub Echo($$$)
+{
+ return if SkipICmd();
+ my ($verbose, $str) = (shift(), shift());
+ DPrint($verbose, shift() ? "$str\n" : Unquote($str));
+}
+
+
+###############################################################################
+# File operations
+
+sub PathConv($;$$$)
+{
+ my $path = shift();
+ if (shift()) { $path =~ tr-\/-\\- }
+ else { $path =~ tr-\\-\/- }
+ return($path) if (!$gWinOS || $path =~ /^(?:\/\/|\\\\)/);
+ my $drive = shift();
+ return(ucfirst(($path =~ /^[a-z]:/i ? "" : ($_[0] ? $_[0] : $gWorkdrive)) . $path))
+ if !$drive;
+ $drive = $gWorkdrive if !($drive = shift());
+ $path =~ s/^$drive//i;
+ return($path);
+}
+
+sub ParseFiles($)
+{
+ my ($file, @files) = (" " . shift() . " ", ());
+ push(@files, defined($1) ? $1 : (defined($2) ? $2 : ())) while ($file =~ /\s(?:"\s*"|"+(.+?)"+|((\\\s|\S)+))(?=\s)/g);
+ return(@files);
+}
+
+sub GlobFiles($;$)
+{
+ return(@gFindresult) if (my $file = shift()) =~ /^__find__$/i;
+ return(map(/[\*\?]/ ? sort({lc($a) cmp lc($b)} grep(!/[\/\\]\.\.?$/,
+ glob(scalar(s/\*/\{\.\*\,\*\}/g, /\s/) ? "\"$_\"" : $_))) : $_, (shift() ? $file : ParseFiles($file))));
+}
+
+sub GetBasename($)
+{
+ return((File::Basename::fileparse(shift()))[0]);
+}
+
+sub GetDirname($)
+{
+ (my $dir = shift()) =~ s/^>>?(?!>)//;
+ return((File::Basename::fileparse($dir))[1]);
+}
+
+sub GetAbsDirname($;$$$)
+{
+ (my $dir = shift()) =~ s/^>>?(?!>)//;
+ $dir = "." if ($dir eq "");
+ my $absdir = "";
+ eval { local $gEvalerr = 1; $absdir = Cwd::abs_path($dir) };
+ return(PathConv($absdir || File::Spec->rel2abs($dir,
+ $dir !~ /^$gWorkdrive/i && $dir =~ /^([a-z]:)/i ? "$1/" : ""), shift(), shift(), shift()));
+}
+
+sub GetAbsFname($;$$$)
+{
+ my $file = shift();
+ return($file) if ($file eq "" || $file =~ /STD(IN|OUT|ERR)$/);
+ my $append = ($file =~ s/^>>(?!>)// ? ">>" : "");
+ return($append . PathConv(File::Spec->catpath("", GetAbsDirname(GetDirname($file)), GetBasename($file)), shift(), shift(), shift()));
+}
+
+sub GetRelFname($;$$)
+{
+ my ($file, $base) = (shift(), shift());
+ my $append = ($file =~ s/^>>(?!>)// ? ">>" : "");
+ ($file = PathConv(File::Spec->abs2rel($file, GetAbsDirname(defined($base) && ($base ne "") ? $base : ".")),
+ shift(), 1, "[a-z]:")) =~ s/^[\/\\]+//;
+ return("$append$file");
+}
+
+sub GetWriteFname($)
+{
+ (my $file = shift()) =~ s/^>?/>/;
+ return($file);
+}
+
+sub GetFreeDrive(;$)
+{
+ my $drives = Win32API::File::GetLogicalDrives();
+ for my $drive ("F".."Z", "A".."E") {
+ return("$drive:") if !($drives & (2 ** (ord($drive) - ord("A"))));
+ }
+ return("") if shift();
+ die("GetFreeDrive: No free drive available.\n");
+}
+
+sub SubstDrive($$)
+{
+ my ($drive, $path) = (uc(shift()), GetAbsDirname(shift()));
+ DPrint(16, "SubstDrive: `$drive' => `$path'\n");
+ $gSubstdrv{$drive} = 1, return if !(Win32API::File::GetLogicalDrives() & (2 ** (ord($drive) - ord("A")))) &&
+ Win32API::File::DefineDosDevice(0, $drive, $path);
+ die("Can't substitute `$drive' => `$path'\n");
+}
+
+sub UnsubstDrive($)
+{
+ return if (my $drive = uc(shift())) eq "";
+ DPrint(16, "UnsubstDrive: `$drive'\n");
+ delete($gSubstdrv{$drive}), return if Win32API::File::DefineDosDevice(DDD_REMOVE_DEFINITION, $drive, []) &&
+ !(Win32API::File::GetLogicalDrives() & (2 ** (ord($drive) - ord("A"))));
+ warn("Can't remove substituted drive `$drive'\n");
+}
- my $cmdarg = " " . imaker::HandleCmdArg($ENV{IMAKER_CMDARG}) . " ";
- my $makecmd = "$ENV{IMAKER_MAKE} -R --no-print-directory" .
- ($ENV{IMAKER_MAKESHELL} ? " SHELL=\"$ENV{IMAKER_MAKESHELL}\"" : "");
- my $cmdout = qx($makecmd -f $0 $cmdarg 2>&1);
- my $targets = ($cmdout =~ />>>MAKECMDGOALS=(.*?)<<</ ? $1 : undef);
+sub Search($$$$$$\@\$)
+{
+ my ($dir, $basere, $inclre, $exclre, $subdir, $finddir, $files, $total) = @_;
+ my @dir = my @file = ();
+
+ opendir(SDIR, $dir) or warn("Can't open directory `$dir'.\n");
+ while (local $_ = readdir(SDIR)) {
+ next if ($_ eq ".") || ($_ eq "..");
+ push(@dir, $_) if ((my $isdir = !(my $isfile = -f($_ = "$dir/$_")) && -d()) && $subdir);
+ next if ($finddir ? $isfile : $isdir);
+ ++$$total;
+ (my $fname = $_) =~ s/$basere//;
+ push(@file, $_) if ($fname =~ /$inclre/) && ($fname !~ /$exclre/) &&
+ (($finddir != 2) || !@{[glob((/\s/ ? "\"$_\"" : $_) . "/{[^.],.[^.],.??*,*}")]});
+ }
+ closedir(SDIR);
+ push(@$files, sort({lc($a) cmp lc($b)} @file));
+
+ foreach (sort({lc($a) cmp lc($b)} @dir)) {
+ Search($_, $basere, $inclre, $exclre, 1, $finddir, @$files, $$total);
+ }
+}
+
+sub Find($$$$$\$)
+{
+ my ($dur, $dir, $inclpat, $exclpat, $subdir, $finddir, $total) = (time(), @_);
+ ($dir, $$total) = (GetAbsDirname($dir), 0);
+ my ($inclre, $exclre, @files) = ("", "", ());
+ if ($inclpat =~ /^\//) {
+ $inclre = eval("qr$inclpat");
+ $inclpat = "";
+ } else {
+ $inclre = join("|", map(Wcard2Restr($_), split(/\s+/, $inclpat)));
+ $inclre = qr/\/(?:$inclre)$/i;
+ }
+ if ($exclpat =~ /^\//) {
+ $exclre = eval("qr$exclpat");
+ $exclpat = "";
+ } else {
+ $exclre = join("|", map(Wcard2Restr($_), split(/\s+/, $exclpat)));
+ $exclre = qr/\/(?:$exclre)$/i;
+ }
+ DPrint(16, "Find" . ($finddir == 2 ? "EmptyDir" : ($finddir ? "Dir" : "File")) . ": Directory `$dir'" .
+ ($subdir ? " and subdirectories" : "") . ", pattern `" . ($inclpat ne "" ? "$inclpat' $inclre" : "$inclre'") .
+ ($exclre eq qr/\/(?:)$/i ? "" : " excluding `" . ($exclpat ne "" ? "$exclpat' $exclre" : "$exclre'")));
+ foreach (GlobFiles($dir, 1)) {
+ Search($_, qr/^$_/i, $inclre, $exclre, $subdir, $finddir, @files, $$total) if -d();
+ }
+ DPrint(16, ", found " . @files . "/$$total " . ($finddir ? "directories" : "files") .
+ ", duration: " . Sec2Min(time() - $dur) . "\n");
+ return(@files);
+}
+
+sub ChangeDir($)
+{
+ if ((my $dir = GetAbsDirname(shift())) ne GetAbsDirname(".")) {
+ DPrint(16, "ChangeDir: `$dir'\n");
+ chdir($dir) or die("Can't change to directory `$dir'.\n");
+ }
+}
+
+sub DeleteDir($;$)
+{
+ return if !-d(my $dir = GetAbsDirname(shift()));
+ DPrint(16, "DeleteDir: `$dir'\n");
+ for my $sec (0, 2, 5) {
+ warn("Can't delete directory `$dir', retrying in $sec seconds...\n"), sleep($sec) if $sec;
+ eval { local $gEvalerr = 1; File::Path::rmtree($dir) };
+ return if !-d($dir);
+ RunSystemCmd($gWinOS ? 'rmdir /q /s "' . PathConv($dir, 1) . '"' :
+ "rm -fr '$dir'", 2);
+ sleep(1);
+ return if !-d($dir);
+ }
+ $dir = "Can't delete directory `$dir'.\n";
+ shift() ? warn($dir) : die($dir);
+}
+
+sub FindDir($$$$)
+{
+ my ($dir, $inclpat, $exclpat, $opt) = @_;
+ $opt = "" if !defined($opt);
+ push(@gFindresult, Find($dir, $inclpat, $exclpat, $opt =~ /r/, 1, local $_));
+}
+
+sub MakeDir($)
+{
+ return if -d(my $dir = shift());
+ eval { local $gEvalerr = 1; File::Path::mkpath($dir = GetAbsDirname($dir)) };
+ if (-d($dir)) {
+ DPrint(16, "MakeDir: `" . GetAbsDirname($dir) ."'\n");
+ } else {
+ DPrint(16, "MakeDir: `$dir'\n");
+ die("Can't create directory `$dir'.\n");
+ }
+}
+
+sub MakeChangeDir($)
+{
+ MakeDir(my $dir = shift());
+ ChangeDir($dir);
+}
+
+sub SetWorkdir($)
+{
+ MakeChangeDir(shift());
+ $gWorkdrive = (Cwd::cwd() =~ /^([a-z]:)/i ? uc($1) : "");
+ $gWorkdir = GetAbsDirname(".");
+}
+
+sub OpenFile(*$$;$)
+{
+ my ($fhandle, $file, $binmode, $print) = @_;
+ MakeDir(GetDirname($file)) if $file =~ /^>/;
+ DPrint(16, defined($print) ? $print : ($file =~ /^>/ ? "Write" : "Read") . "File: `$file'\n");
+ return(open($fhandle, $file)) if !$binmode;
+ return(open($fhandle, $file) and binmode($fhandle));
+}
- die("Can't run `$ENV{IMAKER_MAKE}' properly:\n$cmdout") if !defined($targets);
- map { $cmdarg =~ s/\s+\Q$_\E\s+/ / } split(/\s+/, $targets);
+sub Test($)
+{
+ if (-d(my $file = shift())) {
+ DPrint(16, "TestDir: `" . GetAbsDirname($file) . "'\n");
+ } elsif (-f($file)) {
+ DPrint(16, "TestFile: `" . GetAbsFname($file) . "'\n");
+ } else {
+ DPrint(16, "Test: `$file'\n");
+ die("File or directory `$file' doesn't exist.\n");
+ }
+}
+
+sub CutFile($$$$$)
+{
+ my ($msg, $src, $dest, $head, $len) = @_;
+ my ($buf, $srctmp) = (undef, "$src.tmp");
+
+ OpenFile(*INFILE, $src, 1, $msg) or
+ die("Can't read file `$src'.\n"), return;
+
+ my $out = GetWriteFname($head ? $dest : $srctmp);
+ OpenFile(*OUTFILE, $out, 1) or die("Can't write to `$out'.\n"), return;
+ while ($len > 0) {
+ read(INFILE, $buf, $len < READBUFSIZE ? $len : READBUFSIZE);
+ print(OUTFILE $buf);
+ $len -= READBUFSIZE;
+ }
+ close(OUTFILE);
+
+ $out = GetWriteFname($head ? $srctmp : $dest);
+ OpenFile(*OUTFILE, $out, 1) or die("Can't write to `$out'.\n"), return;
+ print(OUTFILE $buf) while read(INFILE, $buf, READBUFSIZE);
+ close(OUTFILE);
+ close(INFILE);
+ Move($srctmp, $src);
+}
+
+sub Copy($$;$)
+{
+ my ($src, $dest, $dir) = @_;
+ $dir = defined($dir) && $dir;
+ my $file = !($dir || -d($src));
+ $src = ($file ? GetAbsFname($src) : GetAbsDirname($src));
+ $dest = ($file ? GetAbsFname(-d($dest) ? "$dest/" . GetBasename($src) : $dest) :
+ GetAbsDirname($dir ? $dest : "$dest/" . GetBasename($src)));
+ if ($file && ($dest =~ /^>>[^>]/)) {
+ OpenFile(*FILE, $dest, 1, "AppendFile: `$src' => `$dest'\n")
+ or die("Can't append to `$dest'.\n"), return;
+ File::Copy::copy($src, *FILE) and
+ close(FILE) and return;
+ }
+ elsif ($file) {
+ MakeDir(GetDirname($dest));
+ DPrint(16, "CopyFile: `$src' => `$dest'\n");
+ warn("CopyFile: Destination file `$dest' already exists\n") if -f($dest);
+ File::Copy::copy($src, $dest) and return;
+ } else {
+ DPrint(16, "CopyDir: `$src' => `$dest'\n");
+ return if !RunSystemCmd(!$gWinOS ? "cp \"$src\"/* \"$dest\" -frv" :
+ 'xcopy "' . PathConv($src, 1) . '" "' . PathConv($dest, 1) . '" /e /h /i /q /y /z', 2);
+ }
+ die("Can't copy `$src' to `$dest'.\n");
+}
+
+sub CopyIby($$)
+{
+ my ($file, $dir) = (GetAbsFname(shift()), shift());
+ OpenFile(*FILE, $file, 0) or die("Can't read file `$file'.\n"), return;
+ map {
+ Copy(defined($1) ? $1 : $2, "$dir/" . (defined($3) ? $3 : $4)) if $_ =~ FILESPECSTATEMENT;
+ } <FILE>;
+ close(FILE);
+}
+
+sub DeleteFile($;$)
+{
+ return if !-f(my $file = GetAbsFname(shift()));
+ DPrint(16, "DeleteFile: `$file'\n");
+ for my $sec (0, 1, 2) {
+ warn("Can't delete file `$file', retrying in $sec second(s)...\n"), sleep($sec) if $sec;
+ unlink($file);
+ return if !-f($file);
+ }
+ $file = "Can't delete file `$file'.\n";
+ shift() ? warn($file) : die($file);
+}
+
+sub FindFile($$$$)
+{
+ my ($dir, $inclpat, $exclpat, $opt) = @_;
+ $opt = "" if !defined($opt);
+ my @find = Find($opt !~ /f/ ? $dir : GetDirname($dir), $opt !~ /f/ ? $inclpat : GetBasename($dir),
+ $exclpat, $opt =~ /r/, 0, local $_);
+ push(@gFindresult, $opt !~ /f/ ? @find : map("|$_|$inclpat", @find));
+}
+
+sub HeadFile($$$)
+{
+ my ($src, $dest, $len) = (GetAbsFname(shift()), GetAbsFname(shift()), shift());
+ $len = hex($len) if $len =~ /^0x/;
+ CutFile("HeadFile: Cut first $len bytes from `$src' => `$dest'\n", $src, $dest, 1, $len);
+}
- my $tmptarg = $targets = " $targets";
- my $hptarg = 0;
- while ($tmptarg =~ /(\s+(help-\S+))/g) {
- $hptarg = $1, $targets =~ s/\Q$hptarg\E(.*)$/ $1$hptarg/ if $2 ne "help-config";
+sub TailFile($$$)
+{
+ my ($src, $dest, $len) = (GetAbsFname(shift()), GetAbsFname(shift()), shift());
+ $len = hex($len) if $len =~ /^0x/;
+ CutFile("TailFile: Cut last $len bytes from `$src' => `$dest'\n", $src, $dest, 0, (-s($src) ? -s($src) : 0) - $len);
+}
+
+sub TypeFile($;$)
+{
+ my ($file, $str, $mode) = (GetAbsFname(shift()), "", shift() || "");
+ OpenFile(*FILE, $file, $mode, "TypeFile: `$file'" .
+ ($gOutfilter && ($mode ne "b") ? ", filter: `/$gOutfilter/i'" : "") . "\n") or
+ die("Can't read file `$file'.\n"), return;
+ DPrint(8, STARTSTR . "\n");
+ read(FILE, $str, -s($file));
+ if ($mode eq "b") {
+ DPrint(1, Byte2Str(0, map(ord(), split(//, $str))));
+ } else {
+ $str = Uni2Ascii($str) if $mode eq "u";
+ DPrint(1, map("$_\n", grep(!$gOutfilter || /$gOutfilter/i, split(/\n/, $str))));
+ $gOutfilter = "";
+ }
+ DPrint(8, ENDSTR . "\n");
+ close(FILE);
+}
+
+sub ReadFile($$)
+{
+ my ($file, $warn) = (GetAbsFname(shift()), shift());
+ OpenFile(*RFILE, $file, 0) or
+ ($warn ? (warn("Can't read file `$file'.\n"), return(())) : die("Can't read file `$file'.\n"));
+ my @file = map(chomp() ? $_ : $_, grep(!/^\s*$/, <RFILE>));
+ close(RFILE);
+ return(@file);
+}
+
+sub WriteFile($$$;$$)
+{
+ my ($file, $str, $mode, $opt) = (GetAbsFname(shift()), shift(), shift() || "", shift());
+ OpenFile(*WFILE, GetWriteFname($file), $mode) or
+ die("Can't write to `$file'.\n"), return;
+ if ($mode eq "b") {
+ my @byte = Str2Byte($str);
+ DPrint(64, Byte2Str($file =~ s/^>>(?!>)// ? -s($file) : 0, @byte));
+ print(WFILE map(chr(), @byte));
+ } else {
+ $opt = "" if !defined($opt);
+ $str = Unquote($str) if ($opt !~ /q/);
+ $str =~ s/(?<=\S)\/\//\//g if ($opt =~ /c/);
+ DPrint(16, $str) if shift();
+ $str = Ascii2Uni($str) if ($mode eq "u");
+ print(WFILE $str);
+ }
+ close(WFILE);
+}
+
+sub UnzipFile($$)
+{
+ my ($zipfile, $dir) = (GetAbsFname(shift()), GetAbsDirname(shift()));
+ DPrint(16, "UnzipFile: `$zipfile'");
+ Archive::Zip::setErrorHandler(sub{});
+ my ($error, $zip) = (0, Archive::Zip->new());
+ if ($zip->read($zipfile) != AZ_OK) {
+ DPrint(16, " to directory `$dir'\n");
+ die("Can't read zip archive `$zipfile'.\n");
+ return;
+ }
+ my @files = map($_->fileName(), grep(!$_->isDirectory(), $zip->members()));
+ DPrint(16, ", " . @files . " files to directory `$dir'\n");
+ foreach my $file (@files) {
+ DPrint(16, "ExtractFile: `$dir/$file'");
+ eval { local $gEvalerr = 1; $error = ($zip->extractMember($file, "$dir/$file") != AZ_OK) };
+ DPrint(16, $error ? " Failed\n" : "\n");
+ die("Can't extract file `$file' to directory `$dir'.\n") if $error;
+ $error = 0;
+ }
+}
+
+sub Zip($$$$@)
+{
+ my ($zipfile, $dir, $opt, $prefix) = (GetAbsFname(shift()), shift(), shift(), shift());
+
+ $opt = (defined($opt) ? ", options: `$opt'" : "");
+ $prefix = GetAbsDirname($prefix) if $prefix ne "";
+ my %files = ();
+ foreach my $file (@_) {
+ my $zname = "";
+ ($file, $zname) = ($1, $2) if ($file =~ /^\|(.*)\|(.*)$/);
+ next if !($file = (!$dir ? (-f($file) ? GetAbsFname($file) : "") : (-d($file) ? GetAbsDirname($file) : "")));
+ ($zname = ($zname eq "" ? $file : (!$dir ?
+ GetAbsFname($zname) : GetAbsDirname($zname)))) =~ s/^(?:$gEpocroot|[a-z]:)?\/+//i;
+ if ($opt !~ /j/) {
+ $zname =~ s/^.*?\/+/$prefix\// if ($prefix ne "");
+ } else {
+ $zname = ($dir ? "" : GetBasename($file)) if ($prefix eq "") || !s/^$prefix//;
}
- $hptarg = $1, $targets =~ s/\Q$hptarg\E(.*)$/ $1$hptarg/ while $tmptarg =~ /(\s+print-\S+)/g;
- $targets =~ s/^\s+|\s+(?=\s)|\s$//g;
+ $files{lc($zname)} = [$file, $zname];
+ }
+
+ DPrint(16, ($dir ? "ZipDir: `$zipfile'$opt, " . keys(%files) . " directories" :
+ "ZipFile: `$zipfile'$opt, " . keys(%files) . " files") . ($prefix ? ", prefix: $prefix\n" : "\n"));
+
+ Archive::Zip::setErrorHandler(sub{});
+ my ($error, $zip) = (0, Archive::Zip->new());
+ $zip->read($zipfile) if (my $ziptmp = ($zipfile =~ s/^>>(?!>)// ? "$zipfile.tmp" : ""));
+ $zip->zipfileComment("iMaker-generated zip archive `$zipfile'$opt.");
- my $mainmk = "-f $ENV{IMAKER_DIR}/imaker.mk";
- $makecmd .= " -I " . imaker::GetAbsDirname($ENV{CONFIGROOT}, 0, 1) . " $mainmk";
+ foreach my $file (sort({lc($$a[0]) cmp lc($$b[0])} values(%files))) {
+ DPrint(16, "Add" . ($dir ? "Dir" : "File") . ": `$$file[0]' => `$$file[1]'") if ($opt !~ /q/);
+ eval {
+ my $warn = 0;
+ local $gEvalerr = 1; local $SIG{__WARN__} = sub{ $warn = 1 };
+ $error = ($dir ? $zip->addTree($$file[0], $$file[1]) != AZ_OK :
+ !$zip->addFile($$file[0], $$file[1])) || $warn;
+ };
+ DPrint(16, $error ? " Failed\n" : "\n") if ($opt !~ /q/);
+ warn("Can't add " . ($dir ? "directory tree" : "file") . "`$$file[0]' to zip archive `$zipfile'.\n") if $error;
+ $error = 0;
+ }
+ ($zip->writeToFileNamed($ziptmp ? $ziptmp : $zipfile) == AZ_OK) or
+ die("Can't create zip archive `$zipfile'.\n");
+ Move($ziptmp, $zipfile) if $ziptmp;
+}
+
+sub Move($$)
+{
+ my ($src, $dest) = @_;
+ my $dir = -d($src);
+ $src = ($dir ? GetAbsDirname($src) : GetAbsFname($src));
+ MakeDir(GetDirname($dest));
+ $dest = ($dir ? GetAbsDirname($dest) : GetAbsFname($dest));
+ DPrint(16, "Move" . ($dir ? "Dir" : "File") . ": `$src' => `$dest'\n");
+ File::Copy::move($src, $dest) or
+ die("Can't move `$src' to `$dest'.\n");
+}
+
+sub Touch($@)
+{
+ my $time = (shift() =~ /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/ ?
+ Time::Local::timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900) : time);
+ if (@_ != 1) {
+ DPrint(16, "Touch: " . scalar(@_) . " files/dirs, " .
+ POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime($time)) . "\n");
+ utime($time, $time, @_) == @_ or
+ die("Can't touch all the " . scalar(@_) . " files/dirs.\n");
+ return;
+ }
+ my $file = shift();
+ my $dir = -d($file);
+ $file = ($dir ? GetAbsDirname($file) : GetAbsFname($file));
+ DPrint(16, "Touch" . ($dir ? "Dir" : "File") . ": `$file', " .
+ POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime($time)) . "\n");
+ utime($time, $time, $file) == 1 or
+ die("Can't touch " . ($dir ? "directory" : "file") . " `$file'.\n");
+}
+
+sub SetLogfile($)
+{
+ return if !(my $file = GetAbsFname(shift()));
+ my $append = (($file =~ s/^>>(?!>)//) || exists($gLogfiles{$file}) ? ">>" : "");
+ CloseLog();
+ OpenFile(*LOG, GetWriteFname($file = "$append$file"), 0) or
+ warn("Can't log to file `$file'.\n"), return;
+ $gLogfiles{$gLogfiles{__prev__} = $gLogfile = $file} = 1;
+}
+
+
+###############################################################################
+#
+
+sub RunSystemCmd($;$$$)
+{
+ return if ($gICmd !~ $gFiltercmd);
+ my ($cmd, $keepgoing, $null, $file) = @_;
+ DPrint(1, "$cmd\n"), return if $gPrintcmd;
+ local $gError = 0 if ($keepgoing = (defined($keepgoing) && ($keepgoing =~ /^[123]$/) ? $keepgoing : 0));
+ local $gKeepgoing = Max($gKeepgoing, $keepgoing) if $keepgoing;
+ $file = (defined($file) ? GetAbsFname($file) : "");
+ @gCmdoutbuf = ();
+ DPrint(4, local $_ = "RunSystemCmd(" . GetAbsDirname(".") . "): `$cmd'" .
+ ($keepgoing ? ", keep going" . ($keepgoing > 1 ? "($keepgoing)" : "") : "") .
+ ($file ? ", redirect to `$file'" : "") . ($null ? ", redirect stdout to null" : "") .
+ ($gOutfilter ? ", filter: `/$gOutfilter/i'" : "") . "\n");
+ OpenFile(*CMDFILE, GetWriteFname($file), 0) or
+ (die("Can't write to `$file'.\n"), $file = "") if $file;
+ print(CMDFILE $_) if $file;
+ my $dur = time();
+ open(CMD, "$cmd 2>&1 |");
+ DPrint(8, STARTSTR . "\n");
+ while ($_ = <CMD>) {
+ chomp();
+ push(@gCmdoutbuf, $_);
+ next if ($gOutfilter && !/$gOutfilter/i);
+ DPrint(8, "$_\n") if !$null;
+ print(CMDFILE "$_\n") if $file;
+ }
+ close(CMD);
+ my $error = ($? >> 8);
+ close(CMDFILE) if $file;
+ push(@gStepDur, $dur = time() - $dur);
+ $gOutfilter = "";
+ print(map("$_\n", @gCmdoutbuf)) if ($error && !$gKeepgoing && !$null && $gVerbose && !($gVerbose & 8));
+ $dur = Sec2Min($dur);
+ DPrint(8, substr(ENDSTR, 0, -16) . $dur . substr(ENDSTR, length($dur) - 16) . "\n");
+ die("Command `$cmd' failed ($error) in `" . GetAbsDirname(".") . "'.\n") if $error;
+ return($error);
+}
+
+
+###############################################################################
+#
+
+sub ParseSystemCmd($$$$$)
+{
+ return if SkipICmd();
+ my ($title, $inclre, $exclre, $file, $lines) = @_;
+ ($inclre, $exclre) = (eval("qr$inclre"), $exclre ne "" ? eval("qr$exclre") : qr/^$/);
+ $lines = ($lines ? $lines - 1 : 0);
- foreach my $target ($hptarg || $targets eq "" ? $targets : split(/\s/, $targets)) {
- ($cmdarg, $target) = imaker::Menu($makecmd, $mainmk, $cmdarg) if $target eq "menu";
- system($ENV{IMAKER_MAKECMD} = "$makecmd TIMESTAMP=" . imaker::GetTimestamp() . " $cmdarg $mainmk $target")
- if $target ne "menu";
- $error = ($? >> 8) if ($? >> 8);
+ my @parse = ();
+ for (my $i = 0; $i < @gCmdoutbuf; $i++) {
+ next if ($gCmdoutbuf[$i] !~ $inclre);
+ push(@parse, join(" | ", @gCmdoutbuf[$i .. $i + $lines])) if ($gCmdoutbuf[$i] !~ $exclre);
+ $i += $lines;
+ }
+ return if !@parse;
+ if (!$file) {
+ DPrint(1, "$title\n", map(sprintf("%" . length(@parse) . "s", $_) . ") $parse[$_ - 1]\n", 1 .. @parse));
+ } else {
+ WriteFile($title, join("\n", @parse), "", "q");
+ }
+}
+
+
+###############################################################################
+#
+
+sub GenExclfile($$$$$)
+{
+ return if SkipICmd();
+
+ my ($exclfile, $base, $prefix, $exclfiles, @exclfiles) = (shift(), GetAbsDirname(shift()), shift(), "", ());
+
+ if (!-f($exclfile)) {
+ WriteFile($exclfile, "", "");
+ } else {
+ OpenFile(*FILE, $exclfile, 1) or die("Can't read file `$exclfile'.\n"), return;
+ read(FILE, $exclfiles, -s($exclfile));
+ close(FILE);
+ @exclfiles = split(/\n/, Uni2Ascii($exclfiles));
+ }
+
+ my $findfiles = 0;
+ my @addfiles = map($_ ne "**" ? $_ : "*", grep(!(($_ eq "*") && ++$findfiles),
+ map(Trim(Unquote(Trim($_))), grep(!/^\s*(?:#.*)?$/, split(/(?<!\\)\\n/, shift())))));
+
+ if ($findfiles) {
+ $exclfiles = "";
+ foreach (@exclfiles, @addfiles, map(Trim(Unquote(Trim($_))), grep(!/^\s*(?:#.*)?$/, split(/(?<!\\)\\n/, shift())))) {
+ (my $file = $_) =~ tr/\\/\//;
+ $file =~ s/^(?:[a-z]:)?\/*//i;
+ $exclfiles .= ($exclfiles ne "" ? "|" : "") . Wcard2Restr($file);
}
+ push(@addfiles, map(GetRelFname($_, $base), Find($base, "*", "/^\\/(?:$exclfiles)\$/i", 1, 0, local $_)));
+ }
-# imaker::DPrint(1, "\nTotal duration: " . imaker::Sec2Min(time() - $start) . "\n");
- exit($error || 0);
+ $prefix =~ s/[\/\\]+$//;
+ WriteFile($exclfile, join("", map("$_\n", @exclfiles,
+ map(s/^(?:[a-z]:)?\\*/$prefix\\/i ? $_ : $_, map(tr/\//\\/ ? $_ : $_, @addfiles)))), "u", "q");
+}
+
+sub GenIbyfile($$$)
+{
+ return if SkipICmd();
+ my ($ibyfile, $ibystr, $oride, $prevoride) = (shift(), "", "", "");
+
+ map {
+ die("GenIbyfile: Invalid file list configuration: `$_'\n"), return
+ if !/^\s*(?:"(.+?)"|(\S+))\s+(?:"(.+?)"|(\S+))\s*$/;
+ $_ = [defined($1) ? $1 : $2, defined($3) ? $3 : $4];
+ } (my @files = map(Unquote($_), grep(!/^\s*(?:#.*)?$/, split(/(?<!\\)\\n/, shift()))));
+
+ my @ibyconf = map(Unquote($_), grep(!/^\s*(?:#.*)?$/, split(/(?<!\\)\\n/, shift())));
+
+ foreach (@ibyconf) {
+ die("GenIbyfile: Invalid configuration: `$_'\n"), return
+ if !/^\s*(?:"(.+?)"|(\S+))\s+(hide|remove|(?:replace|udeb|urel)(?:-add)?)\s+(\*|core|rofs[2-6])\s*$/i;
+ next if ($4 ne "*") && (uc($4) ne $gImgtype);
+ my $action = lc($3);
+ my $file = Wcard2Restr(defined($1) ? $1 : $2);
+ $file = qr/(?:^|\\|\/)$file$/i;
+ foreach (@files) {
+ next if (@$_[1] !~ $file);
+ $oride = ($action =~ /add$/ ? "ADD" : ($action eq "hide" ? "" : "SKIP"));
+ my $src = ($action eq "remove" ? "empty" : @$_[0]);
+ if ($action =~ /^udeb/) {
+ $src =~ s/(?<=[\/\\])urel(?=[\/\\])/udeb/i;
+ } elsif ($action =~ /^urel/) {
+ $src =~ s/(?<=[\/\\])udeb(?=[\/\\])/urel/i;
+ }
+ $ibystr .= ($prevoride && ($oride ne $prevoride) ? "OVERRIDE_END\n" : "") .
+ ($oride && ($oride ne $prevoride) ? "OVERRIDE_REPLACE/$oride\n" : "") .
+ ($oride ? "override=\"$src\" " : "hide=") . "\"@$_[1]\"\n";
+ $prevoride = $oride;
+ }
+ }
+ WriteFile($ibyfile, ($ibyfile =~ /^>>([^>].*)$/ && -f($1) ? "" : "// Generated `$ibyfile'") .
+ "\n\n/* Custom override configuration\n" . join("\n", @ibyconf) . "\n*/\n$ibystr" .
+ ($oride ? "OVERRIDE_END\n" : ""), "", "q");
+}
+
+sub GenObyfile($$$$@)
+{
+ return if SkipICmd();
+
+ my ($ibyfile, $srcdir, $subdir, $finddir) = (GetAbsFname(shift()), shift(), shift(), shift());
+ my ($header, $footer, $body, %files) = ("", "", "", ());
+
+ foreach my $dir (split(/\s+/, $srcdir)) {
+ $dir = GetAbsDirname($dir);
+ my ($found, $total, $lines) = (0, 0, "");
+ my @param = @_;
+ while (@param) {
+ my ($filepat, $format, @lines) = (shift(@param), shift(@param), ());
+ $header = $format, next if $filepat =~ /^__header__$/i;
+ $footer = $format, next if $filepat =~ /^__footer__$/i;
+ foreach my $src (Find($dir, $filepat, "", $subdir, $finddir, $total)) {
+ next if $files{$src};
+ $files{$src} = 1;
+ (my $line = $format) =~ s/%1/$src/g;
+ $line =~ s/%2/GetRelFname($src, $dir, 1)/ge;
+ $line =~ s/%3/GetAbsFname($src)/ge;
+ if ($line =~ /%4/) {
+ my $attrib = "";
+ if ($gWinOS) {
+ Win32::File::GetAttributes($src, $attrib);
+ $attrib = (($attrib & WIN32_FILE_HIDDEN) ? "attrib=H" : "");
+ }
+ $line =~ s/%4/$attrib/ge;
+ }
+ push(@lines, Trim($line));
+ }
+ $found += @lines;
+ $lines .= "//\n// Format: `$format', " . @lines . ($finddir ? " empty directories" : " files") .
+ ": `$filepat'\n" . (@lines ? "//\n" . join("\n", @lines) . "\n" : "");
+ }
+ $body .= "\n// Collected entries $found/$total from directory `$dir'" .
+ ($subdir ? " and subdirectories" : "") . "\n$lines";
}
- #==========================================================================
+ my $append = ($ibyfile =~ s/^>>(?!>)// && -f($ibyfile) && ">>" || "");
+ (my $fname = "__" . uc(GetBasename($ibyfile)) . "__") =~ s/\W/_/g;
+ my @previby = ();
+
+ if ($append) {
+ OpenFile(*FILE, $ibyfile, 0) or die("Can't read file `$ibyfile'.\n"), return;
+ @previby = <FILE>;
+ close(FILE);
+ $previby[0] =~ s/(, collected )(\d+)( entries)$/$1.($2 + keys(%files)).$3/e;
+ $previby[@previby - 1] = "";
+ }
+ WriteFile($ibyfile, join("", @previby) . ($append ? "// Appended" : "// Generated") .
+ " `$append$ibyfile', collected " . keys(%files) . " entries\n" .
+ ($append ? "" : "\n#ifndef $fname\n#define $fname\n") .
+ ($header ? Unquote("\\n$header\\n") : "") . $body . ($footer ? Unquote("\\n$footer\\n") : "") .
+ "\n#endif // $fname\n", "", "q");
+}
+
+sub GenWidgetConf($$$$)
+{
+ return if SkipICmd();
+ my ($wgzini, $ini, $dir) = (shift(), GetAbsFname(shift()), GetAbsDirname(shift()));
+ my @ini = ($ini eq "" ? () : ReadFile($ini, 0));
+ my $files = ($dir eq "" ? "" : join("\n", Find($dir, "*", '/\/(?:' . join("|",
+ map(GetBasename($_), ($ini, map(!/^\s*[#[]/ && /^\s*(?:"(.+?)"|(\S+))/ &&
+ -e(local $_ = (defined($1) ? $1 : $2)) ? $_ : (), @ini)))) . ')$/i', 0, 0, local $_)));
+
+ WriteFile($wgzini, Unquote(shift()) .
+ (@ini ? "# Copied lines from `$ini':\n" . join("\n", @ini) : "") . "\n" .
+ ($files ? (@ini ? "\n" : "") . "# Collected files from `$dir':\n$files\n" : ""), "", "q");
+}
+
+
+###############################################################################
+#
+
+sub GenMakefile($$$$$)
+{
+ return if SkipICmd();
+ my ($hdrfile, $mkfile, $filter, $prepros, $assignop) =
+ (GetAbsFname(shift()), GetAbsFname(shift()), shift(), shift(), shift());
+ ChangeDir(GetDirname($hdrfile));
+ RunSystemCmd("$prepros " . GetBasename($hdrfile));
+ my $maxdef = Max(map(/^\s*\#define\s+($filter)/ && length($1), @gCmdoutbuf));
+ WriteFile($mkfile, join('\n',
+ map(/^\s*\#define\s+($filter)\s*(.*?)\s*$/ ? sprintf("%-${maxdef}s $assignop %s", $1, $2 eq "" ? 1 : $2) : (), sort(@gCmdoutbuf))) . '\n', "");
+}
+
+
+###############################################################################
+#
+
+sub AddImageHeader($$$$$)
+{
+ return if SkipICmd();
+ my ($file, $hdrfile, $hdrstr, $hdrsize, $align) =
+ (GetAbsFname(shift()), GetAbsFname(shift()), shift(), shift(), shift());
+
+ $hdrstr =~ s/\/\*.*?\*\///g;
+ $hdrstr =~ s/,\s*$//;
+ WriteFile($hdrfile, $hdrstr, "b");
+ die("Invalid image header size: " . sprintf("0x%X", -s($hdrfile)) . " (!=$hdrsize).\n"), return
+ if -s($hdrfile) ne hex($hdrsize);
+
+ $align = Max(hex($align), hex($hdrsize)) - hex($hdrsize);
+ WriteFile(">>$hdrfile", ("0," x ($align - 1)) . "0", "b") if $align;
+ Copy($file, ">>$hdrfile") if $file ne "";
+}
+
+
+###############################################################################
+#
- my ($opt_cmdfile, $opt_incdir, $opt_logfile, $opt_printcmd, $opt_step, $opt_verbose, $opt_workdir) =
- ( "", "", "", 0, "", 1, ".");
- Getopt::Long::GetOptions(
- "cmdfile=s" => \$opt_cmdfile,
- "incdir=s" => \$opt_incdir,
- "logfile=s" => \$opt_logfile,
- "printcmd" => \$opt_printcmd,
- "step=s" => \$opt_step,
- "verbose=s" => \$opt_verbose,
- "workdir=s" => \$opt_workdir,
- "<>" => sub { $error .= ($error ? ", `@_'" : "Unknown imaker.pl option: `@_'") });
+sub Sleep($)
+{
+ return if SkipICmd();
+ sleep(shift());
+}
+
+
+###############################################################################
+#
+
+sub FindSOSFiles($$$$)
+{
+ return if SkipICmd();
+
+ my ($dirs, $imgoby, $pluglog, $opt) = @_;
+ my ($file, %files) = ("", ());
+ local $_;
+
+ foreach my $dir (GlobFiles($dirs)) {
+ my ($featvar, @pluglog) = ("", Find($dir = GetAbsDirname($dir), $pluglog, "", 1, 0, $_));
+
+ foreach $file (@pluglog) {
+ OpenFile(*FILE, $file, 0) or warn("Can't read file `$file'.\n"), last;
+ while (<FILE>) {
+ last if !/^.+?\.pm: Initializing; /;
+ $featvar = $1, last if / feature variant = `(.+)'$/;
+ }
+ close(FILE);
+ last if ($featvar ne "");
+ }
- if ($opt_incdir) {
- my $bsf = ($opt_incdir =~ s/:bsf$//);
- print(map("$_\n", imaker::GetFeatvarIncdir($opt_incdir, $bsf)));
- exit;
+ foreach $file (Find($dir, $imgoby, "", 1, 0, $_)) {
+ OpenFile(*FILE, $file, 0) or warn("Can't read file `$file'.\n"), last;
+ while (<FILE>) {
+ next if ($_ !~ FILESPECSTATEMENT) && ($_ !~ BOOTBINARYSTATEMENT);
+ $file = GetAbsFname(defined($1) ? $1 : $2);
+ $files{lc($file)} = $file if !exists($files{lc($file)});
+ next if ($file !~ s/\.[0-9a-f]{32}\./\./i);
+ $file .= (-f("$file.$featvar.vmap") ? ".$featvar.vmap" : ".vmap");
+ $files{lc($file)} = $file if !exists($files{lc($file)});
+ }
+ close(FILE);
+ }
+
+ my ($incfile, $spifile, $plugfile, $patchfile) = (0, 0, 0, 0);
+ foreach $file (@pluglog) {
+ OpenFile(*FILE, $file, 0) or warn("Can't read file `$file'.\n"), last;
+ while (<FILE>) {
+ $incfile = 1, next if /^Finding include hierarchy from /;
+ $incfile = 0, next if ($incfile && /^Found \d+ different include files$/);
+ $spifile = 1, next if /^Finding SPI input files from /;
+ $spifile = 0, next if ($spifile && /^Found \d+ SPI input files$/);
+ $plugfile = 1, next if /^Reading (ROM|ROFS1|UDEB|UREL) files from /;
+ $plugfile = 0, next if ($plugfile && /^Found \d+ entries$/);
+ $patchfile = 1, next if /^Finding ROM-patched components$/;
+ $patchfile = 0, next if ($patchfile && /^Found \d+ ROM-patched components$/);
+ $files{lc($file)} = $file, next
+ if (($incfile || $spifile || $plugfile) && /`(.+)'$/ && !exists($files{lc($file = GetAbsFname($1))}));
+ next if (!$patchfile || !/^`(.+)'$/);
+ $file = GetAbsFname($1) . ".map";
+ $files{lc($file)} = $file, next if -f($file);
+ $file =~ s/(\..*?\.map)$/\.\*$1/;
+ foreach (glob($file =~ /\s/ ? "\"$file\"" : $file)) {
+ ($file = lc()) =~ s/\.map$//;
+ $files{lc()} = $_, last if exists($files{$file});
+ }
+ }
+ close(FILE);
+ }
+
+ $dir .= "/" if $dir !~ /\/$/;
+ foreach $file (keys(%files)) {
+ delete($files{$file}) if ($file =~ /^$dir/i);
+ }
}
- $opt_verbose = imaker::SetVerbose($opt_verbose);
+ @gFindresult = () if (!defined($opt) || $opt !~ /a/);
+ push(@gFindresult, values(%files));
+}
+
+
+###############################################################################
+#
+
+sub CheckTool(@)
+{
+ return if SkipICmd();
+ my ($maxtlen, $maxvlen, @tools) = (4, 9, ());
+ while (@_) {
+ my ($tool, $vquery, $getver, $version, $md5sum) = (shift(), shift(), shift(), " -", " ?");
+ if (length($vquery) > 1) {
+ RunSystemCmd($vquery, 3, 1);
+ $version = (join("\n", @gCmdoutbuf) =~ eval($getver =~ /^\// ? "qr$getver" : "qr/$getver/ims") ?
+ (defined($1) && defined($2) && "`$1 $2'" || defined($1) && "`$1'" || " ?") : " ?");
+ }
+ OpenFile(*FILE, $tool, 1) and $md5sum = "`" . md5_hex(<FILE>) . "'";
+ close(FILE);
+ $maxtlen = Max($maxtlen, length($tool));
+ $maxvlen = Max($maxvlen, length($version));
+ push(@tools, "`$tool'", $version, $md5sum);
+ }
+ $maxtlen += 2;
+ @_ = (" Tool", " Version", " MD5 Checksum", "-" x $maxtlen, "-" x $maxvlen, "-" x 34, @tools);
+ DPrint(1, sprintf("%-${maxtlen}s %-${maxvlen}s ", shift(), shift()) . shift() . "\n") while(@_);
+}
+
+
+###############################################################################
+#
+
+sub OpCacheInstall($$$)
+{
+ return if SkipICmd();
+ my ($ini, $conf, $tmpdir) = @_;
+ my %opt = (-e => "", -i => "", -m => "", -o => "", -u => "");
- imaker::DPrint(2, "=" x 79 . "\nTIME: " . localtime() . ", USER: " . getlogin() .
- ", HOST: " . ($ENV{HOSTNAME} || $ENV{COMPUTERNAME} || "?") . "\n$^X (v$perlver-$^O)\n");
+ foreach $conf ("opcache_config=$conf", ($ini ne "" ? grep(!/^\s*#/, ReadFile($ini, 0)) : ())) {
+ (local $_, my $error, my %tmpopt) = ($conf, 0, %opt);
+ if (!($error = !(s/^\s*opcache_config\s*[=\s]//i || s/^\s*opcache_content\s*[=\s]/-i /i))) {
+ my @opt = ParseCmdWords($_);
+ while (@opt) {
+ last if ($error = ((($_ = shift(@opt)) !~ /^-[eimou]$/i) ||
+ !defined($tmpopt{$_} = shift(@opt))));
+ $tmpopt{$_} =~ s/EPOCROOT/$gEpocroot/g;
+ }
+ }
+ die("OpCacheInstall: Invalid configuration entry: `$conf'\n"), next if $error;
+ %opt = %tmpopt;
+ }
+ if (-d($opt{-i})) {
+ $opt{-i} = GetAbsDirname($opt{-i});
+ } elsif (-f($opt{-i})) {
+ DeleteDir($tmpdir);
+ MakeDir($tmpdir);
+ RunSystemCmd("$gTool{unzip} x -y \"" . GetAbsFname($opt{-i}) . "\"" .
+ " -o\"" . ($tmpdir = GetAbsDirname($tmpdir)) . "\"", 0, 1);
+ $opt{-i} = $tmpdir;
+ }
+ RunSystemCmd("$gTool{opcache} -u \"$opt{-u}\" -e \"$opt{-e}\" -m \"" .
+ GetAbsFname($opt{-m}) . "\" -i \"$opt{-i}\" -o \"" . GetAbsDirname($opt{-o}) . "\"");
+}
+
+
+###############################################################################
+#
+
+sub SisInstall($$$$$$$$)
+{
+ return if SkipICmd();
+
+ my ($ini, $intini, $conf, $hda, $hdata, $idata, $outdir, $log) =
+ (GetAbsFname(shift()), GetAbsFname(shift()), shift(), GetAbsFname(shift()),
+ shift(), shift(), GetAbsDirname(shift()), shift());
+ my %gopt = (-d => "C", -k => "5.4", -w => "info", '--ignore-err' => 0);
- imaker::SetLogfile($opt_logfile);
- die("$error.\n") if $error;
+ my %haldata = ();
+ map { $haldata{uc($1)} = $2 if /^\s*(\S+)\s+(\S+)\s*$/ } split(/(?<!\\)\\n/, $hdata);
+ $gOutfilter = '\S';
+ RunSystemCmd("$gTool{cpp} -nostdinc -undef \"$hda\"", 1, 1, $log) if ($hda ne "");
+
+ local @_ = (map(!/^\s*E(\S+)\s*=\s*(\S+)\s*$/ ? () : (uc($1) . " = " .
+ (exists($haldata{uc($2)}) ? $haldata{uc($2)} : (exists($haldata{uc("E$1_$2")}) ?
+ $haldata{uc("E$1_$2")} : $2)) . "\n"), @gCmdoutbuf),
+ map(/^\s*$/ ? () : Trim($_) . "\n", split(/(?<!\\)\\n/, $idata)));
+
+ WriteFile($intini, join("", @_), "", "q");
+ RunSystemCmd("$gTool{interpretsis} -i \"$intini\"", 3, 1);
+ map { $_[$1 - 1] = undef if /Unsupported keyword.+?(\d+)/i } @gCmdoutbuf;
+ WriteFile($intini, join("", grep(defined(), @_)), "", "q");
+
+ my ($clean, @dir) = (0, Find($outdir, "*", "", 1, 1, $_));
+ @_ = ("sis_config=$conf", ($ini ne "" ? grep(!/^\s*#/, ReadFile($ini, 0)) : ()), "sis_content=");
+
+ for (my $i = 0; $i < @_; $i++) {
+ local $_ = $_[$i];
+ my ($error, $global, $runtool, %opt) = (0, 0, 0, %gopt);
+ if (!($error = !(s/^\s*sis_(config)\s*[=\s]//i || s/^\s*sis_(content)\s*[=\s]/-s /i))) {
+ $global = ($1 =~ /config/i);
+ my @opt = ParseCmdWords($_);
+ while (@opt) {
+ $_ = shift(@opt);
+ shift(@opt) if ((my $next = (@opt ? ($opt[0] !~ /^!?[-+]/ ? $opt[0] : "") : "")) ne "");
+ next if /^!?-[cilwx]$/;
+ if (s/^!//) { delete($opt{$_}) }
+ else {
+ $_[$#_] .= "\"$next\"", next if (!$i && /^-s$/);
+ ($opt{$_} = $next) =~ s/EPOCROOT/$gEpocroot/g;
+ $runtool = ($next !~ /^\s*$/) if /^-s$/;
+ }
+ }
+ }
+ die("SisInstall: Invalid configuration entry: `$_[$i]'\n"), next if $error;
+ %gopt = %opt if $global;
+ next if !$runtool;
- foreach (split(/-+/, $opt_step)) {
- $error .= ($error ? ", `$_'" : "Unknown imaker.pl step: `$_'")
- if (!/^\w+:?([cbk\d]+)?$/i) || $1 && ($1 =~ /c.*c|b.*b|k.*k|\d[^\d]+\d/i);
+ foreach (-d($opt{-s}) ? Find($opt{-s}, '/\.sisx?$/i', "", 0, 0, $_) : (GetAbsFname($opt{-s}))) {
+ ($opt{-s}, my $puid) = ($_, "?");
+ OpenFile(*SISFILE, $_, 1, "") and sysread(SISFILE, $puid, 3 * 4) and
+ $puid = sprintf("%08X", unpack("V", substr($puid, 8, 4)));
+ close(SISFILE);
+ DPrint(16, "SisInstall: `$_', pUID: $puid" . ($opt{'--ignore-err'} ? ", ignore errors\n" : "\n"));
+
+ my $icmd = $gTool{interpretsis} . (join("", map(($opt{$_} ne "" ? " $_ \"$opt{$_}\"" : " $_"),
+ sort({lc($a) cmp lc($b)} grep(/^-[^s]/ && !/^--ignore-err$/, keys(%opt)))))) .
+ " -c \"" . (GetAbsDirname($outdir)) . "\" -i \"" . (GetAbsFname($intini)) . "\"";
+ $error = RunSystemCmd("$icmd -s \"$opt{-s}\"" . join("", map(" $_",
+ sort({lc($a) cmp lc($b)} grep(/^\+/, keys(%opt))))), 1, 1, ">>$log");
+ my $errmsg = join(" | ", grep(s/^ERR\s*:\s*//, @gCmdoutbuf));
+
+ $_ = join(", ", map(/^INFO:\s+Installing file:\s+\w:\\sys\\bin\\(.+?.exe)\s*$/io &&
+ ($_ = $1) && (qx($gTool{elf2e32} --dump=h --e32input "$outdir/sys/bin/$_") =~
+ /^Uids:\s+.+?\s+([0-9a-f]+)\s+\(/imo) ? "$_: " . uc($1) : (), @gCmdoutbuf));
+ DPrint(16, "SisInstall: `" . GetBasename($opt{-s}) . "', exe UIDs: $_\n")
+ if ($_ && (!($error ||= $errmsg) || $opt{'--ignore-err'}));
+
+ warn("Installation of SIS file `$opt{-s}' failed" . ($errmsg ? ": `$errmsg'.\n" : ".\n"))
+ if ($gErrwarn = $error);
+ next if (!$error || $opt{'--ignore-err'});
+ $clean = 1;
+ warn("Removing installation of SIS file `$opt{-s}'.\n");
+ RunSystemCmd("$icmd -x $puid", 3, 1, ">>$log");
+ }
}
- die("$error.\n") if $error;
+ return if !$clean;
+ my $i = 0;
+ foreach (Find($outdir, "*", "", 1, 1, $_)) {
+ if (($i <= $#dir) && ($_ eq $dir[$i])) { $i++ }
+ else { DeleteDir($_) }
+ }
+}
+
+
+###############################################################################
+#
+
+sub GetIPar(;$)
+{
+ my $par = shift(@gIcmd);
+ $par = ((my $empty = !defined($par)) ? "<UNDEFINED>" : PEval($par));
+ $gParamcnt = 0 if shift();
+ DPrint(32, "iPar: $gParamcnt. `$par'\n") if $gParamcnt && ($gICmd =~ $gFiltercmd);
+ $gParamcnt++;
+ return($empty ? undef : $par);
+}
- imaker::SetWorkdir($opt_workdir);
- imaker::ReadICmdFile($opt_cmdfile);
+sub PEval($)
+{
+ local $_ = shift();
+ while (/\@PEVAL{.*}LAVEP\@/) {
+ my $start = rindex($_, '@PEVAL{', my $end = index($_, '}LAVEP@') + 7);
+ my ($expr, $eval, $evalerr) = (substr($_, $start + 7, $end - $start - 14), undef, "");
+ eval {
+ local $_;
+ local $gEvalerr = (SkipICmd() ? 1 : 2);
+ $eval = eval($expr);
+ ($evalerr = $@) =~ s/^(.+?) at .*/$1/s;
+ };
+# DPrint(64, "PEval: Evaluate `$expr' = `" . (defined($eval) ? $eval : "") . "'\n");
+ if (!defined($eval)) {
+ $eval = "";
+ warn("PEval: Evaluation of `$expr' failed: $evalerr.\n") if !SkipICmd();
+ }
+ substr($_, $start, $end - $start) = $eval;
+ }
+ return($_);
+}
+
+sub PeekICmd($)
+{
+ return(defined($gIcmd[0]) && $gIcmd[0] =~ /^$_[0]$/i);
+}
+
+sub SkipICmd()
+{
+ return($gPrintcmd || defined($gICmd) && ($gICmd !~ $gFiltercmd));
+}
- my (@step, @stepdur) = (split(/-+/, lc($opt_step)), ());
- my ($durstr, $maxslen, $maxdlen) = ("", 6, 8);
+sub GetICmd()
+{
+ $gICmd = GetIPar(1);
+ DPrint(32, "iCmd: " . ++$gCmdcnt . ". `$gICmd'\n") if defined($gICmd) && ($gICmd ne "") && ($gICmd =~ $gFiltercmd);
+}
+
+sub EndICmd()
+{
+ GetICmd(), return(1) if !defined($gIcmd[0]) || PeekICmd("end");
+ return(0);
+}
+
+
+###############################################################################
+#
+
+sub SplitStep($)
+{
+ (my $step = shift()) =~ s/(?<!(\\|\s))\|/ \|/g; # ???
+ return(map((s/^\s+|(?<!\\)\s+$//g, s/\\\|/\|/g) ? $_ : $_, split(/(?<!\\)\|/, "$step ")));
+}
+
+sub RunStep($)
+{
+ ($gStep, my $dur, @gStepDur) = (shift(), time(), ());
+ ChangeDir($gWorkdir);
+ DPrint(2, "=" x 79 . "\nENTER: `$gStep'\n");
+
+ push(@gReport, $gLogfile ? ("iMaker log", $gLogfile =~ /^>>?([^>].*)$/ ? $1 : $gLogfile, "f") : (),
+ SplitStep($gStepIcmd{"REPORT_$gStep"})) if exists($gStepIcmd{"REPORT_$gStep"});
+
+ foreach my $step ("INIT_$gStep", "CLEAN_$gStep", "BUILD_$gStep") {
+ next if (!exists($gStepIcmd{$step}) || $gStepIcmd{$step} =~ /^\s*$/);
+ DPrint(64, "$step = `$gStepIcmd{$step}'\n");
+ @gIcmd = SplitStep($gStepIcmd{$step});
+ my ($file, $iferror, @iffi) = ("", 0, ());
- foreach my $stepnum (0 .. $#step) {
- $step[$stepnum] =~ /^(\w+):?([cbk\d]+)?$/;
- my $step = uc($1);
- $_ = (defined($2) ? $2 : "");
- my @dur = imaker::MakeStep($step, /c/, /b/, /k/, /(\d+)/ ? $1 : $opt_verbose, $opt_printcmd);
- imaker::SetVerbose($opt_verbose);
- my ($cmddur, $stepdur) = (0, pop(@dur));
- $durstr = imaker::Sec2Min($stepdur);
- if (@dur) {
- $durstr .= " (";
- foreach my $dur (@dur) {
- $cmddur += $dur;
- $durstr .= imaker::Sec2Min($dur) . " + ";
+ while (GetICmd(), defined($gICmd)) {
+ next if (local $_ = lc($gICmd)) eq "";
+ if (/^if$/) {
+ push(@iffi, (my $if = GetIPar()), $gFiltercmd);
+ $gFiltercmd = qr/^X$/ if !$if;
+ }
+ elsif (/^else$/) {
+ $gFiltercmd = ($iffi[$#iffi - 1] ? qr/^X$/ : $iffi[$#iffi]);
+ }
+ elsif (/^fi$/) {
+ $gFiltercmd = pop(@iffi);
+ pop(@iffi);
+ }
+ elsif (/^(error|warning)$/) {
+ my ($errwarn, $msg) = (GetIPar(), GetIPar() . "\n");
+ next if SkipICmd();
+ die($msg) if $errwarn && /e/;
+ warn($msg) if $errwarn && /w/;
+ }
+ elsif (/^echo(\d+)?(-q)?$/) {
+ Echo((defined($1) && ($1 < 128) ? $1 : 1), GetIPar(), defined($2));
+ }
+ elsif (/^filter$/) {
+ $gOutfilter = GetIPar();
+ }
+ elsif (/^cmd(tee)?(-(k[0123]?|n)+)?$/) {
+ RunSystemCmd(GetIPar(), (/k(\d)/ ? int($1) : (/k/ ? 1 : 0)), /n/, /tee/ ? GetIPar() : "");
+ }
+ elsif (/^parse(f)?(?:-(\d+))?$/) {
+ ParseSystemCmd(GetIPar(), GetIPar(), GetIPar(), $1, $2);
+ }
+ elsif (/^(cd|copy(dir|iby)?|del(dir)?|find(dir)?(-[afr]+)?|headb|logfile|mkcd|mkdir|move|tailb|test|touch|type[bu]?|unzip|workdir|write[bu]?(-[cq]+)?|zip(dir)?(-[jq]+)?)$/) {
+ my @files = GlobFiles(GetIPar());
+ my $par1 = GetIPar() if /^(?:copy|find|head|move|tail|touch|(un)?zip|write)/;
+ my $par2 = GetIPar() if /^(?:find|head|tail|zip)/;
+ next if SkipICmd();
+ @gFindresult = () if /find(?:dir)?(-[afr]+)?/ && (!defined($1) || ($1 !~ /a/));
+ Touch($par1, @files), next if /touch/;
+ foreach $file (@files) {
+ ChangeDir($file) if /^cd/;
+ DeleteDir($file) if /deldir/;
+ FindDir($file, $par1, $par2, $1) if /finddir(-[ar]+)?/;
+ MakeDir($file) if /mkdir/;
+ MakeChangeDir($file) if /mkcd/;
+ SetWorkdir($file) if /workdir/;
+ Zip($file, 1, $1, $par2, GlobFiles($par1)) if /zipdir(-[jq]+)?/;
+ DeleteFile($file) if /del/;
+ FindFile($file, $par1, $par2, $1) if /find(-[afr]+)?$/;
+ HeadFile($file, $par1, $par2) if /headb/;
+ SetLogfile($file) if /logfile/;
+ TailFile($file, $par1, $par2) if /tailb/;
+ TypeFile($file, $1) if /type(b|u)?/;
+ UnzipFile($file, $par1) if /unzip/;
+ WriteFile($file, $par1, $1, $2) if /write(b|u)?(-[cq]+)?/;
+ Zip($file, 0, $1, $par2, GlobFiles($par1)) if /^zip(-[jq]+)?$/;
+ Copy($file, $par1, $1) if /copy(dir)?$/;
+ CopyIby($file, $par1) if /copyiby/;
+ Move($file, $par1) if /move/;
+ Test($file) if /test/;
+ }
+ }
+ elsif (/^filtercmd$/) {
+ $gFiltercmd = GetIPar();
+ $gFiltercmd = ($gFiltercmd eq "" ? qr/\S/ : qr/$gFiltercmd/i);
+ }
+ elsif (/^genexclst$/) {
+ GenExclfile(GetIPar(), GetIPar(), GetIPar(), GetIPar(), GetIPar());
+ }
+ elsif (/^geniby(-[dr]+)?$/) {
+ my ($opt, $iby, $dir, @par) = ($1 || "", GetIPar(), GetIPar(), ());
+ push(@par, GetIPar(), GetIPar()) while !EndICmd();
+ GenObyfile($iby, $dir, $opt =~ /r/, $opt =~ /d/ ? 2 : 0, @par);
+ }
+ elsif (/^genorideiby$/) {
+ GenIbyfile(GetIPar(), GetIPar(), GetIPar());
+ }
+ elsif (/^genmk$/) {
+ GenMakefile(GetIPar(), GetIPar(), GetIPar(), GetIPar(), GetIPar());
+ }
+ elsif (/^genwgzcfg$/) {
+ GenWidgetConf(GetIPar(), GetIPar(), GetIPar(), GetIPar());
+ }
+ elsif (/^iferror$/) {
+ $iferror++;
+ $gError = 0, next if $gError;
+ while (defined($gIcmd[0])) {
+ GetICmd(), last if PeekICmd("endif") && !--$iferror;
+ $iferror++ if shift(@gIcmd) =~ /^iferror$/i;
+ }
+ }
+ elsif (/^endif$/ && $iferror--) {
+ }
+ elsif (/^imghdr$/) {
+ AddImageHeader(GetIPar(), GetIPar(), GetIPar(), GetIPar(), GetIPar());
+ }
+ elsif (/^pause$/) {
+ DPrint(0, "Press Enter to continue...\n");
+ getc();
+ }
+ elsif (/^sleep$/) {
+ Sleep(GetIPar());
+ }
+ elsif (/^sosfind(-a)?$/) {
+ my $opt = $1;
+ FindSOSFiles(GetIPar(), GetIPar(), GetIPar(), $opt);
+ }
+ elsif (/^tool-(\w+)$/) {
+ $gTool{$1} = GetIPar();
+# DPrint(2, "SetTool: $1: `$gTool{$1}'\n");
+ }
+ elsif (/^toolchk$/) {
+ my @tools = ();
+ push(@tools, GetIPar(), GetIPar(), GetIPar()) while !EndICmd();
+ CheckTool(@tools);
+ }
+ elsif (/^opcache$/) {
+ OpCacheInstall(GetIPar(), GetIPar(), GetIPar());
+ }
+ elsif (/^sisinst$/) {
+ SisInstall(GetIPar(), GetIPar(), GetIPar(), GetIPar(),
+ GetIPar(), GetIPar(), GetIPar(), GetIPar());
+ }
+ elsif (!$gImakerext || !RunIExtCmd($_)) {
+ die("Unknown iMaker command `$gICmd'.\n");
}
- $durstr .= imaker::Sec2Min($stepdur - $cmddur) . ")";
+ }
+ }
+ DPrint(2, "EXIT: `$gStep', duration: " . Sec2Min($dur = time() - $dur) . "\n");
+ push(@gStepDur, $dur);
+}
+
+
+###############################################################################
+#
+
+sub GetConfmkList(;$)
+{
+ if (!%gConfmkList) {
+ my ($dir, $incl, $excl, $depth) = split(/,/, $ENV{IMAKER_MKCONF});
+ $dir = GetAbsDirname($dir, 0, 1, $gEpocdrive);
+ ($incl, $excl) = (qr/$incl/, qr/$excl/);
+ local $_;
+ DPrint(16, "FindFile: GetConfmkList: `$ENV{IMAKER_MKCONF}'");
+ find(sub { $gConfmkList{$1} = $File::Find::name
+ if (/$incl/ && !/$excl/ && (($File::Find::name =~ tr/\///) > (($dir =~ tr/\///) + $depth)));
+ }, $dir);
+ DPrint(16, ", found " . keys(%gConfmkList) . " files\n");
+ $gConfmkList{""} = "" if !%gConfmkList;
+ }
+ return(sort({lc($a) cmp lc($b)} grep($_ ne "", values(%gConfmkList)))) if shift();
+}
+
+sub GetFeatvarIncdir($)
+{
+ open(FILE, "$gEpocroot/epoc32/tools/variant/" . shift() . ".var") or
+ return("Invalid SBV feature variant");
+ my @featdata = <FILE>;
+ close(FILE);
+ my @incdir = ("@featdata" =~ /^\s*EXTENDS\s+(.+?)\s*$/m ? GetFeatvarIncdir($1) : ());
+ @incdir = () if ("@incdir" =~ /^Invalid/);
+ foreach (@featdata) {
+ next if !/^\s*ROM_INCLUDE\s+(\S+)\s+(.+?)\s*$/;
+ if ($1 eq "set") { @incdir = ($2) }
+ elsif ($1 eq "prepend") { unshift(@incdir, $2) }
+ elsif ($1 eq "append") { push(@incdir, $2) }
+ }
+ return(map("$_/" =~ /^$gEpocroot\// ? $_ : $gEpocroot . PathConv($_, 0, 1, $gEpocdrive),
+ map(PathConv($_, 0, 0, $gEpocdrive), @incdir)));
+}
+
+
+###############################################################################
+#
+
+sub SetVerbose($;$)
+{
+ my $verbose = Trim(shift());
+ $verbose = 127 if $verbose =~ /^debug$/i;
+ $gVerbose = int($1), return if ($verbose =~ /^(\d+)$/) && ($1 < 128);
+ $gVerbose = 1;
+ warn("Verbose level `$verbose' is not integer between 0 - 127\n") if !shift();
+}
+
+sub CloseLog()
+{
+ close(LOG) if $gLogfile;
+ $gLogfile = "";
+}
+
+
+###############################################################################
+#
+
+sub RunIMakerCmd($$$$$@)
+{
+ my ($makecmd, $cmdarg, $tgtext, $mklevel, $skipsteps, %prevtgt) = @_;
+ $ENV{IMAKER_MKLEVEL} = $mklevel;
+
+ ($cmdarg, my $hptgt, my @targets) = HandleCmdArg($cmdarg);
+
+ foreach my $tgt (@targets) {
+ my $skipstep = ($tgt =~ s/#$//) || $skipsteps;
+ (my $target = "$tgt$tgtext") =~ s/(\[\d+\])(.+)$/$2$1/;
+ if ($target eq "menu") {
+ ($cmdarg, $target) = Menu($cmdarg);
+ next if ($target eq "menu");
+ ($cmdarg) = HandleCmdArg($cmdarg);
}
- $step = sprintf("%" . length(@step."") . "s", $stepnum + 1) . ". $step";
- push(@stepdur, $step, $durstr);
- $maxslen = imaker::Max($maxslen, length($step));
- $maxdlen = imaker::Max($maxdlen, length($durstr));
+ $prevtgt{$target =~ /^([^-]+)/ ? $1 : $target} = 1;
+ push(@gReport, Trim((($target !~ /^(.+)\[\d+\]$/) || ($gVerbose & 64) ? $target : $1) .
+ ($skipstep ? "#" : "") . " $hptgt"), -1, -$mklevel - 1);
+ my $tgtind = $#gReport;
+ my @targets = RunMakeCmd("$makecmd $cmdarg" . ($target eq "defaultgoals" ? "" : " \"$target\"") .
+ join("", map(" \"$_\"", split(/\s+/, $hptgt))), $skipstep);
+ $gReport[$tgtind - 2] .= " (intermediate)" if @targets;
+ $gReport[$tgtind - 1] = pop(@gStepDur);
+ $gReport[$tgtind] = $mklevel + 1 if !$gError;
+ delete(@gReport[$tgtind - 2 .. $tgtind]) if (@targets && !$gError && !($gVerbose & 64));
+ map {
+ RunIMakerCmd($makecmd, "$cmdarg $_ $hptgt", $target =~ /(-.*)$/ ? $1 : "", $mklevel + 1, $skipstep, %prevtgt)
+ if !exists($prevtgt{$_});
+ } @targets;
+ }
+}
+
+sub RunMakeCmd($$)
+{
+ ($gStartmk, $gMakecmd, $gError) = (time(), Trim(shift()), 0);
+ my ($skipstep, $mkstart, $start, $restart, $cwd, %env) = (shift(), 0, 0, 0, Cwd::cwd(), %ENV);
+ my @stepdur = my @targets = ();
+ $ENV{IMAKER_MKRESTARTS} = -1;
+
+ do {
+ InitMkglobals();
+ ($gTgterr, my $printvar, my @steps) = (1, "", ());
+ $ENV{IMAKER_MKRESTARTS}++;
+
+ if ($gExportvar{""}) {
+ if (!$ENV{IMAKER_EXPORTMK}) {
+ (my $tmpfh, $ENV{IMAKER_EXPORTMK}) = File::Temp::tempfile(
+ File::Spec->tmpdir() . "/imaker_temp_XXXXXXXX", SUFFIX => ".mk", UNLINK => 1);
+ close($tmpfh);
+ $ENV{IMAKER_EXPORTMK} =~ tr-\\-\/-;
+ }
+ WriteFile($ENV{IMAKER_EXPORTMK}, "# Generated temporary makefile `$ENV{IMAKER_EXPORTMK}'\n" .
+ "ifndef __IMAKER_EXPORTMK__\n__IMAKER_EXPORTMK__ := 1\n" .
+ join("", map(/^([^:]+)(?:\:(.+))?$/ && !defined($2) ? "$1=$gExportvar{$_}\n" :
+ "ifeq (\$(filter $1,\$(TARGETNAME)),)\n$2=$gExportvar{$_}\nendif\n",
+ sort({($a =~ /([^:]+)$/ && uc($1)) cmp ($b =~ /([^:]+)$/ && uc($1))}
+ grep(!/^(?:|.*[+:?])$/, keys(%gExportvar))))) .
+ "else\n" .
+ join("", map(/^\d{3}(.+[+:?])$/ ? "$1=$gExportvar{$_}\n" : (), sort({$a cmp $b} keys(%gExportvar)))) .
+ "endif # __IMAKER_EXPORTMK__\n", "", "q", 1);
+ $gExportvar{""} = 0;
+ }
+
+ open(MCMD, "$gMakecmd 2>&1 |");
+ while (local $_ = <MCMD>) {
+ chomp();
+ DPrint(1, "$_\n"), next if !s/^#iMaker\x1E//;
+# DPrint(64, "#iMaker#$_\n");
+
+ if (/^BEGIN$/) {
+ $mkstart = time();
+ $start = $mkstart if !$start;
+ next;
+ }
+ if (/^STEPS=(.*)$/) {
+ my $steps = $1;
+ @steps = split(/\s+/, $steps), next if ($steps !~ s/^target://);
+ @targets = grep($_ ne "", map(Trim($_), split(/(?<!\\)\|/, $steps)));
+ next;
+ }
+ $gImgtype = $1, next if /^IMAGE_TYPE=(.*)$/;
+ $gKeepgoing = $1, next if /^KEEPGOING=(.*)$/;
+ $gPrintcmd = $1, next if /^PRINTCMD=(.*)$/;
+ SetVerbose($1), next if /^VERBOSE=(.*)$/;
+ $gStepIcmd{$1} = $2, next if /^((?:BUILD|CLEAN|INIT|REPORT)_\S+?)=(.*)$/;
+
+ if (/^env (\S+?)=(.*)$/) {
+ DPrint(64, "$1 = `" . ($ENV{$1} = $2) . "'\n")
+ if (!defined($ENV{$1}) || ($ENV{$1} ne $2));
+ next;
+ }
+ if (/^var (\S+?)=(.*)$/) {
+ my ($var, $val) = ($1, $2);
+ my $upd = ($var !~ s/\?$//);
+ $gExportvar{$var} = $val, $gExportvar{""}++
+ if (!exists($gExportvar{$var}) || ($upd && $gExportvar{$var} ne $val));
+ next;
+ }
+ if (/^print (\d+) (\S+?)=(.*)$/) {
+ $printvar = ("=" x 79) . sprintf("\n%-$1s = `$gMakecmd'\n", "Make command") if ($printvar eq "");
+ $printvar .= sprintf("%-$1s = `$3'\n", $2);
+ next;
+ }
+
+ push(@stepdur, [$restart ? "ReMake" : "Make", Sec2Min(time() - $mkstart)]) if /^END$/;
+ PrintEnv(2);
+ DPrint(2, $printvar);
+ die("Unknown iMaker entry: `$_'\n"), next if !/^END$/;
+
+ pop(@steps) if ($restart = (@steps && $steps[$#steps] eq "RESTART"));
+ my $durstr = "";
+ foreach my $step (@steps) {
+ next if $skipstep;
+ RunStep($step);
+ my ($cmddur, $stepdur) = (0, pop(@gStepDur));
+ $durstr = Sec2Min($stepdur);
+ if (@gStepDur) {
+ $durstr .= " (";
+ foreach my $dur (@gStepDur) {
+ $cmddur += $dur;
+ $durstr .= Sec2Min($dur) . " + ";
+ }
+ $durstr .= Sec2Min($stepdur - $cmddur) . ")";
+ }
+ push(@stepdur, [$step, $durstr]);
+ }
+
+ $printvar = "";
+ my @env = ($ENV{IMAKER_EXPORTMK}, $ENV{IMAKER_MKRESTARTS});
+ %ENV = %env;
+ ($ENV{IMAKER_EXPORTMK}, $ENV{IMAKER_MKRESTARTS}) = @env;
+ InitMkglobals();
+ ChangeDir($cwd);
+
+ last if $restart;
+
+ my ($maxilen, $maxslen, $maxdlen) = (length(@stepdur . ""),
+ Max(map(length(@$_[0]), @stepdur)), Max(8, map(length(@$_[1]), @stepdur)));
+ DPrint(2, "=" x 79 . "\nStep" . " " x ($maxilen + $maxslen - 1) . "Duration\n" .
+ "=" x ($maxilen + $maxslen + 2) . " " . "=" x $maxdlen . "\n",
+ map(sprintf("%${maxilen}s. %-${maxslen}s", $_ + 1, $stepdur[$_][0]) .
+ " $stepdur[$_][1]\n", 0 .. $#stepdur),
+ "-" x ($maxilen + $maxslen + 2) . " " . "-" x $maxdlen . "\n" .
+ "Total" . " " x ($maxilen + $maxslen - 2) . Sec2Min(time() - $start) . "\n");
+ ($start, @stepdur) = (time(), ());
+ }
+ close(MCMD);
+ die("\n") if ($? >> 8);
+ die("Command `$gMakecmd' failed in `" . GetAbsDirname(".") . "'.\n") if ($gTgterr = $gError);
+ CloseLog();
+ } until !$restart;
+ push(@gStepDur, time() - $gStartmk);
+ return(@targets);
+}
+
+
+###############################################################################
+#
+
+sub HandleCmdArg($)
+{
+ my $cmdarg = shift();
+ my $origarg = $cmdarg = (defined($cmdarg) ? $cmdarg : "");
+
+ my @cmdout = qx($ENV{PERL} -x $0 --splitarg $cmdarg);
+ die("Can't parse Make arguments: `$cmdarg'.\n") if $?;
+
+ map {
+ chomp();
+ s/ /\x1E/g;
+ s/\"/\\\"/g;
+ s/(\\+)$/$1$1/;
+ } @cmdout;
+ $cmdarg = " " . join(" ", @cmdout) . " ";
+
+ if ($cmdarg =~ /^.* VERBOSE\x1E*=(\S*) /) {
+ (my $verbose = $1) =~ s/\x1E/ /g;
+ SetVerbose($verbose, 1);
}
- imaker::DPrint(2, "=" x 79 . "\n");
- @stepdur = ("Step", "Duration", "=" x $maxslen, "=" x $maxdlen, @stepdur,
- "-" x $maxslen, "-" x $maxdlen, "Total", imaker::Sec2Min(time() - $start));
- imaker::DPrint(2, sprintf("%-${maxslen}s %-${maxdlen}s ", shift(@stepdur), shift(@stepdur)) . "\n")
- while(@stepdur);
+ if ($cmdarg =~ /\s+--?conf=(\S*)\s+/) {
+ (my $prj = $1) =~ /(.*?)(?:;(.*))?$/;
+ ($prj, my $conf) = ($1, defined($2) ? $2 : "");
+ $cmdarg =~ s/\s+--?conf=\S*\s+/ USE_CONE=mk CONE_PRJ=$prj CONE_CONF=$conf cone-pre defaultgoals /;
+ }
+
+ $cmdarg = " " . HandleExtCmdArg($cmdarg) . " " if $gImakerext;
+
+ $gMakecmd = "$ENV{IMAKER_MAKE} -f $0" . join("", map(" \"$_\"", split(/\s+/, Trim($cmdarg))));
+ warn("Can't parse Make targets.\n")
+ if (!(my $targets = (qx($gMakecmd 2>&1) =~ /\|MAKECMDGOALS=(.*?)\|/ ? " $1 " : "")) &&
+ ($cmdarg !~ /\s-(?:-?v(?:ersion?|ersi?|er?)?|versio\S+)\s/));
+
+ GetConfmkList() if
+ grep(!/^(help(-.+)?|print-.+)$/ || /^help-config$/, my @targets = split(/\s+/, Trim($targets)));
+
+ my ($mkfile, $mkfiles, $hptgt) = ("", "", "");
+ map {
+ $cmdarg =~ s/\s+\Q$_\E\s+/ /;
+ if (exists($gConfmkList{$_})) {
+ ($mkfile = $gConfmkList{$_}) =~ s/ /\x1E/g;
+ $mkfiles .= " -f $mkfile";
+ $targets =~ s/\s+\Q$_\E\s+/ /;
+ }
+ } @targets;
+ $cmdarg = "$mkfiles$cmdarg";
+
+ map { $targets =~ s/\s\Q$_\E\s/ /; $hptgt .= " $_" }
+ grep(/^help-.+$/ && !/^help-config$/, @targets);
+ map { $targets =~ s/\s\Q$_\E\s/ /; $hptgt .= " $_" }
+ grep(/^print-.+$/, @targets);
+ $hptgt = Trim($hptgt);
- imaker::CloseLog();
+ if ($targets =~ s/ default(?= )//g) {
+ ($targets = Trim($targets)) =~ s/ /\x1E/g;
+ $cmdarg .= "TARGET_DEFAULT=$targets" if ($targets ne "");
+ $targets = "default";
+ }
+ @targets = ("defaultgoals@targets") if
+ !(@targets = map(s/\x1E/ /g ? $_ : $_, split(/\s+/, Trim($targets)))) || ("@targets" eq "#");
+
+ $mkfiles = "";
+ while ($cmdarg =~ s/\s+(-f\s?|--(?:file?|fi?|makefile?|makefi?|make?)[=\s]|IMAKER_CONFMK\x1E*=)(\S+)\s+/ /) {
+ $mkfile = $2;
+ ($mkfile = GetAbsFname(scalar($mkfile =~ s/\x1E/ /g, $mkfile))) =~ s/ /\\\x1E/g
+ if ($1 !~ /^IMAKER_CONFMK/);
+ $mkfiles .= ($mkfiles eq "" ? "" : chr(0x1E)) . $mkfile;
+ }
+ while ($cmdarg =~ s/\s+(\S+?)\x1E*([+:?])=\x1E*(\S+?)\s+/ /) {
+ ($gExportvar{sprintf("%03s", ++$gExportvar{""}) . "$1$2"} = $3) =~ s/\x1E/ /g;
+ }
+ $cmdarg = join(" ", map(scalar(s/\x1E/ /g, "\"$_\""), split(/\s+/, Trim($cmdarg .
+ ($mkfiles eq "" && ($ENV{IMAKER_MKLEVEL} || grep(/^default$/, @targets)) ? "" : " IMAKER_CONFMK=$mkfiles")))));
+
+ DPrint(2, "HandleCmdArg: `$origarg' => `$cmdarg', `" . join(" ", @targets) . "', `$hptgt'\n");
+ return($cmdarg, $hptgt, @targets);
+}
+
+
+###############################################################################
+#
+
+sub MenuRuncmd($)
+{
+ $ENV{IMAKER_CMDARG} = shift();
+ return(map(chomp() ? $_ : $_, qx($ENV{PERL} -x $0 2>&1)));
}
+sub Menu($)
+{
+ (my $cmdarg = " " . shift() . " ") =~ s/\s+"IMAKER_CONFMK="\s+/ /;
+ my ($prodind, $product, @product) = (0, "", ());
+ my ($tgtind, $target, $tgtcols, $tgtrows, @target) = (0, "", 4, 0, ());
+ my ($vartype, $varudeb, $varsym);
+ my $cfgfile = "./imaker_menu.cfg";
+
+ $cmdarg = ($cmdarg =~ /^\s*$/ ? "" : " " . Trim($cmdarg));
+ open(FILE, "<$cfgfile") and
+ (($prodind, $tgtind, $vartype, $varudeb, $varsym) = map(chomp() ? $_ : $_, <FILE>)) and close(FILE);
+ ($prodind, $tgtind, $vartype, $varudeb, $varsym) =
+ ($prodind || 0, $tgtind || 0, $vartype || "rnd", $varudeb || 0, $varsym || 0);
+
+ while (1) {
+ print("\nPRODUCTS\n--------\n");
+ #
+ if (!@product) {
+ @product = sort({lc($a) cmp lc($b)} grep($_ ne "", keys(%gConfmkList)));
+ $prodind = 0 if ($prodind > @product);
+ }
+ $product = ($prodind ? " $product[$prodind - 1]" : "");
+ my $maxlen = Max(map(length($_), @product));
+ map {
+ printf(" %" . (length(@product)) . "s) %-${maxlen}s %s\n", $_ + 1, $product[$_], $gConfmkList{$product[$_]});
+ } (0 .. $#product);
+ print(" NO PRODUCTS FOUND!\n") if !@product;
+
+ print("\nTARGETS\n-------\n");
+ #
+ if (!@target) {
+ @target = grep(s/^== (.+) ==$/$1/, MenuRuncmd("$product PRINTCMD=0 VERBOSE=1 help-target-*-wiki"));
+ $tgtind = 0 if ($tgtind > @target);
+ $tgtrows = int($#target / $tgtcols + 1);
+ my $maxind = 0;
+ map {
+ if (!($_ % $tgtrows)) {
+ $maxind = length(Min($_ + $tgtrows, $#target + 1)) + 1;
+ $maxlen = Max(map(length(), @target[$_ .. Min($_ + $tgtrows - 1, $#target)]));
+ }
+ $target[$_] = sprintf("%${maxind}s) %-${maxlen}s", "t" . ($_ + 1), $target[$_]);
+ } (0 .. $#target);
+ }
+ ($target = ($tgtind ? $target[$tgtind - 1] : "")) =~ s/^.+?(\S+)\s*$/$1/;
+ foreach my $row (1 .. $tgtrows) {
+ foreach my $col (1 .. $tgtcols) {
+ my $ind = ($col - 1) * $tgtrows + $row - 1;
+ print(($ind < @target ? " $target[$ind]" : "") . ($col != $tgtcols ? " " : "\n"));
+ }
+ }
+ print(" NO TARGETS FOUND!\n") if !@target;
+
+ print("\nCONFIGURATION\n-------------\n");
+ #
+ print(
+ " Product: " . ($prodind ? $product[$prodind - 1] : "NOT SELECTED!") . "\n" .
+ " Target : " . ($tgtind ? $target : "NOT SELECTED!") . "\n" .
+ " Type : " . ucfirst($vartype) . "\n" .
+ " Debug : " . ($varudeb ? ($varudeb =~ /full/i ? "Full debug" : "Enabled") : "Disabled") . "\n" .
+ " Symbols: " . ($varsym ? "Created\n" : "Not created\n"));
+
+ print("\nOPTIONS\n-------\n");
+ #
+ print(
+ " t) Toggle type between rnd/prd/subcon\n" .
+ " u) Toggle debug between urel/udeb/udeb full\n" .
+ " s) Toggle symbol creation on/off\n" .
+ " r) Reset configuration\n" .
+ " h) Print usage information\n" .
+ " x) Exit\n\n" .
+ "Hit Enter to run: imaker$product$cmdarg TYPE=$vartype USE_UDEB=$varudeb USE_SYMGEN=$varsym $target\n");
+
+ print("\nSelection: ");
+ #
+ my $input = <STDIN>;
+ ($input = (defined($input) ? $input : "?")) =~ s/^\s*(.*?)\s*$/\L$1\E/;
+
+ if ($input =~ /^(\d+)$/ && ($1 > 0) && ($1 <= @product) && ($1 != $prodind)) {
+ $prodind = $1;
+ ($tgtind, @target) = (0, ());
+ }
+ elsif ($input =~ /^t(\d+)$/ && ($1 > 0) && ($1 <= @target) && ($1 != $tgtind)) {
+ $tgtind = $1;
+ }
+ elsif ($input eq "t") {
+ $vartype = ($vartype =~ /rnd/i ? "prd" : ($vartype =~ /prd/i ? "subcon" : "rnd"));
+ }
+ elsif ($input eq "u") {
+ $varudeb = (!$varudeb ? 1 : ($varudeb !~ /full/i ? "full" : 0));
+ }
+ elsif ($input eq "s") {
+ $varsym = ($varsym ? 0 : 1);
+ }
+ elsif ($input eq "r") {
+ ($prodind, @product) = (0, ());
+ ($tgtind, @target) = (0, ());
+ ($vartype, $varudeb, $varsym) = ("rnd", 0, 0);
+ }
+ elsif ($input eq "h") {
+ print("\nTODO: Help");
+ sleep(2);
+ }
+ elsif ($input =~ /^(x|)$/) {
+ open(FILE, ">$cfgfile") and
+ print(FILE map("$_\n", ($prodind, $tgtind, $vartype, $varudeb, $varsym))) and close(FILE);
+ return(("", "menu")) if ($input eq "x");
+ $cmdarg = "$product$cmdarg TYPE=$vartype USE_UDEB=$varudeb USE_SYMGEN=$varsym";
+ $ENV{IMAKER_CMDARG} = Trim("$cmdarg $target");
+ return(($cmdarg, $target eq "" ? "defaultgoals" : $target));
+ }
+ }
+}
+
+
+###############################################################################
+#
+
+sub Install($$$)
+{
+ my ($clean, $bldinf, $destdir) = @_;
+ my $srcdir = GetDirname($bldinf = GetAbsFname($bldinf));
+ $destdir = GetAbsDirname($destdir) if $destdir;
+
+ print(($clean ? "\nCleaning" : "\nInstalling") . " `$bldinf'" . ($destdir ? " to `$destdir'\n" : "\n"));
+
+ my $export = 0;
+ foreach (grep(!/^\s*\/\//, ReadFile($bldinf, 0))) {
+ $export = 1, next if /^\s*PRJ_EXPORTS\s*$/i;
+ next if !$export;
+ Install($clean, "$srcdir$1", $destdir), next if /^\s*#include\s+"(.+)"\s*$/;
+ die("Unknown line `$_'.\n") if !/^\s*(\S+)\s+(.+?)\s*$/;
+ my ($src, $dest) = ("$srcdir$1", $2);
+ $dest = "$gEpocroot/epoc32$dest" if ($dest =~ s/^\+//);
+ $dest .= GetBasename($src) if ($dest =~ s/\s+\/\/$//);
+ ($src, $dest) = (GetAbsFname($src), GetAbsFname($dest));
+ next if ($destdir && ($dest !~ /^$gEpocroot\/epoc32\/tools\//i));
+ $dest = "$destdir/" . GetBasename($dest) if $destdir;
+ print(($clean ? "Delete" : "Copy `$src' =>") . " `$dest'\n");
+ unlink($dest);
+ die("Deletion failed.\n") if ($clean && -e($dest));
+ next if $clean;
+ File::Path::mkpath(GetDirname($dest));
+ File::Copy::copy($src, $dest) or die("Copying failed.\n");
+ chmod(0777, $dest);
+ }
+}
+
+
+###############################################################################
+#
+
+END {
+ if (!$gArgv) {
+ (my $keepgoing, $gStartmk) = ($gKeepgoing, time() - $gStartmk);
+ $gKeepgoing = 1;
+ SetLogfile($gLogfiles{__prev__}) if %gLogfiles;
+ PrintEnv(0) if $gError;
+ die("Command `$gMakecmd' failed in `" . GetAbsDirname(".") . "'.\n")
+ if ($gTgterr && !$keepgoing);
+
+ map { UnsubstDrive($_) } sort({$a cmp $b} keys(%gSubstdrv));
+
+ @gIcmd = @gReport;
+ (my $report, @gReport) = (2, ());
+ my ($maxtlen, $maxvlen, %uniq) = (0, 0, ());
+ while (@gIcmd) {
+ my ($tgtvar, $durval, $type) = (GetIPar(1), GetIPar(1), GetIPar(1));
+ if ($type =~ /^-?\d+$/) {
+ push(@gReport, [$tgtvar, $durval, $type]);
+ ($maxtlen, %uniq) = (Max($maxtlen, length($tgtvar)), ());
+ } else {
+ $report = 1, push(@gReport, [$tgtvar, $durval, $type])
+ if ($tgtvar ne "") && !($uniq{"$tgtvar|$durval"}++);
+ $maxvlen = Max($maxvlen, length($tgtvar));
+ }
+ }
+
+ my ($tgtcnt, $warn) = (0, 0);
+ DPrint($report, "=" x 79 . "\n" . join("\n", map(@$_[2] =~ /^-?\d+$/ ?
+ ($tgtcnt++ ? "-" x 79 . "\n" : "") .
+ "Target: " . sprintf("%-${maxtlen}s", @$_[0]) .
+ " Duration: " . Sec2Min(@$_[1] < 0 ? $gStartmk : @$_[1]) .
+ " Status: " . (@$_[2] < 0 ? ($warn = "FAILED") : "OK")
+ : sprintf("%-${maxvlen}s", @$_[0]) . " = `@$_[1]'" .
+ ((@$_[2] =~ /^[fd]$/i) && !-e(@$_[1]) ? " - DOESN'T EXIST" : ""), @gReport)) .
+ (@gReport ? "\n" . "-" x 79 . "\n" : "") .
+ "Total duration: " . Sec2Min(time() - $gStarttime) .
+ " Status: " . ($gError && !$keepgoing ? "FAILED" : "OK" .
+ ($warn ? " (with keep-going)" : "")) .
+ "\n" . "=" x 79 . "\n");
+
+ warn("\$_ has been changed in an uncontrolled manner!\n")
+ if !/^default input and pattern-searching space$/;
+ CloseLog();
+ exit(1) if ($gError && !$keepgoing);
+ }
+}
+
+
__END__ # OF IMAKER.PL
--- a/imgtools/imaker/src/imaker.pm Fri Jun 18 13:49:03 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1462 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of the License "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: iMaker common Perl routines
-#
-
-
-
-use subs qw(CORE::GLOBAL::die);
-
-package imaker;
-
-use strict;
-use warnings;
-use Archive::Zip qw(:ERROR_CODES);
-use Archive::Zip::Tree;
-use Cwd;
-use Digest::MD5 qw(md5_hex);
-use File::Basename;
-use File::Copy;
-use File::Find;
-use File::Path;
-use File::Spec;
-use POSIX qw(strftime);
-use Time::Local;
-use XML::Simple;
-
-sub Max(@);
-sub Min(@);
-sub Quote($);
-sub Unquote($);
-sub Byte2Str($@);
-sub Str2Byte($);
-sub Str2Xml($);
-sub Ascii2Uni($);
-sub Uni2Ascii($);
-sub GetTimestamp();
-sub Sec2Min($);
-sub Wcard2Restr($);
-sub Wcard2Regex($);
-sub DPrint($@);
-sub Echo($$$);
-sub PathConv($;$$);
-sub ParseFiles($);
-sub GlobFiles($);
-sub GetBasename($);
-sub GetDirname($);
-sub GetAbsDirname($;$$);
-sub GetAbsFname($;$$);
-sub GetRelFname($;$$$);
-sub GetWriteFname($);
-sub GetFreeDrive();
-sub Search($$$$$\@\$);
-sub Find($$$$$\$);
-sub ChangeDir($);
-sub DeleteDir($;$);
-sub FindDir($$$$);
-sub MakeDir($);
-sub MakeChangeDir($);
-sub SetWorkdir($);
-sub OpenFile(*$$;$);
-sub Test($);
-sub CutFile($$$$$);
-sub Copy($$;$);
-sub DeleteFile($;$);
-sub FindFile($$$$);
-sub HeadFile($$$);
-sub TailFile($$$);
-sub TypeFile($;$);
-sub WriteFile($$$;$);
-sub UnzipFile($$);
-sub Zip($$$$@);
-sub Move($$);
-sub Touch($$);
-sub SetLogfile($);
-sub WidgetUnzip($$$);
-sub RunSystemCmd($$;$);
-sub ParseSystemCmd($$$);
-sub GenExclfile($$$$$);
-sub GenIbyfile($$$@);
-sub GenMakefile($$$$$);
-sub AddImageHeader($$$$$);
-sub Sleep($);
-sub FindSOSFiles($$$$$);
-sub CheckTool(@);
-sub GetIPar();
-sub PeekICmd($);
-sub GetICmd();
-sub EndICmd();
-sub RunICmd();
-sub RunIExtCmd($);
-sub GetFeatvarIncdir($;$);
-sub SetVerbose($);
-sub ReadICmdFile($);
-sub CloseLog();
-sub MakeStep($$$$$$);
-sub HandleCmdArg($);
-sub HandleExtCmdArg($);
-sub MenuRuncmd($);
-sub Menu($$$);
-
-use constant READBUFSIZE => 2097152; # 2 MB
-
-our $STARTSTR = '>>>[START]=========8<==========8<==========8<==========8<==========8<==========';
-our $ENDSTR = '==========>8==========>8==========>8==========>8==========>8===========[END]<<<';
-
-our $gBuflog = 1;
-our $gCmdcnt = 0;
-our @gCmdoutbuf = ();
-our $gEpoc32;
-our @gFindresult = ();
-our $gError = 0;
-our @gIcmd = ();
-our $gImakerext = 0;
-our $gKeepgoing = 0;
-our @gLogbuf = ();
-our $gLogfile = "";
-our $gMakestep = "";
-our $gOutfilter = "";
-our $gParamcnt = 0;
-our $gPrintcmd = 0;
-our @gStepDur = ();
-our %gStepIcmd = ();
-our $gVerbose = 1;
-our $gWarn = 0;
-our $gWinOS = ($^O =~ /win/i);
-our $gWorkdir = "";
-our $gWorkdrive = (Cwd::cwd() =~ /^([a-z]:)/i ? $1 : "");
-our @iVar = (); # General purpose variable to be used from $(call peval,...)
-
-BEGIN {
- ($gEpoc32 = "$ENV{EPOCROOT}epoc32") =~ tr/\\/\//;
- push(@INC, "$gEpoc32/tools");
- eval { require featurevariantparser };
-}
-
-
-###############################################################################
-#
-
-sub Max(@)
-{
- my $max = (shift() || 0);
- map { $max = $_ if $_ > $max } @_;
- return($max);
-}
-
-sub Min(@)
-{
- my $min = (shift() || 0);
- map { $min = $_ if $_ < $min } @_;
- return($min);
-}
-
-sub Quote($)
-{
- local $_ = shift();
- return("") if !defined();
- s/\\( |n|t)/\\\\$1/g;
- return($_);
-}
-
-sub Unquote($)
-{
- local $_ = shift();
- return("") if !defined();
- s/(?<!\\)(?<=\\n)\s+(\\n)?//g;
- s/(?<!\\)\s+(?=\\n)//g;
- s/(?<!\\)\\ / /g;
- s/(?<!\\)\\n/\n/g;
- s/(?<!\\)\\t/\t/g;
- s/\\\\( |n|t)/\\$1/g;
- s/\x00//g;
- return($_);
-}
-
-sub Byte2Str($@)
-{
- my ($base, @byte) = @_;
- return(join("", map(($_ % 16 ? "" : sprintf("%04X:", $base + $_)) . sprintf(" %02X", $byte[$_]) .
- (!(($_ + 1) % 16) || ($_ == (@byte - 1)) ? "\n" : ""), (0 .. (@byte - 1)))));
-}
-
-sub Str2Byte($)
-{
- my ($str, $ind, @byte) = (shift(), 0, ());
- $str =~ s/,$/, /;
- map {
- $ind++;
- s/^\s+|\s+$//g;
- if (/^\d+$/ && $_ < 256) {
- push(@byte, $_);
- } elsif (/^0x[0-9A-F]+$/i && hex() < 256) {
- push(@byte, hex());
- } else {
- die("Invalid $ind. byte: `$_'.\n");
- return;
- }
- } split(/,/, $str);
- return(@byte);
-}
-
-sub Str2Xml($)
-{
- my $str = shift();
- $str =~ s/(.)/{'"'=>'"', '&'=>'&', "'"=>''', '<'=>'<', '>'=>'>'}->{$1} || $1/ge;
- return($str);
-}
-
-sub Ascii2Uni($)
-{
- (local $_ = shift()) =~ s/(?<!\r)\n/\r\n/g; # Use CR+LF newlines
- s/(.)/$1\x00/gs;
- return("\xFF\xFE$_");
-}
-
-sub Uni2Ascii($)
-{
- (local $_ = shift()) =~ s/(.)\x00/$1/gs;
- s/\r\n/\n/g;
- return(substr($_, 2));
-}
-
-sub GetTimestamp()
-{
- my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = localtime();
- return(sprintf("%04d%02d%02d%02d%02d%02d%02d",
- $year + 1900, $mon + 1, $mday, $hour, $min, $sec, int(($yday + 1) / 7) + 1));
-}
-
-sub Sec2Min($)
-{
- my $sec = shift();
- return(sprintf("%02d:%02d", $sec / 60, $sec % 60));
-}
-
-sub Wcard2Restr($)
-{
- (my $wcard = shift()) =~ s/(.)/{"*"=>".*", "?"=>"."}->{$1} || "\Q$1\E"/ge;
- return($wcard);
-}
-
-sub Wcard2Regex($)
-{
- my $restr = Wcard2Restr(shift());
- return(qr/$restr/i);
-}
-
-
-###############################################################################
-#
-
-sub DPrint($@)
-{
- my ($verbose, @outlist) = @_;
- map { tr/\x00\x1F/#/ } @outlist;
- print(@outlist) if !$verbose || ($verbose & $gVerbose);
- push(@gLogbuf, @outlist) if ($verbose < 32) || ($verbose & $gVerbose);
- return if $gBuflog && !$gLogfile;
- print(LOG @gLogbuf) if $gBuflog;
- @gLogbuf = ();
-}
-
-sub Echo($$$)
-{
- return if $gPrintcmd;
- my ($verbose, $str) = (shift(), shift());
- DPrint($verbose, shift() ? "$str\n" : Unquote($str));
-}
-
-
-###############################################################################
-#
-
-# Overload die
-*CORE::GLOBAL::die = sub {
- $gError = 1;
- return if PeekICmd("iferror");
- CORE::die(@_) if !$gKeepgoing;
- warn(@_);
-};
-
-# Handler for __DIE__ signal
-$SIG{__DIE__} = sub {
- select(STDERR);
- DPrint(0, "*** Error: " . ($gMakestep ? "($gMakestep): " : "") . $_[0]);
- select(STDOUT);
- exit(1);
-};
-
-# Handler for __WARN__ signal
-$SIG{__WARN__} = sub {
- select(STDERR);
- my $msg = ($gMakestep ? "($gMakestep): " : "") . $_[0];
- if ($gError) { DPrint(0, "*** Error: $msg") }
- else { DPrint(127, "Warning: $msg") }
- select(STDOUT);
- $gError = $gWarn = 0;
-};
-
-
-###############################################################################
-# File operations
-
-sub PathConv($;$$)
-{
- my $path = shift();
- if (shift()) { $path =~ tr-\/-\\- }
- else { $path =~ tr-\\-\/- }
- if (shift()) { $path =~ s/^(?![a-z]:)/$gWorkdrive/i }
- else { $path =~ s/^$gWorkdrive//i }
- $path =~ s/^([a-z]:)/\u$1/;
- return($path);
-}
-
-sub ParseFiles($)
-{
- my ($file, @files) = (shift(), ());
- push(@files, defined($1) ? $1 : (defined($2) ? $2 : ())) while $file =~ /""|"+(.+?)"+|((\\\s|\S)+)/g;
- return(@files);
-}
-
-sub GlobFiles($)
-{
- return(@gFindresult) if (my $file = shift()) =~ /^__find__$/i;
- return(map(/[\*\?]/ ? glob(/\s/ ? "\"$_\"" : $_) : $_, ParseFiles($file)));
-}
-
-sub GetBasename($)
-{
- return((File::Basename::fileparse(shift()))[0]);
-}
-
-sub GetDirname($)
-{
- (my $dir = shift()) =~ s/^>>?(?!>)//;
- return((File::Basename::fileparse($dir))[1]);
-}
-
-sub GetAbsDirname($;$$)
-{
- (my $dir = shift()) =~ s/^>>?(?!>)//;
- my $absdir = "";
- eval { local $SIG{__DIE__}; $absdir = Cwd::abs_path($dir) };
- return(PathConv($absdir || File::Spec->rel2abs($dir,
- $dir !~ /^$gWorkdrive/i && $dir =~ /^([a-z]:)/i ? "$1/" : ""), shift(), shift()));
-}
-
-sub GetAbsFname($;$$)
-{
- my $file = shift();
- return($file) if $file eq "" || $file =~ /STD(IN|OUT|ERR)$/;
- my $append = ($file =~ s/^>>(?!>)// ? ">>" : "");
- return($append . PathConv(File::Spec->catpath("", GetAbsDirname(GetDirname($file)), GetBasename($file)), shift(), shift()));
-}
-
-sub GetRelFname($;$$$)
-{
- my ($file, $base) = (shift(), shift());
- my $append = ($file =~ s/^>>(?!>)// ? ">>" : "");
- return($append . PathConv(File::Spec->abs2rel($file, GetAbsDirname(defined($base) && ($base ne "") ? $base : ".")), shift(), shift()));
-}
-
-sub GetWriteFname($)
-{
- (my $file = shift()) =~ s/^>?/>/;
- return($file);
-}
-
-sub GetFreeDrive()
-{
- for my $drive ("F", "A".."E", "G".."Z") {
- return("$drive:") if
- !system("subst $drive: . >nul") and !system("subst $drive: /d >nul");
- }
- die("No free drive letter available.\n");
-}
-
-sub Search($$$$$\@\$)
-{
- my ($dir, $inclre, $exclre, $subdir, $finddir, $files, $total) = @_;
- my @dir = ();
-
- map {
- my $isfile = -f();
- my $isdir = !$isfile && -d();
- if ($finddir ? $isdir : $isfile) {
- ++$$total;
- my $fname = File::Basename::basename($_);
- push(@$files, $_) if ($fname =~ /$inclre/ && $fname !~ /$exclre/);
- }
- push(@dir, $_) if $isdir && $subdir;
- } sort({lc($a) cmp lc($b)} ($dir =~ /\s/ ? <"$dir/*"> : <$dir/*>));
-
- map { Search($_, $inclre, $exclre, 1, $finddir, @$files, $$total) } @dir;
-}
-
-sub Find($$$$$\$)
-{
- my ($dir, $inclpat, $exclpat, $subdir, $finddir, $total) = @_;
- ($dir, $$total) = (GetAbsDirname($dir), 0);
- my ($inclre, $exclre, @files) = ("", "", ());
- if ($inclpat =~ /^\//) {
- $inclre = eval("qr$inclpat");
- $inclpat = "";
- } else {
- $inclre = join("|", map(Wcard2Restr($_), split(/\s+/, $inclpat)));
- $inclre = qr/^($inclre)$/i;
- }
- if ($exclpat =~ /^\//) {
- $exclre = eval("qr$exclpat");
- $exclpat = "";
- } else {
- $exclre = join("|", map(Wcard2Restr($_), split(/\s+/, $exclpat)));
- $exclre = qr/^($exclre)$/i;
- }
- DPrint(16, "Find" . ($finddir ? "Dir" : "File") . ": Directory `$dir'" . ($subdir ? " and subdirectories" : "") .
- ", pattern `" . ($inclpat ne "" ? "$inclpat' $inclre" : "$inclre'") .
- ($exclre eq qr/^()$/i ? "" : " excluding `" . ($exclpat ne "" ? "$exclpat' $exclre" : "$exclre'")));
- Search($dir, $inclre, $exclre, $subdir, $finddir, @files, $$total);
- DPrint(16, ", found " . @files . "/$$total " . ($finddir ? "directories\n" : "files\n"));
- return(@files);
-}
-
-sub ChangeDir($)
-{
- if ((my $dir = GetAbsDirname(shift())) ne GetAbsDirname(".")) {
- DPrint(16, "ChangeDir: `$dir'\n");
- chdir($dir) or die("Can't change to directory `$dir'.\n");
- }
-}
-
-sub DeleteDir($;$)
-{
- return if !-d(my $dir = GetAbsDirname(shift()));
- DPrint(16, "DeleteDir: `$dir'\n");
- for my $sec (0, 2, 5) {
- warn("Can't delete directory `$dir', retrying in $sec seconds...\n"), sleep($sec) if $sec;
- eval { local $SIG{__DIE__}; local $SIG{__WARN__} = sub{}; File::Path::rmtree($dir) };
- return if !-d($dir);
- }
- $dir = "Can't delete directory `$dir'.\n";
- shift() ? warn($dir) : die($dir);
-}
-
-sub FindDir($$$$)
-{
- my ($dir, $inclpat, $exclpat, $opt) = @_;
- @gFindresult = () if (($opt = (defined($opt) ? $opt : "")) !~ /a/);
- push(@gFindresult, Find($dir, $inclpat, $exclpat, $opt =~ /r/, 1, local $_));
-}
-
-sub MakeDir($)
-{
- my $dir = GetAbsDirname(shift());
- return if -d($dir);
- eval { local $SIG{__DIE__}; File::Path::mkpath($dir) };
- if (-d($dir)) {
- DPrint(16, "MakeDir: `" . GetAbsDirname($dir) ."'\n");
- } else {
- DPrint(16, "MakeDir: `$dir'\n");
- die("Can't create directory `$dir'.\n");
- }
-}
-
-sub MakeChangeDir($)
-{
- MakeDir(my $dir = shift());
- ChangeDir($dir);
-}
-
-sub SetWorkdir($)
-{
- MakeChangeDir(shift());
- $gWorkdrive = (Cwd::cwd() =~ /^([a-z]:)/i ? $1 : "");
- $gWorkdir = GetAbsDirname(".");
-}
-
-sub OpenFile(*$$;$)
-{
- my ($fhandle, $file, $binmode, $print) = @_;
- MakeDir(GetDirname($file)) if $file =~ /^>/;
- DPrint(16, defined($print) ? $print : ($file =~ /^>/ ? "Write" : "Read") . "File: `$file'\n");
- return(open($fhandle, $file)) if !$binmode;
- return(open($fhandle, $file) and binmode($fhandle));
-}
-
-sub Test($)
-{
- if (-d(my $file = shift())) {
- DPrint(16, "TestDir: `" . GetAbsDirname($file) . "'\n");
- } elsif (-f($file)) {
- DPrint(16, "TestFile: `" . GetAbsFname($file) . "'\n");
- } else {
- DPrint(16, "Test: `$file'\n");
- die("File or directory `$file' doesn't exist.\n");
- }
-}
-
-sub CutFile($$$$$)
-{
- my ($msg, $src, $dest, $head, $len) = @_;
- my ($buf, $srctmp) = (undef, "$src.CUT");
-
- OpenFile(*INFILE, $src, 1, $msg) or
- die("Can't read file `$src'.\n"), return;
-
- my $out = GetWriteFname($head ? $dest : $srctmp);
- OpenFile(*OUTFILE, $out, 1) or die("Can't write to `$out'.\n"), return;
- while ($len > 0) {
- read(INFILE, $buf, $len < READBUFSIZE ? $len : READBUFSIZE);
- print(OUTFILE $buf);
- $len -= READBUFSIZE;
- }
- close(OUTFILE);
-
- $out = GetWriteFname($head ? $srctmp : $dest);
- OpenFile(*OUTFILE, $out, 1) or die("Can't write to `$out'.\n"), return;
- print(OUTFILE $buf) while read(INFILE, $buf, READBUFSIZE);
- close(OUTFILE);
- close(INFILE);
- Move($srctmp, $src);
-}
-
-sub Copy($$;$)
-{
- my ($src, $dest, $dir) = @_;
- my $append = ($dest =~ /^>>[^>]/);
- $dir = defined($dir) && $dir || !$append && -d($src);
- $src = ($dir ? GetAbsDirname($src) : GetAbsFname($src));
- $dest = ($dir ? GetAbsDirname($dest) : GetAbsFname($dest));
- if ($append) {
- my $buf;
- OpenFile(*INFILE, $src, 1, "AppendFile: `$src' => `$dest'\n") or die("Can't read file `$src'.\n"), return;
- OpenFile(*OUTFILE, $dest, 1, "") or die("Can't write to `$dest'.\n"), return;
- print(OUTFILE $buf) while read(INFILE, $buf, READBUFSIZE);
- return if close(INFILE) && close(OUTFILE);
- }
- elsif (!$dir) {
- DPrint(16, "CopyFile: `$src' => `$dest'\n");
- warn("CopyFile: Destination file `$dest' already exists\n") if -f($dest);
- File::Copy::copy($src, $dest) and return;
- } else {
- DPrint(16, "CopyDir: `$src' => `$dest'\n");
-# warn("CopyDir: Destination directory `$dest' already exists\n") if -d($dest);
- !RunSystemCmd('xcopy "' . PathConv($src, 1) . '" "' . PathConv("$dest/" . GetBasename($src), 1) . '" /e /i /y /z', "") and return;
- }
- die("Can't copy `$src' to `$dest'.\n");
-}
-
-sub DeleteFile($;$)
-{
- return if !-f(my $file = GetAbsFname(shift()));
- DPrint(16, "DeleteFile: `$file'\n");
- for my $sec (0, 1, 2) {
- warn("Can't delete file `$file', retrying in $sec second(s)...\n"), sleep($sec) if $sec;
- unlink($file);
- return if !-f($file);
- }
- $file = "Can't delete file `$file'.\n";
- shift() ? warn($file) : die($file);
-}
-
-sub FindFile($$$$)
-{
- my ($dir, $inclpat, $exclpat, $opt) = @_;
- @gFindresult = () if (($opt = (defined($opt) ? $opt : "")) !~ /a/);
- push(@gFindresult, Find($dir, $inclpat, $exclpat, $opt =~ /r/, 0, local $_));
-}
-
-sub HeadFile($$$)
-{
- my ($src, $dest, $len) = (GetAbsFname(shift()), GetAbsFname(shift()), shift());
- $len = hex($len) if $len =~ /^0x/;
- CutFile("HeadFile: Cut first $len bytes from `$src' => `$dest'\n", $src, $dest, 1, $len);
-}
-
-sub TailFile($$$)
-{
- my ($src, $dest, $len) = (GetAbsFname(shift()), GetAbsFname(shift()), shift());
- $len = hex($len) if $len =~ /^0x/;
- CutFile("TailFile: Cut last $len bytes from `$src' => `$dest'\n", $src, $dest, 0, (-s($src) ? -s($src) : 0) - $len);
-}
-
-sub TypeFile($;$)
-{
- my ($file, $str, $mode) = (GetAbsFname(shift()), "", shift() || "");
- OpenFile(*FILE, $file, $mode, "TypeFile: `$file'" .
- ($gOutfilter && ($mode ne "b") ? ", filter: `/$gOutfilter/i'" : "") . "\n") or
- die("Can't read file `$file'.\n"), return;
- DPrint(8, "$STARTSTR\n");
- read(FILE, $str, -s($file));
- if ($mode eq "b") {
- DPrint(1, Byte2Str(0, map(ord(), split(//, $str))));
- } else {
- $str = Uni2Ascii($str) if $mode eq "u";
- DPrint(1, map("$_\n", grep(!$gOutfilter || /$gOutfilter/i, split(/\n/, $str))));
- $gOutfilter = "";
- }
- DPrint(8, "$ENDSTR\n");
- close(FILE);
-}
-
-sub WriteFile($$$;$)
-{
- my ($file, $str, $mode) = (GetAbsFname(shift()), shift(), shift() || "");
- OpenFile(*FILE, GetWriteFname($file), $mode) or
- die("Can't write to `$file'.\n"), return;
- if ($mode eq "b") {
- my @byte = Str2Byte($str);
- DPrint(64, Byte2Str($file =~ s/^>>(?!>)// ? -s($file) : 0, @byte));
- print(FILE map(chr(), @byte));
- } else {
- $str = Unquote($str) if !shift();
- $str = Ascii2Uni($str) if $mode eq "u";
- print(FILE $str);
- }
- close(FILE);
-}
-
-sub UnzipFile($$)
-{
- my ($zipfile, $dir) = (GetAbsFname(shift()), GetAbsDirname(shift()));
- DPrint(16, "UnzipFile: `$zipfile'");
- Archive::Zip::setErrorHandler(sub{});
- my ($error, $zip) = (0, Archive::Zip->new());
- if ($zip->read($zipfile) != AZ_OK) {
- DPrint(16, " to directory `$dir'\n");
- die("Can't read zip archive `$zipfile'.\n");
- return;
- }
- my @files = map($_->fileName(), grep(!$_->isDirectory(), $zip->members()));
- DPrint(16, ", " . @files . " files to directory `$dir'\n");
- foreach my $file (@files) {
- DPrint(16, "ExtractFile: `$dir/$file'");
- eval { local $SIG{__DIE__}; $error = ($zip->extractMember($file, "$dir/$file") != AZ_OK) };
- DPrint(16, $error ? " Failed\n" : "\n");
- die("Can't extract file `$file' to directory `$dir'.\n") if $error;
- $error = 0;
- }
-}
-
-sub Zip($$$$@)
-{
- my ($zipfile, $dir, $opt, $prefix) = (GetAbsFname(shift()), shift(), shift(), shift());
-
- $opt = (defined($opt) ? ", options: `$opt'" : "");
- $prefix = GetAbsDirname($prefix) if $prefix ne "";
- my %files = ();
- map {
- my $key = lc();
- $files{$key} = $_ if !exists($files{$key});
- } ($dir ? map(GetAbsDirname($_), grep(-d(), @_)) : map(GetAbsFname($_), grep(-f(), @_)));
-
- DPrint(16, ($dir ? "ZipDir: `$zipfile'$opt, " . keys(%files) . " directories" :
- "ZipFile: `$zipfile'$opt, " . keys(%files) . " files") . ($prefix ? ", prefix: $prefix\n" : "\n"));
-
- Archive::Zip::setErrorHandler(sub{});
- my ($error, $zip) = (0, Archive::Zip->new());
- $zip->zipfileComment("iMaker-created zip archive `$zipfile'$opt.");
-
- foreach my $file (sort({lc($a) cmp lc($b)} values(%files))) {
- my $newfile = $file;
- if ($opt !~ /j/) {
- $newfile =~ s/^.*?\/+/$prefix\// if $prefix ne "";
- } else {
- $newfile = ($dir ? "" : GetBasename($file)) if ($prefix eq "") || ($newfile !~ s/^$prefix//);
- }
- DPrint(16, "Add" . ($dir ? "Dir" : "File") . ": `$file'" . ($file ne $newfile ? " => `$newfile'" : "")) if $opt !~ /q/;
- eval {
- local $SIG{__DIE__}; local $SIG{__WARN__} = sub{ $gWarn = 1 };
- $error = ($dir ? $zip->addTree($file, $newfile) != AZ_OK :
- !$zip->addFile($file, $newfile)) || $gWarn;
- };
- DPrint(16, $error ? " Failed\n" : "\n") if $opt !~ /q/;
- warn("Can't add " . ($dir ? "directory tree" : "file") . "`$file' to zip archive `$zipfile'.\n") if $error;
- $error = 0;
- }
- ($zip->writeToFileNamed($zipfile) == AZ_OK) or
- die("Can't create zip archive `$zipfile'.\n");
-}
-
-sub Move($$)
-{
- my ($src, $dest) = @_;
- my $dir = -d($src);
- $src = ($dir ? GetAbsDirname($src) : GetAbsFname($src));
- MakeDir(GetDirname($dest));
- $dest = ($dir ? GetAbsDirname($dest) : GetAbsFname($dest));
- DPrint(16, "Move" . ($dir ? "Dir" : "File") . ": `$src' => `$dest'\n");
- File::Copy::move($src, $dest) or
- die("Can't move `$src' to `$dest'.\n");
-}
-
-sub Touch($$)
-{
- my ($file, $time) = (shift(), shift() =~ /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/ ?
- Time::Local::timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900) : time);
- my $dir = -d($file);
- $file = ($dir ? GetAbsDirname($file) : GetAbsFname($file));
- DPrint(16, "Touch" . ($dir ? "Dir" : "File") . ": `$file': " .
- POSIX::strftime("%Y-%m-%d,%H:%M:%S", localtime($time)) . "\n");
- utime($time, $time, $file) or
- die("Can't touch " . ($dir ? "directory" : "file") . " `$file'.\n");
-}
-
-sub SetLogfile($)
-{
- $gBuflog = 0, return if !(my $file = GetAbsFname(shift()));
- CloseLog();
- OpenFile(*LOG, GetWriteFname($file), 0) or
- warn("Can't log to file `$file'.\n"), return;
- $gLogfile = $file;
-}
-
-
-###############################################################################
-#
-
-sub WidgetUnzip($$$)
-{
- my ($wgzfile, $outdir, $plist) = (GetAbsFname(shift()), GetAbsDirname(shift()), shift());
-
- my $tmpdir = "$outdir/wgz_unzip_temp";
- DeleteDir($tmpdir);
- UnzipFile($wgzfile, $tmpdir);
-
- for my $dir (Find($tmpdir, "*", "", 0, 1, local $_)) {
- my $xml = undef;
- eval { local $SIG{__DIE__}; local $SIG{__WARN__} = sub{}; $xml = XMLin("$dir/$plist") };
- die("Can't find/parse XML file `$dir/$plist'.\n"), next if !defined($xml);
- my $id = "";
- for my $ind (0 .. @{$xml->{dict}{key}} - 1) {
- $id = $xml->{dict}{string}[$ind], last if $xml->{dict}{key}[$ind] =~ /^\s*Identifier\s*$/i;
- }
- die("Can't find Identifier from XML file `$dir/$plist'.\n"), next if $id eq "";
- Move($dir, "$outdir/$id/" . GetBasename($dir));
- }
- DeleteDir($tmpdir);
-}
-
-
-###############################################################################
-#
-
-sub RunSystemCmd($$;$)
-{
- my ($cmd, $file, $ignorerr) = @_;
- DPrint(1, "$cmd\n"), return if $gPrintcmd;
- my $null = ($file =~ /^null$/i);
- $file = ($null ? "" : GetAbsFname($file));
- @gCmdoutbuf = ();
- DPrint(4, "RunSystemCmd(" . GetAbsDirname(".") . "): `$cmd'" .
- ($file ? ", redirect to: `$file'" : ($null ? ", redirect to null" : "")) .
- ($gOutfilter ? ", filter: `/$gOutfilter/i'" : "") . "\n");
- OpenFile(*FILE, GetWriteFname($file), 0) or
- (die("Can't write to `$file'.\n"), $file = "") if $file;
- my $dur = time();
- open(CMD, "$cmd 2>&1 |");
- DPrint(8, "$STARTSTR\n");
- while (my $line = <CMD>) {
- chomp($line);
- push(@gCmdoutbuf, $line);
- DPrint(8, "$line\n") if !$null && (!$gOutfilter || ($line =~ /$gOutfilter/i));
- print(FILE "$line\n") if $file;
- }
- close(CMD);
- close(FILE) if $file;
- push(@gStepDur, $dur = time() - $dur);
- $gOutfilter = "";
- my $error = ($? >> 8) && !$ignorerr && !$null;
- print(map("$_\n", @gCmdoutbuf)) if $error && $gVerbose && !($gVerbose & 8);
- $dur = Sec2Min($dur);
- DPrint(8, substr($ENDSTR, 0, -16) . $dur . substr($ENDSTR, length($dur) - 16) . "\n");
- die("Command `$cmd' failed (" . ($? >> 8). ").\n") if $error;
-}
-
-
-###############################################################################
-#
-
-sub ParseSystemCmd($$$)
-{
- return if $gPrintcmd;
- my ($title, $regex, $file) = @_;
- $regex = ($regex =~ /^\// ? eval("qr$regex") : Wcard2Regex($regex));
- return if !(my @parse = grep(/$regex/, @gCmdoutbuf));
- if (!$file) {
- Echo(1, $title, 0);
- DPrint(1, map(sprintf("%" . length(@parse) . "s", $_) . ") $parse[$_ - 1]\n", 1 .. @parse));
- return;
- }
- OpenFile(*FILE, GetWriteFname($file = $title), 0) or
- die("Can't write to `$file'.\n"), return;
- print(FILE join("\n", @parse));
- close(FILE);
-}
-
-
-###############################################################################
-#
-
-sub GenExclfile($$$$$)
-{
- return if $gPrintcmd;
-
- my ($exclfile, $base, $prefix, $addfiles) = (shift(), shift(), shift(), shift());
- my ($file, $rmfiles, %files) = ("", "", ());
-
- WriteFile($exclfile, "", "");
- $base = GetAbsDirname($base);
-
- foreach $file (ParseFiles(shift())) {
- $file =~ tr/\\/\//;
- $file =~ s/^\///;
- $file =~ s/\/$/\/\*/;
- $rmfiles .= ($rmfiles eq "" ? "" : "|") . Wcard2Restr($file);
- }
- $rmfiles = qr/^(?:$rmfiles)$/i;
-
- foreach $file (ParseFiles($addfiles)) {
- $file =~ tr/\\/\//;
- $file =~ /^\/?(?:(.*)\/)?(.+?)$/;
- (my $dir, $file) = ($base . (defined($1) ? "/$1" : ""), $2);
- map {
- $files{$_} = 1 if ($_ = GetRelFname($_, $base)) !~ $rmfiles;
- } ($file =~ /[\*\?]/ ? Find($dir, $file, "", 1, 0, local $_) : "$dir/$file");
- }
-
- map {
- $files{"$_/"} = 1 while (s/^(.*)\/.*?$/$1/) && !exists($files{"$_/"});
- } keys(%files);
- $files{""} = 1;
-
- WriteFile($exclfile, join("", map(($_ = "$prefix$_\n") =~ tr/\//\\/ ? $_ : $_, sort({lc($a) cmp lc($b)} keys(%files)))), "u", 1);
-}
-
-sub GenIbyfile($$$@)
-{
- return if $gPrintcmd;
-
- my ($ibyfile, $srcdir, $subdir) = (GetAbsFname(shift()), shift(), shift());
- my ($header, $footer, $body, %files) = ("", "", "", ());
-
- foreach my $dir (split(/\s+/, $srcdir)) {
- $dir = GetAbsDirname($dir);
- my ($found, $total, $lines) = (0, 0, "");
- my @param = @_;
- while (@param) {
- my ($filepat, $format, @lines) = (shift(@param), shift(@param), ());
- $header = $format, next if $filepat =~ /^__header__$/i;
- $footer = $format, next if $filepat =~ /^__footer__$/i;
- foreach my $src (Find($dir, $filepat, "", $subdir, 0, $total)) {
- next if $files{$src};
- $files{$src} = 1;
- (my $line = $format) =~ s/%1/$src/g;
- $line =~ s/%2/GetRelFname($src, $dir, 1)/ge;
- $line =~ s/%3/GetRelFname($src, GetDirname($ibyfile))/ge;
- push(@lines, $line);
- }
- $found += @lines;
- $lines .= "//\n// Format: `$format', " . @lines . " files: `$filepat'\n" .
- (@lines ? "//\n" . join("\n", @lines) . "\n" : "");
- }
- $body .= "\n// Collected files $found/$total from directory `$dir'" .
- ($subdir ? " and subdirectories" : "") . "\n$lines";
- }
-
- my $append = ($ibyfile =~ s/^>>(?!>)// && -f($ibyfile) && ">>" || "");
- (my $fname = "__" . uc(GetBasename($ibyfile)) . "__") =~ s/\W/_/g;
- my @previby = ();
-
- if ($append) {
- OpenFile(*FILE, $ibyfile, 0) or die("Can't read file `$ibyfile'.\n"), return;
- @previby = <FILE>;
- close(FILE);
- $previby[0] =~ s/(, collected )(\d+)( files)$/$1.($2 + keys(%files)).$3/e;
- $previby[@previby - 1] = "";
- }
-
- OpenFile(*FILE, GetWriteFname($ibyfile), 0) or
- die("Can't write to `$ibyfile'.\n"), return;
- print(FILE @previby, ($append ? "// Appended" : "// Generated") . " `$append$ibyfile', " .
- "collected " . keys(%files) . " files\n" .
- ($append ? "" : "\n#ifndef $fname\n#define $fname\n") .
- ($header ? Unquote("\\n$header\\n") : "") . $body . ($footer ? Unquote("\\n$footer\\n") : "") .
- "\n#endif // $fname\n");
- close(FILE);
-}
-
-
-###############################################################################
-#
-
-sub GenMakefile($$$$$)
-{
- return if $gPrintcmd;
- my ($hdrfile, $mkfile, $filter, $prepros, $assignop) =
- (GetAbsFname(shift()), GetAbsFname(shift()), shift(), shift(), shift());
- ChangeDir(GetDirname($hdrfile));
- RunSystemCmd("$prepros " . GetBasename($hdrfile), "");
- my $maxdef = Max(map(/^\s*\#define\s+($filter)/ && length($1), @gCmdoutbuf));
- WriteFile($mkfile, join('\n',
- map(/^\s*\#define\s+($filter)\s*(.*?)\s*$/ ? sprintf("%-${maxdef}s $assignop %s", $1, $2 eq "" ? 1 : $2) : (), sort(@gCmdoutbuf))) . '\n', "");
-}
-
-
-###############################################################################
-#
-
-sub AddImageHeader($$$$$)
-{
- return if $gPrintcmd;
- my ($file, $hdrfile, $hdrstr, $hdrsize, $align) =
- (GetAbsFname(shift()), GetAbsFname(shift()), shift(), shift(), shift());
-
- $hdrstr =~ s/\/\*.*?\*\///g;
- $hdrstr =~ s/,\s*$//;
- WriteFile($hdrfile, $hdrstr, "b");
- die("Invalid image header size: " . sprintf("0x%X", -s($hdrfile)) . " (!=$hdrsize).\n"), return
- if -s($hdrfile) ne hex($hdrsize);
-
- $align = Max(hex($align), hex($hdrsize)) - hex($hdrsize);
- WriteFile(">>$hdrfile", ("0," x ($align - 1)) . "0", "b") if $align;
- Copy($file, ">>$hdrfile") if $file ne "";
-}
-
-
-###############################################################################
-#
-
-sub Sleep($)
-{
- sleep(shift()) if !$gPrintcmd;
-}
-
-
-###############################################################################
-#
-
-sub FindSOSFiles($$$$$)
-{
- my ($dirs, $tmpoby, $imgoby, $pluglog, $opt) = @_;
- my ($file, %files) = ("", ());
- local $_;
-
- foreach my $dir (GlobFiles($dirs)) {
- $dir = GetAbsDirname($dir);
-
- foreach $file (Find($dir, $tmpoby, "", 1, 0, $_)) {
- OpenFile(*FILE, $file, 0) or warn("Can't read file `$file'.\n"), last;
- (my $dir = GetDirname($file) . "/") =~ s/\/+$/\//;
- while (<FILE>) {
- next if !/^#\s+\d+\s+"(.+?)"/;
- $_ = $1;
- $file = GetAbsFname(/^(?:[a-z]:)?[\/\\]/i ? $_ : "$dir$_");
- $files{lc($file)} = $file if !exists($files{lc($file)});
- }
- close(FILE);
- }
-
- foreach $file (Find($dir, $imgoby, "", 1, 0, $_)) {
- OpenFile(*FILE, $file, 0) or warn("Can't read file `$file'.\n"), last;
- while (<FILE>) {
- next if !/^\s*(?:bootbinary|data|device|dll|extension|file|primary|secondary|variant)\S*?\s*[=\s]\s*(?:"(.+?)"|(\S+))/i;
- $file = GetAbsFname(defined($1) ? $1 : $2);
- $files{lc($file)} = $file if !exists($files{lc($file)});
- next if ($file !~ s/\.[0-9a-f]{32}\./\./i);
- $file .= ".vmap";
- $files{lc($file)} = $file if !exists($files{lc($file)});
- }
- close(FILE);
- }
-
- my ($plugfile, $patched) = (0, 0);
- foreach $file (Find($dir, $pluglog, "", 1, 0, $_)) {
- OpenFile(*FILE, $file, 0) or warn("Can't read file `$file'.\n"), last;
- while (<FILE>) {
- $plugfile = 1, next if /^Reading (ROM|ROFS1|UDEB|UREL) files$/;
- $plugfile = 0, next if ($plugfile && /^Found \d+ entries$/);
- if ($plugfile) {
- next if !/`(.+)'$/;
- $file = GetAbsFname($1);
- $files{lc($file)} = $file if !exists($files{lc($file)});
- next;
- }
- $patched = $1, next if /^Found (\d+) ROM-patched components:$/;
- next if (!$patched || !/^`(.+)'$/);
- $patched--;
- $file = GetAbsFname($1) . ".map";
- $files{lc($file)} = $file, next if -f($file);
- $file =~ s/(\..*?\.map)$/\.\*$1/;
- foreach (glob($file =~ /\s/ ? "\"$file\"" : $file)) {
- ($file = lc()) =~ s/\.map$//;
- $files{lc()} = $_, last if exists($files{$file});
- }
- }
- close(FILE);
- }
-
- $dir .= "/" if $dir !~ /\/$/;
- foreach $file (keys(%files)) {
- delete($files{$file}) if ($file =~ /^$dir/i);
- }
- }
-
- @gFindresult = () if (!defined($opt) || $opt !~ /a/);
- push(@gFindresult, values(%files));
-}
-
-
-###############################################################################
-#
-
-sub CheckTool(@)
-{
- return if $gPrintcmd;
- my ($maxtlen, $maxvlen, @tools) = (4, 9, ());
- while (@_) {
- my ($tool, $vquery, $getver, $version, $md5sum) = (shift(), shift(), shift(), " -", " ?");
- if (length($vquery) > 1) {
- RunSystemCmd($vquery, "null");
- $version = (join("\n", @gCmdoutbuf) =~ eval($getver =~ /^\// ? "qr$getver" : "qr/$getver/ims") ?
- (defined($1) && defined($2) && "`$1 $2'" || defined($1) && "`$1'" || " ?") : " ?");
- }
- OpenFile(*FILE, $tool, 1) and $md5sum = "`" . md5_hex(<FILE>) . "'";
- close(FILE);
- $maxtlen = Max($maxtlen, length($tool));
- $maxvlen = Max($maxvlen, length($version));
- push(@tools, "`$tool'", $version, $md5sum);
- }
- $maxtlen += 2;
- @_ = (" Tool", " Version", " MD5 Checksum", "-" x $maxtlen, "-" x $maxvlen, "-" x 34, @tools);
- DPrint(1, sprintf("%-${maxtlen}s %-${maxvlen}s ", shift(), shift()) . shift() . "\n") while(@_);
-}
-
-
-###############################################################################
-#
-
-sub GetIPar()
-{
- local $_ = shift(@gIcmd);
- $_ = "<UNDEFINED>" if (my $empty = !defined());
-
- while (/\@PEVAL{.*}LAVEP\@/) {
- my $start = rindex($_, '@PEVAL{', my $end = index($_, '}LAVEP@') + 7);
- my ($expr, $eval, $evalerr) = (substr($_, $start + 7, $end - $start - 14), undef, "");
- eval {
- local ($_, $SIG{__DIE__});
- local $SIG{__WARN__} = sub{} if $gPrintcmd;
- $eval = eval($expr);
- ($evalerr = $@) =~ s/^(.+?) at .*/$1/s;
- };
-# DPrint(64, "GetIPar: Evaluate `$expr' = `" . (defined($eval) ? $eval : "") . "'\n");
- if (!defined($eval)) {
- $eval = "";
- warn("GetIPar: Evaluation `$expr' failed: $evalerr.\n") if !$gPrintcmd;
- }
- substr($_, $start, $end - $start) = $eval;
- }
- DPrint(32, "iPar: $gParamcnt. `$_'\n") if $gParamcnt;
- $gParamcnt++;
- return($empty ? undef : $_);
-}
-
-sub PeekICmd($)
-{
- return(defined($gIcmd[0]) && $gIcmd[0] =~ /^$_[0]$/i);
-}
-
-sub GetICmd()
-{
- $gParamcnt = 0;
- my $cmd = GetIPar();
- DPrint(32, "iCmd: " . ++$gCmdcnt . ". `$cmd'\n") if defined($cmd) && $cmd ne "";
- return($cmd);
-}
-
-sub EndICmd()
-{
- GetICmd(), return(1) if !defined($gIcmd[0]) || PeekICmd("end");
- return(0);
-}
-
-sub RunICmd()
-{
- my ($cmd, $file, $iferror) = ("", "", 0);
- while (defined($cmd = GetICmd())) {
- next if $cmd eq "";
- local $_ = lc($cmd);
- if (/^(error|warning)$/) {
- my ($errwarn, $msg) = (GetIPar(), Unquote(GetIPar()));
- die($msg) if $errwarn && /e/;
- warn($msg) if $errwarn && /w/;
- }
- elsif (/^echo(\d+)?(-q)?$/) {
- my ($verbose, $quote) = (defined($1) && ($1 < 128) ? $1 : 1, defined($2));
- Echo($verbose, GetIPar(), $quote);
- }
- elsif (/^filter$/) {
- $gOutfilter = GetIPar();
- }
- elsif (/^cmd(tee)?$/) {
- $file = $1;
- RunSystemCmd(GetIPar(), $file ? GetIPar() : "");
- }
- elsif (/^parse(f)?$/) {
- $file = $1;
- ParseSystemCmd(GetIPar(), GetIPar(), $file);
- }
- elsif (/^(cd|copy(dir)?|del(dir)?|find(dir)?(-[ar]+)?|headb|logfile|mkcd|mkdir|move|tailb|test|touch|type[bu]?|unzip|workdir|write[bu]?(-q)?|zip(dir)?(-[jq]+)?)$/) {
- my @files = GlobFiles(GetIPar());
- my $par1 = GetIPar() if /^(?:copy|find|head|move|tail|touch|(un)?zip|write)/;
- my $par2 = GetIPar() if /^(?:find|head|tail|zip)/;
- next if $gPrintcmd;
- foreach $file (@files) {
- ChangeDir($file) if /^cd/;
- DeleteDir($file) if /deldir/;
- FindDir($file, $par1, $par2, $1) if /finddir(-[ar]+)?/;
- MakeDir($file) if /mkdir/;
- MakeChangeDir($file) if /mkcd/;
- SetWorkdir($file) if /workdir/;
- Zip($file, 1, $1, $par2, GlobFiles($par1)) if /zipdir(-[jq]+)?/;
- DeleteFile($file) if /del/;
- FindFile($file, $par1, $par2, $1) if /find(-[ar]+)?$/;
- HeadFile($file, $par1, $par2) if /headb/;
- SetLogfile($file) if /logfile/;
- TailFile($file, $par1, $par2) if /tailb/;
- TypeFile($file, $1) if /type(b|u)?/;
- UnzipFile($file, $par1) if /unzip/;
- WriteFile($file, $par1, $1, $2) if /write(b|u)?(-q)?/;
- Zip($file, 0, $1, $par2, GlobFiles($par1)) if /^zip(-[jq]+)?$/;
- Copy($file, $par1, $1) if /copy(dir)?/;
- Move($file, $par1) if /move/;
- Test($file) if /test/;
- Touch($file, $par1) if /touch/;
- }
- }
- elsif (/^genexclst$/) {
- GenExclfile(GetIPar(), GetIPar(), GetIPar(), GetIPar(), GetIPar());
- }
- elsif (/^geniby(-r)?$/) {
- my ($sub, $iby, $dir, @par) = ($1, GetIPar(), GetIPar(), ());
- push(@par, GetIPar(), GetIPar()) while !EndICmd();
- GenIbyfile($iby, $dir, $sub, @par);
- }
- elsif (/^genmk$/) {
- GenMakefile(GetIPar(), GetIPar(), GetIPar(), GetIPar(), GetIPar());
- }
- elsif (/^iferror$/) {
- $iferror++;
- $gError = 0, next if $gError;
- while (defined($gIcmd[0])) {
- GetICmd(), last if PeekICmd("endif") && !--$iferror;
- $iferror++ if shift(@gIcmd) =~ /^iferror$/i;
- }
- }
- elsif (/^endif$/ && $iferror--) {
- }
- elsif (/^imghdr$/) {
- AddImageHeader(GetIPar(), GetIPar(), GetIPar(), GetIPar(), GetIPar());
- }
- elsif (/^pause$/) {
- DPrint(0, "Press Enter to continue...\n");
- getc();
- }
- elsif (/^sleep$/) {
- Sleep(GetIPar());
- }
- elsif (/^sosfind(-a)?$/) {
- my $opt = $1;
- FindSOSFiles(GetIPar(), GetIPar(), GetIPar(), GetIPar(), $opt);
- }
- elsif (/^toolchk$/) {
- my @tools = ();
- push(@tools, GetIPar(), GetIPar(), GetIPar()) while !EndICmd();
- CheckTool(@tools);
- }
- elsif (/^wgunzip$/) {
- ($file, my $dir, my $fname) = (GetIPar(), GetIPar(), GetIPar());
- map { WidgetUnzip($_, $dir, $fname) } GlobFiles($file);
- }
- elsif (!$gImakerext || !RunIExtCmd($_)) {
- die("Unknown iMaker command `$cmd'.\n");
- }
- }
-}
-
-
-###############################################################################
-#
-
-sub GetFeatvarIncdir($;$)
-{
- my ($varname, $nbv) = @_;
- my %featvar = ();
- my @incdir = ("Invalid SBV feature variant");
- my $valid = 0;
- local $_;
-
- open(OLDERR, ">&STDERR");
- open(STDERR, $gWinOS ? ">nul" : ">/dev/null");
- select(STDERR);
- eval {
- local $SIG{__DIE__};
- %featvar = featurevariantparser->GetVariant($varname);
- $valid = $featvar{VALID};
- };
- close(STDERR);
- open(STDERR, ">&OLDERR");
- close(OLDERR);
- select(STDOUT);
-
- return(grep(tr/\\/\// || 1, @{$featvar{ROM_INCLUDES}})) if $valid;
- return(@incdir) if !$nbv;
-
- # N*kia Binary Variation
- foreach my $file (<$gEpoc32/tools/*.bsf>) {
- (my $varname = lc($file)) =~ s/^.*\/(.+?)\.bsf$/$1/;
- open(FILE, $file);
- while (my $line = <FILE>) {
- $featvar{$varname}{CUSTOMIZES} = lc($1) if $line =~ /^\s*CUSTOMIZES\s+(\S+)\s*$/i;
- $featvar{$varname}{VARIANT} = (uc($1) || 1) if $line =~ /^\s*(VIRTUAL)?VARIANT\s*$/i;
- }
- close(FILE);
- }
- $varname = lc($varname);
- my @variant = ();
- while ($featvar{$varname}{VARIANT}) {
- unshift(@variant, $varname) if $featvar{$varname}{VARIANT} ne "VIRTUAL";
- $varname = $featvar{$varname}{CUSTOMIZES};
- }
- while (@variant) {
- map { push(@incdir, join("/", $_, @variant)) } ("$gEpoc32/rom", "$gEpoc32/include");
- pop(@variant);
- }
- return(@incdir);
-}
-
-
-###############################################################################
-#
-
-sub SetVerbose($)
-{
- my $verbose = shift();
- return($gVerbose = int($1)) if ($verbose =~ /^(\d+)$/) && ($1 < 128);
- $gVerbose = 1;
- warn("Verbose level `$verbose' is not integer between 0 - 127\n");
- return(1);
-}
-
-sub ReadICmdFile($)
-{
- my ($file, $steps) = (GetAbsFname(shift()), "");
- OpenFile(*FILE, $file, 0) or
- die("Can't read iMaker command file `$file'.\n"), return;
- while (<FILE>) {
- DPrint(2, $_), next if /^\s*#/;
- next if !/^\s*(\S+?)\s*=(.*)$/;
- $gStepIcmd{my $step = $1} = (my $icmd = $2);
- $steps .= ($steps ? ", " : "") . $step . ($icmd =~ /^\s*$/ ? " (empty)" : "");
- }
- close(FILE);
- DPrint(2, "Steps: $steps\n");
-}
-
-sub CloseLog()
-{
- close(LOG) if $gLogfile;
- $gLogfile = "";
-}
-
-sub MakeStep($$$$$$)
-{
- (my $step, my $clean, my $build, $gKeepgoing, my $verbose, $gPrintcmd) = @_;
- (my $dur, @gStepDur) = (time(), ());
-
- SetVerbose($verbose);
- ChangeDir($gWorkdir);
-
- $gMakestep = "S:$step,C:" . ($clean ? 1 : 0) . ",B:" . ($build ? 1 : 0) .
- ",K:" . ($gKeepgoing ? 1 : 0) . ",V:$gVerbose";
- DPrint(2, "=" x 79 . "\nENTER: `$gMakestep'\n");
- map {
- if (defined($gStepIcmd{$_})) {
- DPrint(64, "$_ = `$gStepIcmd{$_}'\n");
- $gStepIcmd{$_} =~ s/(?<!(\\|\s))\|/ \|/g; # ???
- @gIcmd = map((s/^\s+|(?<!\\)\s+$//g, s/\\\|/\|/g) ? $_ : $_, split(/(?<!\\)\|/, "$gStepIcmd{$_} "));
- RunICmd();
- } else {
- warn("Step `$_' is undefined.\n");
- }
- } ($clean ? "CLEAN_$step" : (), $build ? "BUILD_$step" : ());
-
- DPrint(2, "EXIT: `$gMakestep', duration: " . Sec2Min($dur = time() - $dur) . "\n");
- return((@gStepDur, $dur));
-}
-
-
-###############################################################################
-#
-
-sub HandleCmdArg($)
-{
- my $arg = (defined($_[0]) ? $_[0] : "");
- return($gImakerext ? HandleExtCmdArg($arg) : $arg);
-}
-
-
-###############################################################################
-#
-
-sub MenuRuncmd($)
-{
- ($ENV{IMAKER_MAKECMD}, my @menubuf) = (shift(), ());
- map {
- chomp();
- push(@menubuf, $_);
- } qx($ENV{IMAKER_MAKECMD});
- return(@menubuf);
-}
-
-sub Menu($$$)
-{
- my ($makecmd, $mainmk, $cmdarg) = @_;
- my $quietopt = 'LOGFILE= PRINTCMD=0 VERBOSE=1 WORKDIR=$(CURDIR)';
- my ($prodind, $prodmk, @product) = (0, "", ());
- my ($targind, $target, $targcols, $targrows, @target) = (0, "", 4, 0, ());
- my ($vartype, $varudeb, $varsym) = ("", 0, 0);
- my $cfgfile = "./imaker_menu.cfg";
-
- $cmdarg =~ s/^\s+|\s+$//g;
- $cmdarg = " $cmdarg" if $cmdarg ne "";
- open(FILE, "<$cfgfile") and
- (($prodind, $targind, $vartype, $varudeb, $varsym) = map(chomp() ? $_ : $_, <FILE>)) and close(FILE);
-
- while (1) {
- system($gWinOS ? "cls" : "clear");
-
- print("\nPRODUCTS\n--------\n");
- #
- if (!@product) {
- map {
- push(@product, [ucfirst($1), $_]) if /image_conf_(.+?)\./;
- } MenuRuncmd("$makecmd $mainmk $quietopt help-config");
- }
- $prodmk = ($prodind ? " -f $product[$prodind - 1][1]" : "");
- my $maxlen = Max(map(length(@$_[0]), @product));
- map {
- printf(" %" . (length(@product)) . "s) %-${maxlen}s %s\n", $_ + 1, $product[$_][0], $product[$_][1]);
- } (0 .. $#product);
- print(" NO PRODUCTS FOUND!\n") if !@product;
-
- print("\nTARGETS\n-------\n");
- #
- if (!@target) {
- @target = MenuRuncmd("$makecmd$prodmk $mainmk $quietopt help-target-*-list");
- $targrows = int($#target / $targcols + 1);
- my $maxind = 0;
- map {
- if (!($_ % $targrows)) {
- $maxind = length(Min($_ + $targrows, $#target + 1)) + 1;
- $maxlen = Max(map(length(), @target[$_ .. Min($_ + $targrows - 1, $#target)]));
- }
- $target[$_] = sprintf("%${maxind}s) %-${maxlen}s", "t" . ($_ + 1), $target[$_]);
- } (0 .. $#target);
- }
- ($target = ($targind ? $target[$targind - 1] : "")) =~ s/^.+?(\S+)\s*$/$1/;
- foreach my $row (1 .. $targrows) {
- foreach my $col (1 .. $targcols) {
- my $ind = ($col - 1) * $targrows + $row - 1;
- print(($ind < @target ? " $target[$ind]" : "") . ($col != $targcols ? " " : "\n"));
- }
- }
- print(" NO TARGETS FOUND!\n") if !@target;
-
- print("\nCONFIGURATION\n-------------\n");
- #
- if (!$vartype) {
- ($vartype, $varudeb, $varsym) = map(/^\S+\s+=\s+`(.*)'$/ ? $1 : (),
- MenuRuncmd("$makecmd$prodmk $mainmk $quietopt TIMESTAMP=" . GetTimestamp() .
- " $target print-TYPE,USE_UDEB,USE_SYMGEN"));
- $varudeb =~ s/0//g;
- $varsym =~ s/0//g;
- }
- print(
- " Product: " . ($prodind ? $product[$prodind - 1][0] : "NOT SELECTED!") . "\n" .
- " Target : " . ($targind ? $target : "NOT SELECTED!") . "\n" .
- " Type : " . ucfirst($vartype) . "\n" .
- " Tracing: " . ($varudeb ? ($varudeb =~ /full/i ? "Full debug" : "Enabled") : "Disabled") . "\n" .
- " Symbols: " . ($varsym ? "Created\n" : "Not created\n"));
-
- print("\nOPTIONS\n-------\n");
- #
- print(
- " t) Toggle between rnd/prd/subcon\n" .
- " u) Toggle between urel/udeb/udeb full\n" .
- " s) Toggle symbol creation on/off\n" .
- " r) Reset configuration\n" .
- " h) Print usage information\n" .
- " x) Exit\n\n" .
- "Hit Enter to run: imaker$prodmk$cmdarg TYPE=$vartype USE_UDEB=$varudeb USE_SYMGEN=$varsym $target\n");
-
- print("\nSelection: ");
- #
- (my $input = <STDIN>) =~ s/^\s*(.*?)\s*$/\L$1\E/;
-
- if ($input =~ /^(\d+)$/ && ($1 > 0) && ($1 <= @product) && ($1 != $prodind)) {
- $prodind = $1;
- ($targind, @target) = (0, ());
- }
- elsif ($input =~ /^t(\d+)$/ && ($1 > 0) && ($1 <= @target) && ($1 != $targind)) {
- $targind = $1;
- }
- elsif ($input eq "t") {
- $vartype = ($vartype =~ /rnd/i ? "prd" : ($vartype =~ /prd/i ? "subcon" : "rnd"));
- }
- elsif ($input eq "u") {
- $varudeb = (!$varudeb ? 1 : ($varudeb !~ /full/i ? "full" : 0));
- }
- elsif ($input eq "s") {
- $varsym = !$varsym;
- }
- elsif ($input eq "r") {
- ($prodind, @product) = (0, ());
- ($targind, @target) = (0, ());
- ($vartype, $varudeb, $varsym) = ("", 0, 0);
- }
- elsif ($input eq "h") {
- print("\nTODO: Help");
- sleep(2);
- }
- elsif ($input =~ /^(x|)$/) {
- open(FILE, ">$cfgfile") and
- print(FILE map("$_\n", ($prodind, $targind, $vartype, $varudeb, $varsym))) and close(FILE);
- return($input eq "x" ? ("", "menu") :
- ("$prodmk$cmdarg TYPE=$vartype USE_UDEB=$varudeb USE_SYMGEN=$varsym", $target));
- }
- }
-}
-
-
-###############################################################################
-#
-
-die($@) if !defined($gImakerext = do("imaker_extension.pm")) && $@;
-
-1;
-
-__END__ # OF IMAKER.PM
--- a/imgtools/imaker/src/imaker_core.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_core.mk Thu Jun 24 10:35:05 2010 +0300
@@ -23,10 +23,10 @@
# \___\___/|_|_\___|
#
-USE_NOROMHDR = 0
-
CORE_TITLE = Core (ROM$(call iif,$(USE_ROFS1), & ROFS1))
-CORE_DIR = $(WORKDIR)/core
+CORE_DRIVE = Z
+CORE_ROOT = $(OUTDIR)/core
+CORE_DIR = $(CORE_ROOT)
CORE_NAME = $(NAME)
CORE_PREFIX = $(CORE_DIR)/$(CORE_NAME)
CORE_IDIR =
@@ -38,13 +38,14 @@
CORE_INLINE =
CORE_TIME = $(DAY)/$(MONTH)/$(YEAR)
-CORE_OBYGEN =
+CORE_DEFHRH = $(CORE_PREFIX)_core_define.hrh
+CORE_FEAXML = $(E32ROMINC)/featuredatabase.xml $(E32INC)/s60features.xml $(E32INC)/s60customswfeatures.xml
+CORE_FEAIBY = $(CORE_DIR)/feature.iby $(CORE_DIR)/s60features.iby $(CORE_DIR)/s60customswfeatures.iby
-CORE_VERIBY = $(CORE_PREFIX)_core_version.iby
-CORE_ROMVER = 0.01(0)
-CORE_VERSION = V $(subst .,,$(COREPLAT_VERSION)).$(subst .,,$(S60_VERSION)).$(BUILD_YEAR).$(BUILD_WEEK).$(BUILD_NUMBER)$(if $(TYPE), $(call ucase,$(TYPE)))
+CORE_ROMVER =
+CORE_VERSION = $(SW_VERSION)
CORE_SWVERFILE = $(CORE_PREFIX)_core_sw.txt
-CORE_SWVERINFO = $(CORE_VERSION)\\\n$(DAY)-$(MONTH)-$(YEAR2)\\\n$(PRODUCT_TYPE)\\\n(c) $(PRODUCT_MANUFACT)
+CORE_SWVERINFO = $(CORE_VERSION)\n$(BUILD_YEAR)-$(BUILD_MONTH)-$(BUILD_DAY)\n$(PRODUCT_TYPE)\n(c) $(PRODUCT_MANUFACT)
CORE_MODELFILE = $(CORE_PREFIX)_core_model.txt
CORE_MODELINFO = S60
CORE_IMEISVFILE = $(CORE_PREFIX)_core_imeisv.txt
@@ -53,10 +54,35 @@
CORE_PLATINFO = SymbianOSMajorVersion=$(word 1,$(subst ., ,$(SOS_VERSION)))\nSymbianOSMinorVersion=$(word 2,$(subst ., ,$(SOS_VERSION)))\n
CORE_PRODFILE = $(CORE_PREFIX)_core_product.txt
CORE_PRODINFO = Manufacturer=$(PRODUCT_MANUFACT)\nModel=$(PRODUCT_MODEL)\nProduct=$(PRODUCT_TYPE)\nRevision=$(PRODUCT_REVISION)
+CORE_ID = general
CORE_FWIDFILE = $(CORE_PREFIX)_core_fwid.txt
CORE_FWID = core
-CORE_FWIDVER = $(CORE_VERSION) $(PRODUCT_TYPE)
+CORE_FWIDVER = $(subst -,,$(PRODUCT_TYPE))_$(CORE_VERSION)_$(CORE_ID)$(SW_TYPEINFO)
CORE_FWIDINFO = id=$(CORE_FWID)\nversion=$(CORE_FWIDVER)\n
+CORE_PURPFILE = $(CORE_PREFIX)_core_purpose.txt
+CORE_PURPINFO = MCL
+CORE_DEVATTRFILE = $(CORE_PREFIX)_core_deviceattrib.ini
+
+define CORE_DEVATTRINFO
+ [Device]
+ 0x10286358 = $(PRODUCT_MANUFACT)
+ 0x10286359 = $(PRODUCT_MODEL)
+ 0x1028635A = $(PRODUCT_TYPE)
+ 0x1028635B = $(PRODUCT_REVISION)
+
+ [UI]
+ 0x1028635D = S60
+ 0x1028635E = $(word 1,$(subst ., ,$(S60_VERSION)))
+ 0x1028635F = $(word 2,$(subst ., ,$(S60_VERSION)))
+ 0x10286360 = $(S60_VERSION)
+
+ [OS]
+ 0x10286361 = $(word 1,$(subst ., ,$(SOS_VERSION)))
+ 0x10286362 = $(word 2,$(subst ., ,$(SOS_VERSION)))
+ 0x10286363 = $(SOS_VERSION)
+endef
+
+CORE_IMG = $(ROM_IMG) $(call iif,$(USE_ROFS1),$(ROFS1_IMG))
CORE_PLUGINLOG = $(CORE_PREFIX)_core_bldromplugin.log
CORE_NDPROMFILE = $(E32ROMBLD)/romfiles.txt
@@ -70,62 +96,69 @@
CORE_PAGEFILE = $(ODP_PAGEFILE)
CORE_UDEBFILE = $(TRACE_UDEBFILE)
+CORE_OBYGEN =
+CORE_ORIDEIBY = $(CORE_PREFIX)_core_override.iby
+CORE_ORIDEFILES = $(IMAGE_ORIDEFILES)
+CORE_ORIDECONF = $(IMAGE_ORIDECONF)
+
CORE_ICHKLOG = $(CORE_PREFIX)_core_imgcheck.log
CORE_ICHKOPT = $(IMGCHK_OPT)
-CORE_ICHKIMG = $(ROM_IMG) $(call iif,$(USE_ROFS1),$(ROFS1_IMG))
+CORE_ICHKIMG = $(CORE_IMG)
CORE_I2FDIR = $(CORE_DIR)/img2file
+CORE_CONECONF =
+CORE_CONEOPT = --all-layers --impl-tag=target:core
+
#==============================================================================
ROM_BUILDOPT = $(call iif,$(USE_NOROMHDR),-no-header)
-ROM_CHECKSUM = 0x12345678
ROM_IMGHDRSIZE = 256
ROM_HEADER =
ROM_FOOTER =
-ROM_IMG = $(CORE_PREFIX).rom.img
-ROM_INC = $(CORE_PREFIX).rom.inc
-ROM_LOG = $(CORE_PREFIX).rom.log
-ROM_OUTOBY = $(CORE_PREFIX).rom.oby
-ROM_SYM = $(CORE_PREFIX).rom.symbol
+ROM_PREFIX = $(CORE_PREFIX).rom
+ROM_IMG = $(ROM_PREFIX).img
+ROM_INC = $(ROM_PREFIX).inc
+ROM_LOG = $(ROM_PREFIX).log
+ROM_OUTOBY = $(ROM_PREFIX).oby
+ROM_SYM = $(ROM_PREFIX).symbol
-ROFS1_HEADER =
-ROFS1_IMG = $(CORE_PREFIX).rofs1.img
-ROFS1_LOG = $(CORE_PREFIX).rofs1.log
-ROFS1_OUTOBY = $(CORE_PREFIX).rofs1.oby
-ROFS1_SYM = $(CORE_PREFIX).rofs1.symbol
+ROFS1_PREFIX = $(CORE_PREFIX)
+ROFS1_PAGEFILE =
#==============================================================================
define CORE_MSTOBYINFO
- $(BLDROM_HDRINFO)
+ $(call BLDROM_HDRINFO,CORE)
- $(BLDROM_PLUGINFO)
+ $(call BLDROM_PLUGINFO,CORE)
- // Core header
- //
+ /* Core header
+ */
$(CORE_HDRINFO)
- // Core ROM
- //
+ /* Core ROM
+ */
ROM_IMAGE[0] {
$(ROM_HDRINFO)
+ #ifndef _IMAGE_INCLUDE_HEADER_ONLY
$(BLR.CORE.OBY)
$(CORE_INLINE)
$(ROM_FOOTERINFO)
}
$(call iif,$(USE_ROFS1),
- // Core ROFS1
- //
- ROM_IMAGE 1 rofs1 non-xip size=$(ROFS_MAXSIZE)
+ /* Core ROFS1
+ */
+ ROM_IMAGE 1 rofs1 non-xip size=$(ROFS1_MAXSIZE)
ROM_IMAGE[1] {
$(ROFS1_HDRINFO)
- // Content to be moved from ROM to ROFS1
+ /* Content to be moved from ROM to ROFS1 */
}
)
+ #endif // _IMAGE_INCLUDE_HEADER_ONLY
endef
define CORE_HDRINFO
@@ -143,124 +176,200 @@
define ROM_FOOTERINFO
$(if $(ROM_BUILDOPT),ROMBUILD_OPTION $(ROM_BUILDOPT))
- romname $(notdir $(ROM_IMG))
$(if $(CORE_TIME),time=$(CORE_TIME))
- $(if $(ROM_CHECKSUM),romchecksum=$(ROM_CHECKSUM))
+ $(if $(CORE_ROMVER),version=$(CORE_ROMVER))
$(ROM_FOOTER)
endef
define ROFS1_HDRINFO
- $(call ODP_CODEINFO,1)
+ $(ODP_ROFSINFO)
$(ROFS1_HEADER)
$(if $(CORE_TIME),time=$(CORE_TIME))
endef
-define CORE_VERIBYINFO
- // Generated `$(CORE_VERIBY)$' for Core image creation
- $(if $(CORE_ROMVER),
-
- version=$(CORE_ROMVER))
+define CORE_ORIDEINFO
+ // Generated `$(CORE_ORIDEIBY)' for $(CORE_TITLE) image creation
- OVERRIDE_REPLACE/ADD
- data-override=$(CORE_SWVERFILE) RESOURCE_FILES_DIR\versions\sw.txt
- data-override=$(CORE_MODELFILE) RESOURCE_FILES_DIR\versions\model.txt
- data-override=$(CORE_IMEISVFILE) RESOURCE_FILES_DIR\versions\imeisv.txt
- data-override=$(CORE_PLATFILE) RESOURCE_FILES_DIR\versions\platform.txt
- data-override=$(CORE_PRODFILE) RESOURCE_FILES_DIR\versions\product.txt
- $(call iif,$(USE_FOTA),
- data-override=$(CORE_FWIDFILE) RESOURCE_FILES_DIR\versions\fwid1.txt)
- OVERRIDE_END
+ $(call iif,$(USE_ROFS1),\
+ OVERRIDE_REPLACE/ADD
+ $(if $(CORE_SWVERINFO),
+ data-override="$(CORE_SWVERFILE)" "$(IMAGE_VERSDIR)\sw.txt")
+ $(if $(CORE_MODELINFO),
+ data-override="$(CORE_MODELFILE)" "$(IMAGE_VERSDIR)\model.txt")
+ $(if $(CORE_IMEISVINFO),
+ data-override="$(CORE_IMEISVFILE)" "$(IMAGE_VERSDIR)\imeisv.txt")
+ $(if $(CORE_PLATINFO),
+ data-override="$(CORE_PLATFILE)" "$(IMAGE_VERSDIR)\platform.txt")
+ $(if $(CORE_PRODINFO),
+ data-override="$(CORE_PRODFILE)" "$(IMAGE_VERSDIR)\product.txt")
+ $(if $(CORE_PURPINFO),
+ data-override="$(CORE_PURPFILE)" "$(IMAGE_VERSDIR)\purpose.txt")
+ $(if $(CORE_FWIDINFO),
+ data-override="$(CORE_FWIDFILE)" "$(IMAGE_VERSDIR)\fwid1.txt")
+ $(if $(CORE_DEVATTRINFO),
+ data-override="$(CORE_DEVATTRFILE)" "$(IMAGE_VERSDIR)\deviceattributes.ini")
+ OVERRIDE_END
+ )
endef
#==============================================================================
CLEAN_COREFILE =\
- del | "$(CORE_MSTOBY)" "$(CORE_VERIBY)" "$(CORE_SWVERFILE)" "$(CORE_MODELFILE)"\
- "$(CORE_IMEISVFILE)" "$(CORE_PLATFILE)" "$(CORE_PRODFILE)" "$(CORE_FWIDFILE)" |\
+ del | "$(CORE_MSTOBY)" "$(CORE_ORIDEIBY)" "$(CORE_SWVERFILE)" "$(CORE_MODELFILE)"\
+ "$(CORE_IMEISVFILE)" "$(CORE_PLATFILE)" "$(CORE_PRODFILE)" "$(CORE_PURPFILE)"\
+ "$(CORE_FWIDFILE)" "$(CORE_DEVATTRFILE)" |\
del | $(call getgenfiles,$(CORE_OBYGEN))
BUILD_COREFILE =\
- echo-q | Generating file(s) for Core image creation |\
- write | $(CORE_MSTOBY) | $(call def2str,$(CORE_MSTOBYINFO)) |\
- $(call iif,$(USE_ROFS1),$(call iif,$(USE_VERGEN),\
- write | $(CORE_VERIBY) | $(call def2str,$(CORE_VERIBYINFO)) |\
- writeu | $(CORE_SWVERFILE) | $(CORE_SWVERINFO) |\
- writeu | $(CORE_MODELFILE) | $(CORE_MODELINFO) |\
- writeu | $(CORE_IMEISVFILE) | $(CORE_IMEISVINFO) |\
- writeu | $(CORE_PLATFILE) | $(CORE_PLATINFO) |\
- writeu | $(CORE_PRODFILE) | $(CORE_PRODINFO) |\
- writeu | $(CORE_FWIDFILE) | $(CORE_FWIDINFO) |))\
+ echo-q | Generating file(s) for $(CORE_TITLE) image creation |\
+ write-c | "$(CORE_MSTOBY)" | $(call def2str,$(CORE_MSTOBYINFO))\n |\
+ $(call iif,$(USE_ROFS1),\
+ $(if $(CORE_SWVERINFO),\
+ writeu | "$(CORE_SWVERFILE)" | $(call quote,$(CORE_SWVERINFO)) |)\
+ $(if $(CORE_MODELINFO),\
+ writeu | "$(CORE_MODELFILE)" | $(CORE_MODELINFO) |)\
+ $(if $(CORE_IMEISVINFO),\
+ writeu | "$(CORE_IMEISVFILE)" | $(CORE_IMEISVINFO) |)\
+ $(if $(CORE_PLATINFO),\
+ writeu | "$(CORE_PLATFILE)" | $(CORE_PLATINFO) |)\
+ $(if $(CORE_PRODINFO),\
+ writeu | "$(CORE_PRODFILE)" | $(CORE_PRODINFO) |)\
+ $(if $(CORE_PURPINFO),\
+ writeu | "$(CORE_PURPFILE)" | $(CORE_PURPINFO) |)\
+ $(if $(CORE_FWIDINFO),\
+ writeu | "$(CORE_FWIDFILE)" | $(CORE_FWIDINFO) |)\
+ $(if $(CORE_DEVATTRINFO),\
+ writeu | "$(CORE_DEVATTRFILE)" | $(call def2str,$(CORE_DEVATTRINFO)) |)\
+ )\
+ $(if $(CORE_ORIDEINFO),\
+ write-c | "$(CORE_ORIDEIBY)" | $(call def2str,$(CORE_ORIDEINFO)) |)\
+ $(if $(CORE_ORIDECONF),\
+ genorideiby | >>$(CORE_ORIDEIBY) | $(call def2str,$(CORE_ORIDEFILES) | $(CORE_ORIDECONF)) |)\
$(CORE_OBYGEN)
###############################################################################
# Core pre-build step
-CLEAN_COREPRE = $(if $(filter 1,$(USE_VARIANTBLD)),$(CLEAN_CUSTVARIANT) |) $(CLEAN_COREFILE)
+CLEAN_COREPRE =\
+ $(if $(filter 1,$(USE_VARIANTBLD)),$(CLEAN_VARIANT) |)\
+ $(CLEAN_COREFILE) | $(CLEAN_DEFHRH) | $(CLEAN_FEATMAN)
+
BUILD_COREPRE =\
- $(if $(filter 1,$(USE_VARIANTBLD)),$(BUILD_CUSTVARIANT) |)\
- mkcd | $(CORE_DIR) |\
- $(BUILD_COREFILE)
+ $(if $(filter 1,$(USE_VARIANTBLD)),$(BUILD_VARIANT) |)\
+ mkdir | "$(CORE_DIR)" |\
+ $(BUILD_COREFILE) |\
+ $(BUILD_DEFHRH) |\
+ $(BUILD_FEATMAN)
#==============================================================================
# Core build step
-BLR.CORE.IDIR = $(call dir2inc,$(CORE_IDIR) $(call iif,$(USE_FEATVAR),,$(FEATVAR_IDIR)))
-BLR.CORE.HBY = $(call includeiby,<data_caging_paths_for_iby.hrh> $(CORE_HBY))
-BLR.CORE.OBY = $(call includeiby,$(CORE_OBY) $(if $(filter 1,$(USE_VARIANTBLD)),$(VARIANT_OBY)) $(BLDROBY) $(call iif,$(USE_ROFS1),$(call iif,$(USE_VERGEN),$(CORE_VERIBY))))
-BLR.CORE.OPT = $(CORE_OPT) $(if $(filter 1,$(USE_PAGEDCODE)),$(if $(ODP_CODECOMP),-c$(ODP_CODECOMP))) -o$(notdir $(CORE_NAME).img) $(BLDROPT)
-BLR.CORE.POST =\
- move | $(CORE_PREFIX).log | $(ROM_LOG) |\
- move | $(CORE_PREFIX).oby | $(ROM_OUTOBY) |\
- test | $(ROM_IMG) | $(call iif,$(USE_PAGEDROM),test | $(ROM_INC) |)\
- $(call iif,$(USE_ROFS1),test | $(ROFS1_IMG))
+BLR.CORE.IDIR = $(call dir2inc,$(CORE_IDIR) $(call iif,$(USE_FEATVAR),,$(FEATVAR_IDIR)))
+BLR.CORE.HBY = $(call includeiby,<data_caging_paths_for_iby.hrh> $(CORE_HBY))
+BLR.CORE.OBY =\
+ $(call includeiby,$(CORE_OBY))\
+ $(and $(call true,$(SYMBIAN_FEATURE_MANAGER)),$(CORE_FEAIBY),$(call mac2cppdef,-U__FEATURE_IBY__)$(call includeiby,$(CORE_FEAIBY)))\
+ $(call includeiby,$(if $(filter 1,$(USE_VARIANTBLD)),$(VARIANT_OBY)) $(BLDROBY) $(CORE_ORIDEIBY))
+BLR.CORE.OPT = $(CORE_OPT) $(if $(filter 1,$(USE_PAGEDCODE)),$(if $(ODP_CODECOMP),-c$(ODP_CODECOMP))) -o$(call pathconv,$(ROM_IMG)) $(BLDROPT)
+BLR.CORE.POST =\
+ test | "$(ROM_IMG)" $(call iif,$(USE_PAGEDROM),"$(ROM_INC)") |\
+ $(call iif,$(USE_ROFS1),\
+ move | "$(ROM_PREFIX).rofs1.img" | $(ROFS1_IMG) |\
+ move | "$(ROM_PREFIX).rofs1.log" | $(ROFS1_LOG) |\
+ move | "$(ROM_PREFIX).rofs1.oby" | $(ROFS1_OUTOBY) |\
+ $(call iif,$(USE_SYMGEN),move | "$(ROM_PREFIX).rofs1.symbol" | $(ROFS1_SYM)))
-CLEAN_CORE = $(CLEAN_BLDROM)
-BUILD_CORE = $(BUILD_BLDROM)
+CLEAN_CORE = $(call CLEAN_BLDROM,CORE)
+BUILD_CORE = $(call BUILD_BLDROM,CORE)
+
+REPORT_CORE =\
+ $(CORE_TITLE) dir | $(CORE_DIR) | d |\
+ Core ROM image | $(ROM_IMG) | f\
+ $(call iif,$(USE_SYMGEN),| Core ROM symbols | $(ROM_SYM) | f)\
+ $(call iif,$(USE_ROFS1),|\
+ Core ROFS1 image | $(ROFS1_IMG) | f\
+ $(call iif,$(USE_SYMGEN),| Core ROFS1 symbols | $(ROFS1_SYM) | f))
#==============================================================================
# Core post-build step
-CLEAN_COREPOST = $(CLEAN_IMGCHK) | $(CLEAN_CORESYM)
-BUILD_COREPOST =\
- $(call iif,$(USE_IMGCHK),$(BUILD_IMGCHK) |)\
- $(call iif,$(USE_SYMGEN),$(BUILD_CORESYM))
+CLEAN_COREPOST = $(CLEAN_IMGCHK)
+BUILD_COREPOST = $(call iif,$(USE_IMGCHK),$(BUILD_IMGCHK))
+
+
+###############################################################################
+# Core symbol generation
+
+MAKSYM_CMD = $(MAKSYM_TOOL) $(call pathconv,"$(ROM_LOG)" "$(ROM_SYM)")
CLEAN_CORESYM = del | "$(ROM_SYM)" "$(ROFS1_SYM)"
BUILD_CORESYM =\
echo-q | Creating $(CORE_TITLE) symbol file(s) |\
- cmd | $(MAKSYM_TOOL) $(call pathconv,$(ROM_LOG) $(ROM_SYM)) |\
- $(call iif,$(USE_ROFS1),cmd | $(MAKSYMROFS_TOOL) $(call pathconv,$(ROFS1_LOG) $(ROFS1_SYM)))
+ cmd | $(MAKSYM_CMD) |\
+ $(call iif,$(USE_ROFS1),cmd | $(MAKSYMROFS_TOOL) $(call pathconv,"$(ROFS1_LOG)" "$(ROFS1_SYM)"))
+
+REPORT_CORESYM =\
+ Core ROM symbols | $(ROM_SYM) | f\
+ $(call iif,$(USE_ROFS1),| Core ROFS1 symbols | $(ROFS1_SYM) | f)
+
-#==============================================================================
+###############################################################################
+# Steps
-SOS.CORE.STEPS = $(call iif,$(SKIPPRE),,COREPRE) $(call iif,$(SKIPBLD),,CORE) $(call iif,$(SKIPPOST),,COREPOST)
+SOS.CORE.STEPS =\
+ $(call iif,$(SKIPPRE),,$(and $(filter 1,$(USE_VARIANTBLD)),$(call true,$(USE_CONE)),CONEGEN RESTART) COREPRE)\
+ $(call iif,$(SKIPBLD),,CORE) $(call iif,$(SKIPPOST),,COREPOST)
+
ALL.CORE.STEPS = $(SOS.CORE.STEPS)
+CORE_PRESTEPS = $(call iif,$(USE_SMR),smr |)
+CORE_STEPS = $(CORE_PRESTEPS) $(ALL.CORE.STEPS)
+CORE_IMGSTEPS = $(CORE_PRESTEPS) $(SOS.CORE.STEPS)
+
###############################################################################
# Targets
-.PHONY: core core-all core-image core-pre core-check core-symbol core-i2file
+.PHONY: core $(addprefix core-,all check cone i2file image pre symbol)
-core core-% rom-% rofs1-%: IMAGE_TYPE = CORE
-core-all : USE_SYMGEN = 1
+core core% rom% rofs1%: IMAGE_TYPE = CORE
+core-all : USE_SYMGEN = 1
-core core-all: ;@$(call IMAKER,$$(ALL.CORE.STEPS))
-core-image : ;@$(call IMAKER,$$(SOS.CORE.STEPS))
+core core-all: ;@$(call IMAKER,$$(CORE_STEPS))
+core-image : ;@$(call IMAKER,$$(CORE_IMGSTEPS))
-core-pre : ;@$(call IMAKER,COREPRE)
-core-check : ;@$(call IMAKER,IMGCHK)
-core-symbol : ;@$(call IMAKER,CORESYM)
+core-cone : ;@$(call IMAKER,CONEGEN)
+core-pre : ;@$(call IMAKER,COREPRE)
+core-check : ;@$(call IMAKER,IMGCHK)
+core-symbol: ;@$(call IMAKER,CORESYM)
+core-i2file: ;@$(call IMAKER,I2FILE)
-core-i2file : ;@$(call IMAKER,COREI2F)
-
-core-trace-% : LABEL = _trace_$*
-core-trace-% : USE_UDEB = 1
-core-trace-% : CORE_UDEBFILE = $(call findfile,$(TRACE_PREFIX)$*$(TRACE_SUFFIX),$(TRACE_IDIR))
-core-trace-% :\
+core-trace-%: LABEL = _$*
+core-trace-%: USE_UDEB = 1
+core-trace-%: CORE_UDEBFILE = $(call findfile,$(TRACE_PREFIX)$*$(TRACE_SUFFIX),$(TRACE_IDIR))
+core-trace-%:\
;@$(if $(wildcard $(CORE_UDEBFILE)),,$(error Can't make target `$@', file `$(CORE_UDEBFILE)' not found))\
$(call IMAKER,$$(ALL.CORE.STEPS))
+###############################################################################
+# Helps
+
+$(call add_help,CORE_PURPFILE,v,(string),The (generated) _core_purpose.txt file name.)
+$(call add_help,CORE_PURPINFO,v,(string),The content string for the purpose.txt file.)
+
+$(call add_help,core,t,Create $$(CORE_TITLE) image.)
+$(call add_help,core-dir,t,Create directory structure for $$(CORE_TITLE) creation.)
+$(call add_help,core-i2file,t,Extract all files from $$(CORE_TITLE) image.)
+$(call add_help,core-image,t,Create $$(CORE_TITLE) image (.img) file(s).)
+$(call add_help,core-pre,t,Run pre-step, create files etc. for $$(CORE_TITLE) creation.)
+$(call add_help,core-symbol,t,Create $$(CORE_TITLE) symbol file(s).)
+
+BUILD_HELPDYNAMIC +=\
+ $(foreach file,$(call reverse,$(wildcard $(addsuffix /$(TRACE_PREFIX)*$(TRACE_SUFFIX),$(TRACE_IDIR)))),\
+ $(call add_help,core-trace-$(patsubst $(TRACE_PREFIX)%$(TRACE_SUFFIX),%,$(notdir $(file))),t,\
+ Create $(CORE_TITLE) image with traces for $(file).))
+
+
# END OF IMAKER_CORE.MK
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imaker/src/imaker_emmc.mk Thu Jun 24 10:35:05 2010 +0300
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: iMaker eMMC (Embedded Mass Memory) image configuration
+#
+
+
+
+###############################################################################
+# __ __ __ __ ___
+# ___| \/ | \/ |/ __|
+# / -_) |\/| | |\/| | (__
+# \___|_| |_|_| |_|\___|
+#
+
+EMMC_TITLE = eMMC
+
+EMMC_DRIVE = E
+EMMC_FATTYPE = 32# FAT32
+EMMC_SIZE = 16777216# kB (= 16 GB)
+EMMC_CLUSTERSIZE = 16# kB
+EMMC_FATTABLE = 2
+
+EMMC_SWVERFILE = $(EMMC_DATADIR)/Resource/Versions/User Content Package_Mass_Memory.txt
+EMMC_SWVERINFO = # Don't generate sw version file
+EMMC_EXCLFILE = # Don't generate exclude list
+
+
+# END OF IMAKER_EMMC.MK
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imaker/src/imaker_fat.mk Thu Jun 24 10:35:05 2010 +0300
@@ -0,0 +1,296 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: iMaker FAT (File Allocation Table) image configuration
+#
+
+
+
+###############################################################################
+# ___ _ _____
+# | __|/_\|_ _|
+# | _|/ _ \ | |
+# |_|/_/ \_\|_|
+#
+
+USE_FILEDISK = 0
+USE_FSIMAGE = 0
+USE_SOSUDA = 1
+
+FATEMPTY_CMD =
+
+
+###############################################################################
+#
+
+define FAT_EVAL
+$1_TITLE = $1
+$1_ROOT = $$(OUTDIR)/$2
+$1_DIR = $$($1_ROOT)
+$1_NAME = $$(NAME)
+$1_PREFIX = $$($1_DIR)/$$($1_NAME)
+$1_IDIR =
+$1_HBY =
+$1_OBY =
+$1_OPT = $$(BLDROM_OPT) -D_EABI=$$(ARM_VERSION)
+$1_MSTOBY = $$($1_PREFIX)_$2_master.oby
+$1_HEADER =
+$1_INLINE =
+$1_FOOTER =
+$1_TIME = $$(DAY)/$$(MONTH)/$$(YEAR)
+
+$1_DEFHRH = $$($1_PREFIX)_$2_define.hrh
+$1_FEAXML =
+$1_FEAIBY =
+
+$1_ROMVER = $$(CORE_ROMVER)
+$1_ID = $$(if $$(filter $2_%,$$(TARGETNAME)),$$(TARGETID1),00)
+$1_REVISION = 01
+$1_VERSION = $$(CORE_VERSION).$$($1_ID).$$($1_REVISION)
+$1_SWVERFILE = $$($1_DATADIR)/Resource/Versions/User Content Package_$1.txt
+$1_SWVERINFO = $$($1_VERSION)
+
+$1_IMG = $$($1_PREFIX).$2.img
+$1_LOG = $$($1_PREFIX).$2.log
+$1_OUTOBY = $$($1_PREFIX).$2.oby
+
+$1_PLUGINLOG = $$($1_PREFIX)_$2_bldromplugin.log
+$1_UDEBFILE = $$(TRACE_UDEBFILE)
+
+$1_OBYGEN =
+$1_ORIDEIBY = $$($1_PREFIX)_$2_override.iby
+$1_ORIDEFILES = $$(IMAGE_ORIDEFILES)
+$1_ORIDECONF = $$(IMAGE_ORIDECONF)
+
+$1_CONECONF = $$(PRODUCT_NAME)_$2_$$($1_ID)$$(addprefix _,$$($1_VARNAME))_root.confml
+$1_CONEOPT = --all-layers --impl-tag=target:$2
+
+$1_DRIVE = C
+$1_FATTYPE = 16# FAT16
+$1_SIZE = 20480# kB
+$1_SIZEB = $$(call peval,$$($1_SIZE) * 1024)# B
+$1_DISKSIZE = $$($1_SIZE)# kB
+$1_SECTORSIZE = 512# B
+$1_CLUSTERSIZE = 4# kB
+$1_FATTABLE = 1
+$1_VOLUME =
+
+$1_TOUCH = 0#$$(YEAR)$$(MONTH)$$(DAY)000000
+$1_CPDIR =
+$1_ZIP =
+$1_DATADIR = $$($1_DIR)/datadrive
+
+$1_VARNAME = $$(if $$(filter $2_%,$$(TARGETNAME)),$$(TARGETID2-))
+$1_VARROOT = $$(or $$(wildcard $$(PRODUCT_DIR)/$2),$$(or $$(if $$(PRODUCT_MSTNAME),$$(wildcard $$(PRODUCT_MSTDIR)/$2)),$$(PRODUCT_DIR)/$2))
+$1_VARDIR = $$(if $$(and $$(call true,$$(USE_CONE)),$$(call true,$$(IMAKER_MKRESTARTS))),$$(CONE_OUTDIR),$$($1_VARROOT)/$2_$$($1_ID)$$(addprefix _,$$($1_VARNAME))$$(call iif,$$(USE_CONE),/content))
+
+$1_EXCLFILE = $$($1_DATADIR)/private/100059C9/excludelist.txt
+
+define $1_EXCLADD
+*
+endef
+
+define $1_EXCLRM
+endef
+
+$1EMPTY_TITLE = $$($1_TITLE) Empty
+$1EMPTY_IMG = $$($1_PREFIX).$2empty.img
+$1EMPTY_CMD = $$(FATEMPTY_CMD)
+
+#==============================================================================
+
+define $1_MSTOBYINFO
+ $$(call BLDROM_HDRINFO,$1)
+
+ ROM_IMAGE 0 non-xip size=0x00000000
+
+ DATA_IMAGE 0 $$(basename $$($1_IMG)) size=$$(call peval,$$($1_DISKSIZE) * 1024) fat$$(if $$(filter %32,$$($1_FATTYPE)),32,16)
+
+ $$(call BLDROM_PLUGINFO,$1)
+
+ /* $1 header
+ */
+ $$($1_HDRINFO)
+
+ DATA_IMAGE[0] {
+ $$(if $$($1_VOLUME),volume=$$($1_VOLUME))
+ fattable=$$($1_FATTABLE)
+ #ifndef _IMAGE_INCLUDE_HEADER_ONLY
+ $$(BLR.$1.OBY)
+ $$($1_INLINE)
+ $$($1_FOOTERINFO)
+ }
+ #endif // _IMAGE_INCLUDE_HEADER_ONLY
+endef
+
+define $1_HDRINFO
+ $$(DEFINE) _IMAGE_WORKDIR $$($1_DIR)
+ $$(call mac2cppdef,$$(BLR.$1.OPT))
+ $$(BLR.$1.HBY)
+ $$($1_HEADER)
+ $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(VARIANT_HEADER))
+endef
+
+define $1_FOOTERINFO
+ $$(if $$($1_TIME),time=$$($1_TIME))
+ $$(if $$($1_ROMVER),version=$$($1_ROMVER))
+ $$($1_FOOTER)
+endef
+
+$1_ORIDEINFO =
+
+#==============================================================================
+# FAT pre-build
+
+CLEAN_$1PRE =\
+ $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(CLEAN_VARIANT),deldir | "$$($1_DATADIR)") |\
+ $$(CLEAN_$1FILE) | $$(CLEAN_DEFHRH) | $$(CLEAN_FEATMAN)
+
+BUILD_$1PRE =\
+ echo-q | Preparing $$($1_TITLE) FAT image creation |\
+ $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(BUILD_VARIANT) |,\
+ mkdir | "$$($1_DATADIR)" |\
+ $$(if $$($1_ZIP),\
+ $$(eval __i_zip := $$(foreach zip,$$($1_ZIP),$$(zip)$$(if $$(filter %.zip,$$(call lcase,$$(zip))),,/*.zip)))\
+ echo-q | Extracting `$$(__i_zip)' to `$$($1_DATADIR)' |\
+ unzip | "$$(__i_zip)" | $$($1_DATADIR) |)\
+ $$(if $$($1_CPDIR),\
+ copydir | "$$($1_CPDIR)" | $$($1_DATADIR) |))\
+ mkdir | "$$($1_DIR)" |\
+ $$(BUILD_$1FILE) |\
+ $$(call iif,$$(BLR.$1.OBY),$$(BUILD_DEFHRH) |)\
+ $$(BUILD_FEATMAN)
+
+CLEAN_$1FILE =\
+ del | "$$($1_MSTOBY)" "$$($1_ORIDEIBY)" "$$($1_SWVERFILE)" |\
+ del | $$(call getgenfiles,$$($1_OBYGEN))
+
+BUILD_$1FILE =\
+ echo-q | Generating file(s) for $$($1_TITLE) FAT image creation |\
+ $$(call iif,$$(BLR.$1.OBY),\
+ write-c | "$$($1_MSTOBY)" | $$(call def2str,$$($1_MSTOBYINFO))\n |)\
+ $$(if $$($1_SWVERINFO),\
+ writeu | "$$($1_SWVERFILE)" | $$(call quote,$$($1_SWVERINFO)) |)\
+ $$(if $$($1_ORIDEINFO),\
+ write-c | "$$($1_ORIDEIBY)" | $$(call def2str,$$($1_ORIDEINFO)) |)\
+ $$(if $$($1_ORIDECONF),\
+ genorideiby | >>$$($1_ORIDEIBY) | $$(call def2str,$$($1_ORIDEFILES) | $$($1_ORIDECONF)) |)\
+ $$($1_OBYGEN)
+
+#==============================================================================
+# FAT build
+
+BLR.$1.IDIR = $$(call dir2inc,$$($1_IDIR) $$(call iif,$$(USE_FEATVAR),,$$(FEATVAR_IDIR)))
+BLR.$1.HBY = $$(call includeiby,$$(IMAGE_HBY) $$($1_HBY))
+BLR.$1.OBY = $$(call includeiby,$$($1_OBY))\
+ $$(and $$(call true,$$(SYMBIAN_FEATURE_MANAGER)),$$($1_FEAIBY),$$(call mac2cppdef,-U__FEATURE_IBY__)$$(call includeiby,$$($1_FEAIBY)))\
+ $$(call includeiby,$$(and $$(filter $3,$$(USE_VARIANTBLD)),$$(call true,$$(VARIANT_INCDIR)$$(USE_SOSUDA)),$$(VARIANT_OBY))\
+ $$(if $$(strip $$($1_ORIDEINFO)$$($1_ORIDECONF)),$$($1_ORIDEIBY)))
+BLR.$1.OPT = $$($1_OPT) -noimage -o$$(call pathconv,$$($1_PREFIX)).dummy0.img $$(BLDROPT)
+BLR.$1.POST = $$(call iif,$$(USE_SOSUDA),,copyiby | "$$($1_OUTOBY)" | $$($1_DATADIR))
+
+CLEAN_$1 = $$(call CLEAN_BLDROM,$1) | $$(CLEAN_FILEDISK) | $$(CLEAN_WINIMAGE) | $$(CLEAN_FSIMAGE)
+BUILD_$1 =\
+ $$(call iif,$$(BLR.$1.OBY),$$(call BUILD_BLDROM,$1) |)\
+ $$(if $$($1_EXCLFILE),\
+ genexclst | $$($1_EXCLFILE) | $$($1_DATADIR) | $$($1_DRIVE): |\
+ $$(call def2str,$$($1_EXCLADD) | $$($1_EXCLRM)) |)\
+ $$(call iif,$$($1_TOUCH),\
+ finddir-r | "$$($1_DATADIR)" | * ||\
+ find-ar | "$$($1_DATADIR)" | * ||\
+ touch | __find__ | $$($1_TOUCH) |)\
+ echo-q | Creating $$($1_TITLE) FAT image |\
+ $$(call iif,$$(USE_SOSUDA),$$(BUILD_ROFSBLDFAT),\
+ $$(call iif,$$(USE_FSIMAGE),$$(BUILD_FSIMAGE),\
+ $$(call iif,$$(USE_FILEDISK),$$(BUILD_FILEDISK),$$(BUILD_WINIMAGE))))
+
+REPORT_$1 =\
+ $$($1_TITLE) dir | $$($1_DIR) | d |\
+ $$($1_TITLE) image | $$($1_IMG) | f
+
+#==============================================================================
+# FAT post-build
+
+CLEAN_$1POST =
+BUILD_$1POST =
+REPORT_$1POST =
+
+#==============================================================================
+# Empty FAT
+
+CLEAN_$1EMPTY = del | "$$($1EMPTY_IMG)"
+BUILD_$1EMPTY = $$(if $$($1EMPTY_CMD),\
+ echo-q | Creating $$($1EMPTY_TITLE) FAT image |\
+ mkdir | "$$($1_DIR)" |\
+ cmd | $$($1EMPTY_CMD))
+
+REPORT_$1EMPTY = $$($1EMPTY_TITLE) image | $$($1EMPTY_IMG) | f
+
+#==============================================================================
+# FAT steps
+
+SOS.$1.STEPS =\
+ $$(call iif,$$(SKIPPRE),,$$(and $$(filter $3,$$(USE_VARIANTBLD)),$$(call true,$$(USE_CONE)),CONEGEN RESTART) $1PRE)\
+ $$(call iif,$$(SKIPBLD),,$1) $$(call iif,$$(SKIPPOST),,$1POST)
+
+SOS.$1EMPTY.STEPS = $$(if $$(BUILD_$1EMPTY),$1EMPTY)
+
+ALL.$1.STEPS = $$(SOS.$1.STEPS)
+ALL.$1EMPTY.STEPS = $$(SOS.$1EMPTY.STEPS)
+
+#==============================================================================
+# Targets
+
+.PHONY: $2 $2-cone $2-image $2-pre $2empty $2empty-image variant$2
+
+$2 $2% : IMAGE_TYPE = $1
+
+$2 : ;@$$(call IMAKER,$$$$(ALL.$1.STEPS))
+$2-image: ;@$$(call IMAKER,$$$$(SOS.$1.STEPS))
+$2-cone : ;@$$(call IMAKER,CONEGEN)
+$2-pre : ;@$$(call IMAKER,$1PRE)
+
+$2empty : ;@$$(call IMAKER,$$$$(ALL.$1EMPTY.STEPS))
+$2empty-image: ;@$$(call IMAKER,$$$$(SOS.$1EMPTY.STEPS))
+
+variant$2 variant$2% : USE_CONE = 0
+variant$2 variant$2% $2_%: USE_VARIANTBLD = $3
+variant$2 variant$2% $2_%: $2$$(TARGETEXT) ;
+
+#==============================================================================
+# Helps
+
+$(call add_help,$2,t,Create $$($1_TITLE) image.)
+$(call add_help,$2-dir,t,Create directory structure for $$($1_TITLE) creation.)
+$(call add_help,$2-image,t,Create $$($1_TITLE) image (.img) file.)
+$(call add_help,$2-pre,t,Run pre-step, create files etc. for $$($1_TITLE) creation.)
+$(call add_help,variant$2,t,Create $$($1_TITLE) image from a variant directory. Be sure to define the VARIANT_DIR.)
+
+BUILD_HELPDYNAMIC +=\
+ $$(call add_help,$$(call getlastdir,$$(wildcard $$($1_VARROOT)/$2_*/)),t,$$($1_TITLE) variant target.)\
+ $$(eval include $$(wildcard $$($1_VARROOT)/$2_*/$$(VARIANT_MKNAME)))
+
+endef # FAT_EVAL
+
+
+###############################################################################
+#
+
+$(eval $(call FAT_EVAL,EMMC,emmc,e))
+$(eval $(call FAT_EVAL,MCARD,mcard,m))
+$(eval $(call FAT_EVAL,UDA,uda,u))
+
+$(call includechk,$(addprefix $(IMAKER_DIR)/imaker_,emmc.mk memcard.mk uda.mk))
+
+
+# END OF IMAKER_FAT.MK
--- a/imgtools/imaker/src/imaker_help.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_help.mk Thu Jun 24 10:35:05 2010 +0300
@@ -25,14 +25,15 @@
add_help =\
$(if $(filter help%,$(MAKECMDGOALS)),\
- $(eval __i_type := $(call select,$(call substr,1,1,$(strip $2)),t,t,v))\
- $(eval __i_isvar := $(call equal,$(__i_type),v))\
+ $(eval __i_type := $(if $(filter t% T%,$2),t,v))\
+ $(eval __i_isvar := $(filter v,$(__i_type)))\
$(foreach name,$1,\
$(eval HELP.$(name).TYPE := $(__i_type))\
$(if $(__i_isvar),$(eval HELP.$(name).VALUES = $3))\
- $(eval HELP.$(name).DESC = $(strip $(eval __i_desc := $(if $(__i_isvar),$4,$3))\
+ $(eval HELP.$(name).DESC = $(strip $(eval __i_desc = $(if $(__i_isvar),$$4,$$3))\
$(foreach p,$(if $(__i_isvar),,4) 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20,\
- $(if $(call defined,$p),$(eval __i_desc := $(__i_desc)$(,)$($p)))))$(__i_desc))))
+ $(if $(call defined,$p),$(eval __i_desc = $(value __i_desc)$(,)$$($p))))\
+ $(subst $$1,$(name),$(subst $$2,$(__i_type),$(__i_desc)))))))
get_helpitems =\
$(strip $(eval __i_list := $(filter HELP.%.TYPE,$(.VARIABLES)))\
@@ -40,26 +41,19 @@
#==============================================================================
-.PHONY: help help-config help-target help-variable
+.PHONY: help help-config
-.DEFAULT_GOAL := help
-
-help:: ;@$(call IMAKER,HELPUSAGE:b)
+help:: ;@$(call IMAKER,HELPUSAGE)
-help-config: ;@$(call IMAKER,HELPCFG:b)
-
-help-target help-variable: $$@-* ;
+help-config: ;@$(call IMAKER,HELPCFG)
-help-target-%-list help-target-%-wiki help-target-% \
-help-variable-%-list help-variable-%-value help-variable-%-all help-variable-%-wiki help-variable-% \
-help-%-list help-%:\
- ;@$(call IMAKER)
+help-%: ;@$(call IMAKER,HELP)
# Help usage info
define HELP_USAGE
Print help data on documented iMaker API items; targets and variables.
- Wildcards *, ? and [] can be used with % patterns.
+ Wildcards *, ? and [..] can be used with % patterns.
help : Print this message.
help-% : $(HELP.help-%.DESC)
@@ -85,15 +79,10 @@
BUILD_HELPUSAGE = echo | $(call def2str,$(HELP_USAGE))\n
-BUILD_HELPDYNAMIC =\
- $(foreach file,$(call reverse,$(wildcard $(addsuffix /$(TRACE_PREFIX)*$(TRACE_SUFFIX),$(TRACE_IDIR)))),\
- $(call add_help,core-trace-$(patsubst $(TRACE_PREFIX)%$(TRACE_SUFFIX),%,$(notdir $(file))),t,Core image with traces for $(file).))\
- $(call add_help,$(call getlastdir,$(wildcard $(LANGPACK_ROOT)/$(LANGPACK_PREFIX)*/)),t,Language variant target.)\
- $(call add_help,$(call getlastdir,$(wildcard $(CUSTVARIANT_ROOT)/$(CUSTVARIANT_PREFIX)*/)),t,Customer variant target.)\
- $(eval include $(wildcard $(LANGPACK_ROOT)/$(LANGPACK_PREFIX)*/$(LANGPACK_MKNAME)))\
- $(eval include $(wildcard $(CUSTVARIANT_ROOT)/$(CUSTVARIANT_PREFIX)*/$(VARIANT_MKNAME)))
+BUILD_HELPDYNAMIC =
BUILD_HELP =\
+ $(BUILD_HELPDYNAMIC)\
$(eval __i_var := $(filter help-%,$(MAKECMDGOALS)))\
$(if $(filter help-target help-variable,$(__i_var)),$(eval __i_var := $(__i_var)-*))\
$(eval __i_helpgoal := $(__i_var))\
@@ -107,15 +96,15 @@
$(call peval,\
my @var = ($(foreach var,$(foreach var2,$(subst $(,), ,$(__i_var)),$(call filterwcard,$(var2),$(__i_list))),{\
n=>$(call pquote,$(var))\
- $(eval __i_isvar := $(call equal,$(HELP.$(var).TYPE),v))\
+ $(eval __i_isvar := $(filter v,$(HELP.$(var).TYPE)))\
$(if $(__i_value),$(if $(__i_isvar),$(,)v=>$(call pquote,$(call def2str,$($(var))))))\
$(,)t=>q($(HELP.$(var).TYPE))\
$(if $(__i_desc),\
$(,)d=>$(call pquote,$(HELP.$(var).DESC))\
$(if $(__i_isvar),$(,)V=>$(call pquote,$(HELP.$(var).VALUES)))) }$(,)));\
- imaker:DPrint(1, map($(if $(__i_desc),$(if $(__i_wiki),,q(-) x 40 . qq(\n) .))\
+ DPrint(1, map($(if $(__i_desc),$(if $(__i_wiki),,q(-) x 40 . qq(\n) .))\
qq($(if $(__i_wiki),== $$_->{n} ==,$$_->{n}))\
- $(if $(__i_value),. ($$_->{t} eq q(v) ? qq( = `$$_->{v}$') : q())) . qq(\n)\
+ $(if $(__i_value),. ($$_->{t} eq q(v) ? qq( = `$$_->{v}') : q())) . qq(\n)\
$(if $(__i_desc),.\
qq($(__i_wiki)Type : ) . ($$_->{t} eq q(t) ? qq(Target\n) : qq(Variable\n)) .\
qq($(__i_wiki)Description: $$_->{d}\n) .\
@@ -124,42 +113,44 @@
BUILD_HELPCFG =\
echo | Finding available configuration file(s):\n\
- $(call get_cfglist,$(CONFIGROOT),image_conf_.*\.mk,2)\n
+ $(call peval,return(join(q(), map(Quote(qq($$_\n)), GetConfmkList(1)))))
+
+
+###############################################################################
+# print-%
-get_cfglist =\
- $(call peval,\
- use File::Find;\
- my ($$dir, @conf) = (GetAbsDirname($(call pquote,$1)), ());\
- find(sub {\
- push(@conf, $$File::Find::name) if\
- /$2$$/s && (($$File::Find::name =~ tr/\///) > (($$dir =~ tr/\///) + $3));\
- }, $$dir);\
- return(join(q(\n), map(Quote($$_), sort({lc($$a) cmp lc($$b)} @conf)))))
+BUILD_PRINTVAR = $(call peval,DPrint(1,\
+ $(foreach var1,$(subst $(,), ,$(subst print-,,$(filter print-%,$(MAKECMDGOALS)))),\
+ $(foreach var2,$(call filterwcard,$(var1),$(filter-out BUILD_PRINTVAR,$(filter $(word 1,$(call substm,* ? [, ,$(var1)))%,$(.VARIABLES)))),\
+ $(call pquote,$(var2) = `$(call def2str,$($(var2)))').qq(\n),))); return(q()))
+
+print-%: ;@$(call IMAKER,PRINTVAR)
+
+$(call add_help,print-%,t,Print the value(s) of the given variable(s). Wildcards *, ? and [..] can be used in variable names.)
###############################################################################
# Helps
$(call add_help,CONFIGROOT,v,(string),Define the default configuration root directory.)
-$(call add_help,USE_OVERRIDE,v,([0|1]),Define whether the override.pm Buildrom.pl plugin is used.)
$(call add_help,USE_PAGING,v,((0|rom|code[:[(1|2|3)]+]?)),Define the usage of On Demand Pagin (ODP). (E.g. 0,rom,code).)
$(call add_help,USE_ROFS,v,([[dummy|]0..6][,[dummy|]0..6]*),Define the rofs sections in use. A comma separated list can be given of possible values. (E.g. 1,2,3).)
$(call add_help,USE_ROMFILE,v,([0|1]),Define whether the \epoc32\rombuild\romfiles.txt is used. Files in romfiles are automatically moved to ROM, everything else in core is moved to ROFS1.)
$(call add_help,USE_SYMGEN,v,([0|1]),Generate the rom symbol file. 0=Do not generate, 1=Generate)
$(call add_help,USE_UDEB,v,([0|1|full]),Include the usage of the debug binary *.txt to define the list of binaries that are taken from udeb folder instead of the urel.)
-$(call add_help,USE_VERGEN,v,([0|1]),Use iMaker version info generation)
-$(call add_help,KEEPTEMP,v,([0|1]),Keep the buildrom.pl temp files (copied to the WORKDIR). E.g. tmp1.oby tmp2.oby..tmp9.oby)
+$(call add_help,KEEPTEMP,v,([0|1]),Keep the buildrom.pl temp files (copied to the OUTDIR). E.g. tmp1.oby tmp2.oby..tmp9.oby)
$(call add_help,LABEL,v,(string),A label to the NAME of the image)
$(call add_help,NAME,v,(string),The name of the image)
$(call add_help,TYPE,v,(rnd|prd|subcon),Defines the image type.)
-$(call add_help,WORKDIR,v,(string),The working directory for the image creation)
+$(call add_help,OUTDIR,v,(string),The output directory for the image creation.)
+$(call add_help,WORKDIR,v,(string),The working directory for the image creation. Deprecated, please use OUTDIR.)
$(call add_help,PRODUCT_NAME,v,(string),Name of the product)
$(call add_help,PRODUCT_MODEL,v,(string),The model of the product)
$(call add_help,PRODUCT_REVISION,v,(string),The revision of the product.)
$(call add_help,BLDROM_OPT,v,(string),The default buildrom.pl options)
$(call add_help,BLDROPT,v,(string),For passing extra parameters (from command line) to the buildrom.pl)
$(call add_help,BLDROBY,v,(string),For passing extra oby files (from command line) to the buildrom.pl)
-$(call add_help,SOS_VERSION,v,([0-9]+.[0-9]+),Symbian OS version number. The value is used in the version info generation (platform.txt).(see USE_VERGEN))
+$(call add_help,SOS_VERSION,v,([0-9]+.[0-9]+),Symbian OS version number. The value is used in the version info generation (platform.txt).)
$(call add_help,COREPLAT_NAME,v,(string),Name of the core platform)
$(call add_help,CORE_DIR,v,(string),The working directory, when creating core image)
$(call add_help,CORE_NAME,v,(string),The name of the core image)
@@ -209,28 +200,20 @@
$(call add_help,ROFS3_TIME,v,(string),The time defined to the rofs3 image.)
$(call add_help,ROFS3_VERIBY,v,(string),The (generated) version iby file name for the rofs3 image. This file included the version text files and other version parameters.)
$(call add_help,ROFS3_ROMVER,v,(string),The rofs3 ROM version string)
-$(call add_help,ROFS3_CUSTSWFILE,v,(string),The (generated) source file name for customersw.txt.)
-$(call add_help,ROFS3_CUSTSWINFO,v,(string),The content string for the customersw.txt.)
+$(call add_help,ROFS3_SWVERFILE,v,(string),The (generated) source file name for customersw.txt.)
+$(call add_help,ROFS3_SWVERINFO,v,(string),The content string for the customersw.txt.)
$(call add_help,ROFS3_FWIDFILE,v,(string),The (generated) _rofs3_fwid.txt file name.)
$(call add_help,ROFS3_FWIDINFO,v,(string),The content string for the fwid3.txt file.)
$(call add_help,VARIANT_DIR,v,(string),Configure the directory where to included the customer variant content. By default all content under $(VARIANT_CPDIR) is included to the image as it exists in the folder.)
-$(call add_help,VARIANT_CONFML,v,(string),Configure what is the ConfigurationTool input confml file, when configuration tool is ran.)
-$(call add_help,VARIANT_CONFCP,v,(string),Configure which ConfigurationTool generated configurations dirs are copied to output.)
+$(call add_help,PRODUCT_VARDIR,v,(string),Overrides the VARIANT_DIR for product variant, see the instructions of VARIANT_DIR for details.)
+$(call add_help,TARGET_DEFAULT,v,(string),Configure actual target(s) for target default.)
# Targets
$(call add_help,version,t,Print the version information)
$(call add_help,clean,t,Clean all target files.)
-$(call add_help,core,t,Create the core image (ROM,ROFS1))
-$(call add_help,rofs2,t,Create the rofs2 image)
-$(call add_help,rofs3,t,Create the rofs3 image)
$(call add_help,variant,t,Create the variant image (rofs2,rofs3))
-$(call add_help,uda,t,Create the User Data area (uda) image.)
$(call add_help,image,t,Create only the image file(s) (*.img))
-$(call add_help,core-image,t,Create the core image files (rom.img, rofs1.img))
-$(call add_help,rofs2-image,t,Create the rofs2 image file (rofs2.img))
-$(call add_help,rofs3-image,t,Create the rofs3 image file (rofs3.img))
-$(call add_help,variant-image,t,Create the variant image files (rofs3.img,rofs3.img))
-$(call add_help,uda-image,t,Create the User Data area (uda) image.)
+$(call add_help,variant-image,t,Create the variant image files (rofs2.img, rofs3.img))
$(call add_help,toolinfo,t,Print info about the tool)
$(call add_help,romsymbol,t,Create the rom symbol file)
$(call add_help,all,t,Create all image sections and symbol files.)
@@ -240,7 +223,7 @@
$(call add_help,step-%,t,\
Generic target to execute any step inside the iMaker configuration. Any step (e.g. BUILD_*,CLEAN_*) can be executed with step-STEPNAME.\
Example: step-ROFS2PRE executes the CLEAN_ROFS2PRE and BUILD_ROFS2PRE commands.)
-$(call add_help,print-%,t,Print the value of the given variable to the screen.)
+$(call add_help,default,t,Default target, uses variable TARGET_DEFAULT to get actual target(s), current default = $$(TARGET_DEFAULT).)
$(call add_help,help,t,Print help on help targets.)
$(call add_help,help-%,t,Print help on help items matching the pattern.)
--- a/imgtools/imaker/src/imaker_image.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_image.mk Thu Jun 24 10:35:05 2010 +0300
@@ -17,31 +17,36 @@
USE_FEATVAR = $(call select,$(word 1,$(getsbvrominc)),invalid,0,1)
-USE_FOTA = 0
USE_IMGCHK = 0
-USE_IINTPRSIS = 0
-USE_IREADIMG = 0
-USE_IROMBLD = 0
-USE_OVERRIDE = 1
+USE_NOROMHDR = 0
+USE_QTLOCLZTN = 0
USE_ROFS = 1,2,3
USE_ROFSFILE = $(call iif,$(USE_PAGING),1,0)
USE_ROMFILE = 1
+USE_SMR = 0
USE_SYMGEN = 0
USE_UDEB = 0
-USE_VERGEN = 0
-$(foreach rofs,1 2 3 4 5 6,\
- $(eval USE_ROFS$(rofs) = $$(if $$(findstring $(rofs),$$(filter-out :%,$$(subst :, :,$$(subst $$(,), ,$$(USE_ROFS))))),1,0)))
+# Temporary
+USE_BLRWORKDIR = 0
#==============================================================================
TYPE = rnd
-BUILD_INFOMK = image_conf_buildinfo.mk
-BUILD_NAMEMK = image_conf_naming.mk
+MAJOR_VERSION = 001
+MINOR_VERSION = 000
+SW_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION)
+SW_TYPEINFO = $(call select,$(TYPE),rnd,RD)
+
+BUILD_INFOMK = $(call findfile,image_conf_buildinfo.mk,,1)
+BUILD_NAMEMK = $(call findfile,image_conf_naming.mk,,1)
BUILD_YEAR = $(YEAR)
+BUILD_MONTH = $(MONTH)
BUILD_WEEK = $(WEEK)
-BUILD_NUMBER = xx
+BUILD_DAY = $(DAY)
+BUILD_ID = 001
+BUILD_NUMBER = 001
COREPLAT_NAME =
COREPLAT_DIR = $(CONFIGROOT)/$(COREPLAT_NAME)
@@ -49,24 +54,31 @@
PLATFORM_NAME = $(subst .,,$(COREPLAT_VERSION)$(S60_VERSION))
PLATFORM_DIR = $(CONFIGROOT)/$(PLATFORM_NAME)
PRODUCT_MSTNAME =
+PRODUCT_MSTDIR = $(if $(PRODUCT_MSTNAME),$(PLATFORM_DIR)/$(PRODUCT_MSTNAME))
PRODUCT_NAME =
PRODUCT_MANUFACT = Nokia
PRODUCT_MODEL = N00
PRODUCT_TYPE =
PRODUCT_REVISION = 01
-PRODUCT_DIR = $(PLATFORM_DIR)/$(if $(PRODUCT_MSTNAME),$(PRODUCT_MSTNAME)/)$(PRODUCT_NAME)
+PRODUCT_DIR = $(if $(PRODUCT_NAME),$(PLATFORM_DIR)/$(if $(PRODUCT_MSTNAME),$(PRODUCT_MSTNAME)/)$(PRODUCT_NAME))
FEATURE_VARIANT = $(PRODUCT_NAME)
FEATVAR_IDIR = $(call getrominc)
+FEATVAR_HRH = $(call findfile,feature_settings.hrh)
-LABEL =
-NAME = $(PRODUCT_NAME)$(LABEL)
-WORKDIR = $(if $(PRODUCT_NAME),$(E32ROMBLD)/$(PRODUCT_NAME),$(CURDIR))
-WORKPREFIX = $(WORKDIR)/$(NAME)
-WORKNAME = $(WORKPREFIX)
+LABEL =
+NAME = $(or $(PRODUCT_NAME),imaker)$(LABEL)
+WORKDIR = $(if $(PRODUCT_NAME),$(E32ROMBLD)/$(PRODUCT_NAME),$(CURDIR))
-IMAGE_HBY = <data_caging_paths_for_iby.hrh> <Variant\Header.iby>
-IMAGE_TYPE =
+IMAGE_TYPE =
+IMAGE_ID = $(or $(subst CORE,1,$(subst ROFS,,$(filter CORE ROFS%,$(IMAGE_TYPE)))),\
+ $(call lcase,$(call substr,1,1,$(filter EMMC MCARD UDA,$(IMAGE_TYPE)))))
+IMAGE_PREFIX = $($(IMAGE_TYPE)_PREFIX)_$(call lcase,$(IMAGE_TYPE))
+IMAGE_HBY = <data_caging_paths_for_iby.hrh> <variant/header.iby>
+IMAGE_VERSDIR = RESOURCE_FILES_DIR\versions
+
+IMAGE_ORIDEFILES =
+IMAGE_ORIDECONF =
TRACE_IDIR = $(addsuffix /traces,$(FEATVAR_IDIR))
TRACE_PREFIX =
@@ -75,72 +87,63 @@
OVERRIDE_CONF = OVERRIDE_REPLACE/WARN #OVERRIDE_REPLACE/ADD, OVERRIDE_REPLACE/SKIP, OVERRIDE_SKIP/ADD
-GENIBY_FILEPAT = *.dll *.exe *.agt *.csy *.fsy *.tsy *.drv *.nif *.pgn *.prt
+#GENIBY_FILEPAT = *.dll *.exe *.agt *.csy *.fsy *.tsy *.drv *.nif *.pgn *.prt
ARM_VERSION = ARMV5
-SOS_VERSION = #9.3, 9.4, 9.5
-S60_VERSION = #3.2, 5.0
-
-ROFS_MAXSIZE = 0x10000000
-
-CPPFILE_LIST =
-MKFILE_LIST = $(call findfile,$(BUILD_INFOMK) $(BUILD_NAMEMK) $(LANGPACK_SYSLANGMK),$(FEATVAR_IDIR)) | $(VARIANT_MK)
-
+SOS_VERSION = #9.5
+S60_VERSION =
-###############################################################################
-#
+CPPFILE_FILTER = FF_WDP_\S+|SYMBIAN_\S+
+CPPFILE_LIST = $(if $(FEATURE_VARIANT),$(FEATVAR_HRH))
-SOS.IMAGE.STEPS =\
- $(filter-out %POST,$(SOS.CORE.STEPS) $(SOS.VARIANT.STEPS))\
- $(filter %POST,$(SOS.CORE.STEPS) $(SOS.VARIANT.STEPS))
-
-ALL.IMAGE.STEPS = $(SOS.IMAGE.STEPS)
-
-CLEAN_WORKAREA = del | $(WORKDIR)/* | deldir | $(WORKDIR)/*
-ALL.CLEAN.STEPS = $(ALL.IMAGE.STEPS) WORKAREA
+TARGET_PRODUCT =
+TARGET_DEFAULT = all
###############################################################################
# Internal macros and definitions
-getrominc = $(if $(call true,$(USE_FEATVAR)),$(getsbvrominc),$(CONFIGROOT) $(E32ROM))
+getrominc =\
+ $(if $(call true,$(USE_FEATVAR)),$(getsbvrominc),$(if $(word 5,$(__i_getrominc)),$(call restwords,5,$(__i_getrominc))\
+ ,$(PRODUCT_DIR) $(PRODUCT_MSTDIR) $(CONFIGROOT)) $(E32ROM) $(E32ROMINC) $(E32INC)/oem $(E32INC))
+
+# ,$(PRODUCT_DIR) $(PRODUCT_MSTDIR) $(CONFIGROOT)) $(E32INC)/config $(E32ROM) $(E32ROMINC) $(E32INC)/internal $(E32INC))
getsbvrominc =\
- $(if $(call equal,$(__i_featvar),$(FEATURE_VARIANT)),,$(eval __i_featvar := $(FEATURE_VARIANT))\
- $(eval __i_getrominc := $(shell $(PERL) -x $(IMAKER_TOOL) --incdir $(__i_featvar))))$(__i_getrominc)
+ $(if $(and $(FEATURE_VARIANT),$(call equal,$(__i_featvar),$(FEATURE_VARIANT))),,$(eval __i_featvar := $(FEATURE_VARIANT))\
+ $(eval __i_getrominc := $(if $(__i_featvar),$(shell $(PERL) -x $(IMAKER_TOOL) --incdir $(__i_featvar)),invalid)))$(__i_getrominc)
-includeiby = $(call peval,\
+includeiby = $(if $(strip $1),$(call peval,\
my @files = ();\
while ($(call pquote,$1) =~ /(?:([1-6]):)?(?:<(.+?)>|"+(.+?)"+|(\S+))/g) {\
my $$rom = (defined($$1) ? $$1 : q());\
- push(@files, ($$rom ? q(ROM_IMAGE[).$$rom.q(] {\\\n) : q()) . q(\#include ).\
- (defined($$2) ? qq(<$$2>) : q(").GetRelFname(defined($$3) ? $$3 : $$4, $(call pquote,$2)).q(")) . ($$rom ? q(\\\n}) : q()))\
+ push(@files, ($$rom ? q(ROM_IMAGE[).$$rom.q(] {\n) : q()) . q(\#include ).\
+ (defined($$2) ? qq(<$$2>) : q(").GetAbsFname(defined($$3) ? $$3 : $$4).q(")) . ($$rom ? q(\n}) : q()))\
}\
- return(join(q(\\\n), @files)))
+ return(join(q(), map(q(\n) . $$_, @files)))))
define BLDROM_HDRINFO
- // Generated master oby for $($(IMAGE_TYPE)_TITLE) image creation
+ // Generated master oby for $($1_TITLE) image creation
//
- // Filename: $($(IMAGE_TYPE)_MSTOBY)
- // Work dir: $(call peval,GetAbsDirname(q(.)))
- // Command : $(BLDROM_CMD)
+ // Filename: $($1_MSTOBY)
+ // Command : $(call BLDROM_CMD,$1)
endef
define BLDROM_PLUGINFO
- // Buildrom plugins
- //
- $(call iif,$(USE_OVERRIDE),
- externaltool=override:$($(IMAGE_TYPE)_PLUGINLOG);$(if $(filter debug 127,$(VERBOSE)),debug,0)
- $(OVERRIDE_CONF))
- externaltool=obyparse:$($(IMAGE_TYPE)_PLUGINLOG);$(if $(filter debug 127,$(VERBOSE)),debug,0)
- $(call iif,$(call select,$(IMAGE_TYPE),CORE,$(USE_ROFS1)),
+ /* Buildrom plugins
+ */
+ externaltool=override:-i$1;-l$($1_PLUGINLOG)$(if $(filter debug 127,$(VERBOSE)),;-ddebug)
+ $(OVERRIDE_CONF)
+ externaltool=obyparse:-i$1;-l$($1_PLUGINLOG);-w$($1_DIR)$(if $(filter debug 127,$(VERBOSE)),;-ddebug);-f$(FEATURE_VARIANT)
+ externaltool=stubsischeck:-i$1;-l$($1_PLUGINLOG)$(if $(filter debug 127,$(VERBOSE)),;-ddebug)
+ $(call iif,$(if $(filter CORE,$1),$(USE_ROFS1)),
$(call iif,$(USE_ROMFILE),
OBYPARSE_ROM $(CORE_ROMFILE))
$(call iif,$(USE_ROFSFILE),
OBYPARSE_ROFS1 $(CORE_ROFSFILE))
)
$(call iif,$(USE_UDEB),
- OBYPARSE_UDEB $(call select,$(USE_UDEB),full,*,$($(IMAGE_TYPE)_UDEBFILE)))
+ OBYPARSE_UDEB $(call select,$(USE_UDEB),full,*,$($1_UDEBFILE)))
endef
getgenfiles = $(if $1,\
@@ -148,54 +151,60 @@
$(if $(__i_cmd),"$(call getelem,2,$1)")\
$(call getgenfiles,$(call restelems,$(if $(filter geniby%,$(__i_cmd)),7,$(if $(filter write%,$(__i_cmd)),4,2)),$1)))
-# TEMPORARY
-_buildoby = $(if $1,\
- $(eval __i_elem1 := $(call getelem,1,$1))\
- $(if $(filter geniby%,$(call lcase,$(__i_elem1))),$1,\
- geniby | $(__i_elem1) | $(call getelem,2,$1) | $(call getelem,3,$1) | \#include "%3" | end |\
- $(call _buildoby,$(call restelems,4,$1))))
-# TEMPORARY
-
#==============================================================================
-BLDROM_CMD = $(BLDROM_TOOL) $(filter-out --D% -U%,$(BLR.$(IMAGE_TYPE).OPT)) $(BLR.$(IMAGE_TYPE).IDIR) $($(IMAGE_TYPE)_MSTOBY)
+BLDROM_CMD = $(BLDROM_TOOL)\
+ $(filter-out --D% -U% $(filter-out $(BLDROM_CMDDOPT),$(filter -D%,$(BLR.$1.OPT))),$(BLR.$1.OPT))\
+ $(BLR.$1.IDIR) $(subst \,/,$($1_MSTOBY))
+
+BLDROM_CMDDOPT = -DFEATUREVARIANT=% -D_FULL_DEBUG -D_PLAT=%
CLEAN_BLDROM =\
- del | "$($(IMAGE_TYPE)_PREFIX).*" "$($(IMAGE_TYPE)_DIR)/tmp?.oby" "$($(IMAGE_TYPE)_DIR)/ecom*.s??" "$($(IMAGE_TYPE)_PLUGINLOG)" |\
- $(BLR.$(IMAGE_TYPE).CLEAN)
+ del | $(foreach file,dir *.img *.inc *.log *.oby *.symbol,"$($1_PREFIX).$(file)")\
+ $(foreach file,ecom*.s?? features.dat loglinux.oby logwin.oby tmp?.oby,"$($1_DIR)/$(file)")\
+ "$($1_PLUGINLOG)" |\
+ $(BLR.$1.CLEAN)
BUILD_BLDROM =\
- $(if $(BLR.$(IMAGE_TYPE).BUILD),$(BLR.$(IMAGE_TYPE).BUILD),\
- echo-q | Creating $($(IMAGE_TYPE)_TITLE) SOS image |\
- cd | $($(IMAGE_TYPE)_DIR) |\
- cmd | $(strip $(BLDROM_CMD)) | $(BLDROM_PARSE) |\
- copy | tmp1.oby | $($(IMAGE_TYPE)_PREFIX).tmp1.oby |\
- $(call iif,$(KEEPTEMP),,del | "tmp?.oby" "$($(IMAGE_TYPE)_PREFIX).dummy*" |)\
- $(BLR.$(IMAGE_TYPE).POST))
+ $(or $(BLR.$1.BUILD),\
+ echo-q | Creating $($1_TITLE) SOS $(if $(filter -noimage,$(BLR.$1.OPT)),oby,image) |\
+ $(call iif,$(USE_BLRWORKDIR),,cd | "$($1_DIR)" |)\
+ cmd | $(strip $(call BLDROM_CMD,$1)) | $(BLDROM_PARSE) |\
+ move | "$($1_DIR)/tmp1.oby" | $($1_PREFIX).tmp1.oby |\
+ $(call iif,$(KEEPTEMP),,del | "$($1_DIR)/tmp?.oby" "$($1_PREFIX).dummy*" |)\
+ $(BLR.$1.POST))
-CLEAN_MAKSYMROFS = del | $($(IMAGE_TYPE)_SYM)
-BUILD_MAKSYMROFS =\
- echo-q | Creating $($(IMAGE_TYPE)_TITLE) symbol file |\
- cmd | $(MAKSYMROFS_TOOL) $(call pathconv,$($(IMAGE_TYPE)_LOG) $($(IMAGE_TYPE)_SYM))
+
+###############################################################################
+# Steps
+
+IMAGE_STEPS = core $(VARIANT_STEPS)
+
+VARIANT_STEPS = $(call iif,$(USE_ROFS2),langpack_$(or $(TARGETID),01))\
+ $(foreach rofs,3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),rofs$(rofs)))
###############################################################################
# Targets
-.PHONY:\
- all flash flash-all image image-all\
- i2file
+.PHONY: default all flash image variant #i2file variant-i2file
+
+default default-%:\
+ ;@$(call IMAKER,$$(if $$(PRODUCT_NAME),,$$(TARGET_PRODUCT)) $$(TARGET_DEFAULT))
-all flash-all image-all: USE_SYMGEN = 1
-all flash flash-all : ;@$(call IMAKER,$$(ALL.IMAGE.STEPS))
+all : ;@$(call IMAKER,flash-all)
+image: ;@$(call IMAKER,flash-image)
+
+flash flash-% image-%: ;@$(call IMAKER,$$(IMAGE_STEPS))
-image image-all: ;@$(call IMAKER,$$(SOS.IMAGE.STEPS))
+variant variant_% variant-%: ;@$(call IMAKER,$$(VARIANT_STEPS))
-i2file: ;@$(call IMAKER,$(call ucase,$@))
+#i2file : ;@$(call IMAKER,$(call ucase,$@))
+#variant-i2file: ;@$(call IMAKER,VARIANTI2F)
#==============================================================================
-include $(addprefix $(IMAKER_DIR)/imaker_,$(addsuffix .mk,core odp rofs2 rofs3 rofs4 uda variant))
+$(call includechk,$(addprefix $(IMAKER_DIR)/imaker_,fat.mk odp.mk rofs.mk smr.mk core.mk variant.mk))
# END OF IMAKER_IMAGE.MK
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imaker/src/imaker_memcard.mk Thu Jun 24 10:35:05 2010 +0300
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: iMaker Memory MMC/SD card image configuration
+#
+
+
+
+###############################################################################
+# __ __ ___ _
+# | \/ |___ _ __ / __|__ _ _ _ __| |
+# | |\/| / -_) ' \ (__/ _` | '_/ _` |
+# |_| |_\___|_|_|_\___\__,_|_| \__,_|
+#
+
+MCARD_TITLE = MemCard
+
+MCARD_DRIVE = F
+MCARD_FATTYPE = 32# FAT32
+MCARD_SIZE = 2097152# kB (= 2 GB)
+MCARD_CLUSTERSIZE = 16# kB
+MCARD_FATTABLE = 2
+
+MCARD_SWVERFILE = #$(MCARD_DATADIR)/Resource/Versions/User Content Package_Mass_Memory.txt
+MCARD_SWVERINFO = # Don't generate sw version file
+MCARD_EXCLFILE = # Don't generate exclude list
+
+
+# END OF IMAKER_MEMCARD.MK
--- a/imgtools/imaker/src/imaker_minienv.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_minienv.mk Thu Jun 24 10:35:05 2010 +0300
@@ -23,58 +23,156 @@
# |_| |_|_|_||_|_|___|_||_\_/
#
-MINIENV_ZIP = $(WORKPREFIX)_minienv.zip
-MINIENV_EXCLBIN = *.axf *.bin *.cmt *.fpsx *.hex *.out *.pmd *.ppu *.zip
-MINIENV_INCLBIN = *.axf *.bin *.fpsx *.hex *.out
-MINIENV_SOSDIR = $(WORKDIR)
+MINIENV_ZIP = $(EPOC_ROOT)/$(MINIENV_MFBSNAME)_$(MINIENV_MFBVER).jar
+MINIENV_EXCLBIN = *.axf *.bin *.cmt *.fpsx *.hex *.out *.pmd *.ppu *.zip
+MINIENV_INCLBIN = *.axf *.bin *.fpsx *.hex *.out
+MINIENV_SOSDIR = $(OUTDIR)
+
+MINIENV_MFFILE = $(EPOC_ROOT)/META-INF/MANIFEST.MF
+MINIENV_MFTMP = $(OUTTMPDIR)/META-INF/MANIFEST.MF
+
+MINIENV_MFBNAME = Minienv for $(PRODUCT_MODEL)
+MINIENV_MFBSNAME = com.nokia.tools.griffin.minienv.$(PRODUCT_MODEL)
+MINIENV_MFBVER = $(MAJOR_VERSION).$(MINOR_VERSION).0
+MINIENV_MFPATH = epoc32/tools
+MINIENV_MFSWVER = $(word 1,$(subst ., ,$(MINIENV_MFBVER))).*
+MINIENV_MFCFGFLT = (&(product_type=$(PRODUCT_TYPE))(sw_version=$(MINIENV_MFSWVER)))
+#MINIENV_MFCFGFLT = (&(product_type=$(PRODUCT_TYPE))(sw_version=$(MAJOR_VERSION).$(MINOR_VERSION)))
-CLEAN_MINIENV = del | $(MINIENV_ZIP)
-BUILD_MINIENV =\
- echo-q | Creating minimal flash image creation environment $(MINIENV_ZIP) |\
- $(MINIENV_TOOL) | $(MINIENV_CONF) |\
- zip-q | $(MINIENV_ZIP) | __find__ |
+define MINIENV_MFINFO
+ Manifest-Version: 1.0
+ Bundle-ManifestVersion: 2.0
+ Bundle-Name: $(MINIENV_MFBNAME)
+ Bundle-SymbolicName: $(MINIENV_MFBSNAME);singleton:=true
+ Bundle-Version: $(MINIENV_MFBVER)
+ Griffin-ExportDirectory: $(MINIENV_MFPATH)
+ Griffin-ConfigurationFilter: $(MINIENV_MFCFGFLT)
+
+ Name: epoc32/tools/imaker.cmd
+ Require-Bundle: com.nokia.tools.griffin.theme
+endef
+
+MINIENV_META = find-af | $(MINIENV_MFTMP) | $(MINIENV_MFFILE) |
+
+#==============================================================================
MINIENV_IMAKER =\
- find | $(E32TOOLS) | imaker.cmd localise.pm localise_all_resources.pm obyparse.pm override.pm plugincommon.pm | |\
- find-a | $(IMAKER_DIR) | * |
+ find-a | $(E32TOOLS) | imaker imaker.cmd ||\
+ find-a | $(IMAKER_DIR) | * ||\
+ find-ar | $(CONFIGROOT)/assets/image | * |
-MINIENV_TOOL =\
- $(MINIENV_IMAKER) |\
- find-a | $(ITOOL_DIR) | * | |\
+MINIENV_ITOOL =\
+ find-a | $(ITOOL_DIR) | *.exe *.pl *.py imgcheck.* | *upct*
+
+MINIENV_BLDROM =\
find-a | $(E32TOOLS) |\
- cli.cmd s60ibymacros.pm\
- armutl.pm bpabiutl.pm buildrom.* checksource.pm configpaging.pm datadriveimage.pm e32plat.pm\
- e32variant.pm externaltools.pm featurevariantmap.pm featurevariantparser.pm genutl.pm maksym.*\
- maksymrofs.* modload.pm pathutl.pm rofsbuild.exe rombuild.exe spitool.* uidcrc.exe winutl.pm\
- *.bsf | gcc*.bsf |\
- find-a | $(E32TOOLS)/variant | * | |\
- find-ar | $(E32GCCBIN) | * | |\
- find-ar | $(CONFT_TOOLDIR) | * |
+ armutl.pm bpabiutl.pm buildrom.* checksource.pm configpaging.* datadriveimage.pm e32plat.pm e32variant.pm\
+ externaltools.pm flexmodload.pm genutl.pm maksym.* maksymrofs.* modload.pm pathutl.pm rofsbuild.exe rombuild.exe\
+ romosvariant.pm romutl.pm spitool.* uidcrc.exe winutl.pm feature* genericparser.pm rvct_*2set.pm writer.pm mingwm10.dll ||\
+ find-ar | $(E32TOOLS)/build/lib/XML | * |
+
+MINIENV_CONE = find-a | $(E32TOOLS) | cone cone.cmd || find-ar | $(CONE_TOOLDIR) | * |
+
+MINIENV_CPP = find-a | $(E32GCCBIN) | cpp.exe cygwin1.dll |
+
+MINIENV_TOOL1 =\
+ $(MINIENV_ITOOL) |\
+ $(MINIENV_BLDROM) |\
+ $(MINIENV_CONE) |\
+ $(MINIENV_CPP) |\
+ find-a | $(E32TOOLS) |\
+ featuredatabase.dtd s60ibymacros.pm\
+ bmconv.exe dumpsis.exe elf2e32.exe interpretsis.exe mifconv.exe petran.exe svgtbinencode.exe\
+ xerces-c_2_*.dll ||\
+ find-a | $(E32TOOLS)/variant | * ||
+
+MINIENV_TOOL2 =\
+ find-ar | $(dir $(WIDGET_TOOL)) $(WIDGET_HSTOOLDIR) | * ||\
+ find-a | $(E32DATAZ)/private/10282f06 $(EPOC32)/winscw/c/private/10282f06 | Widget_lproj.xml ||
+
+MINIENV_TOOL = $(foreach tool,$(sort $(filter $(addprefix MINIENV_TOOL,0 1 2 3 4 5 6 7 8 9),$(.VARIABLES))),$($(tool)) |)
-MINIENV_CONF =\
- find-a | $(E32INC) | *.hrh | |\
- find-ar | $(E32INCCFG) | * | |\
- find-ar | $(E32INC)/oem | * | |\
- find-ar | $(E32INC)/variant | * | |\
- find-a | $(E32ROM) | * | |\
- find-ar | $(E32ROMCFG) | * | $(MINIENV_EXCLBIN) |\
- find-ar | $(E32ROM)/configpaging | * | |\
- find-ar | $(E32ROMINC) | * | |\
- find-ar | $(E32ROM)/variant | * | |\
- find-ar | $(OST_DICTDIR) | $(OST_DICTPAT) | |\
- find-ar | $(EPOC32)/data/Z/resource/plugins | * | |\
- find-a | $(COREPLAT_DIR) | $(MINIENV_INCLBIN) | |\
- find-ar | $(PRODUCT_DIR) | $(MINIENV_INCLBIN) | |\
- sosfind-a | $(MINIENV_SOSDIR) | *.tmp1.oby | *.rom.oby *.rofs?.oby | *_bldromplugin.log
+MINIENV_CONF1 =\
+ find-a | $(E32INC) | *.hrh ||\
+ find-ar | $(E32INCCFG) | * ||\
+ find-ar | $(E32ROM)/configpaging | * ||\
+ find-a | $(sort $(dir $(CORE_FEAXML))) | $(notdir $(CORE_FEAXML)) ||\
+ find-a | $(CONFIGROOT) | *.mk ||\
+ find-a | $(PLATFORM_DIR) | *.mk mem*.hrh ||\
+ find-ar | $(PRODUCT_DIR) | *.mk mem*.hrh ||\
+ find-a | $(E32INC)/mw | ThirdPartyBitmap.pal ||\
+ find-a | $(E32ROMINC)/customervariant/mw | Certificates_Operator.iby ||\
+ find-a | $(E32DATAZ)/private/101f72a6 | * ||\
+ find-a | $(E32DATAZ)/private/10202be9 | cccccc00_empty.cre ||\
+ find-a | $(E32DATAZ)/private/200009F3 | defaultimportfile.mde ||\
+ find-a | $(E32DATAZ)/private/20019119 | config.xml ||\
+ find-a | $(E32DATAZ)/resource | swicertstore*.dat ||\
+ find-a | $(E32DATAZ)/system/data | SkinExclusions.ini ||\
+ find-ar | $(E32DATAZ)/system/data/midp2/security/trustroots | * ||\
+ find-a | $(E32DATAZ)/system/sounds/audiothemes | at_nokia.xml ||\
+ find-a | $(EPOC32)/release/armv5/urel | R1_Mobile_4_0_Operator.cfg ||\
+ find-a | $(EPOC32)/release/armv5/urel/z/private/100059C9 | ScriptInit.txt ||\
+ find-a | $(EPOC_ROOT)/ext/app/firsttimeuse/StartupSettings3/tools | APConf.txt ||\
+ find-af | $(SISINST_HALHDA) |||\
+ find-ar | $(CONFIGROOT) | * | *.pmd isa.out dsp.hex *.cmt fota_updapp.bin *.axf DCT_ISA*.zip |
+
+MINIENV_CONF2 =\
+ sosfind-a | $(MINIENV_SOSDIR) | *.rom.oby *.rofs?.oby *.uda.oby *.emmc.oby *.mcard.oby | *_bldromplugin.log
+
+MINIENV_CONF3 =\
+ find-ar | $(OST_DICTDIR) | $(OST_DICTPAT) ||\
+ find-a | $(COREPLAT_DIR) | $(MINIENV_INCLBIN) ||\
+ find-ar | $(PRODUCT_DIR) | $(MINIENV_INCLBIN) ||
+
+# find-a | $(CONFIGROOT) | *.confml ||\
+# find-ar | $(CONFIGROOT)/assets | * ||\
+# find-a | $(PLATFORM_DIR) | *.confml ||\
+# find-ar | $(PRODUCT_DIR) | *.confml ||\
+
+MINIENV_CONF = $(foreach conf,$(sort $(filter $(addprefix MINIENV_CONF,0 1 2 3 4 5 6 7 8 9),$(.VARIABLES))),$($(conf)) |)
+
+#==============================================================================
+
+CLEAN_MINIENV = $(if $(MINIENV_META),$(CLEAN_MINIENVMETA) |) del | "$(MINIENV_ZIP)"
+BUILD_MINIENV =\
+ $(if $(MINIENV_META),$(BUILD_MINIENVMETA) |)\
+ echo-q | Creating minimal flash image creation environment |\
+ find ||||\
+ $(MINIENV_META) |\
+ $(MINIENV_IMAKER) |\
+ $(MINIENV_TOOL) |\
+ $(MINIENV_CONF) |\
+ zip$(if $(filter debug 127,$(VERBOSE)),,-q) | "$(MINIENV_ZIP)" | __find__ |
+
+REPORT_MINIENV =\
+ Minienv input SOS dir | $(MINIENV_SOSDIR) | d |\
+ Minienv archive | $(MINIENV_ZIP) | f
+
+CLEAN_MINIENVMETA = del | "$(MINIENV_MFTMP)"
+BUILD_MINIENVMETA =\
+ echo-q | Creating manifest file |\
+ write | "$(MINIENV_MFTMP)" | $(call def2str,$(MINIENV_MFINFO))\n
###############################################################################
# Targets
-.PHONY:\
- minienv
+.PHONY: minienv minienv-conf minienv-imaker minienv-tool core-minienv
+
+minienv-conf: MINIENV_IMAKER =
+minienv-conf: MINIENV_TOOL =
+
+minienv-imaker: MINIENV_TOOL =
+minienv-imaker: minienv-tool ;
-minienv: ;@$(call IMAKER,$(call ucase,$@))
+minienv-itool: MINIENV_TOOL = $(MINIENV_ITOOL)
+minienv-itool: minienv-tool ;
+
+minienv-tool: MINIENV_META =
+minienv-tool: MINIENV_CONF =
+
+minienv: MINIENV_CONF3 =
+minienv minienv-conf minienv-tool core-minienv: ;@$(call IMAKER,MINIENV)
# END OF IMAKER_MINIENV.MK
--- a/imgtools/imaker/src/imaker_odp.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_odp.mk Thu Jun 24 10:35:05 2010 +0300
@@ -18,46 +18,71 @@
USE_PAGING = 0
-USE_PAGEDROM = $(if $(filter rom code code:%,$(call lcase,$(USE_PAGING))),1,0)
+USE_PAGEDROM = $(if $(or $(call true,$(USE_PAGEDCODE)$(USE_PAGEDDATA)),$(filter rom,$(call lcase,$(USE_PAGING)))),1,0)
USE_PAGEDCODE = $(call _getcodedp)
+USE_PAGEDDATA = $(if $(filter data,$(call lcase,$(USE_PAGING))),1,0)
ODP_CONFDIR = $(E32ROM)/configpaging
-ODP_PAGEFILE = configpaging.cfg
+ODP_PAGEFILE = $(call iif,$(USE_PAGEDDATA),configpaging_wdp.cfg,configpaging.cfg)
ODP_CODECOMP = bytepair
-# Min Max Young/Old NAND page read NAND page read
-# live live page ratio delay CPU overhead
-# pages pages (microseconds) (microseconds)
-ODP_ROMCONF = 1024 2048 3 0 0
+ODP_ROMCONF =\
+ $(or $(SYMBIAN_ODP_NUMBER_OF_MIN_LIVE_PAGES),1024)\
+ $(or $(SYMBIAN_ODP_NUMBER_OF_MAX_LIVE_PAGES),2048)\
+ $(or $(SYMBIAN_ODP_YOUNG_OLD_PAGE_RATIO),3)\
+ $(or $(SYMBIAN_ODP_NAND_PAGE_READ_DELAY),0)\
+ $(or $(SYMBIAN_ODP_NAND_PAGE_NAND_PAGE_READ_CPU_OVERHEAD),0)
-# Section for Rombuild phase on all Demand Paging builds
+# Section for Rombuild on all Demand Paging builds
#
define ODP_ROMINFO
+ $(call iif,$(USE_PAGEDDATA),
+ #if defined(FF_WDP_EMMC) && defined(FF_WDP_NAND)
+ #error ERROR: Both of the flags FF_WDP_EMMC and FF_WDP_NAND are defined!
+ #elif !defined(FF_WDP_EMMC) && !defined(FF_WDP_NAND)
+ #error ERROR: One of the flags FF_WDP_EMMC or FF_WDP_NAND should be defined!
+ #endif
+ ,
+ #undef FF_WDP_EMMC
+ #undef FF_WDP_NAND
+ )
$(call iif,$(USE_PAGEDROM),
#define PAGED_ROM
ROMBUILD_OPTION -geninc
- demandpagingconfig $(strip $(ODP_ROMCONF))
- pagingoverride defaultpaged
pagedrom
compress
+ demandpagingconfig $(strip $(ODP_ROMCONF))
+ codepagingoverride defaultpaged
+ $(call iif,$(USE_PAGEDDATA),
+ datapagingoverride defaultunpaged
+ ,
+ datapagingoverride nopaging)
)
$(if $(filter 1,$(USE_PAGEDCODE)),
#define PAGED_CODE
- pagingpolicy defaultpaged
+ codepagingpolicy defaultpaged
+ $(call iif,$(USE_PAGEDDATA),
+ datapagingpolicy defaultunpaged
+ ,
+ datapagingpolicy nopaging)
)
$(if $(CORE_PAGEFILE),$(call iif,$(USE_PAGEDROM)$(filter 1,$(USE_PAGEDCODE)),
- externaltool=configpaging:$(CORE_PAGEFILE))
- )
+ externaltool=configpaging:$(CORE_PAGEFILE)))
endef
-# Section for Rofsbuild phase on Code DP enabled builds
+# Section for Rofsbuild on Code/Data DP enabled builds
#
-define ODP_CODEINFO
- $(if $(filter $1,$(USE_PAGEDCODE)),
+define ODP_ROFSINFO
+ $(if $(filter $(IMAGE_ID),$(USE_PAGEDCODE)),
#define PAGED_CODE
- $(if $(ROFS$1_PAGEFILE),
- externaltool=configpaging:$(ROFS$1_PAGEFILE))
- pagingoverride defaultpaged
+ codepagingoverride defaultpaged
+ $(call iif,$(USE_PAGEDDATA),
+ datapagingoverride defaultunpaged
+ ,
+ datapagingoverride nopaging
+ )
+ $(if $(ROFS$(IMAGE_ID)_PAGEFILE),
+ externaltool=configpaging:$(ROFS$(IMAGE_ID)_PAGEFILE))
)
endef
@@ -66,10 +91,11 @@
# Internal stuff
_getcodedp = $(or $(strip\
- $(if $(filter code code:,$(eval __i_paging := $(call lcase,$(call sstrip,$(USE_PAGING))))$(__i_paging)),\
- $(foreach rofs,1 2 3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),$(rofs))),\
- $(if $(filter code:%,$(__i_paging)),\
- $(foreach rofs,1 2 3 4 5 6,$(findstring $(rofs),$(__i_paging)))))),0)
+ $(eval __i_paging := $(call lcase,$(USE_PAGING)))\
+ $(foreach rofs,$(if $(filter code:%,$(__i_paging)),\
+ $(foreach rofs,1 2 3 4 5 6,$(findstring $(rofs),$(__i_paging))),\
+ $(if $(or $(call true,$(USE_PAGEDDATA)),$(filter code,$(__i_paging))),1 2 3 4 5 6)),\
+ $(call iif,$(USE_ROFS$(rofs)),$(rofs)))),0)
# END OF IMAKER_ODP.MK
--- a/imgtools/imaker/src/imaker_public.mk Fri Jun 18 13:49:03 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of the License "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: iMaker public interface
-#
-
-
-
-#==============================================================================
-# Product variant variables
-
-FEATVARIANT_CONFML = $(wildcard $(PRODUCT_DIR)/$(FEATURE_VARIANT).confml)
-
-PRODVARIANT_DIR = $(PRODUCT_DIR)
-PRODVARIANT_CONFML = $(or $(FEATVARIANT_CONFML),$(PRODUCT_DIR)/$(PRODUCT_NAME).confml)
-PRODVARIANT_CONFCP =\
- $(PLATFORM_NAME) $(PRODUCT_MSTNAME) $(PRODUCT_NAME)\
- $(if $(FEATVARIANT_CONFML),$(call select,$(PRODUCT_NAME),$(FEATURE_VARIANT),,$(FEATURE_VARIANT)))
-
-#==============================================================================
-# Customer variant variables
-# Root for customer variant (custvariant) package settings
-
-CUSTVARIANT_ROOT = $(PRODUCT_DIR)/customer
-CUSTVARIANT_PREFIX = custvariant_
-CUSTVARIANT_NAME =
-CUSTVARIANT_ID =
-CUSTVARIANT_DIR = $(CUSTVARIANT_ROOT)/$(CUSTVARIANT_NAME)
-CUSTVARIANT_COMPLP =
-
-#==============================================================================
-# The Target specific override settings
-
-$(CUSTVARIANT_PREFIX)%: CUSTVARIANT_NAME = $(TARGETNAME)
-$(CUSTVARIANT_PREFIX)%: CUSTVARIANT_ID = $(TARGETID)
-$(CUSTVARIANT_PREFIX)%: VARIANT_DIR = $(CUSTVARIANT_DIR)
-$(CUSTVARIANT_PREFIX)%: variantrofs3_$(TARGETID)$(TARGETEXT) ;
-
-#==============================================================================
-# Helps
-
-$(call add_help,PRODVARIANT_DIR,v,(string),Overrides the VARIANT_DIR for product variant, see the instructions of VARIANT_CONFCP for details.)
-$(call add_help,PRODVARIANT_CONFML,v,(string),Overrides the VARIANT_CONFML for product variant, see the instructions of VARIANT_CONFML for details.)
-$(call add_help,PRODVARIANT_CONFCP,v,(string),Overrides the VARIANT_CONFCP for product variant, see the instructions of VARIANT_CONFCP for details.)
-$(call add_help,CUSTVARIANT_DIR,v,(string),Overrides the VARIANT_DIR for customer variant, see the instructions of VARIANT_CONFCP for details.)
-$(call add_help,CUSTVARIANT_COMPLP,v,(string),Compatible language variant.)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imaker/src/imaker_rofs.mk Thu Jun 24 10:35:05 2010 +0300
@@ -0,0 +1,261 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: iMaker generic ROFS image configuration
+#
+
+
+
+###############################################################################
+# ___ ___ ___ ___
+# | _ \/ _ \| __/ __|
+# | / (_) | _|\__ \
+# |_|_\\___/|_| |___/
+#
+
+ROFS_MAXSIZE = 0x10000000
+
+define ROFS_EVAL
+USE_$1 = $$(call userofs,$3)
+
+$1_TITLE = $1
+$1_DRIVE = Z
+$1_ROOT = $$(OUTDIR)/$2
+$1_DIR = $$($1_ROOT)
+$1_NAME = $$(NAME)
+$1_PREFIX = $$($1_DIR)/$$($1_NAME)
+$1_IDIR =
+$1_HBY =
+$1_OBY =
+$1_OPT =
+$1_MAXSIZE = $$(ROFS_MAXSIZE)
+$1_MSTOBY = $$($1_PREFIX)_$2_master.oby
+$1_HEADER =
+$1_INLINE =
+$1_FOOTER =
+$1_TIME = $$(DAY)/$$(MONTH)/$$(YEAR)
+
+$1_DEFHRH = $$($1_PREFIX)_$2_define.hrh
+$1_FEAXML =
+$1_FEAIBY =
+
+$1_ROMVER = $$(CORE_ROMVER)
+$1_ID = $$(if $$(filter $2_%,$$(TARGETNAME)),$$(TARGETID1),00)
+$1_REVISION = 01
+$1_VERSION = $$(CORE_VERSION).$$($1_ID).$$($1_REVISION)
+$1_SWVERFILE = $$($1_PREFIX)_$2_sw.txt
+$1_SWVERTGT = $$(IMAGE_VERSDIR)\$2sw.txt
+$1_SWVERINFO = $$($1_VERSION)\n$$(BUILD_YEAR)-$$(BUILD_MONTH)-$$(BUILD_DAY)
+$1_FWIDFILE = $$($1_PREFIX)_$2_fwid.txt
+$1_FWID = $2
+$1_FWIDVER = $$($1_VERSION)$$(SW_TYPEINFO)
+$1_FWIDINFO = id=$$($1_FWID)\nversion=$$($1_FWIDVER)\n
+
+$1_IMG = $$($1_PREFIX).$2.img
+$1_LOG = $$($1_PREFIX).$2.log
+$1_OUTOBY = $$($1_PREFIX).$2.oby
+$1_SYM = $$($1_PREFIX).$2.symbol
+
+$1_PLUGINLOG = $$($1_PREFIX)_$2_bldromplugin.log
+$1_PAGEFILE = $$(ODP_PAGEFILE)
+$1_UDEBFILE = $$(TRACE_UDEBFILE)
+
+$1_OBYGEN =
+$1_ORIDEIBY = $$($1_PREFIX)_$2_override.iby
+$1_ORIDEFILES = $$(IMAGE_ORIDEFILES)
+$1_ORIDECONF = $$(IMAGE_ORIDECONF)
+
+$1_ICHKLOG = $$($1_PREFIX)_$2_imgcheck.log
+$1_ICHKOPT = $$(IMGCHK_OPT)
+$1_ICHKIMG = $$($1_IMG)
+
+$1_I2FDIR = $$($1_DIR)/img2file
+
+$1_CONECONF = $$(PRODUCT_NAME)_$2_$$($1_ID)$$(addprefix _,$$($1_VARNAME))_root.confml
+$1_CONEOPT = --all-layers --impl-tag=target:$2
+
+$1_VARNAME = $$(if $$(filter $2_%,$$(TARGETNAME)),$$(TARGETID2-))
+$1_VARROOT = $$(or $$(wildcard $$(PRODUCT_DIR)/$2),$$(or $$(if $$(PRODUCT_MSTNAME),$$(wildcard $$(PRODUCT_MSTDIR)/$2)),$$(PRODUCT_DIR)/$2))
+$1_VARDIR = $$(if $$(and $$(call true,$$(USE_CONE)),$$(call true,$$(IMAKER_MKRESTARTS))),$$(CONE_OUTDIR),$$($1_VARROOT)/$2_$$($1_ID)$$(addprefix _,$$($1_VARNAME))$$(call iif,$$(USE_CONE),/content))
+
+#==============================================================================
+
+define $1_MSTOBYINFO
+ $$(call BLDROM_HDRINFO,$1)
+
+ ROM_IMAGE 0 non-xip size=0x00000000
+ $$(foreach rofs,1 2 3 4 5 6,
+ ROM_IMAGE $$(rofs) $$(if $$(filter $$(rofs),$3), rofs,dummy)$$(rofs) non-xip size=$$($1_MAXSIZE))
+
+ $$(call BLDROM_PLUGINFO,$1)
+
+ /* $1 header
+ */
+ $$($1_HDRINFO)
+
+ ROM_IMAGE[$3] {
+ $$(ODP_ROFSINFO)
+ #ifndef _IMAGE_INCLUDE_HEADER_ONLY
+ $$(BLR.$1.OBY)
+ $$($1_INLINE)
+ $$($1_FOOTERINFO)
+ }
+ #endif // _IMAGE_INCLUDE_HEADER_ONLY
+endef
+
+define $1_HDRINFO
+ $$(DEFINE) _IMAGE_WORKDIR $$($1_DIR)
+ $$(call mac2cppdef,$$(BLR.$1.OPT))
+ $$(BLR.$1.HBY)
+ $$($1_HEADER)
+ $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(VARIANT_HEADER))
+endef
+
+define $1_FOOTERINFO
+ $$(if $$($1_TIME),time=$$($1_TIME))
+ $$(if $$($1_ROMVER),version=$$($1_ROMVER))
+ $$($1_FOOTER)
+endef
+
+define $1_ORIDEINFO
+ // Generated `$$($1_ORIDEIBY)' for $$($1_TITLE) image creation
+
+ $$(if $$($1_SWVERINFO)$$($1_FWIDINFO),
+ OVERRIDE_REPLACE/ADD
+ $$(if $$($1_SWVERINFO),
+ data-override="$$($1_SWVERFILE)" "$$($1_SWVERTGT)")
+ $$(if $$($1_FWIDINFO),
+ data-override="$$($1_FWIDFILE)" "$$(IMAGE_VERSDIR)\fwid$3.txt")
+ OVERRIDE_END
+ )
+endef
+
+#==============================================================================
+# ROFS pre-build
+
+CLEAN_$1PRE =\
+ $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(CLEAN_VARIANT) |)\
+ $$(CLEAN_$1FILE) | $$(CLEAN_DEFHRH) | $$(CLEAN_FEATMAN)
+
+BUILD_$1PRE =\
+ $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(BUILD_VARIANT) |)\
+ mkdir | "$$($1_DIR)" |\
+ $$(BUILD_$1FILE) |\
+ $$(BUILD_DEFHRH) |\
+ $$(BUILD_FEATMAN)
+
+CLEAN_$1FILE =\
+ del | "$$($1_MSTOBY)" "$$($1_ORIDEIBY)" "$$($1_SWVERFILE)" "$$($1_FWIDFILE)" |\
+ del | $$(call getgenfiles,$$($1_OBYGEN))
+
+BUILD_$1FILE =\
+ echo-q | Generating file(s) for $$($1_TITLE) image creation |\
+ write-c | "$$($1_MSTOBY)" | $$(call def2str,$$($1_MSTOBYINFO))\n |\
+ $$(if $$($1_SWVERINFO),\
+ writeu | "$$($1_SWVERFILE)" | $$(call quote,$$($1_SWVERINFO)) |)\
+ $$(if $$($1_FWIDINFO),\
+ writeu | "$$($1_FWIDFILE)" | $$($1_FWIDINFO) |)\
+ $$(if $$($1_ORIDEINFO),\
+ write-c | "$$($1_ORIDEIBY)" | $$(call def2str,$$($1_ORIDEINFO)) |)\
+ $$(if $$($1_ORIDECONF),\
+ genorideiby | >>$$($1_ORIDEIBY) | $$(call def2str,$$($1_ORIDEFILES) | $$($1_ORIDECONF)) |)\
+ $$($1_OBYGEN)
+
+#==============================================================================
+# ROFS build
+
+$1_DUMMY = $$(call rofsdummy,$1)
+
+BLR.$1.BUILD = $$(if $$(filter d%,$$(USE_$1)),echo-q | Creating dummy $$($1_TITLE) SOS image | write-q | "$$($1_IMG)" | $$($1_DUMMY))
+BLR.$1.IDIR = $$(call dir2inc,$$($1_IDIR) $$(call iif,$$(USE_FEATVAR),,$$(FEATVAR_IDIR)))
+BLR.$1.HBY = $$(call includeiby,$$(IMAGE_HBY) $$($1_HBY))
+BLR.$1.OBY = $$(call includeiby,$$($1_OBY))\
+ $$(and $$(call true,$$(SYMBIAN_FEATURE_MANAGER)),$$($1_FEAIBY),$$(call mac2cppdef,-U__FEATURE_IBY__)$$(call includeiby,$$($1_FEAIBY)))\
+ $$(call includeiby,$$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(VARIANT_OBY)) $$($1_ORIDEIBY))
+BLR.$1.OPT = $$($1_OPT) $$(if $$(filter $3,$$(USE_PAGEDCODE)),$$(if $$(ODP_CODECOMP),-c$$(ODP_CODECOMP))) -o$$(call pathconv,$$($1_PREFIX)).img $$(BLDROPT)
+BLR.$1.POST = $$(call iif,$$(KEEPTEMP),,del | "$$($1_PREFIX).???")
+
+CLEAN_$1 = $$(call CLEAN_BLDROM,$1)
+BUILD_$1 = $$(call BUILD_BLDROM,$1)
+
+REPORT_$1 =\
+ $$($1_TITLE) dir | $$($1_DIR) | d |\
+ $$($1_TITLE) image | $$($1_IMG) | f\
+ $$(call iif,$$(USE_SYMGEN),| $$(REPORT_MAKSYMROFS))
+
+#==============================================================================
+# ROFS post-build
+
+CLEAN_$1POST = $$(CLEAN_IMGCHK)
+BUILD_$1POST = $$(call iif,$$(USE_IMGCHK),$$(BUILD_IMGCHK))
+REPORT_$1POST =
+
+#==============================================================================
+# ROFS steps
+
+SOS.$1.STEPS = $$(call iif,$$(USE_$1),\
+ $$(call iif,$$(SKIPPRE),,$$(and $$(filter $3,$$(USE_VARIANTBLD)),$$(call true,$$(USE_CONE)),CONEGEN RESTART) $1PRE)\
+ $$(call iif,$$(SKIPBLD),,$1) $$(call iif,$$(SKIPPOST),,$1POST))
+
+ALL.$1.STEPS = $$(SOS.$1.STEPS)
+
+#==============================================================================
+# Targets
+
+.PHONY: $2 $(addprefix $2-,all check cone i2file image pre symbol) variant$2
+
+$2 $2%: IMAGE_TYPE = $1
+$2-all: USE_SYMGEN = 1
+
+$2 $2-all: ;@$$(call IMAKER,$$$$(ALL.$1.STEPS))
+$2-image : ;@$$(call IMAKER,$$$$(SOS.$1.STEPS))
+
+$2-cone : ;@$$(call IMAKER,CONEGEN)
+$2-pre : ;@$$(call IMAKER,$1PRE)
+$2-check : ;@$$(call IMAKER,IMGCHK)
+$2-symbol: ;@$$(call IMAKER,MAKSYMROFS)
+$2-i2file: ;@$$(call IMAKER,I2FILE)
+
+variant$2 variant$2% : USE_CONE = 0
+variant$2 variant$2% $2_%: USE_VARIANTBLD = $3
+variant$2 variant$2% $2_%: $2$$(TARGETEXT) ;
+
+#==============================================================================
+# Helps
+
+$(call add_help,$2,t,Create $$($1_TITLE) image.)
+$(call add_help,$2-dir,t,Create directory structure for $$($1_TITLE) creation.)
+$(call add_help,$2-i2file,t,Extract all files from $$($1_TITLE) image.)
+$(call add_help,$2-image,t,Create $$($1_TITLE) image (.img) file.)
+$(call add_help,$2-pre,t,Run pre-step, create files etc. for $$($1_TITLE) creation.)
+$(call add_help,$2-symbol,t,Create $$($1_TITLE) symbol file.)
+$(call add_help,variant$2,t,Create $$($1_TITLE) image from a variant directory. Be sure to define the VARIANT_DIR.)
+
+endef # ROFS_EVAL
+
+
+###############################################################################
+#
+
+userofs = $(eval __i_rofs := $(filter-out :%,$(subst :, :,$(subst $(,), ,$(USE_ROFS)))))$(if\
+ $(filter $1,$(__i_rofs)),1,$(if $(filter d$1 D$1,$(__i_rofs)),dummy,0))
+
+rofsdummy = $(if $(filter d%,$(USE_$1)),$(call prepeat,\
+ $(call peval,$(call pquote,$(USE_ROFS)) =~ /d$1:(\d*)/i && $$1 || 100),X))
+
+$(foreach rofs,1 2 3 4 5 6,$(eval $(call ROFS_EVAL,ROFS$(rofs),rofs$(rofs),$(rofs))))
+
+$(call includechk,$(addprefix $(IMAKER_DIR)/imaker_rofs,2.mk 3.mk 4.mk))
+
+
+# END OF IMAKER_ROFS.MK
--- a/imgtools/imaker/src/imaker_rofs2.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_rofs2.mk Thu Jun 24 10:35:05 2010 +0300
@@ -23,145 +23,74 @@
# |_|_\\___/|_| |___/ /___|
#
-USE_NEWLOCLZTN = $(if $(filter 5%,$(S60_VERSION)),1,0)
-
-ROFS2_TITLE = ROFS2
-ROFS2_DIR = $(WORKDIR)/rofs2
-ROFS2_NAME = $(NAME)
-ROFS2_PREFIX = $(ROFS2_DIR)/$(ROFS2_NAME)
-ROFS2_IDIR =
-ROFS2_HBY =
-ROFS2_OBY =
-ROFS2_OPT =
-ROFS2_MSTOBY = $(ROFS2_PREFIX)_rofs2_master.oby
-ROFS2_HEADER =
-ROFS2_INLINE =
-ROFS2_FOOTER =
-ROFS2_TIME = $(DAY)/$(MONTH)/$(YEAR)
-
-ROFS2_OBYGEN =
-
-ROFS2_VERIBY = $(ROFS2_PREFIX)_rofs2_version.iby
-ROFS2_ROMVER = 0.01(0)
-ROFS2_VERSION = $(CORE_VERSION)
-ROFS2_FWIDFILE = $(ROFS2_PREFIX)_rofs2_fwid.txt
-ROFS2_FWID = language
-ROFS2_FWIDVER = $(LANGPACK_ID)
-ROFS2_FWIDINFO = id=$(ROFS2_FWID)\nversion=$(ROFS2_FWIDVER)\n
-
-ROFS2_IMG = $(ROFS2_PREFIX).rofs2.img
-ROFS2_LOG = $(ROFS2_PREFIX).rofs2.log
-ROFS2_OUTOBY = $(ROFS2_PREFIX).rofs2.oby
-ROFS2_SYM = $(ROFS2_PREFIX).rofs2.symbol
+ROFS2_FEAXML = $(E32ROMINC)/featuredatabase.xml $(E32INC)/s60features.xml
+ROFS2_FEAIBY = $(ROFS2_DIR)/feature.iby $(ROFS2_DIR)/s60features.iby
-ROFS2_PLUGINLOG = $(ROFS2_PREFIX)_rofs2_bldromplugin.log
-ROFS2_PAGEFILE = $(ODP_PAGEFILE)
-ROFS2_UDEBFILE = $(TRACE_UDEBFILE)
-
-ROFS2_ICHKLOG = $(ROFS2_PREFIX)_rofs2_imgcheck.log
-ROFS2_ICHKOPT = $(IMGCHK_OPT)
-ROFS2_ICHKIMG = $(ROFS2_IMG) $(CORE_ICHKIMG)
-
-ROFS2_I2FDIR = $(ROFS2_DIR)/img2file
-
-#==============================================================================
-
-define ROFS2_MSTOBYINFO
- $(BLDROM_HDRINFO)
+ROFS2_ID = $(LANGPACK_ID)
+ROFS2_REVISION = $(LANGPACK_REVISION)
+ROFS2_SWVERINFO = $(ROFS2_VERSION)\n$(BUILD_YEAR)-$(BUILD_MONTH)-$(BUILD_DAY)\n$(PRODUCT_TYPE)\n(c) $(PRODUCT_MANUFACT)
+ROFS2_SWVERTGT = $(IMAGE_VERSDIR)\langsw.txt
+ROFS2_FWID = language
- ROM_IMAGE 0 non-xip size=0x00000000
- ROM_IMAGE 1 dummy1 non-xip size=$(ROFS_MAXSIZE)
- ROM_IMAGE 2 rofs2 non-xip size=$(ROFS_MAXSIZE)
- ROM_IMAGE 3 dummy3 non-xip size=$(ROFS_MAXSIZE)
+ROFS2_ICHKIMG += $(CORE_ICHKIMG)
- $(BLDROM_PLUGINFO)
+ROFS2_CONECONF = $(PRODUCT_NAME)_langpack_$(LANGPACK_ID)_root.confml
- // ROFS2 header
- //
- $(ROFS2_HDRINFO)
- ROM_IMAGE[2] {
- $(call ODP_CODEINFO,2)
- $(BLR.ROFS2.OBY)
- $(ROFS2_INLINE)
- $(ROFS2_FOOTERINFO)
- }
-endef
+###############################################################################
+# ROFS2 pre
define ROFS2_HDRINFO
$(DEFINE) _IMAGE_WORKDIR $(ROFS2_DIR)
$(call mac2cppdef,$(BLR.ROFS2.OPT))
- $(call iif,$(USE_NEWLOCLZTN),
- $(foreach lang,$(call getlangbyid,$(LANGPACK_LANGS)),
- #define __LOCALES_$(lang)_IBY__)
- $(foreach lang,$(call getlangbyid,$(LANGPACK_LANGS)),
- ADD_LANGUAGE $(lang))
- )
+ $(foreach lang,$(call getlangbyid,$(LANGPACK_LANGS)),
+ #define __LOCALES_$(lang)_IBY__)
+ $(foreach lang,$(call getlangbyid,$(LANGPACK_LANGS)),
+ LANGUAGE_CODE $(lang))
+ $(call iif,$(USE_QTLOCLZTN),QT_TO_SYMBIAN_LANGID $(LANGPACK_SYSLANGINI))
$(BLR.ROFS2.HBY)
$(ROFS2_HEADER)
$(if $(filter 2,$(USE_VARIANTBLD)),$(VARIANT_HEADER))
endef
-define ROFS2_FOOTERINFO
- $(if $(ROFS2_TIME),time=$(ROFS2_TIME))
- $(ROFS2_FOOTER)
-endef
-
-define ROFS2_VERIBYINFO
- // Generated `$(ROFS2_VERIBY)$' for ROFS2 image creation
- $(if $(ROFS2_ROMVER),
+ROFS2_ORIDEINFO += $(LANGPACK_ORIDEINFO)
- version=$(ROFS2_ROMVER))
-
+define LANGPACK_ORIDEINFO
OVERRIDE_REPLACE/ADD
- $(call iif,$(USE_NEWLOCLZTN),
- data-override=$(LANGPACK_LANGFILE) RESOURCE_FILES_DIR\Bootdata\languages.txt
- data-override=$(LANGPACK_IDFILE) RESOURCE_FILES_DIR\versions\lang.txt
- data-override=$(LANGPACK_SWVERFILE) RESOURCE_FILES_DIR\versions\langsw.txt
- )
- $(call iif,$(USE_FOTA),
- data-override=$(ROFS2_FWIDFILE) RESOURCE_FILES_DIR\versions\fwid2.txt)
+ data-override="$(LANGPACK_LANGFILE)" "RESOURCE_FILES_DIR\Bootdata\languages.txt"
+ data-override="$(LANGPACK_IDFILE)" "$(IMAGE_VERSDIR)\lang.txt"
OVERRIDE_END
endef
#==============================================================================
-CLEAN_ROFS2FILE =\
- del | "$(ROFS2_MSTOBY)" "$(ROFS2_VERIBY)" "$(ROFS2_FWIDFILE)" |\
- $(CLEAN_LANGFILE) |\
- del | $(call getgenfiles,$(call _buildoby,$(ROFS2_OBYGEN)))
-
-BUILD_ROFS2FILE =\
- echo-q | Generating file(s) for ROFS2 image creation |\
- write | $(ROFS2_MSTOBY) | $(call def2str,$(ROFS2_MSTOBYINFO)) |\
- $(call iif,$(USE_VERGEN),\
- write | $(ROFS2_VERIBY) | $(call def2str,$(ROFS2_VERIBYINFO)) |\
- writeu | $(ROFS2_FWIDFILE) | $(ROFS2_FWIDINFO) |)\
- $(call iif,$(USE_NEWLOCLZTN),$(BUILD_LANGFILE)) |\
- $(call _buildoby,$(ROFS2_OBYGEN))
+CLEAN_ROFS2FILE += | $(CLEAN_LANGFILE)
+BUILD_ROFS2FILE += | $(BUILD_LANGFILE)
###############################################################################
-#
+# Language package
-LANGPACK_SYSLANGMK = system_languages.mk
+LANGPACK_SYSLANGMK = $(call findfile,system_languages.mk,,1)
+LANGPACK_SYSLANGINI = $(E32DATAZ)/resource/system_languages.ini
-LANGPACK_ROOT = $(PRODUCT_DIR)/language
+LANGPACK_ROOT = $(or $(wildcard $(PRODUCT_DIR)/language),$(or $(if $(PRODUCT_MSTNAME),$(wildcard $(PRODUCT_MSTDIR)/language)),$(PRODUCT_DIR)/language))
LANGPACK_PREFIX = langpack_
LANGPACK_MKNAME = language_variant.mk
-LANGPACK_NAME =
-LANGPACK_DIR = $(LANGPACK_ROOT)/$(LANGPACK_NAME)
-LANGPACK_CONFML = $(or $(wildcard $(LANGPACK_DIR)/$(CONFT_CFGNAME).confml),$(PRODVARIANT_CONFML))
-LANGPACK_CONFCP = $(PRODVARIANT_CONFCP) $(if $(wildcard $(LANGPACK_DIR)/$(CONFT_CFGNAME).confml),$(CONFT_CFGNAME))
+LANGPACK_NAME = $(LANGPACK_PREFIX)$(LANGPACK_ID)
+LANGPACK_DIR = $(if $(and $(call true,$(USE_CONE)),$(call true,$(IMAKER_MKRESTARTS))),$(CONE_OUTDIR),$(LANGPACK_ROOT)/$(LANGPACK_NAME)$(call iif,$(USE_CONE),/content))
+LANGPACK_DIRS = $(wildcard $(LANGPACK_ROOT)/$(LANGPACK_PREFIX)*$(call iif,$(USE_CONE),/content))
+LANGPACK_MK = $(or $(wildcard $(LANGPACK_DIR)/$(LANGPACK_MKNAME)),$(wildcard $(LANGPACK_ROOT)/$(LANGPACK_NAME)/content/$(LANGPACK_MKNAME)))
LANGPACK_IDFILE = $(ROFS2_PREFIX)_rofs2_lang.txt
-LANGPACK_ID = 01
+LANGPACK_IDINFO = $(ROFS2_VERSION)
+LANGPACK_ID = $(if $(filter $(LANGPACK_PREFIX)%,$(TARGETNAME)),$(TARGETID1),01)
+LANGPACK_REVISION = 01
LANGPACK_LANGFILE = $(ROFS2_PREFIX)_rofs2_languages.txt
LANGPACK_LANGS = English
LANGPACK_DEFAULTLANG = $(word 1,$(LANGPACK_LANGS))
LANGPACK_DEFAULTREGION = Western
-LANGPACK_SWVERFILE = $(ROFS2_PREFIX)_rofs2_langsw.txt
-LANGPACK_SWVERINFO = $(CORE_SWVERINFO)
+LANGPACK_REGIONS = china japan western
LANGPACK_INFOFILE = $(ROFS2_PREFIX)_rofs2_$(LANGPACK_NAME)_info.txt
LANGPACK_LANGNAMES = $(call getlangname,$(LANGPACK_LANGS))
@@ -172,38 +101,37 @@
#==============================================================================
-CLEAN_LANGFILE = del | "$(LANGPACK_LANGFILE)" "$(LANGPACK_IDFILE)" "$(LANGPACK_SWVERFILE)" "$(LANGPACK_INFOFILE)"
+CLEAN_LANGFILE = del | "$(LANGPACK_LANGFILE)" "$(LANGPACK_IDFILE)" "$(LANGPACK_INFOFILE)"
BUILD_LANGFILE =\
echo-q | Generating language files for Language Package image creation |\
$(if $(strip $(LANGUAGE_SYSLANGS)),,\
- error | 1 | No system languages defined\n |)\
+ error | 1 | No system languages defined. |)\
$(if $(strip $(LANGPACK_LANGS)),,\
- error | 1 | No languages defined in the language pack\n |)\
+ error | 1 | No languages defined in the language pack. |)\
$(call select,$(words $(LANGPACK_LANGS)),$(words $(LANGPACK_LANGIDS)),,\
- error | 1 | Not all languages of the language pack defined in the system languages\n |)\
+ error | 1 | Not all languages of the language pack defined in the system languages. |)\
$(call select,$(words $(LANGPACK_LANGS)),$(words $(call getlangbyid,$(LANGPACK_LANGS))),,\
- error | 1 | Duplicate language defined in the language pack\n |)\
+ error | 1 | Duplicate language defined in the language pack. |)\
$(if $(strip $(LANGPACK_DEFAULTLANG)),,\
- error | 1 | No default language defined\n |)\
+ error | 1 | No default language defined. |)\
$(if $(word 2,$(LANGPACK_DEFAULTLANG)),\
- error | 1 | More than one default language defined\n |)\
+ error | 1 | More than one default language defined. |)\
$(if $(filter $(call lcase,$(LANGPACK_DEFAULTLANG)),$(call lcase,$(LANGPACK_LANGS))),,\
- error | 1 | Default language not defined in the language pack languages\n |)\
+ error | 1 | Default language not defined in the language pack languages. |)\
$(if $(word 2,$(sort $(call getlangregion,$(LANGPACK_LANGS)))),\
- error | 1 | Not all languages of the language pack belong to the same region\n |)\
+ error | 1 | Not all languages of the language pack belong to the same region. |)\
\
- writeu | $(LANGPACK_LANGFILE) | $(LANGPACK_LANGINFO) |\
- writeu | $(LANGPACK_IDFILE) | $(LANGPACK_ID) |\
- writeu | $(LANGPACK_SWVERFILE) | $(LANGPACK_SWVERINFO) |\
+ writeu | "$(LANGPACK_LANGFILE)" | $(LANGPACK_LANGINFO) |\
+ writeu | "$(LANGPACK_IDFILE)" | $(LANGPACK_IDINFO) |\
$(if $(LANGPACK_NAME),\
- write | $(LANGPACK_INFOFILE) | $(call def2str,$(LANGPACK_INFO)))
+ write | "$(LANGPACK_INFOFILE)" | $(call def2str,$(LANGPACK_INFO)))
LANGPACK_LANGINFO =\
$(foreach lang,$(LANGPACK_LANGIDS),\
$(lang)$(call select,$(lang),$(LANGPACK_DEFLANGID),$(,)d)\n)
define LANGPACK_INFO
- Generated `$(LANGPACK_INFOFILE)$' for documenting the language selections
+ Generated `$(LANGPACK_INFOFILE)' for documenting the language selections
Name : $(LANGPACK_NAME)
Default Lang.: $(LANGPACK_DEFLANGNAME) ($(LANGPACK_DEFLANGID))
@@ -214,79 +142,25 @@
###############################################################################
-# ROFS2 pre
+# Targets
-CLEAN_ROFS2PRE = $(if $(filter 2,$(USE_VARIANTBLD)),$(CLEAN_CUSTVARIANT) |) $(CLEAN_ROFS2FILE)
-BUILD_ROFS2PRE =\
- $(if $(filter 2,$(USE_VARIANTBLD)),$(BUILD_CUSTVARIANT) |)\
- mkcd | $(ROFS2_DIR) |\
- $(BUILD_ROFS2FILE)
-
-#==============================================================================
-# ROFS2 build
+LANGPACK_EXPORT = $(if $(filter $(LANGPACK_PREFIX)%,$(TARGETNAME)),$(addprefix $(LANGPACK_PREFIX)%:LANGPACK_,ID NAME))
+TARGET_EXPORT += $(LANGPACK_EXPORT)
-BLR.ROFS2.IDIR = $(call dir2inc,$(ROFS2_IDIR) $(call iif,$(USE_FEATVAR),,$(FEATVAR_IDIR)))
-BLR.ROFS2.HBY = $(call includeiby,$(IMAGE_HBY) $(ROFS2_HBY))
-BLR.ROFS2.OBY = $(call includeiby,$(ROFS2_OBY) $(if $(filter 2,$(USE_VARIANTBLD)),$(VARIANT_OBY)) $(call iif,$(USE_VERGEN),$(ROFS2_VERIBY)))
-BLR.ROFS2.OPT = $(ROFS2_OPT) $(if $(filter 2,$(USE_PAGEDCODE)),$(if $(ODP_CODECOMP),-c$(ODP_CODECOMP))) -o$(notdir $(ROFS2_NAME).img) $(BLDROPT)
-BLR.ROFS2.POST = $(call iif,$(KEEPTEMP),,del | $(ROFS2_PREFIX).???)
-
-CLEAN_ROFS2 = $(CLEAN_BLDROM)
-BUILD_ROFS2 = $(BUILD_BLDROM)
+# langpack_all langpack_china langpack_japan langpack_western
+.PHONY: $(addprefix $(LANGPACK_PREFIX),all $(LANGPACK_REGIONS))
-#==============================================================================
-# ROFS2 post
+$(addprefix $(LANGPACK_PREFIX),all $(LANGPACK_REGIONS)) \
+$(addsuffix -%,$(addprefix $(LANGPACK_PREFIX),all $(LANGPACK_REGIONS))):\
+ ;@$(call IMAKER,$$(call getlpacksbyregion,$(LANGPACK_ID)))
-CLEAN_ROFS2POST = $(CLEAN_IMGCHK) | $(CLEAN_MAKSYMROFS)
-BUILD_ROFS2POST =\
- $(call iif,$(USE_IMGCHK),$(BUILD_IMGCHK) |)\
- $(call iif,$(USE_SYMGEN),$(BUILD_MAKSYMROFS))
-
-#==============================================================================
-
-SOS.ROFS2.STEPS = $(call iif,$(USE_ROFS2),$(call iif,$(SKIPPRE),,ROFS2PRE) $(call iif,$(SKIPBLD),,ROFS2) $(call iif,$(SKIPPOST),,ROFS2POST))
-ALL.ROFS2.STEPS = $(SOS.ROFS2.STEPS)
+$(LANGPACK_PREFIX)%: rofs2_$$* ;
###############################################################################
-# Targets
-
-.PHONY: rofs2 rofs2-all rofs2-image rofs2-pre rofs2-check rofs2-symbol rofs2-i2file
-
-rofs2 rofs2-% : IMAGE_TYPE = ROFS2
-rofs2-all : USE_SYMGEN = 1
-
-rofs2 rofs2-all: ;@$(call IMAKER,$$(ALL.ROFS2.STEPS))
-rofs2-image : ;@$(call IMAKER,$$(SOS.ROFS2.STEPS))
-
-rofs2-pre : ;@$(call IMAKER,ROFS2PRE)
-rofs2-check : ;@$(call IMAKER,IMGCHK)
-rofs2-symbol : ;@$(call IMAKER,MAKSYMROFS)
-
-rofs2-i2file : USE_ROFS = 2
-rofs2-i2file : ;@$(call IMAKER,VARIANTI2F)
-
-# langpack_%
-$(LANGPACK_PREFIX)%: LANGPACK_NAME = $(TARGETNAME)
-$(LANGPACK_PREFIX)%: LANGPACK_ID = $(TARGETID)
-$(LANGPACK_PREFIX)%: VARIANT_DIR = $(LANGPACK_DIR)
-$(LANGPACK_PREFIX)%: VARIANT_MKNAME = $(LANGPACK_MKNAME)
-$(LANGPACK_PREFIX)%: VARIANT_CONFML = $(LANGPACK_CONFML)
-$(LANGPACK_PREFIX)%: VARIANT_CONFCP = $(LANGPACK_CONFCP)
-$(LANGPACK_PREFIX)%: variantrofs2_$(TARGETID)$(TARGETEXT) ;
-
-# langpack_all langpack_china langpack_japan langpack_western
-.PHONY: $(addprefix $(LANGPACK_PREFIX),all china japan western)
-
-$(addprefix $(LANGPACK_PREFIX),all china japan western):\
- ;@$(call IMAKER,$$(addsuffix |,$$(call getlpacksbyregion,$(LANGPACK_ID))))
-
-#==============================================================================
# Helps
-$(call add_help,LANGPACK_DIR,v,(string),Overrides the VARIANT_DIR for language pack, see the instructions of VARIANT_CONFCP for details.)
-$(call add_help,LANGPACK_CONFML,v,(string),Overrides the VARIANT_CONFML for language pack, see the instructions of VARIANT_CONFML for details.)
-$(call add_help,LANGPACK_CONFCP,v,(string),Overrides the VARIANT_CONFCP for language pack, see the instructions of VARIANT_CONFCP for details.)
+$(call add_help,LANGPACK_DIR,v,(string),Overrides the VARIANT_DIR for language pack, see the instructions of VARIANT_DIR for details.)
$(call add_help,LANGPACK_LANGS,v,(string),Languages are the languages that are taken to the image (SC language is is defaulting to 01 in languages.txt))
$(call add_help,LANGPACK_DEFAULTLANG,v,(string),Default language is the language where the device will boot to (SIM language overrides this selection))
$(call add_help,LANGPACK_ID,v,(string),Language id used in the lang.txt generation)
@@ -296,6 +170,12 @@
$(call add_help,$(LANGPACK_PREFIX)japan,t,Create language packages that belong to Japan region.)
$(call add_help,$(LANGPACK_PREFIX)western,t,Create language packages that belong to Western region.)
+LANGPACK_HELP =\
+ $(call add_help,$(call getlpfrompath,$(LANGPACK_DIRS)),t,Language variant target.)\
+ $(eval include $(wildcard $(addsuffix /$(LANGPACK_MKNAME),$(LANGPACK_DIRS))))
+
+BUILD_HELPDYNAMIC += $(LANGPACK_HELP)
+
###############################################################################
# Functions
@@ -315,19 +195,20 @@
# Get all language pack targets that belong to a given region
getlpacksbyregion = $(strip\
- $(foreach file,$(wildcard $(LANGPACK_ROOT)/$(LANGPACK_PREFIX)*/$(LANGPACK_MKNAME)),\
+ $(foreach file,$(wildcard $(addsuffix /$(LANGPACK_MKNAME),$(LANGPACK_DIRS))),\
$(eval include $(file))\
- $(if $(call select,$1,all,1)$(call select,$1,$(LANGPACK_REGION),1),\
- $(notdir $(patsubst %/,%,$(dir $(file)))))))
+ $(if $(call select,$1,all,1)$(call select,$1,$(LANGPACK_REGION),1),$(call getlpfrompath,$(file)))))
+
+# Get language pack target(s) from given path(s)
+getlpfrompath = $(filter $(LANGPACK_PREFIX)%,$(call substm,/ \, ,$1))
###############################################################################
# Internal stuff
LANGUAGE_EVAL =\
- $(eval -include $(call findfile,$(LANGPACK_SYSLANGMK),$(FEATVAR_IDIR)))\
$(eval LANGUAGE_ID-NAME :=)$(eval LANGUAGE_ID-REGION :=)\
- $(call _evallangdata,$(subst $(\n), | ,$(LANGUAGE_SYSLANGS)))
+ $(call _evallangdata,$(strip $(subst $(\n), | ,$(LANGUAGE_SYSLANGS))))
_evallangdata = $(if $1,\
$(eval __i_ldata := $(call getelem,1,$1))\
--- a/imgtools/imaker/src/imaker_rofs3.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_rofs3.mk Thu Jun 24 10:35:05 2010 +0300
@@ -23,166 +23,55 @@
# |_|_\\___/|_| |___/ |___/
#
-ROFS3_TITLE = ROFS3
-ROFS3_DIR = $(WORKDIR)/rofs3
-ROFS3_NAME = $(NAME)
-ROFS3_PREFIX = $(ROFS3_DIR)/$(ROFS3_NAME)
-ROFS3_IDIR =
-ROFS3_HBY =
-ROFS3_OBY =
-ROFS3_OPT =
-ROFS3_MSTOBY = $(ROFS3_PREFIX)_rofs3_master.oby
-ROFS3_HEADER =
-ROFS3_INLINE =
-ROFS3_FOOTER =
-ROFS3_TIME = $(DAY)/$(MONTH)/$(YEAR)
-
-ROFS3_OBYGEN = #geniby | $(ROFS3_PREFIX)_rofs3_collected.oby | $(E32ROMINC)/customervariant/* | *.iby | \#include "%3" | end
-
-ROFS3_VERIBY = $(ROFS3_PREFIX)_rofs3_version.iby
-ROFS3_ROMVER = 0.01(0)
-ROFS3_VERSION = $(CORE_VERSION)
-ROFS3_CUSTSWFILE = $(ROFS3_PREFIX)_rofs3_customersw.txt
-ROFS3_CUSTSWINFO = $(ROFS3_VERSION)\\\n$(DAY)-$(MONTH)-$(YEAR2)
-ROFS3_FWIDFILE = $(ROFS3_PREFIX)_rofs3_fwid.txt
-ROFS3_FWID = customer
-ROFS3_FWIDVER = $(ROFS3_VERSION) Customer
-ROFS3_FWIDINFO = id=$(ROFS3_FWID)\nversion=$(ROFS3_FWIDVER)\n
-
-ROFS3_IMG = $(ROFS3_PREFIX).rofs3.img
-ROFS3_LOG = $(ROFS3_PREFIX).rofs3.log
-ROFS3_OUTOBY = $(ROFS3_PREFIX).rofs3.oby
-ROFS3_SYM = $(ROFS3_PREFIX).rofs3.symbol
-
-ROFS3_PLUGINLOG = $(ROFS3_PREFIX)_rofs3_bldromplugin.log
-ROFS3_PAGEFILE = $(ODP_PAGEFILE)
-ROFS3_UDEBFILE = $(TRACE_UDEBFILE)
-
-ROFS3_ICHKLOG = $(ROFS3_PREFIX)_rofs3_imgcheck.log
-ROFS3_ICHKOPT = $(IMGCHK_OPT)
-ROFS3_ICHKIMG = $(ROFS3_IMG) $(ROFS2_ICHKIMG)
-
-ROFS3_I2FDIR = $(ROFS3_DIR)/img2file
-
-#==============================================================================
-
-define ROFS3_MSTOBYINFO
- $(BLDROM_HDRINFO)
-
- ROM_IMAGE 0 non-xip size=0x00000000
- ROM_IMAGE 1 dummy1 non-xip size=$(ROFS_MAXSIZE)
- ROM_IMAGE 2 dummy2 non-xip size=$(ROFS_MAXSIZE)
- ROM_IMAGE 3 rofs3 non-xip size=$(ROFS_MAXSIZE)
-
- $(BLDROM_PLUGINFO)
+ROFS3_FEAXML = $(E32INC)/s60customswfeatures.xml
+ROFS3_FEAIBY = $(ROFS3_DIR)/s60customswfeatures.iby
- // ROFS3 header
- //
- $(ROFS3_HDRINFO)
-
- ROM_IMAGE[3] {
- $(call ODP_CODEINFO,3)
- $(BLR.ROFS3.OBY)
- $(ROFS3_INLINE)
- $(ROFS3_FOOTERINFO)
- }
-endef
-
-define ROFS3_HDRINFO
- $(DEFINE) _IMAGE_WORKDIR $(ROFS3_DIR)
- $(call mac2cppdef,$(BLR.ROFS3.OPT))
- $(BLR.ROFS3.HBY)
- $(ROFS3_HEADER)
- $(if $(filter 3,$(USE_VARIANTBLD)),$(VARIANT_HEADER))
-endef
-
-define ROFS3_FOOTERINFO
- $(if $(ROFS3_TIME),time=$(ROFS3_TIME))
- $(ROFS3_FOOTER)
-endef
+ROFS3_ID = $(CUSTVARIANT_ID)
+ROFS3_REVISION = $(CUSTVARIANT_REVISION)
+ROFS3_SWVERTGT = $(IMAGE_VERSDIR)\customersw.txt
+ROFS3_FWID = customer
-define ROFS3_VERIBYINFO
- // Generated `$(ROFS3_VERIBY)$' for ROFS3 image creation
- $(if $(ROFS3_ROMVER),
-
- version=$(ROFS3_ROMVER))
-
- OVERRIDE_REPLACE/ADD
- $(if $(ROFS3_CUSTSWINFO),
- data-override=$(ROFS3_CUSTSWFILE) RESOURCE_FILES_DIR\versions\customersw.txt)
- $(call iif,$(USE_FOTA),
- data-override=$(ROFS3_FWIDFILE) RESOURCE_FILES_DIR\versions\fwid3.txt)
- OVERRIDE_END
-endef
+ROFS3_ICHKIMG += $(ROFS2_ICHKIMG)
-#==============================================================================
-
-CLEAN_ROFS3FILE =\
- del | "$(ROFS3_MSTOBY)" "$(ROFS3_VERIBY)" "$(ROFS3_CUSTSWFILE)" "$(ROFS3_FWIDFILE)" |\
- del | $(call getgenfiles,$(ROFS3_OBYGEN))
-
-BUILD_ROFS3FILE =\
- echo-q | Generating file(s) for ROFS3 image creation |\
- write | $(ROFS3_MSTOBY) | $(call def2str,$(ROFS3_MSTOBYINFO)) |\
- $(call iif,$(USE_VERGEN),\
- write | $(ROFS3_VERIBY) | $(call def2str,$(ROFS3_VERIBYINFO)) |\
- writeu | $(ROFS3_CUSTSWFILE) | $(ROFS3_CUSTSWINFO) |\
- writeu | $(ROFS3_FWIDFILE) | $(ROFS3_FWIDINFO) |)\
- $(ROFS3_OBYGEN)
+ROFS3_CONECONF = $(PRODUCT_NAME)_custvariant_$(CUSTVARIANT_ID)$(addprefix _,$(CUSTVARIANT_NAME))_root.confml
+ROFS3_CONEOPT = --layer-wildcard=*/custvariant* --impl-tag=target:rofs3
###############################################################################
-# ROFS3 pre
-
-CLEAN_ROFS3PRE = $(if $(filter 3,$(USE_VARIANTBLD)),$(CLEAN_CUSTVARIANT) |) $(CLEAN_ROFS3FILE)
-BUILD_ROFS3PRE =\
- $(if $(filter 3,$(USE_VARIANTBLD)),$(BUILD_CUSTVARIANT) |)\
- mkcd | $(ROFS3_DIR) |\
- $(BUILD_ROFS3FILE)
-
-#==============================================================================
-# ROFS3 build
+# Customer variant
-BLR.ROFS3.IDIR = $(call dir2inc,$(ROFS3_IDIR) $(call iif,$(USE_FEATVAR),,$(FEATVAR_IDIR)))
-BLR.ROFS3.HBY = $(call includeiby,$(IMAGE_HBY) $(ROFS3_HBY))
-BLR.ROFS3.OBY = $(call includeiby,$(ROFS3_OBY) $(if $(filter 3,$(USE_VARIANTBLD)),$(VARIANT_OBY)) $(call iif,$(USE_VERGEN),$(ROFS3_VERIBY)))
-BLR.ROFS3.OPT = $(ROFS3_OPT) $(if $(filter 3,$(USE_PAGEDCODE)),$(if $(ODP_CODECOMP),-c$(ODP_CODECOMP))) -o$(notdir $(ROFS3_NAME).img) $(BLDROPT)
-BLR.ROFS3.POST = $(call iif,$(KEEPTEMP),,del | $(ROFS3_PREFIX).???)
-
-CLEAN_ROFS3 = $(CLEAN_BLDROM)
-BUILD_ROFS3 = $(BUILD_BLDROM)
+CUSTVARIANT_ROOT = $(PRODUCT_DIR)/customer
+CUSTVARIANT_ROOT2 = $(if $(PRODUCT_MSTNAME),$(PRODUCT_MSTDIR)/customer)
+#CUSTVARIANT_ROOT3 = $(PLATFORM_DIR)/country
+CUSTVARIANT_PREFIX = custvariant_
+CUSTVARIANT_ID = $(if $(filter $(CUSTVARIANT_PREFIX)%,$(TARGETNAME)),$(TARGETID1),00)
+CUSTVARIANT_NAME = $(if $(filter $(CUSTVARIANT_PREFIX)%,$(TARGETNAME)),$(TARGETID2-),vanilla)
+CUSTVARIANT_REVISION = 01
+CUSTVARIANT_DIR = $(if $(and $(call true,$(USE_CONE)),$(call true,$(IMAKER_MKRESTARTS))),$(CONE_OUTDIR),$(strip\
+ $(eval __i_custvardir :=)$(foreach croot,$(sort $(filter CUSTVARIANT_ROOT%,$(.VARIABLES))),\
+ $(if $(__i_custvardir),,$(eval __i_custvardir := $(if $(wildcard $($(croot))),\
+ $(wildcard $($(croot))/$(CUSTVARIANT_PREFIX)$(CUSTVARIANT_ID)$(addprefix _,$(CUSTVARIANT_NAME)))))))\
+ )$(or $(__i_custvardir),$(CUSTVARIANT_ROOT)/$(CUSTVARIANT_PREFIX)$(CUSTVARIANT_ID)$(addprefix _,$(CUSTVARIANT_NAME)))$(call iif,$(USE_CONE),/content))
+CUSTVARIANT_COMPLP =
-#==============================================================================
-# ROFS3 post
+CUSTVARIANT_EXPORT = $(if $(filter $(CUSTVARIANT_PREFIX)%,$(TARGETNAME)),$(addprefix $(CUSTVARIANT_PREFIX)%:CUSTVARIANT_,ID NAME))
+TARGET_EXPORT += $(CUSTVARIANT_EXPORT)
-CLEAN_ROFS3POST = $(CLEAN_IMGCHK) | $(CLEAN_MAKSYMROFS)
-BUILD_ROFS3POST =\
- $(call iif,$(USE_IMGCHK),$(BUILD_IMGCHK) |)\
- $(call iif,$(USE_SYMGEN),$(BUILD_MAKSYMROFS))
-
-#==============================================================================
-
-SOS.ROFS3.STEPS = $(call iif,$(USE_ROFS3),$(call iif,$(SKIPPRE),,ROFS3PRE) $(call iif,$(SKIPBLD),,ROFS3) $(call iif,$(SKIPPOST),,ROFS3POST))
-ALL.ROFS3.STEPS = $(SOS.ROFS3.STEPS)
+# custvariant_%
+$(CUSTVARIANT_PREFIX)%: rofs3_$$* ;
###############################################################################
-# Targets
+# Helps
-.PHONY: rofs3 rofs3-all rofs3-image rofs3-pre rofs3-check rofs3-symbol rofs3-i2file
-
-rofs3 rofs3-% : IMAGE_TYPE = ROFS3
-rofs3-all : USE_SYMGEN = 1
+$(call add_help,CUSTVARIANT_DIR,v,(string),Overrides the VARIANT_DIR for customer variant, see the instructions of VARIANT_DIR for details.)
+$(call add_help,CUSTVARIANT_COMPLP,v,(string),Compatible language variant.)
-rofs3 rofs3-all: ;@$(call IMAKER,$$(ALL.ROFS3.STEPS))
-rofs3-image : ;@$(call IMAKER,$$(SOS.ROFS3.STEPS))
+CUSTVARIANT_HELP = $(call add_help,$(foreach croot,$(filter CUSTVARIANT_ROOT%,$(.VARIABLES)),\
+ $(if $(wildcard $($(croot))),$(call getlastdir,$(filter %/,$(wildcard $($(croot))/$(CUSTVARIANT_PREFIX)*/))))),\
+ t,Customer $$(subst $$(CUSTVARIANT_PREFIX),,$$1) variant target.)
-rofs3-pre : ;@$(call IMAKER,ROFS3PRE)
-rofs3-check : ;@$(call IMAKER,IMGCHK)
-rofs3-symbol : ;@$(call IMAKER,MAKSYMROFS)
-
-rofs3-i2file : USE_ROFS = 3
-rofs3-i2file : ;@$(call IMAKER,VARIANTI2F)
+BUILD_HELPDYNAMIC += $(CUSTVARIANT_HELP)
# END OF IMAKER_ROFS3.MK
--- a/imgtools/imaker/src/imaker_rofs4.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_rofs4.mk Thu Jun 24 10:35:05 2010 +0300
@@ -23,141 +23,5 @@
# |_|_\\___/|_| |___/ |_|
#
-ROFS4_TITLE = ROFS4
-ROFS4_DIR = $(WORKDIR)/rofs4
-ROFS4_NAME = $(NAME)
-ROFS4_PREFIX = $(ROFS4_DIR)/$(ROFS4_NAME)
-ROFS4_IDIR =
-ROFS4_HBY =
-ROFS4_OBY =
-ROFS4_OPT =
-ROFS4_MSTOBY = $(ROFS4_PREFIX)_rofs4_master.oby
-ROFS4_HEADER =
-ROFS4_INLINE =
-ROFS4_FOOTER =
-ROFS4_TIME = $(DAY)/$(MONTH)/$(YEAR)
-
-ROFS4_OBYGEN =
-
-ROFS4_VERSION = $(CORE_VERSION)
-
-ROFS4_IMG = $(ROFS4_PREFIX).rofs4.img
-ROFS4_LOG = $(ROFS4_PREFIX).rofs4.log
-ROFS4_OUTOBY = $(ROFS4_PREFIX).rofs4.oby
-ROFS4_SYM = $(ROFS4_PREFIX).rofs4.symbol
-
-ROFS4_PLUGINLOG = $(ROFS4_PREFIX)_rofs4_bldromplugin.log
-ROFS4_PAGEFILE = $(ODP_PAGEFILE)
-ROFS4_UDEBFILE = $(TRACE_UDEBFILE)
-
-ROFS4_ICHKLOG = $(ROFS4_PREFIX)_rofs4_imgcheck.log
-ROFS4_ICHKOPT = $(IMGCHK_OPT)
-ROFS4_ICHKIMG = $(ROFS4_IMG) $(ROFS2_ICHKIMG)
-
-ROFS4_I2FDIR = $(ROFS4_DIR)/img2file
-
-#==============================================================================
-
-define ROFS4_MSTOBYINFO
- $(BLDROM_HDRINFO)
-
- ROM_IMAGE 0 non-xip size=0x00000000
- ROM_IMAGE 1 dummy1 non-xip size=$(ROFS_MAXSIZE)
- ROM_IMAGE 2 dummy2 non-xip size=$(ROFS_MAXSIZE)
- ROM_IMAGE 3 dummy3 non-xip size=$(ROFS_MAXSIZE)
- ROM_IMAGE 4 rofs4 non-xip size=$(ROFS_MAXSIZE)
- ROM_IMAGE 5 dummy5 non-xip size=$(ROFS_MAXSIZE)
- ROM_IMAGE 6 dummy6 non-xip size=$(ROFS_MAXSIZE)
-
- $(BLDROM_PLUGINFO)
-
- // ROFS4 header
- //
- $(ROFS4_HDRINFO)
-
- ROM_IMAGE[4] {
- $(call ODP_CODEINFO,4)
- $(BLR.ROFS4.OBY)
- $(ROFS4_INLINE)
- $(ROFS4_FOOTERINFO)
- }
-endef
-
-define ROFS4_HDRINFO
- $(DEFINE) _IMAGE_WORKDIR $(ROFS4_DIR)
- $(call mac2cppdef,$(BLR.ROFS4.OPT))
- $(BLR.ROFS4.HBY)
- $(ROFS4_HEADER)
-endef
-
-define ROFS4_FOOTERINFO
- $(if $(ROFS4_TIME),time=$(ROFS4_TIME))
- $(ROFS4_FOOTER)
-endef
-
-#==============================================================================
-
-CLEAN_ROFS4FILE =\
- del | "$(ROFS4_MSTOBY)" |\
- del | $(call getgenfiles,$(ROFS4_OBYGEN))
-
-BUILD_ROFS4FILE =\
- echo-q | Generating file(s) for $(ROFS4_TITLE) image creation |\
- write | $(ROFS4_MSTOBY) | $(call def2str,$(ROFS4_MSTOBYINFO)) |\
- $(ROFS4_OBYGEN)
-
-
-###############################################################################
-# ROFS4 pre
-
-CLEAN_ROFS4PRE = $(CLEAN_ROFS4FILE)
-BUILD_ROFS4PRE =\
- mkcd | $(ROFS4_DIR) |\
- $(BUILD_ROFS4FILE)
-
-#==============================================================================
-# ROFS4 build
-
-BLR.ROFS4.IDIR = $(call dir2inc,$(ROFS4_IDIR) $(call iif,$(USE_FEATVAR),,$(FEATVAR_IDIR)))
-BLR.ROFS4.HBY = $(call includeiby,$(IMAGE_HBY) $(ROFS4_HBY))
-BLR.ROFS4.OBY = $(call includeiby,$(ROFS4_OBY))
-BLR.ROFS4.OPT = $(ROFS4_OPT) $(if $(filter 4,$(USE_PAGEDCODE)),$(if $(ODP_CODECOMP),-c$(ODP_CODECOMP))) -o$(ROFS4_NAME).img $(BLDROPT)
-BLR.ROFS4.POST = $(call iif,$(KEEPTEMP),,del | $(ROFS4_PREFIX).???)
-
-CLEAN_ROFS4 = $(CLEAN_BLDROM)
-BUILD_ROFS4 = $(BUILD_BLDROM)
-
-#==============================================================================
-# ROFS4 post
-
-CLEAN_ROFS4POST = $(CLEAN_IMGCHK) | $(CLEAN_MAKSYMROFS)
-BUILD_ROFS4POST =\
- $(call iif,$(USE_IMGCHK),$(BUILD_IMGCHK) |)\
- $(call iif,$(USE_SYMGEN),$(BUILD_MAKSYMROFS))
-
-#==============================================================================
-
-SOS.ROFS4.STEPS = $(call iif,$(USE_ROFS4),$(call iif,$(SKIPPRE),,ROFS4PRE) $(call iif,$(SKIPBLD),,ROFS4) $(call iif,$(SKIPPOST),,ROFS4POST))
-ALL.ROFS4.STEPS = $(SOS.ROFS4.STEPS)
-
-
-###############################################################################
-# Targets
-
-.PHONY: rofs4 rofs4-all rofs4-image rofs4-pre rofs4-check rofs4-symbol rofs4-i2file
-
-rofs4 rofs4-% : IMAGE_TYPE = ROFS4
-rofs4-all : USE_SYMGEN = 1
-
-rofs4 rofs4-all: ;@$(call IMAKER,$$(ALL.ROFS4.STEPS))
-rofs4-image : ;@$(call IMAKER,$$(SOS.ROFS4.STEPS))
-
-rofs4-pre : ;@$(call IMAKER,ROFS4PRE)
-rofs4-check : ;@$(call IMAKER,IMGCHK)
-rofs4-symbol : ;@$(call IMAKER,MAKSYMROFS)
-
-rofs4-i2file : USE_ROFS = 4
-rofs4-i2file : ;@$(call IMAKER,VARIANTI2F)
-
# END OF IMAKER_ROFS4.MK
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imaker/src/imaker_smr.mk Thu Jun 24 10:35:05 2010 +0300
@@ -0,0 +1,127 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: iMaker SMR image configuration
+#
+
+
+
+###############################################################################
+# ___ __ __ ___
+# / __| \/ | _ \
+# \__ \ |\/| | /
+# |___/_| |_|_|_\
+#
+
+SMR_TITLE = SMR
+SMR_DIR = $(CORE_DIR)/smr
+SMR_NAME = $(NAME)
+SMR_PREFIX = $(SMR_DIR)/$(SMR_NAME)
+SMR_IDIR =
+SMR_HBY =
+SMR_OBY =
+SMR_OPT = $(BLDROM_OPT) -s -D_EABI=$(ARM_VERSION)
+SMR_MSTOBY = $(SMR_PREFIX)_smr_master.oby
+SMR_HEADER =
+
+SMR_OBYGEN =
+
+SMR_IMG = $(SMR_PREFIX).smr.img
+SMR_LOG = $(SMR_PREFIX).smr.log
+SMR_OUTOBY = $(SMR_PREFIX).smr.oby
+
+SMR_CONECONF =
+SMR_CONEOPT = --all-layers --impl-tag=target:smr
+
+#==============================================================================
+
+define SMR_MSTOBYINFO
+ $(call BLDROM_HDRINFO,SMR)
+
+ ROM_IMAGE 0 non-xip size=0x00000000
+
+ /* $(SMR_TITLE) header
+ */
+ $(SMR_HDRINFO)
+
+ SMR_IMAGE {
+ $(BLR.SMR.OBY)
+ imagename=$(notdir $(SMR_IMG))
+ }
+endef
+
+define SMR_HDRINFO
+ $(DEFINE) _IMAGE_WORKDIR $(SMR_DIR)
+ $(call mac2cppdef,$(BLR.SMR.OPT))
+ $(BLR.SMR.HBY)
+ $(SMR_HEADER)
+ $(if $(filter 1,$(USE_VARIANTBLD)),$(VARIANT_HEADER))
+endef
+
+
+###############################################################################
+# SMR pre-build step
+
+CLEAN_SMRPRE =\
+ $(if $(filter 1,$(USE_VARIANTBLD)),$(CLEAN_VARIANT) |)\
+ del | "$(SMR_MSTOBY)" | del | $(call getgenfiles,$(SMR_OBYGEN))
+
+BUILD_SMRPRE =\
+ $(if $(filter 1,$(USE_VARIANTBLD)),$(BUILD_VARIANT) |)\
+ mkdir | "$(SMR_DIR)" |\
+ echo-q | Generating file(s) for $(SMR_TITLE) image creation |\
+ write-c | "$(SMR_MSTOBY)" | $(call def2str,$(SMR_MSTOBYINFO)) |\
+ $(SMR_OBYGEN)
+
+#==============================================================================
+# SMR build step
+
+BLR.SMR.IDIR = $(call dir2inc,$(SMR_IDIR) $(call iif,$(USE_FEATVAR),,$(FEATVAR_IDIR)))
+BLR.SMR.HBY = $(call includeiby,$(IMAGE_HBY) $(SMR_HBY))
+BLR.SMR.OBY = $(call includeiby,$(SMR_OBY))\
+ $(call includeiby,$(if $(filter 1,$(USE_VARIANTBLD)),$(VARIANT_OBY)) $(BLDROBY))
+BLR.SMR.OPT = $(SMR_OPT) -o$(call pathconv,$(SMR_PREFIX)).img $(BLDROPT)
+BLR.SMR.POST =\
+ move | "$(SMR_OUTOBY).log" | $(SMR_LOG) |\
+ test | "$(SMR_IMG)"
+
+CLEAN_SMR = $(call CLEAN_BLDROM,SMR)
+BUILD_SMR = $(call BUILD_BLDROM,SMR)
+
+REPORT_SMR =\
+ $(SMR_TITLE) dir | $(SMR_DIR) | d |\
+ $(SMR_TITLE) image | $(SMR_IMG) | f
+
+#==============================================================================
+
+SOS.SMR.STEPS = $(call iif,$(USE_SMR),\
+ $(call iif,$(SKIPPRE),,$(and $(filter 1,$(USE_VARIANTBLD)),$(call true,$(USE_CONE)),CONEGEN RESTART) SMRPRE)\
+ $(call iif,$(SKIPBLD),,SMR) $(call iif,$(SKIPPOST),,SMRPOST))
+
+ALL.SMR.STEPS = $(SOS.SMR.STEPS)
+
+
+###############################################################################
+# Targets
+
+.PHONY: smr smr-all smr-image smr-cone smr-pre
+
+smr smr%: IMAGE_TYPE = SMR
+
+smr smr-all: ;@$(call IMAKER,$$(ALL.SMR.STEPS))
+smr-image : ;@$(call IMAKER,$$(SOS.SMR.STEPS))
+smr-cone : ;@$(call IMAKER,CONEGEN)
+smr-pre : ;@$(call IMAKER,SMRPRE)
+
+
+# END OF IMAKER_SMR.MK
--- a/imgtools/imaker/src/imaker_tools.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_tools.mk Thu Jun 24 10:35:05 2010 +0300
@@ -19,124 +19,308 @@
###############################################################################
# External tools
-BLDROM_TOOL = buildrom
+BLDROM_TOOL = $(PERL) -S buildrom.pl
+FEATMAN_TOOL = $(PERL) -S features.pl
ROMBLD_TOOL = rombuild
ROFSBLD_TOOL = rofsbuild
-MAKSYM_TOOL = maksym
-MAKSYMROFS_TOOL = maksymrofs
+MAKSYM_TOOL = $(PERL) -S maksym.pl
+MAKSYMROFS_TOOL = $(PERL) -S maksymrofs.pl
+ELF2E32_TOOL = elf2e32
IMGCHK_TOOL = imgcheck
INTPRSIS_TOOL = interpretsis
READIMG_TOOL = readimage
-UNZIP_TOOL = unzip
ZIP_TOOL = zip
7ZIP_TOOL = 7za
-FILEDISK_TOOL = filedisk
-WINIMAGE_TOOL = "c:/program files/winimage/winimage.exe"
+UNZIP_TOOL = $(7ZIP_TOOL)
+
+BUILD_TOOLSET =\
+ tool-cpp | $(CPP) |\
+ tool-elf2e32 | $(ELF2E32_TOOL) |\
+ tool-interpretsis | $(INTPRSIS_TOOL) |\
+ tool-opcache | $(OPC_TOOL) |\
+ tool-unzip | $(UNZIP_TOOL)
+
+#==============================================================================
+
+BLDROM_JOBS =
+
+BLDROM_OPT =\
+ -loglevel1 $(call iif,$(KEEPTEMP),-p) -v $(call iif,$(USE_SYMGEN),,-nosymbols) $(addprefix -j,$(BLDROM_JOBS))\
+ $(call iif,$(USE_BLRWORKDIR),-workdir="$($(IMAGE_TYPE)_DIR)")\
+ $(call iif,$(USE_FEATVAR),-DFEATUREVARIANT=$(FEATURE_VARIANT))\
+ $(call iif,$(SYMBIAN_FEATURE_MANAGER),\
+ $(if $($(IMAGE_TYPE)_FEAXML),-fm=$(subst $( ),$(,),$(strip $($(IMAGE_TYPE)_FEAXML)))) -D__FEATURE_IBY__)\
+ $(if $(IMAGE_TYPE),-D_IMAGE_TYPE_$(IMAGE_TYPE)) $(if $(TYPE),-D_IMAGE_TYPE_$(call ucase,$(TYPE)))
+
+BLDROM_PARSE =\
+ parse | Missing files: | /Missing file:/i ||\
+ parse | Errors: | /ERROR:\|ERR :/i ||\
+ parse-4 | Erroneous links: | /WARNING: Kernel\/variant\/extension/i ||\
+ parse | Warnings: | /WARNING:\|WARN:/i |\
+ /WARNING: the value of attribute .+ has been overridden\|WARNING: Kernel\/variant\/extension\|Warning: Can't open .+\.map/i
+
+# parse | Can't locate: | /Can't locate\|couldn't be located/i |
+#Unrecognised option -NO-HEADER0
+
+# For passing extra parameters (from command line)
+BLDROPT =
+BLDROBY =
#==============================================================================
-BLDROM_OPT =\
- -loglevel1 $(call iif,$(KEEPTEMP),-p) -v -nosymbols\
- $(call iif,$(USE_FEATVAR),-DFEATUREVARIANT=$(FEATURE_VARIANT))\
- $(if $(IMAGE_TYPE),-D_IMAGE_TYPE_$(IMAGE_TYPE)) $(if $(TYPE),-D_IMAGE_TYPE_$(call ucase,$(TYPE)))
+DEFHRH_IDIR = . $($(IMAGE_TYPE)_IDIR) $(FEATVAR_IDIR)
+DEFHRH_CMD = $(CPP) -nostdinc -undef -dM -D_IMAGE_INCLUDE_HEADER_ONLY\
+ $(call dir2inc,$(DEFHRH_IDIR)) -include $(call upddrive,$(FEATVAR_HRH)) $(call updoutdrive,$($(IMAGE_TYPE)_MSTOBY)) \|\
+ $(PERL) -we $(call iif,$(USE_UNIX),',")print(sort({lc($$a) cmp lc($$b)} <STDIN>))$(call iif,$(USE_UNIX),',")\
+ >>$($(IMAGE_TYPE)_DEFHRH)
+
+define DEFHRH_HDRINFO
+ // Generated file for documenting feature variant definitions
+ //
+ // Filename: $($(IMAGE_TYPE)_DEFHRH)
+ // Command : $(DEFHRH_CMD)
+endef
+
+CLEAN_DEFHRH = del | "$($(IMAGE_TYPE)_DEFHRH)"
+BUILD_DEFHRH =\
+ $(if $($(IMAGE_TYPE)_DEFHRH),\
+ write | "$($(IMAGE_TYPE)_DEFHRH)" | $(call def2str,$(DEFHRH_HDRINFO))\n\n |\
+ cmd | $(DEFHRH_CMD))
+
+#==============================================================================
-BLDROM_PARSE =\
- parse | \nMissing file(s):\n | Missing file: |\
- parse | \nWarning(s):\n | /WARNING:\|WARN:/i |\
- parse | \nError(s):\n | /ERROR:\|ERR :/i |\
- parse | \nCan$'t locate:\n | Can$'t locate | parse | \ncouldn$'t be located:\n | couldn$'t be located
+FEATMAN_OPT = $($(IMAGE_TYPE)_FEAXML) --ibyfile=$($(IMAGE_TYPE)_DIR) --verbose
+FEATMAN_CMD = $(FEATMAN_TOOL) $(FEATMAN_OPT)
+
+CLEAN_FEATMAN = del | $(foreach file,$($(IMAGE_TYPE)_FEAIBY),"$(file)")
+BUILD_FEATMAN =\
+ $(call iif,$(SYMBIAN_FEATURE_MANAGER),$(if $($(IMAGE_TYPE)_FEAXML),\
+ echo-q | Generating Feature manager file(s) |\
+ write | $($(IMAGE_TYPE)_FEAIBY) | |\
+ cmd | $(FEATMAN_CMD)))
-#* Writing tmp7.oby - result of problem-suppression phase
-#Can't open \epoc32\release\ARMV5\urel\apgrfx.dll.map
-#Unrecognised option -NO-HEADER0
+#==============================================================================
+# ROFS symbol generation
+
+MAKSYMROFS_CMD = $(MAKSYMROFS_TOOL) $(call pathconv,"$($(IMAGE_TYPE)_LOG)" "$($(IMAGE_TYPE)_SYM)")
-# For passing extra paramters (from command line)
-BLDROPT =
-BLDROBY =
+CLEAN_MAKSYMROFS = del | "$($(IMAGE_TYPE)_SYM)"
+BUILD_MAKSYMROFS =\
+ echo-q | Creating $($(IMAGE_TYPE)_TITLE) symbol file |\
+ cmd | $(MAKSYMROFS_CMD)
+
+REPORT_MAKSYMROFS = $($(IMAGE_TYPE)_TITLE) symbols | $($(IMAGE_TYPE)_SYM) | f
###############################################################################
-# S60 Configuration Tool CLI
+# ConE
+
+USE_CONE = 0
+
+CONE_TOOL = $(call iif,$(USE_UNIX),,call )cone
+CONE_TOOLDIR = $(or $(wildcard $(E32TOOLS)/configurationengine),$(E32TOOLS)/cone)
+CONE_OUTDIR = $(OUTTMPDIR)/cone
+CONE_PRJ = $(CONFIGROOT)
+CONE_CONF = $($(IMAGE_TYPE)_CONECONF)
+CONE_RNDCONF = $(COREPLAT_NAME)/$(PRODUCT_NAME)/rnd/root.confml
+CONE_ADDCONF = $(call select,$(TYPE),rnd,$(if $(wildcard $(CONE_PRJ)/$(CONE_RNDCONF)),$(CONE_RNDCONF)))
+CONE_LOG = $($(or $(addsuffix _,$(IMAGE_TYPE)),WORK)PREFIX)_cone_$(call substm,* / : ? \,@,$(TARGET)).log
+CONE_VERBOSE = $(if $(filter debug 127,$(VERBOSE)),5)
+CONE_GOPT = generate --project="$(CONE_PRJ)"\
+ $(if $(CONE_CONF),--configuration="$(CONE_CONF)") $(addprefix --add=,$(CONE_ADDCONF))\
+ $(if $(CONE_LOG),--log-file="$(CONE_LOG)") $(addprefix --verbose=,$(CONE_VERBOSE))
+CONE_PARSE = parse-2 | ConE errors: | /ERROR\s*:/i |
+
+#==============================================================================
-CONFT_TOOL = cli.cmd
-CONFT_TOOLDIR = $(or $(wildcard /s60/tools/toolsextensions/ConfigurationTool),/ext/tools/toolsextensions/ConfigurationTool)
+CONE_MK = $(if $(CONE_PRJ),$(CONE_PRJ).mk)
+CONE_MKOPT = $(CONE_GOPT) --impl=imaker.* --all-layers --set=imaker.makefilename="$(CONE_MK)" --output=.
+CONE_MKCMD = $(CONE_TOOL) $(CONE_MKOPT)
+
+CLEAN_CONEPRE = del | "$(CONE_MK)" "$(CONE_LOG)"
+BUILD_CONEPRE =\
+ echo-q | Creating ConE makefile `$(CONE_MK)' |\
+ cmd | $(CONE_MKCMD) | $(CONE_PARSE) |\
+ test | "$(CONE_MK)"
+
+#==============================================================================
+
+CONE_IMPLS =
+CONE_IMPLOPT = $(addprefix --impl=,$(subst $(,), ,$(CONE_IMPLS)))
+CONE_LAYERS =
+CONE_LAYEROPT = $(addprefix --layer=,$(subst $(,), ,$(CONE_LAYERS)))
+CONE_REPFILE = $(basename $(CONE_LOG)).html
+CONE_REPDATADIR = $(OUTDIR)/cone-repdata
+CONE_REPDATAFILE = $(CONE_REPDATADIR)/$(IMAGE_TYPE).dat
+CONE_RTMPLFILE =
+
+CONE_GENOPT = $(CONE_GOPT)\
+ $(CONE_IMPLOPT) $(CONE_LAYEROPT) --add-setting-file=imaker_variantdir.cfg\
+ $(if $(CONE_REPFILE),$(call select,$(USE_CONE),mk,--report-data-output="$(CONE_REPDATAFILE)",--report="$(CONE_REPFILE)"))\
+ $($(IMAGE_TYPE)_CONEOPT) --output="$(CONE_OUTDIR)"
+CONE_GENCMD = $(CONE_TOOL) $(CONE_GENOPT)
-CONFT_DIR = $(WORKDIR)/ct
-CONFT_TMPDIR = $(CONFT_DIR)/_temp
-CONFT_CFGNAME = variant
-CONFT_CONFML = $(call iif,$(USE_VARIANTBLD),$(VARIANT_CONFML),$(WORKDIR)/$(CONFT_CFGNAME).confml)
-CONFT_IMPL = $(CONFIGROOT)/confml_data/s60;$(CONFIGROOT)/confml_data/customsw
-CONFT_IBYML = $(CONFT_TOOLDIR)/ibyml
-CONFT_OUTDIR = $(call iif,$(USE_VARIANTBLD),$(VARIANT_OUTDIR),$(CONFT_DIR)/cenrep)
-CONFT_CRLOG = $(call iif,$(USE_VARIANTBLD),$(VARIANT_PREFIX)_,$(CONFT_DIR))cenrep.log
-CONFT_ECLCONF = -configuration $(CONFT_TMPDIR) -data $(CONFT_TMPDIR)
-CONFT_CONF = $(CONFT_ECLCONF)\
- -master $(CONFT_CONFML) -impl $(CONFT_IMPL) $(if $(CONFT_IBYML),-ibyml $(CONFT_IBYML)) -output $(CONFT_DIR)\
- -report $(CONFT_CRLOG) -ignore_errors
-CONFT_CONFCP = $(call iif,$(USE_VARIANTBLD),$(VARIANT_CONFCP),$(CONFT_CFGNAME))
+CLEAN_CONEGEN = del | "$(CONE_LOG)" "$(CONE_REPFILE)" | deldir | "$(CONE_OUTDIR)"
+BUILD_CONEGEN =\
+ echo-q | Generating $($(IMAGE_TYPE)_TITLE) content with ConE |\
+ mkdir | "$(CONE_OUTDIR)" |\
+ cmd | $(CONE_GENCMD) | $(CONE_PARSE)
+
+REPORT_CONEGEN =\
+ ConE log | $(CONE_LOG) | f\
+ $(if $(CONE_REPFILE),| ConE report | $(CONE_REPFILE) | f)
+
+#==============================================================================
+
+CLEAN_CONEREPPRE = deldir | "$(CONE_REPDATADIR)"
+BUILD_CONEREPPRE =
+
+CONE_REPGENOPT =\
+ report --input-data-dir="$(CONE_REPDATADIR)"\
+ $(if $(CONE_RTMPLFILE),--template="$(CONE_RTMPLFILE)")\
+ --report="$(CONE_REPFILE)" --log-file="$(CONE_LOG)" $(addprefix --verbose=,$(CONE_VERBOSE))
+CONE_REPGENCMD = $(CONE_TOOL) $(CONE_REPGENOPT)
-CONFT_CMD = $(CONFT_TOOL) $(CONFT_CONF)
-CONFT_PARSE = parse | \nWarnings, errors and problems:\n | /warning:\|error:\|problem/i
+CLEAN_CONEREPGEN = del | "$(CONE_REPFILE)"
+BUILD_CONEREPGEN = $(if $(CONE_REPFILE),\
+ echo-q | Generating report with ConE to `$(CONE_REPFILE)' |\
+ cmd | $(CONE_REPGENCMD))
+
+REPORT_CONEREPGEN = $(if $(CONE_REPFILE),ConE report | $(CONE_REPFILE) | f)
-CLEAN_CENREP =\
- del | $(CONFT_CRLOG) |\
- deldir | "$(CONFT_DIR)" "$(CONFT_TMPDIR)" $(call iif,$(USE_VARIANTBLD),,"$(CONFT_OUTDIR)")
+#==============================================================================
+
+CONE_XCF = $(ICDP_XCF)
+
+CONE_XCFOPT = $(CONE_GOPT) --impl=xcf.gcfml --all-layers --output="$(dir $(CONE_XCF))"
+CONE_XCFCMD = $(CONE_TOOL) $(CONE_XCFOPT)
-BUILD_CENREP =\
- echo-q | Calling S60 Configuration Tool |\
- mkcd | $(CONFT_DIR) |\
- deldir | $(CONFT_TMPDIR) |\
- cmd | $(CONFT_CMD) | $(CONFT_PARSE) |\
- $(foreach dir,$(CONFT_CONFCP),\
- finddir | $(CONFT_DIR)/$(dir) | * | |\
- copy | __find__ | $(CONFT_OUTDIR) |)\
- $(call iif,$(KEEPTEMP),,deldir | $(CONFT_TMPDIR))
+CLEAN_CONEXCF = del | "$(CONE_XCF)" "$(CONE_LOG)"
+BUILD_CONEXCF =\
+ echo-q | Creating XCF file `$(CONE_XCF)' |\
+ cmd | $(CONE_XCFCMD) | $(CONE_PARSE) |\
+ test | "$(CONE_XCF)"
+
+#==============================================================================
+
+.PHONY: cone-pre cone-gen cone-rep-pre cone-rep-gen
+
+cone-pre: ;@$(call IMAKER,CONEPRE)
+cone-gen: ;@$(call IMAKER,CONEGEN)
+cone-rep-pre: ;@$(call IMAKER,CONEREPPRE)
+cone-rep-gen: ;@$(call IMAKER,CONEREPGEN)
###############################################################################
-# Interpretsis
+# SIS pre-installation
+
+SISINST_INI = $(wildcard $(VARIANT_DIR)/sis_config.ini)
+SISINST_DIR = $(VARIANT_SISDIR)
+SISINST_OUTDIR = $(VARIANT_OUTDIR)
+SISINST_CFGINI = $(IMAGE_PREFIX)_sis.ini
+SISINST_LOG = $(IMAGE_PREFIX)_sis.log
+SISINST_CONF = -d $(if $(filter Z z,$(or $($(IMAGE_TYPE)_DRIVE),Z)),C,$($(IMAGE_TYPE)_DRIVE)) -e -k 5.4 -s "$(SISINST_DIR)"
+SISINST_HALHDA =
+
+# sf/os/kernelhwsrv/halservices/hal/inc/hal_data.h:
+define SISINST_HALINFO
+ EManufacturer_Ericsson 0x00000000
+ EManufacturer_Motorola 0x00000001
+ EManufacturer_Nokia 0x00000002
+ EManufacturer_Panasonic 0x00000003
+ EManufacturer_Psion 0x00000004
+ EManufacturer_Intel 0x00000005
+ EManufacturer_Cogent 0x00000006
+ EManufacturer_Cirrus 0x00000007
+ EManufacturer_Linkup 0x00000008
+ EManufacturer_TexasInstruments 0x00000009
-SISINST_DIR = $(WORKDIR)/sisinst
-SISINST_SISDIR = $(call iif,$(USE_VARIANTBLD),$(VARIANT_SISDIR))
-SISINST_OUTDIR = $(call iif,$(USE_VARIANTBLD),$(VARIANT_OUTDIR),$(SISINST_DIR)/output)
-#SISINST_ZDIR = $(SISINST_DIR)/z_drive
-SISINST_ZDIR = $(EPOC32)/data/Z
+ EDeviceFamily_Crystal 0
+ EDeviceFamily_Pearl 1
+ EDeviceFamily_Quartz 2
+
+ ECPU_ARM 0
+ ECPU_MCORE 1
+ ECPU_X86 2
+
+ ECPUABI_ARM4 0
+ ECPUABI_ARMI 1
+ ECPUABI_THUMB 2
+ ECPUABI_MCORE 3
+ ECPUABI_MSVC 4
+ ECPUABI_ARM5T 5
+ ECPUABI_X86 6
+
+ ESystemStartupReason_Cold 0
+ ESystemStartupReason_Warm 1
+ ESystemStartupReason_Fault 2
+
+ EKeyboard_Keypad 0x1
+ EKeyboard_Full 0x2
-SISINST_HALINI = $(wildcard $(PRODUCT_DIR)/interpretsis.ini)
-SISINST_CONF = -w info -z $(SISINST_ZDIR) $(if $(SISINST_HALINI),-i $(SISINST_HALINI)) -c $(SISINST_OUTDIR) -s $(SISINST_SISDIR)
-SISINST_CMD = $(INTPRSIS_TOOL) $(SISINST_CONF)
-SISINST_PARSE =\
- parse | \nWarning(s):\n | /^WARN:/ |\
- parse | \nError(s):\n | /^ERR :/
+ EMouseState_Invisible 0
+ EMouseState_Visible 1
-#CLEAN_SISINSTPRE = deldir | $(SISINST_ZDIR)
-#BUILD_SISINSTPRE =\
-# mkdir | $(SISINST_ZDIR) |\
-# $(foreach img,$(ROM_IMG) $(foreach rofs,1 2 3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),$(ROFS$(rofs)_IMG))),\
-# cmd | $(READIMG_TOOL) -z $(SISINST_ZDIR) $(img) |)
+ EMachineUid_Series5mx 0x1000118a
+ EMachineUid_Brutus 0x10005f60
+ EMachineUid_Cogent 0x10005f61
+ EMachineUid_Win32Emulator 0x10005f62
+ EMachineUid_WinC 0x10005f63
+ EMachineUid_CL7211_Eval 0x1000604f
+ EMachineUid_LinkUp 0x00000000
+ EMachineUid_Assabet 0x100093f3
+ EMachineUid_Zylonite 0x101f7f27
+ EMachineUid_IQ80310 0x1000a681
+ EMachineUid_Lubbock 0x101f7f26
+ EMachineUid_Integrator 0x1000AAEA
+ EMachineUid_Helen 0x101F3EE3
+ EMachineUid_X86PC 0x100000ad
+ EMachineUid_OmapH2 0x1020601C
+ EMachineUid_OmapH4 0x102734E3
+ EMachineUid_NE1_TB 0x102864F7
+ EMachineUid_EmuBoard 0x1200afed
+ EMachineUid_OmapH6 0x10286564
+ EMachineUid_OmapZoom 0x10286565
+ EMachineUid_STE8500 0x101FF810
-CLEAN_SISINST = deldir | "$(SISINST_DIR)" $(call iif,$(USE_VARIANTBLD),,"$(SISINST_OUTDIR)")
+ EPowerBatteryStatus_Zero 0
+ EPowerBatteryStatus_Replace 1
+ EPowerBatteryStatus_Low 2
+ EPowerBatteryStatus_Good 3
+
+ EPowerBackupStatus_Zero 0
+ EPowerBackupStatus_Replace 1
+ EPowerBackupStatus_Low 2
+ EPowerBackupStatus_Good 3
+endef
+
+define SISINST_CFGINFO
+ $(foreach lang,$(LANGPACK_LANGIDS),
+ DEVICE_SUPPORTED_LANGUAGE = $(lang))
+endef
+
+CLEAN_SISINST = del | "$(SISINST_CFGINI)" "$(SISINST_LOG)"
BUILD_SISINST =\
- echo-q | Installing SIS |\
- mkdir | $(SISINST_OUTDIR) |\
- cmd | $(SISINST_CMD) | $(SISINST_PARSE)
+ echo-q | Installing SIS file(s) |\
+ sisinst | $(SISINST_INI) | $(SISINST_CFGINI) | $(SISINST_CONF) |\
+ $(SISINST_HALHDA) | $(strip $(call def2str,$(SISINST_HALINFO) | $(SISINST_CFGINFO))) |\
+ $(SISINST_OUTDIR) | $(SISINST_LOG)
###############################################################################
# Operator Cache Tool
-OPC_TOOL = $(ITOOL_DIR)/opcache_tool.py
-OPC_CONF = -u $(OPC_URL) -e $(OPC_EXPDATE) -m $(OPC_MMAPFILE) -i $(OPC_RAWDIR) -o $(OPC_OUTDIR)/$(OPC_CACHEDIR)
-OPC_CMD = $(PYTHON) $(OPC_TOOL) $(OPC_CONF)
-OPC_DIR = $(WORKDIR)/opcache
-OPC_RAWDIR = $(call iif,$(USE_VARIANTBLD),$(VARIANT_OPCDIR))
-OPC_OUTDIR = $(call iif,$(USE_VARIANTBLD),$(VARIANT_OUTDIR),$(OPC_DIR)/output)
-OPC_CACHEDIR = cache
-OPC_MMAPFILE = $(OPC_DIR)/mimemap.dat
-
+OPC_TOOL = $(PYTHON) $(ITOOL_DIR)/opcache_tool.py
+OPC_INI = $(wildcard $(VARIANT_DIR)/opcache_config.ini)
+OPC_DIR = $(VARIANT_OPCDIR)
+OPC_OUTDIR = $(VARIANT_OUTDIR)/$(OPC_CACHEDIR)
+OPC_TMPDIR = $(OUTTMPDIR)/opcache
+OPC_CACHEDIR = system/cache/op
OPC_URL = http://www.someoperator.com/Cache_OpCache
-OPC_EXPDATE = 3
+OPC_EXPDATE = 2012-01-01
+OPC_MIMEFILE = $(IMAGE_PREFIX)_opcachemime.dat
+OPC_CONF = -u "$(OPC_URL)" -e "$(OPC_EXPDATE)" -m "$(OPC_MIMEFILE)" -i "$(OPC_DIR)" -o "$(OPC_OUTDIR)"
define OPC_MIMEMAP
.bmp: image/bmp
@@ -159,30 +343,12 @@
.xhtml: application/xhtml+xml
endef
-CLEAN_OPCACHE = del | $(OPC_MMAPFILE) | deldir | "$(OPC_DIR)" $(call iif,$(USE_VARIANTBLD),,"$(OPC_OUTDIR)")
+CLEAN_OPCACHE = del | "$(OPC_MIMEFILE)"
BUILD_OPCACHE =\
- echo-q | Creating Operator Cache content |\
- write | $(OPC_MMAPFILE) |\
- $(call def2str,\# Generated `$(OPC_MMAPFILE)$' for Operator Cache content creation$(\n)$(\n)$(OPC_MIMEMAP)) |\
- test | $(OPC_RAWDIR)/* |\
- mkdir | $(OPC_OUTDIR)/$(OPC_CACHEDIR) |\
- cmd | $(OPC_CMD)
-
-
-###############################################################################
-# Widget Pre-installation
-
-WIDGET_WGZIP = $(WORKDIR)/*.wgz
-WIDGET_WGZDIR = $(EPOC32)/release/winscw/udeb/z/data/WidgetBURTemp
-WIDGET_WGZIBY = $(E32ROMINC)/widgetbackupfiles.iby
-WIDGET_WGZPXML = Info.plist
-
-CLEAN_WGZPREINST = del | $(WIDGET_WGZIBY) | deldir | $(WIDGET_WGZDIR)
-BUILD_WGZPREINST =\
- echo-q | Widget Pre-installation |\
- echo-q | Unzip $(WIDGET_WGZIP) file(s) to $(WIDGET_WGZDIR), generating $(WIDGET_WGZIBY) |\
- wgunzip | $(WIDGET_WGZIP) | $(WIDGET_WGZDIR) | $(WIDGET_WGZPXML) |\
- geniby-r | $(WIDGET_WGZIBY) | $(WIDGET_WGZDIR) | * | data="%1" "data/WidgetBURTemp/%2" | end
+ echo-q | Creating Operator Cache content |\
+ mkdir | "$(OPC_OUTDIR)" |\
+ write | "$(OPC_MIMEFILE)" | $(call def2str,$(OPC_MIMEMAP))\n |\
+ opcache | $(OPC_INI) | $(OPC_CONF) | $(OPC_TMPDIR)
###############################################################################
@@ -226,28 +392,276 @@
###############################################################################
# Image to files; extract files from .img using Readimage tool
-I2FILE_DIR = $(WORKDIR)/img2file
+CLEAN_I2FILE = deldir | "$($(IMAGE_TYPE)_I2FDIR)"
+BUILD_I2FILE =\
+ echo-q | Extracting files from $($(IMAGE_TYPE)_TITLE) SOS image to $($(IMAGE_TYPE)_I2FDIR) |\
+ mkcd | "$($(IMAGE_TYPE)_I2FDIR)" |\
+ $(foreach img,$($(IMAGE_TYPE)_IMG),\
+ cmd | $(READIMG_TOOL) -s $(img) |\
+ cmd | $(READIMG_TOOL) -z . $(img) |)
+
+
+###############################################################################
+# Rofsbuild FAT
+
+ROFSBLD_FATOPT = -datadrive="$($(IMAGE_TYPE)_OUTOBY)" $(addprefix -j,$(BLDROM_JOBS)) $(call iif,$(KEEPGOING),-k) -loglevel2 -slog
+
+CLEAN_ROFSBLDFAT = del | "$($(IMAGE_TYPE)_LOG)"
+BUILD_ROFSBLDFAT =\
+ cmd | $(ROFSBLD_TOOL) $(ROFSBLD_FATOPT) |\
+ move | "$($(IMAGE_TYPE)_OUTOBY).log" | $($(IMAGE_TYPE)_LOG)
+
+
+###############################################################################
+# Filedisk
+
+FILEDISK_TOOL = filedisk
+FILEDISK_OPT = /mount 0 $(call peval,GetAbsFname($(call pquote,$($(IMAGE_TYPE)_IMG)),1)) $(call peval,$$iVar[0] = GetFreeDrive())
+FILEDISK_SLEEP = 1
-CLEAN_COREI2F = deldir | $(CORE_I2FDIR)
-BUILD_COREI2F = $(call _buildi2file,CORE,$(CORE_I2FDIR),$(ROM_IMG) $(call iif,$(USE_ROFS1),$(ROFS1_IMG)))
+CLEAN_FILEDISK = del | "$($(IMAGE_TYPE)EMPTY_IMG)"
+BUILD_FILEDISK =\
+ $(if $($(IMAGE_TYPE)EMPTY_CMD),\
+ cmd | $($(IMAGE_TYPE)EMPTY_CMD) |\
+ move | "$($(IMAGE_TYPE)EMPTY_IMG)" | $($(IMAGE_TYPE)_IMG) |)\
+ cmd | $(FILEDISK_TOOL) $(FILEDISK_OPT) |\
+ copydir | "$($(IMAGE_TYPE)_DATADIR)" | $(call peval,$$iVar[0])/ |\
+ cmd | $(FILEDISK_TOOL) /status $(call peval,$$iVar[0]) |\
+ sleep | $(FILEDISK_SLEEP) |\
+ cmd | $(FILEDISK_TOOL) /umount $(call peval,$$iVar[0])
+
+
+###############################################################################
+# WinImage
+
+WINIMAGE_TOOL = "c:/program files/winimage/winimage.exe"
+WINIMAGE_OPT = $(call pathconv,$($(IMAGE_TYPE)_IMG)) /i $(call pathconv,$($(IMAGE_TYPE)_DATADIR)) /h /q
+
+CLEAN_WINIMAGE = del | "$($(IMAGE_TYPE)EMPTY_IMG)"
+BUILD_WINIMAGE =\
+ $(if $($(IMAGE_TYPE)EMPTY_CMD),\
+ cmd | $($(IMAGE_TYPE)EMPTY_CMD) |\
+ move | "$($(IMAGE_TYPE)EMPTY_IMG)" | $($(IMAGE_TYPE)_IMG) |)\
+ cmd | $(WINIMAGE_TOOL) $(WINIMAGE_OPT)
+
+
+###############################################################################
+# Widget Pre-installation
-CLEAN_VARIANTI2F = $(foreach rofs,2 3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),deldir | $(ROFS$(rofs)_I2FDIR) |))
-BUILD_VARIANTI2F =\
- $(foreach rofs,2 3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),\
- $(call _buildi2file,ROFS$(rofs),$(ROFS$(rofs)_I2FDIR),$(ROFS$(rofs)_IMG))))
+WIDGET_TOOLDIR = $(E32TOOLS)/widget_tools
+WIDGET_TOOL = $(WIDGET_TOOLDIR)/widgetpreinstaller/installwidgets.pl
+WIDGET_DIR = $(VARIANT_WGZDIR)
+WIDGET_TMPDIR = $(OUTTMPDIR)/widget
+WIDGET_OUTDIR = $(VARIANT_OUTDIR)
+WIDGET_IDIR = $(WIDGET_DIR) $(VARIANT_DIR) $(FEATVAR_IDIR)
+WIDGET_INI = $(call findfile,widget_config.ini,$(WIDGET_IDIR),1)
+WIDGET_CFGINI = $(IMAGE_PREFIX)_widget.ini
+WIDGET_LANGOPT = $(LANGPACK_DEFLANGID)
+WIDGET_OPT = -verbose $(if $(filter debug 127,$(VERBOSE)),-debug) -epocroot "$(WIDGET_TMPDIR)" $(call iif,$(WIDGET_LANGOPT),-localization $(WIDGET_LANGOPT))
+WIDGET_CMD = $(PERL) $(WIDGET_TOOL) $(WIDGET_OPT) "$(WIDGET_CFGINI)"
+
+define WIDGET_HDRINFO
+ # Generated configuration file for Widget pre-installation
+ #
+ # Filename: $(WIDGET_CFGINI)
+ # Command : $(WIDGET_CMD)
+
+ $(if $(WIDGET_INI),,[drive-$(call lcase,$($(IMAGE_TYPE)_DRIVE))])
+endef
+
+WIDGET_HSINI = $(IMAGE_PREFIX)_hsplugin.ini
+WIDGET_HSCINI = $(IMAGE_PREFIX)_hsplugincwrt.ini
+WIDGET_HSOPT = "$(WIDGET_TMPDIR)" "$(WIDGET_HSINI)"
+WIDGET_HSCOPT = "$(WIDGET_TMPDIR)" "$(WIDGET_HSCINI)"
+WIDGET_HSCMD = $(call iif,$(USE_UNIX),,call )$(WIDGET_TOOLDIR)/hspluginpreinstaller/HSPluginPreInstaller $(WIDGET_HSOPT)
+WIDGET_HSCCMD = $(call iif,$(USE_UNIX),,call )$(WIDGET_TOOLDIR)/hspluginpreinstaller/HSPluginPreInstaller $(WIDGET_HSCOPT)
+
+WIDGET_HSVIEWDIR = $(if $(VARIANT_CPDIR),$(wildcard $(subst \,/,$(VARIANT_CPDIR))/private/200159c0/install))
+WIDGET_HSWIDEDIR = $(E32DATAZ)/private/200159c0/install/wideimage_2001f489
+WIDGET_HSOUTDIR = $(subst \,/,$(WIDGET_OUTDIR))/private/200159c0/install
+
+define WIDGET_HSINFO
+ # Generated configuration file for Home Screen plugin pre-installation for$(if $1, $1) widgets
+ #
+ # Filename: $(WIDGET_HS$(if $1,C)INI)
+ # Command : $(WIDGET_HS$(if $1,C)CMD)
+
+ WIDGET_REGISTRY_PATH=$(subst \,/,$(WIDGET_OUTDIR))/private/10282f06/$1WidgetEntryStore.xml
+
+ VIEW_CONFIGURATION_PATH=$(WIDGET_HSVIEWDIR)
+
+ WIDEIMAGE_PATH=$(WIDGET_HSWIDEDIR)
+
+ OUTPUT_DIR=$(WIDGET_HSOUTDIR)
+endef
+
+CLEAN_WIDGET =\
+ del | "$(WIDGET_CFGINI)" "$(WIDGET_HSINI)" "$(WIDGET_HSCINI)" |\
+ deldir | "$(WIDGET_TMPDIR)"
+
+BUILD_WIDGET =\
+ echo-q | Installing widget(s) |\
+ genwgzcfg | $(WIDGET_CFGINI) | $(WIDGET_INI) | $(WIDGET_DIR) | $(call def2str,$(WIDGET_HDRINFO)) |\
+ $(and $(WIDGET_HSINFO),$(WIDGET_HSVIEWDIR),\
+ write | "$(WIDGET_HSINI)" | $(call def2str,$(call WIDGET_HSINFO))\n |\
+ write | "$(WIDGET_HSCINI)" | $(call def2str,$(call WIDGET_HSINFO,CWRT))\n |)\
+ mkdir | "$(WIDGET_TMPDIR)" |\
+ cmd | (cd $(call pathconv,$(WIDGET_TMPDIR))) & $(WIDGET_CMD) |\
+ copydir | "$(WIDGET_TMPDIR)/epoc32/$(if $(filter CORE ROFS%,$(IMAGE_TYPE)),release/winscw/udeb/z,winscw/?)" |\
+ $(WIDGET_OUTDIR) |\
+ $(and $(WIDGET_HSINFO),$(WIDGET_HSVIEWDIR),\
+ mkdir | "$(WIDGET_HSOUTDIR)" |\
+ cmd | $(WIDGET_HSCMD) |\
+ cmd | $(WIDGET_HSCCMD) |)\
+ $(call iif,$(KEEPTEMP),,deldir | "$(WIDGET_TMPDIR)")
+
+
+###############################################################################
+# Data package 2.0 creation / iCreatorDP
+
+#USE_DPGEN = 0
-CLEAN_I2FILE = deldir | $(I2FILE_DIR) | $(CLEAN_COREI2F) | $(CLEAN_VARIANTI2F)
-BUILD_I2FILE =\
- $(BUILD_COREI2F) | $(BUILD_VARIANTI2F) |\
- copy | $(CORE_I2FDIR)/* | $(I2FILE_DIR) |\
- $(foreach rofs,2 3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),copy | $(ROFS$(rofs)_I2FDIR)/* | $(I2FILE_DIR) |))
+ICDP_TOOL = iCreatorDP.py
+ICDP_TOOLDIR = $(EPOC_ROOT)/iCreatorDP
+ICDP_OPT = --xcfs="$(ICDP_XCF)" --wa="$(ICDP_WRKDIR)" --ba="$(ICDP_BLDDIR)" --i="$(ICDP_IMGDIR)" --build
+ICDP_OUTDIR = $(EPOC_ROOT)/output
+ICDP_XCF = $(ICDP_OUTDIR)/griffin.xcf
+ICDP_WRKDIR = $(ICDP_OUTDIR)/DP_WA
+ICDP_BLDDIR = $(ICDP_OUTDIR)/DP_OUT
+ICDP_IMGDIR = $(ICDP_OUTDIR)/images
+ICDP_VPLDIR = $(ICDP_OUTDIR)/VPL
+ICDP_CMD = $(PYTHON) $(ICDP_TOOL) $(ICDP_OPT)
+
+ICDP_CUSTIMG = $(ICDP_IMGDIR)/customer.fpsx
+ICDP_UDAIMG = $(ICDP_IMGDIR)/customer_uda.fpsx
+
+#ICDP_IMGLIST = "$(ICDP_IMGDIR)/customer.fpsx" "$(ICDP_IMGDIR)/customer_uda.fpsx"
+
+CLEAN_DPPRE = $(CLEAN_CONEXCF) | del | "$(ICDP_CUSTIMG)"
+BUILD_DPPRE =\
+ $(BUILD_CONEXCF) |\
+ echo-q | Copying images |\
+ mkdir | "$(ICDP_IMGDIR)" |\
+ copy | "$(ROFS3_FLASH)" | $(ICDP_CUSTIMG) |\
+# copy | $(UDA_FLASH) | $(ICDP_UDAIMG)
+
+CLEAN_DPBLD = deldir | "$(ICDP_BLDDIR)"
+BUILD_DPBLD =\
+ echo-q | Generating data package |\
+ cd | "$(ICDP_TOOLDIR)" |\
+ cmd | $(ICDP_CMD)
+
+CLEAN_DPPOST = deldir | "$(ICDP_VPLDIR)"
+BUILD_DPPOST =\
+ find-r | "$(ICDP_BLDDIR)" | *.zip | |\
+ unzip | __find__ | $(ICDP_VPLDIR)
+
+#==============================================================================
+
+.PHONY: datapack datapack-pre
+
+datapack : ;@$(call IMAKER,$$(call iif,$$(SKIPPRE),,DPPRE) $$(call iif,$$(SKIPBLD),,DPBLD) $$(call iif,$$(SKIPPOST),,DPPOST))
+datapack-pre: ;@$(call IMAKER,DPPRE)
+
+
+###############################################################################
+# Data package copying functionality for Griffin
+
+#DP_SRCDIR = $(EPOC_ROOT)/output/images
+DP_CORESRC =
+DP_LANGSRC =
+DP_CUSTSRC =
+DP_UDASRC =
+DP_DCPSRC =
+DP_VPLSRC =
+DP_SIGNSRC =
+
+DP_OUTDIR = $(EPOC_ROOT)/output/VPL
+DP_CORETGT = $(DP_OUTDIR)/core.fpsx
+DP_LANGTGT = $(DP_OUTDIR)/lang.fpsx
+DP_CUSTTGT = $(DP_OUTDIR)/customer.fpsx
+DP_UDATGT = $(DP_OUTDIR)/uda.fpsx
+DP_DCPTGT = $(DP_OUTDIR)/carbidev.dcp
+DP_VPLTGT = $(DP_OUTDIR)/carbidev.vpl
+DP_SIGNTGT = $(DP_OUTDIR)/carbidev_signature.bin
-_buildi2file =\
- echo-q | Extracting files from $($1_TITLE) SOS image to $2 |\
- mkcd | $2 |\
- $(foreach img,$3,\
- cmd | $(READIMG_TOOL) -s $(img) |\
- cmd | $(READIMG_TOOL) -z . $(img) |)
+DP_MK = $(OUTPREFIX)_dpcopy.mk
+DP_MKLOG = $(basename $(DP_MK))_cone.log
+DP_MKOPT =\
+ generate --project="$(CONE_PRJ)" $(if $(CONE_CONF),--configuration="$(CONE_CONF)")\
+ --impl=dp.makeml --all-layers --set=imaker.makefilename="$(DP_MK)"\
+ --log-file="$(DP_MKLOG)" $(addprefix --verbose=,$(CONE_VERBOSE))
+DP_MKCMD = $(CONE_TOOL) $(DP_MKOPT)
+
+CLEAN_DPCOPYPRE = del | "$(DP_MK)" "$(DP_MKLOG)"
+BUILD_DPCOPYPRE =\
+ echo-q | Generating makefile `$(DP_MK)' for Data Package copy |\
+ cmd | $(DP_MKCMD) |\
+ test | "$(DP_MK)"
+
+CLEAN_DPCOPY = deldir | "$(DP_OUTDIR)"
+
+BUILD_DPCOPY =\
+ echo-q | Copying Data Package contents |\
+ mkdir | "$(DP_OUTDIR)" |\
+ $(foreach type,CORE LANG CUST UDA DCP VPL SIGN,\
+ copy | "$(DP_$(type)SRC)" | $(DP_$(type)TGT) |)
+
+#==============================================================================
+
+.PHONY: dpcopy dpcopy-pre
+
+dpcopy : ;@$(call IMAKER,DPCOPY)
+dpcopy-pre: ;@$(call IMAKER,DPCOPYPRE)
+
+
+###############################################################################
+# PlatSim
+
+USE_PLATSIM = 0
+
+PLATSIM_TOOL = pscli.exe
+PLATSIM_TOOLDIR = /rd_sw/platsim
+PLATSIM_TOOL_INSTANCESDIR = $(PLATSIM_TOOLDIR)/instances
+PLATSIM_IMAGESDIR = $(PLATSIM_TOOLDIR)/HW77/images
+PLATSIM_INSTANCE = 1
+RUN_PLATSIM = 0
+PLATSIM_IMAGES = $(CORE_FLASH)
+PLATSIM_IMAGESRC = $(patsubst %\,%,$(call pathconv,$(dir $(PLATSIM_IMAGES))))
+
+PLATSIM_INSTANCES = $(notdir $(foreach entry,$(wildcard $(PLATSIM_TOOL_INSTANCESDIR)/*),$(call isdir,$(entry))))
+define isdir
+$(if $(wildcard $1/*),$1)
+endef
+
+BUILD_PLATLAUNCH =\
+ echo-q | Launching PlatSim instance $(PLATSIM_INSTANCE) |\
+ cd | $(PLATSIM_TOOLDIR) |\
+ cmd | $(PLATSIM_TOOL) --launch $(PLATSIM_INSTANCE)
+
+BUILD_PLATSHUTDOWN =\
+ echo-q | Stopping PlatSim instance $(PLATSIM_INSTANCE) |\
+ cd | $(PLATSIM_TOOLDIR) |\
+ cmd | $(PLATSIM_TOOL) --console --shutdown $(PLATSIM_INSTANCE)
+
+BUILD_PLATCREATE =\
+ echo-q | Creating new PlatSim instance $(PLATSIM_INSTANCE) |\
+ cmd | $(PLATSIM_TOOL) --console --create $(PLATSIM_INSTANCE) |\
+ cmd | $(PLATSIM_TOOL) --set $(PLATSIM_INSTANCE):imaker_$(PLATSIM_INSTANCE)
+
+BUILD_PLATUPDATE =\
+ echo-q | Updating PlatSim instance $(PLATSIM_INSTANCE) |\
+ cmd | $(PLATSIM_TOOL) --console --set $(PLATSIM_INSTANCE):$(PLATSIM_IMAGESRC):$(notdir $(PLATSIM_IMAGES))
+
+BUILD_PLATBLD =\
+ cd | $(PLATSIM_TOOLDIR) |\
+ $(if $(filter $(PLATSIM_INSTANCE),$(PLATSIM_INSTANCES)),\
+ echo-q | Platsim instance $(PLATSIM_INSTANCE) exists | $(BUILD_PLATSHUTDOWN),\
+ $(BUILD_PLATCREATE)) |\
+ $(BUILD_PLATUPDATE) |\
+ $(call iif,$(RUN_PLATSIM),$(BUILD_PLATLAUNCH))
+
+$(call add_help,USE_PLATSIM,v,(string),Define that the configuration is a PlatSim configuration.)
###############################################################################
@@ -269,7 +683,6 @@
$(IMGCHK_TOOL) | $(IMGCHK_TOOL) -h | IMGCHECK.+? V(.+?)\s*$$ |
$(INTPRSIS_TOOL) | $(INTPRSIS_TOOL) -h | INTERPRETSIS\s+Version\s+(.+?)\s*$$ |
$(READIMG_TOOL) | $(READIMG_TOOL) | Readimage.+? V(.+?)\s*$$ |
- $(CONFT_TOOL) | $(CONFT_TOOL) -version | ^.+?\n(.+?)\n(.+?)\n
endef
BUILD_TOOLINFO = echo-q | | toolchk | $(strip $(TOOL_INFO)) | end
@@ -282,9 +695,9 @@
###############################################################################
# Targets
-.PHONY: checkdep opcache sisinst toolinfo wgzpreinst
+.PHONY: checkdep opcache sisinst toolinfo
-chkdep opcache sisinst toolinfo wgzpreinst:\
+chkdep opcache sisinst toolinfo:\
;@$(call IMAKER,$(call ucase,$@))
--- a/imgtools/imaker/src/imaker_uda.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_uda.mk Thu Jun 24 10:35:05 2010 +0300
@@ -23,205 +23,11 @@
# \___/|___/_/ \_\
#
-USE_FILEDISK = 0
-USE_SOSUDA = 0
-USE_UDAFGEN = 0
-
-UDA_TITLE = UDA
-UDA_DIR = $(WORKDIR)/uda
-UDA_NAME = $(NAME)
-UDA_PREFIX = $(UDA_DIR)/$(UDA_NAME)
-UDA_IDIR =
-UDA_HBY =
-UDA_OBY =
-UDA_OPT = $(BLDROM_OPT) -D_EABI=$(ARM_VERSION)
-UDA_MSTOBY = $(UDA_PREFIX)_uda_master.oby
-UDA_HEADER =
-UDA_INLINE =
-UDA_FOOTER =
-UDA_TIME = $(DAY)/$(MONTH)/$(YEAR)
-
-UDA_CPDIR =
-UDA_ZIP =
-UDA_DATADIR = $(UDA_DIR)/datadrive
-UDA_SISCONFFILE = $(UDA_PREFIX)_uda_sisconf.txt
-UDA_SISCONF =\
- -d $(UDA_DRIVE): -c $(UDA_DATADIR) $(if $(SISINST_SISDIR),-s $(SISINST_SISDIR))\
- -z $(SISINST_ZDIR) $(if $(SISINST_HALINI),-i $(SISINST_HALINI)) -w info
-
-UDA_VERSION = $(CORE_VERSION)
-UDA_SWVERFILE = "$(UDA_DATADIR)/Resource/Versions/User Content Package_UDA.txt"
-UDA_SWVERINFO = $(UDA_VERSION)
-UDA_EXCLFILE = $(UDA_DATADIR)/private/100059C9/excludelist.txt
-UDA_TOUCH = $(call iif,$(USE_SOSUDA),,$(YEAR)$(MONTH)$(DAY)000000)
-
-UDA_IMG = $(UDA_PREFIX).uda.img
-UDA_LOG = $(UDA_PREFIX).uda.log
-UDA_OUTOBY = $(UDA_PREFIX).uda.oby
-UDA_EMPTYIMG = $(UDA_PREFIX).udaempty.img
-
-UDA_PLUGINLOG = $(UDA_PREFIX)_uda_bldromplugin.log
-UDA_UDEBFILE = $(TRACE_UDEBFILE)
-
UDA_DRIVE = C
-UDA_FATTYPE = fat16
-UDA_FATSIZE = 20480
-
-define UDA_EXCLADD
-*
-endef
-
-define UDA_EXCLRM
-endef
-
-#==============================================================================
-
-UDA_FDISKCONF = /mount 0
-UDA_FDISKCMD =\
- $(FILEDISK_TOOL) $(UDA_FDISKCONF) $(call peval,GetAbsFname($(call pquote,$(UDA_IMG)),1,1)) $(call peval,$$iVar[0] = GetFreeDrive()) |\
- copy | $(UDA_DATADIR)/* | $(call peval,$$iVar[0])/ |\
- cmd | $(FILEDISK_TOOL) /status $(call peval,$$iVar[0]) |\
- sleep | 1 |\
- cmd | $(FILEDISK_TOOL) /umount $(call peval,$$iVar[0])
-
-UDA_WINIMGCMD = $(WINIMAGE_TOOL) $(call pathconv,$(UDA_IMG)) /i $(call pathconv,$(UDA_DATADIR)) /h /q
-
-UDA_CMD = $(call iif,$(USE_FILEDISK),$(UDA_FDISKCMD),$(UDA_WINIMGCMD))
-UDA_EMPTYCMD =
-
-#==============================================================================
-
-define UDA_MSTOBYINFO
- $(BLDROM_HDRINFO)
-
- ROM_IMAGE 0 non-xip size=0x00000000
-
- DATA_IMAGE 0 $(basename $(UDA_IMG)) size=$(call peval,$(UDA_FATSIZE) * 1024) $(UDA_FATTYPE)
-
- // UDA header
- //
- $(UDA_HDRINFO)
-
- DATA_IMAGE[0] {
- $(BLR.UDA.OBY)
- $(UDA_INLINE)
- $(UDA_FOOTERINFO)
- }
-endef
-
-define UDA_HDRINFO
- $(DEFINE) _IMAGE_WORKDIR $(UDA_DIR)
- $(call mac2cppdef,$(BLR.UDA.OPT))
- $(BLR.UDA.HBY)
- $(UDA_HEADER)
- $(if $(filter u U,$(USE_VARIANTBLD)),$(VARIANT_HEADER))
-endef
-
-define UDA_FOOTERINFO
- $(if $(UDA_TIME),time=$(UDA_TIME))
- $(UDA_FOOTER)
-endef
-
-#==============================================================================
-
-CLEAN_UDAFILE =\
- del | "$(UDA_MSTOBY)" "$(UDA_SISCONFFILE)" "$(UDA_SWVERFILE)" "$(UDA_EXCLFILE)"
-
-BUILD_UDAFILE =\
- echo-q | Generating file(s) for UDA image creation |\
- $(call iif,$(USE_SOSUDA),\
- write | $(UDA_MSTOBY) | $(call def2str,$(UDA_MSTOBYINFO)) |\
- write | $(UDA_SISCONFFILE) | $(call quote,$(UDA_SISCONF)) |)\
- $(call iif,$(USE_UDAFGEN),\
- $(if $(UDA_SWVERINFO),\
- writeu | $(UDA_SWVERFILE) | $(UDA_SWVERINFO) |)\
- $(if $(UDA_EXCLFILE),\
- genexclst | $(UDA_EXCLFILE) | $(UDA_DATADIR) | $(UDA_DRIVE):/ |\
- "$(subst $(\n)," ",$(UDA_EXCLADD))" | "$(subst $(\n)," ",$(UDA_EXCLRM))")\
- )
-
-
-###############################################################################
-# UDA pre
-
-CLEAN_UDAPRE = $(if $(filter u U,$(USE_VARIANTBLD)),$(CLEAN_CUSTVARIANT),deldir | $(UDA_DATADIR)) | $(CLEAN_UDAFILE)
-
-BUILD_UDAPRE =\
- echo-q | Preparing UDA image creation |\
- $(if $(filter u U,$(USE_VARIANTBLD)),$(BUILD_CUSTVARIANT) |,\
- mkdir | $(UDA_DATADIR) |\
- $(if $(UDA_ZIP),\
- $(eval __i_zip := $(foreach zip,$(UDA_ZIP),$(zip)$(if $(filter %.zip,$(call lcase,$(zip))),,/*.zip)))\
- echo-q | Extracting `$(__i_zip)$' to `$(UDA_DATADIR)$' |\
- unzip | $(__i_zip) | $(UDA_DATADIR) |)\
- $(if $(UDA_CPDIR),\
- copy | $(UDA_CPDIR)/* | $(UDA_DATADIR) |))\
- mkcd | $(UDA_DIR) |\
- $(BUILD_UDAFILE) |\
- $(call iif,$(USE_FILEDISK),\
- cmd | attrib -r -a -s -h $(call pathconv,$(UDA_DATADIR)) /s /d |)\
- $(if $(UDA_TOUCH),\
- finddir-r | $(UDA_DATADIR) | * | |\
- find-ar | $(UDA_DATADIR) | * | |\
- touch | __find__ | $(UDA_TOUCH))
-
-#==============================================================================
-# UDA build
-
-BLR.UDA.IDIR = $(call dir2inc,$(UDA_IDIR) $(call iif,$(USE_FEATVAR),,$(FEATVAR_IDIR)))
-BLR.UDA.HBY = $(call includeiby,$(IMAGE_HBY) $(UDA_HBY))
-BLR.UDA.OBY = $(call includeiby,$(UDA_OBY) $(if $(filter u U,$(USE_VARIANTBLD)),$(VARIANT_OBY)))
-BLR.UDA.OPT = $(UDA_OPT) -p -retainfolder -pfile=$(UDA_SISCONFFILE) -o$(UDA_NAME).dummy0.img $(BLDROPT)
-BLR.UDA.POST =\
- move | $(UDA_OUTOBY).log | $(UDA_LOG)
-
-BLR.UDA.CLEAN = del | "$(UDA_EMPTYIMG)" "$(UDA_IMG)"
-BLR.UDA.BUILD =\
- $(call iif,$(USE_SOSUDA),,\
- echo-q | Creating $(UDA_TITLE) SOS image |\
- $(if $(UDA_EMPTYCMD),\
- cmd | $(UDA_EMPTYCMD) |\
- move | $(UDA_EMPTYIMG) | $(UDA_IMG) |)\
- cmd | $(UDA_CMD))
-
-CLEAN_UDA = $(CLEAN_BLDROM)
-BUILD_UDA = $(BUILD_BLDROM)
-
-# UDA Empty
-#
-CLEAN_UDAEMPTY = del | $(UDA_EMPTYIMG)
-BUILD_UDAEMPTY =\
- echo-q | Creating empty UDA FAT image |\
- mkdir | $(UDA_DIR) |\
- cmd | $(UDA_EMPTYCMD)
-
-#==============================================================================
-# UDA post
-
-#==============================================================================
-
-SOS.UDA.STEPS = $(call iif,$(SKIPPRE),,UDAPRE) UDA $(SOS.UDAEMPTY.STEPS)
-SOS.UDAEMPTY.STEPS = UDAEMPTY
-
-ALL.UDA.STEPS = $(SOS.UDA.STEPS)
-ALL.UDAEMPTY.STEPS = $(SOS.UDAEMPTY.STEPS)
-
-#==============================================================================
-
-.PHONY: uda uda-image uda-pre uda-empty uda-empty-image variantuda
-
-uda uda-%: IMAGE_TYPE = UDA
-
-uda : ;@$(call IMAKER,$$(ALL.UDA.STEPS))
-uda-image: ;@$(call IMAKER,$$(SOS.UDA.STEPS))
-uda-pre : ;@$(call IMAKER,UDAPRE)
-
-uda-empty: ;@$(call IMAKER,$$(ALL.UDAEMPTY.STEPS))
-uda-empty-image: ;@$(call IMAKER,$$(SOS.UDAEMPTY.STEPS))
-
-variantuda variantuda%: USE_CUSTVARIANTBLD = 1
-variantuda variantuda%: USE_VARIANTBLD = u
-variantuda variantuda%: uda$(TARGETEXT) ;
+UDA_FATTYPE = 16# FAT16
+UDA_SIZE = 20480# kB
+UDA_CLUSTERSIZE = 4# kB
+UDA_FATTABLE = 1
# END OF IMAKER_UDA.MK
--- a/imgtools/imaker/src/imaker_variant.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_variant.mk Thu Jun 24 10:35:05 2010 +0300
@@ -11,7 +11,7 @@
#
# Contributors:
#
-# Description: iMaker Variant image configuration
+# Description: iMaker Variant Build image configuration
#
@@ -25,107 +25,82 @@
USE_VARIANTBLD = 0
+PRODUCT_VARDIR = $(if $(and $(call true,$(USE_CONE)),$(call true,$(IMAKER_MKRESTARTS))),$(CONE_OUTDIR),$(PRODUCT_DIR))
+
VARIANT_NAME = $(TARGETNAME)
VARIANT_ID = $(TARGETID)
-VARIANT_DIR = $(call iif,$(USE_CUSTVARIANTBLD),,$(PRODVARIANT_DIR))
-VARIANT_OUTDIR = $(if $(filter u U,$(USE_VARIANTBLD)),$(UDA_DATADIR),$($(IMAGE_TYPE)_DIR)/variant)
+VARIANT_DIR = $(if $(filter $(LANGPACK_PREFIX)%,$(TARGETNAME)),$(LANGPACK_DIR),$(if\
+ $(filter $(CUSTVARIANT_PREFIX)%,$(TARGETNAME)),$(CUSTVARIANT_DIR),$(if\
+ $(filter emmc_% mcard_% uda_%,$(TARGETNAME)),$($(IMAGE_TYPE)_VARDIR),$(if\
+ $(filter variant%,$(TARGETNAME)),,$(PRODUCT_VARDIR)))))
+VARIANT_OUTDIR = $(if $(filter CORE ROFS%,$(IMAGE_TYPE)),$($(IMAGE_TYPE)_DIR)/variant,$($(IMAGE_TYPE)_DATADIR))
VARIANT_MKNAME = variant.mk
VARIANT_MK = $(if $(VARIANT_DIR),$(wildcard $(VARIANT_DIR)/$(VARIANT_MKNAME)))
-VARIANT_PREFIX = $($(IMAGE_TYPE)_PREFIX)_$(call lcase,$(IMAGE_TYPE))
-VARIANT_HBY = $(VARIANT_PREFIX)_customervariant.hby
+VARIANT_HBY = $(IMAGE_PREFIX)_$(if $(filter CORE ROFS%,$(IMAGE_TYPE)),variant,datadrive).hby
VARIANT_HEADER = $(if $(VARIANT_INCDIR),$(call includeiby,$(VARIANT_HBY)))
-VARIANT_OBY = $(VARIANT_PREFIX)_customervariant.oby
-VARIANT_OVERRIDE = $(if $(filter 1 2,$(USE_VARIANTBLD)),1,0)
-VARIANT_OBYDATA = data$(call iif,$(VARIANT_OVERRIDE),-override)="%1" "%2"
+VARIANT_OBY = $(basename $(VARIANT_HBY)).oby
+VARIANT_OVERRIDE = $(if $(filter CORE ROFS%,$(IMAGE_TYPE)),OVERRIDE_REPLACE/ADD)
+VARIANT_OBYDATA = data$(call iif,$(VARIANT_OVERRIDE),-override)="%1" "%2"$(if $(filter CORE ROFS%,$(IMAGE_TYPE)),, %4)
-VARIANT_CONFML = $(call iif,$(USE_CUSTVARIANTBLD),$(wildcard $(VARIANT_DIR)/$(CONFT_CFGNAME).confml),$(PRODVARIANT_CONFML))
-VARIANT_CONFCP = $(call iif,$(USE_CUSTVARIANTBLD),$(if $(VARIANT_CONFML),$(CONFT_CFGNAME)),$(PRODVARIANT_CONFCP))
-VARIANT_CPDIR = $(wildcard $(VARIANT_DIR)/content)
-VARIANT_INCDIR = $(wildcard $(VARIANT_DIR)/include)
-VARIANT_SISDIR = $(wildcard $(VARIANT_DIR)/sis)
-VARIANT_OPCDIR = $(wildcard $(VARIANT_DIR)/opcache)
-VARIANT_ZIPDIR = $(wildcard $(VARIANT_DIR)/zip)
+VARIANT_CPDIR = $(if $(wildcard $(VARIANT_DIR)/content/*),$(VARIANT_DIR)/content)
+VARIANT_INCDIR = $(if $(wildcard $(VARIANT_DIR)/include/*),$(VARIANT_DIR)/include)
+VARIANT_SISDIR = $(if $(wildcard $(VARIANT_DIR)/sis/*),$(VARIANT_DIR)/sis)
+VARIANT_OPCDIR = $(if $(wildcard $(VARIANT_DIR)/opcache/*),$(VARIANT_DIR)/opcache)
+VARIANT_WGZDIR = $(if $(wildcard $(VARIANT_DIR)/widget/*),$(VARIANT_DIR)/widget)
+VARIANT_ZIPDIR = $(if $(wildcard $(VARIANT_DIR)/zip/*),$(VARIANT_DIR)/zip)
#==============================================================================
-CLEAN_CUSTVARIANT =\
- del | "$(VARIANT_HBY)" "$(VARIANT_OBY)" | deldir | $(VARIANT_OUTDIR) |\
- $(if $(VARIANT_CONFML),$(CLEAN_CENREP) |)\
- $(if $(VARIANT_SISDIR),$(CLEAN_SISINST) |)\
- $(if $(VARIANT_OPCDIR),$(CLEAN_OPCACHE) |)
+CLEAN_VARIANT =\
+ del | "$(VARIANT_HBY)" "$(VARIANT_OBY)" | deldir | "$(VARIANT_OUTDIR)" |\
+ $(CLEAN_SISINST) | $(CLEAN_OPCACHE) | $(CLEAN_WIDGET)
-BUILD_CUSTVARIANT =\
- echo-q | Variant target USE_VARIANTBLD = $(call iif,$(USE_VARIANTBLD),`$(USE_VARIANTBLD)$',-) |\
- echo-q | Variant directory VARIANT_DIR = $(or $(filter -,$(VARIANT_DIR)),$(if $(VARIANT_DIR),`$(VARIANT_DIR)$',-)) |\
- echo-q | Variant config makefile VARIANT_MK = $(if $(VARIANT_MK),`$(VARIANT_MK)$',-) |\
- echo-q | Variant include directory VARIANT_INCDIR = $(if $(VARIANT_INCDIR),`$(VARIANT_INCDIR)$',-) |\
- echo-q | Variant confml file VARIANT_CONFML = $(if $(VARIANT_CONFML),`$(VARIANT_CONFML)$',-) |\
- echo-q | Variant CenRep configs VARIANT_CONFCP = $(if $(VARIANT_CONFCP),`$(VARIANT_CONFCP)$',-) |\
- echo-q | Variant SIS directory VARIANT_SISDIR = $(if $(VARIANT_SISDIR),`$(VARIANT_SISDIR)$',-) |\
- echo-q | Variant operator cache dir VARIANT_OPCDIR = $(if $(VARIANT_OPCDIR),`$(VARIANT_OPCDIR)$',-) |\
- echo-q | Variant zip content dir VARIANT_ZIPDIR = $(if $(VARIANT_ZIPDIR),`$(VARIANT_ZIPDIR)$',-) |\
- echo-q | Variant copy content dir VARIANT_CPDIR = $(if $(VARIANT_CPDIR),`$(VARIANT_CPDIR)$',-) |\
- echo-q | Variant output directory VARIANT_OUTDIR = $(if $(VARIANT_OUTDIR),`$(VARIANT_OUTDIR)$',-) |\
+BUILD_VARIANT =\
+ echo-q | Variant target USE_VARIANTBLD = $(call iif,$(USE_VARIANTBLD),`$(USE_VARIANTBLD)',-) |\
+ echo-q | Variant directory VARIANT_DIR = $(or $(filter -,$(VARIANT_DIR)),$(if $(VARIANT_DIR),`$(VARIANT_DIR)',-)) |\
+ echo-q | Variant config makefile VARIANT_MK = $(if $(VARIANT_MK),`$(VARIANT_MK)',-) |\
+ echo-q | Variant include directory VARIANT_INCDIR = $(if $(VARIANT_INCDIR),`$(VARIANT_INCDIR)',-) |\
+ echo-q | Variant SIS conf SISINST_INI = $(if $(SISINST_INI),`$(SISINST_INI)',-) |\
+ echo-q | Variant SIS directory VARIANT_SISDIR = $(if $(VARIANT_SISDIR),`$(VARIANT_SISDIR)',-) |\
+ echo-q | Variant operator cache conf OPC_INI = $(if $(OPC_INI),`$(OPC_INI)',-) |\
+ echo-q | Variant operator cache dir VARIANT_OPCDIR = $(if $(VARIANT_OPCDIR),`$(VARIANT_OPCDIR)',-) |\
+ echo-q | Variant widget preinst conf WIDGET_INI = $(if $(WIDGET_INI),`$(WIDGET_INI)',-) |\
+ echo-q | Variant widget preinst dir VARIANT_WGZDIR = $(if $(VARIANT_WGZDIR),`$(VARIANT_WGZDIR)',-) |\
+ echo-q | Variant zip content dir VARIANT_ZIPDIR = $(if $(VARIANT_ZIPDIR),`$(VARIANT_ZIPDIR)',-) |\
+ echo-q | Variant copy content dir VARIANT_CPDIR = $(if $(VARIANT_CPDIR),`$(VARIANT_CPDIR)',-) |\
+ echo-q | Variant output directory VARIANT_OUTDIR = $(if $(VARIANT_OUTDIR),`$(VARIANT_OUTDIR)',-) |\
$(if $(VARIANT_DIR),,\
- error | 1 | Variable VARIANT_DIR is not set while making target $@!\n |)\
- $(if $(word 2,$(USE_VARIANTBLD))$(filter-out 0 1 2 3 4 5 6 u U,$(USE_VARIANTBLD)),\
- error | 1 | Variable USE_VARIANTBLD is incorrectly defined. Possible values are 1 - 3 (6) and u.\n |)\
- mkdir | $(VARIANT_OUTDIR) |\
+ error | 1 | Variable VARIANT_DIR is not set while making target $(TARGETNAME). |)\
+ $(if $(wildcard $(subst \,/,$(VARIANT_DIR))),,\
+ error | 1 | Variable VARIANT_DIR does not point to an existing directory ($(VARIANT_DIR)). |)\
+ $(if $(word 2,$(USE_VARIANTBLD))$(filter-out 0 1 2 3 4 5 6 e E m M u U,$(USE_VARIANTBLD)),\
+ error | 1 | Variable USE_VARIANTBLD is incorrectly defined. Possible values are 1 - 6$(,) e$(,) m and u. |)\
+ mkdir | "$(VARIANT_OUTDIR)" |\
$(if $(VARIANT_INCDIR),\
echo-q | Generating oby(s) for Variant image creation |\
- geniby | $(VARIANT_HBY) | $(VARIANT_INCDIR) | *.hrh | \#include "%3" | end |\
+ geniby | $(VARIANT_HBY) | $(VARIANT_INCDIR) |\
+ __header__ | define _IMAGE_VARINCDIR $(call quote,$(VARIANT_INCDIR)) | *.hrh | \#include "%3" | end |\
geniby | $(VARIANT_OBY) | $(VARIANT_INCDIR) | *.iby | \#include "%3" | end |)\
- $(if $(wildcard $(VARIANT_CONFML)),\
- $(BUILD_CENREP) |)\
- $(if $(VARIANT_SISDIR),\
- $(call iif,$(USE_SOSUDA),\
- geniby-r | >>$(VARIANT_OBY) | $(VARIANT_SISDIR) | *.sis* | sisfile="%1" | end,\
- $(BUILD_SISINST)) |)\
- $(if $(VARIANT_OPCDIR),\
+ $(if $(or $(SISINST_INI),$(VARIANT_SISDIR)),\
+ $(BUILD_SISINST) |)\
+ $(if $(or $(OPC_INI),$(VARIANT_OPCDIR)),\
$(BUILD_OPCACHE) |)\
- $(if $(VARIANT_ZIPDIR),$(if $(wildcard $(VARIANT_ZIPDIR)/*),\
+ $(if $(or $(WIDGET_INI),$(VARIANT_WGZDIR)),\
+ $(BUILD_WIDGET) |)\
+ $(if $(VARIANT_ZIPDIR),\
echo-q | Extracting zip content directory |\
- cmd | $(7ZIP_TOOL) x -y $(VARIANT_ZIPDIR)/* -o$(VARIANT_OUTDIR) |))\
+ cmd | $(7ZIP_TOOL) x -y $(VARIANT_ZIPDIR)/* -o$(VARIANT_OUTDIR) |)\
$(if $(VARIANT_CPDIR),\
- echo-q | Copying copy content directory |\
- copy | $(VARIANT_CPDIR)/* | $(VARIANT_OUTDIR) |)\
- $(if $(filter u U,$(USE_VARIANTBLD)),,\
- geniby-r | >>$(VARIANT_OBY) | $(VARIANT_OUTDIR) | * | $(VARIANT_OBYDATA) | end |)\
- write | >>$(VARIANT_OBY) | |
-
-#==============================================================================
-
-variantrofs%: USE_CUSTVARIANTBLD = 1
+ echo-q | Copying copy content directory |\
+ copydir | "$(VARIANT_CPDIR)" | $(VARIANT_OUTDIR) |)\
+ $(call iif,$(filter CORE ROFS%,$(IMAGE_TYPE))$(USE_SOSUDA),\
+ geniby-r | >>$(VARIANT_OBY) | $(VARIANT_OUTDIR) |\
+ $(call iif,$(VARIANT_OVERRIDE),__header__ | $(VARIANT_OVERRIDE) |)\
+ * | $(VARIANT_OBYDATA) |\
+ $(call iif,$(VARIANT_OVERRIDE),__footer__ | OVERRIDE_END |) end)
-$(foreach rofs,2 3 4 5 6,\
- $(eval .PHONY: variantrofs$(rofs))\
- $(eval variantrofs$(rofs) variantrofs$(rofs)%: USE_VARIANTBLD = $(rofs))\
- $(eval variantrofs$(rofs) variantrofs$(rofs)%: rofs$(rofs)$(TARGETEXT) ;)\
-)
-
-$(call add_help,variantrofs2,t,Create an image from a variant with rofs2. Be sure to define the VARIANT_DIR.)
-$(call add_help,variantrofs3,t,Create an image from a customer variant folder. Be sure to define the VARIANT_DIR.)
-$(call add_help,variantuda,t,Create an image from a variant userdata folder. Be sure to define the VARIANT_DIR.)
-
-#==============================================================================
-
-SOS.VARIANT.STEPS = $(foreach rofs,2 3 4 5 6,$(SOS.ROFS$(rofs).STEPS))
-ALL.VARIANT.STEPS = $(SOS.VARIANT.STEPS)
-
-#==============================================================================
-# Targets
-
-.PHONY: variant variant-image variant-symbol variant-i2file
-
-variant: ;@$(call IMAKER,$$(ALL.VARIANT.STEPS))
-
-variant-image: ;@$(call IMAKER,$$(SOS.VARIANT.STEPS))
-
-variant-symbol:\
- ;@$(call IMAKER,$(foreach rofs,2 3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),ROFS$(rofs)SYM)))
-
-variant-i2file: ;@$(call IMAKER,VARIANTI2F)
+# geniby-dr | >>$(VARIANT_OBY) | $(VARIANT_OUTDIR) | * | dir="%2" | end
# END OF IMAKER_VARIANT.MK
--- a/imgtools/imaker/src/imaker_version.mk Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_version.mk Thu Jun 24 10:35:05 2010 +0300
@@ -14,4 +14,4 @@
# Description: iMaker version string
#
-IMAKER_VERSION = iMaker 09.06.01, 05-Feb-2009.
+IMAKER_VERSION = iMaker 10.24.01, 14-Jun-2010.