blob: 5815844d2966235c17d15319da20a953e3b145b5 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001#!/bin/perl
2
3use File::Basename;
4
5$CROSS_PREFIX=$ENV{'CROSS_PREFIX'};
6$WORKDIR=$ENV{'WORKDIR'};
7$OUTDIR=$ENV{'OUTDIR'};
8$LOGDIR=$ENV{'OUTDIR'}."/log";
9$PRJ_FILE=$ENV{'PRJ_FILENAME'};
10$COMPLIST=`cat $LOGDIR/infomake.log |grep COMPLIST|sed -e 's/COMPLIST = //g'`;
11@COMPS=split(' ', $COMPLIST);
12
13if(-d "$WORKDIR/custom/$PRJ_FILE") {
14 $CONFIGDIR="$WORKDIR/custom/$PRJ_FILE/build/config";
15} else {
16 $CONFIGDIR="$WORKDIR/custom/DEFAULT/build/config";
17}
18
19#generate ConfigPack images
20system("rm -rf $OUTDIR/rootfs/usr/cfg");
21system("mkdir -p $OUTDIR/rootfs/usr/cfg");
22foreach my $comp (@COMPS)
23{
24 if(-e "$WORKDIR/custom/$PRJ_FILE/$comp/cfg") {
25 system("cp -rf $WORKDIR/custom/$PRJ_FILE/$comp/cfg/* $OUTDIR/rootfs/usr/cfg");
26 } elsif (-e "$WORKDIR/custom/DEFAULT/$comp/cfg") {
27 system("cp -rf $WORKDIR/custom/DEFAULT/$comp/cfg/* $OUTDIR/rootfs/usr/cfg");
28 }
29}
30
31system("$WORKDIR/install/$CROSS_PREFIX/host/cfgpack/mkcfgpack $OUTDIR/rootfs/usr/cfg $OUTDIR/tmp/default.bin > $LOGDIR/mkcfgpack_default.log");
32system("cp $OUTDIR/tmp/default.bin $OUTDIR/initramfs/usr/cfg/default.bin");
33system("cp $OUTDIR/tmp/default.bin $OUTDIR/rootfs/usr/cfg/default.bin");
34
35#generate doxygen document
36system("cd $WORKDIR/install/$CROSS_PREFIX/host/doxygen/doc;$WORKDIR/install/$CROSS_PREFIX/host/doxygen/bin/doxygen > $LOGDIR/doxygen.log 2>&1");
37system("rm -rf $OUTDIR/doc;mkdir $OUTDIR/doc");
38system("cp -afr $WORKDIR/install/$CROSS_PREFIX/host/doxygen/doc/html/* $OUTDIR/doc/");
39
40
41#generate FirmwareConfig FactoryConfig images
42system("mkdir -p $OUTDIR/tmp/empty_tmp_dir");
43@DEFAULTCFG=`ls $CONFIGDIR/*.cfg`;
44foreach my $file (@DEFAULTCFG)
45{
46 my $cfgfile = basename($file);
47 chomp $cfgfile;
48 my $cfg = $cfgfile;
49 $cfg =~ s/default-//gi;
50 $cfg =~ s/\.cfg//gi;
51 system("$WORKDIR/install/$CROSS_PREFIX/host/cfgpack/mkcfgpack -x $CONFIGDIR/$cfgfile $OUTDIR/tmp/empty_tmp_dir $OUTDIR/fc-$cfg.bin >> $LOGDIR/mkcfgpack_fc.log");
52}
53system("rm -rf $OUTDIR/tmp/empty_tmp_dir");