--- a/imgtools/romtools/group/release.txt Wed Nov 17 13:47:08 2010 +0800
+++ b/imgtools/romtools/group/release.txt Wed Nov 17 14:05:07 2010 +0800
@@ -1,3 +1,8 @@
+Version 2.16.3 (ROFSBUILD)
+===============
+Released by Marvin Shi 17/11/2010
+ 1) Fix ou1cimx1#651819 rofsbiuld fails to generate correct log info when using multi-thread
+
Version 2.16.2 (ROFSBUILD)
===============
Released by Ross Qin, 02/11/2010
--- a/imgtools/romtools/rofsbuild/r_build.cpp Wed Nov 17 13:47:08 2010 +0800
+++ b/imgtools/romtools/rofsbuild/r_build.cpp Wed Nov 17 14:05:07 2010 +0800
@@ -59,6 +59,9 @@
#include "cache/cachemanager.hpp"
#include "uniconv.hpp"
+
+#define MAX_LINE 65535
+
extern TUint checkSum(const void* aPtr);
extern ECompression gCompress;
@@ -625,7 +628,7 @@
if(offset > 0xFFFF)
{
- printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, offset);
+ printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (unsigned int)offset);
throw "fail";
}
@@ -640,7 +643,7 @@
TUint32 offset = ((((TUint8*) entry) - dirBlockBase) >> 2);
if(offset > 0xFFFF)
{
- printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, offset);
+ printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (unsigned int)offset);
throw "fail";
}
@@ -790,7 +793,18 @@
iNextNodeForSameFile = aPreviousNode;
}
-
+void TRomNode::FlushLogMessages()
+{
+ if(iEntry)
+ {
+ for(int i=0; i < (int) iEntry->iLogMessages.size(); i++)
+ {
+ std::string& log = iEntry->iLogMessages[i];
+ Print(ELog, log.c_str());
+ }
+ iEntry->iLogMessages.clear();
+ }
+}
@@ -863,9 +877,12 @@
TInt TRomBuilderEntry::PlaceFile( TUint8* &aDest,TUint aMaxSize, CBytePair *aBPE ){
+ char tmpbuf[MAX_LINE];
TUint compression = 0;
TBool executable = iExecutable;
- Print(ELog,"Reading file %s to image\n", iFileName );
+ sprintf(tmpbuf,"Reading file %s to image\n", iFileName );
+ iLogMessages.push_back(tmpbuf);
+
TUint32 size = HFile::GetLength(iFileName);
if (size==0)
Print(EWarning, "File %s does not exist or is 0 bytes in length.\n",iFileName);
@@ -1070,12 +1087,14 @@
if( newFileComp == 0)
{
- Print(ELog,"Decompressing executable '%s'\n", iFileName);
+ sprintf(tmpbuf,"Decompressing executable '%s'\n", iFileName);
+ iLogMessages.push_back(tmpbuf);
f.iHdr->iCompressionType = 0;
}
else
{
- Print(ELog,"Compressing executable '%s' with method:%08x\n", iFileName, newFileComp);
+ sprintf(tmpbuf,"Compressing executable '%s' with method:%08x\n", iFileName, (unsigned int)newFileComp);
+ iLogMessages.push_back(tmpbuf);
f.iHdr->iCompressionType = newFileComp;
}
f.UpdateHeaderCrc();
@@ -1124,11 +1143,12 @@
compression = atoi(entryref->GetCachedFileCompressionID());
memcpy(&iUids[0], aDest, sizeof(iUids));
if (compression)
- Print(ELog,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, size, compression);
+ sprintf(tmpbuf,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, (unsigned int) size, (unsigned int)compression);
else if (iExecutable)
- Print(ELog,"Executable File '%s' size: %08x\n", iFileName, size);
+ sprintf(tmpbuf,"Executable File '%s' size: %08x\n", iFileName, (unsigned int)size);
else
- Print(ELog,"File '%s' size: %08x\n", iFileName, size);
+ sprintf(tmpbuf,"File '%s' size: %08x\n", iFileName, (unsigned int) size);
+ iLogMessages.push_back(tmpbuf);
iRealFileSize = size; // required later when directory is written
return size;
@@ -1206,11 +1226,12 @@
}
if (compression)
- Print(ELog,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, size, compression);
+ sprintf(tmpbuf,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, (unsigned int) size, (unsigned int) compression);
else if (iExecutable)
- Print(ELog,"Executable File '%s' size: %08x\n", iFileName, size);
+ sprintf(tmpbuf,"Executable File '%s' size: %08x\n", iFileName, (unsigned int) size);
else
- Print(ELog,"File '%s' size: %08x\n", iFileName, size);
+ sprintf(tmpbuf,"File '%s' size: %08x\n", iFileName, (unsigned int) size);
+ iLogMessages.push_back(tmpbuf);
iCompressEnabled = compression;
iRealFileSize = size; // required later when directory is written
--- a/imgtools/romtools/rofsbuild/r_rofs.cpp Wed Nov 17 13:47:08 2010 +0800
+++ b/imgtools/romtools/rofsbuild/r_rofs.cpp Wed Nov 17 14:05:07 2010 +0800
@@ -263,6 +263,7 @@
}
class Worker : public boost::thread {
public:
+ static boost::mutex iOutputMutex;
static void thrd_func(E32Rofs* rofs){
CBytePair bpe;
@@ -274,6 +275,8 @@
//no symbol for hidden file
if(rofs->iSymGen && !p->node->iEntry->iHidden)
rofs->iSymGen->AddFile(p->node->iEntry->iFileName,(p->node->iEntry->iCompressEnabled|| p->node->iEntry->iExecutable));
+ boost::mutex::scoped_lock lock(iOutputMutex);
+ p->node->FlushLogMessages();
}
p = rofs->GetFileNode(deferred);
}
@@ -288,6 +291,8 @@
}
};
+boost::mutex Worker::iOutputMutex;
+
TPlacingSection* E32Rofs::GetFileNode(bool &aDeferred) {
//get a node from the node list, the node list is protected by mutex iMuxTree.
//The iMuxTree also helps to make sure the order in iVPS is consistent with the node list.
--- a/imgtools/romtools/rofsbuild/r_romnode.h Wed Nov 17 13:47:08 2010 +0800
+++ b/imgtools/romtools/rofsbuild/r_romnode.h Wed Nov 17 14:05:07 2010 +0800
@@ -20,6 +20,8 @@
#define __R_ROMNODE_H__
#include <fstream>
+#include <vector>
+#include <string>
#include <e32std.h>
#include "rofs.h"
#include "e32image.h"
@@ -123,7 +125,8 @@
TInt GetFullName(char* aBuf, TBool aIgnoreHiddenAttrib = EFalse) const;
static void InitializeCount();
// Accessor Function.
- inline TRomNode* GetParent() const { return iParent; }
+ inline TRomNode* GetParent() const { return iParent; }
+ void FlushLogMessages();
private:
void Remove(TRomNode* aChild);
@@ -209,6 +212,7 @@
public:
char *iName;
char *iFileName;
+ std::vector<std::string> iLogMessages;
TRomBuilderEntry* iNext;
TRomBuilderEntry* iNextInArea;
--- a/imgtools/romtools/rofsbuild/rofsbuild.cpp Wed Nov 17 13:47:08 2010 +0800
+++ b/imgtools/romtools/rofsbuild/rofsbuild.cpp Wed Nov 17 14:05:07 2010 +0800
@@ -49,7 +49,7 @@
static const TInt RofsbuildMajorVersion=2;
static const TInt RofsbuildMinorVersion=16;
-static const TInt RofsbuildPatchVersion=2;
+static const TInt RofsbuildPatchVersion=3;
static TBool SizeSummary=EFalse;
static TPrintType SizeWhere=EAlways;
--- a/imgtools/romtools/rofsbuild/src/logging/logparser.cpp Wed Nov 17 13:47:08 2010 +0800
+++ b/imgtools/romtools/rofsbuild/src/logging/logparser.cpp Wed Nov 17 14:05:07 2010 +0800
@@ -67,6 +67,18 @@
}
}
}
+ else if(linebuf.compare(0,15,"Executable File") == 0)
+ {
+ if(linebuf.find("size:", 26) != string::npos)
+ {
+ size_t startpos = linebuf.find('\'') ;
+ size_t endpos = linebuf.rfind('\'');
+ if((startpos!=string::npos) && (endpos!=string::npos))
+ {
+ symgen->AddFile(linebuf.substr(startpos+1,endpos-startpos-1), true);
+ }
+ }
+ }
else if(linebuf.compare(0,26,"Compressed executable File") == 0)
{
if(linebuf.find("size:", 26) != string::npos)