[Feature]add MT2731_MP2_MR2_SVN388 baseline version

Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/src/bach/build.bach/tools/config_gen.pl b/src/bach/build.bach/tools/config_gen.pl
new file mode 100644
index 0000000..5815844
--- /dev/null
+++ b/src/bach/build.bach/tools/config_gen.pl
@@ -0,0 +1,53 @@
+#!/bin/perl
+
+use File::Basename;
+
+$CROSS_PREFIX=$ENV{'CROSS_PREFIX'};
+$WORKDIR=$ENV{'WORKDIR'};
+$OUTDIR=$ENV{'OUTDIR'};
+$LOGDIR=$ENV{'OUTDIR'}."/log";
+$PRJ_FILE=$ENV{'PRJ_FILENAME'};
+$COMPLIST=`cat $LOGDIR/infomake.log |grep COMPLIST|sed -e 's/COMPLIST = //g'`;
+@COMPS=split(' ', $COMPLIST);
+
+if(-d "$WORKDIR/custom/$PRJ_FILE") {
+	$CONFIGDIR="$WORKDIR/custom/$PRJ_FILE/build/config";
+} else {
+	$CONFIGDIR="$WORKDIR/custom/DEFAULT/build/config";
+}
+
+#generate ConfigPack images
+system("rm -rf $OUTDIR/rootfs/usr/cfg");
+system("mkdir -p $OUTDIR/rootfs/usr/cfg");
+foreach my $comp (@COMPS)
+{
+	if(-e "$WORKDIR/custom/$PRJ_FILE/$comp/cfg") {
+		system("cp -rf $WORKDIR/custom/$PRJ_FILE/$comp/cfg/* $OUTDIR/rootfs/usr/cfg");
+	} elsif (-e "$WORKDIR/custom/DEFAULT/$comp/cfg") {
+		system("cp -rf $WORKDIR/custom/DEFAULT/$comp/cfg/* $OUTDIR/rootfs/usr/cfg");
+	}
+}
+
+system("$WORKDIR/install/$CROSS_PREFIX/host/cfgpack/mkcfgpack $OUTDIR/rootfs/usr/cfg $OUTDIR/tmp/default.bin > $LOGDIR/mkcfgpack_default.log");
+system("cp $OUTDIR/tmp/default.bin $OUTDIR/initramfs/usr/cfg/default.bin");
+system("cp $OUTDIR/tmp/default.bin $OUTDIR/rootfs/usr/cfg/default.bin");
+
+#generate doxygen document
+system("cd $WORKDIR/install/$CROSS_PREFIX/host/doxygen/doc;$WORKDIR/install/$CROSS_PREFIX/host/doxygen/bin/doxygen > $LOGDIR/doxygen.log 2>&1");
+system("rm -rf $OUTDIR/doc;mkdir $OUTDIR/doc");
+system("cp -afr $WORKDIR/install/$CROSS_PREFIX/host/doxygen/doc/html/* $OUTDIR/doc/");
+
+
+#generate FirmwareConfig FactoryConfig images
+system("mkdir -p $OUTDIR/tmp/empty_tmp_dir");
+@DEFAULTCFG=`ls $CONFIGDIR/*.cfg`;
+foreach my $file (@DEFAULTCFG)
+{
+	my $cfgfile = basename($file);
+	chomp $cfgfile;
+	my $cfg = $cfgfile;
+	$cfg =~ s/default-//gi;
+	$cfg =~ s/\.cfg//gi;
+	system("$WORKDIR/install/$CROSS_PREFIX/host/cfgpack/mkcfgpack -x $CONFIGDIR/$cfgfile $OUTDIR/tmp/empty_tmp_dir $OUTDIR/fc-$cfg.bin >> $LOGDIR/mkcfgpack_fc.log");
+}
+system("rm -rf $OUTDIR/tmp/empty_tmp_dir");