From a1ffb10f211fa712dfd6d54156a412cce24014f4 Mon Sep 17 00:00:00 2001 From: qouyang Date: Sun, 10 Sep 2006 12:51:19 +0000 Subject: Support calling customized compression tool in FrameworkTask. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1506 6f19259b-4bc3-4df7-8a09-765794883524 --- .../GenBuild/org/tianocore/build/FfsProcess.java | 60 ++++++++++++++++++---- 1 file changed, 49 insertions(+), 11 deletions(-) (limited to 'Tools/Source/GenBuild') diff --git a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java index a098719073..3a67e6eb34 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java +++ b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java @@ -238,7 +238,9 @@ public class FfsProcess { **/ private void dealSections(int mode, Document doc, Element root, XmlCursor cursor, Vector list) { String type = cursor.getAttributeText(new QName("EncapsulationType")); - if (type == null) { + String toolName = cursor.getAttributeText(new QName("ToolName")); + String sectType = cursor.getAttributeText(new QName("SectionType")); + if (type == null && sectType == null) { if (cursor.toFirstChild()) { do { if (cursor.getName().getLocalPart().equalsIgnoreCase("Section")) { @@ -255,33 +257,69 @@ public class FfsProcess { return; } Element ele; - if (type.equalsIgnoreCase("COMPRESS")) { + Element toolEle = null; + if (type.equalsIgnoreCase("COMPRESS") && (toolName == null || toolName.equalsIgnoreCase(""))) { mode = MODE_COMPRESS; // - // - // - ele = doc.createElement("compress"); - ele.setAttribute("compressName", "dummy"); + // + // + ele = doc.createElement("gensection"); + ele.setAttribute("sectionType", "EFI_SECTION_COMPRESSION"); + } else { mode = MODE_GUID_DEFINED; // + // + // + ele = doc.createElement("gensection"); + if (type != null) { + ele.setAttribute("sectiontype", "EFI_SECTION_GUID_DEFINED"); + } else { + ele.setAttribute("sectiontype", sectType); + } + // // // - ele = doc.createElement("tool"); - ele.setAttribute("toolName", "${WORKSPACE_DIR}" + File.separatorChar + "Tools" + File.separatorChar + "bin" + toolEle = doc.createElement("tool"); + if (toolName == null || toolName.equalsIgnoreCase("")) { + toolEle.setAttribute("toolName", "${WORKSPACE_DIR}" + File.separatorChar + "Tools" + File.separatorChar + "bin" + File.separatorChar + "GenCRC32Section"); - ele.setAttribute("outputPath", "${DEST_DIR_OUTPUT}"); + }else{ + File toolExe = new File(toolName); + // + // If element exist, add sub element under . + // + if (toolExe.isAbsolute()) { + toolEle.setAttribute("toolName", toolName); + } else { + toolEle.setAttribute("toolName", "${WORKSPACE_DIR}" + File.separatorChar + "Tools" + File.separatorChar + "bin" + + File.separatorChar + toolName); + } + } + + toolEle.setAttribute("outputPath", "${DEST_DIR_OUTPUT}"); + ele.appendChild(toolEle); } if (cursor.toFirstChild()) { do { if (cursor.getName().getLocalPart().equalsIgnoreCase("Section")) { cursor.push(); - dealSection(mode, doc, ele, cursor, list); + if (toolEle == null) { + dealSection(mode, doc, ele, cursor, list); + } else { + dealSection(mode, doc, toolEle, cursor, list); + } + cursor.pop(); } else if (cursor.getName().getLocalPart().equalsIgnoreCase("Sections")) { cursor.push(); - dealSections(mode, doc, ele, cursor, list); + if (toolEle == null) { + dealSections(mode, doc, ele, cursor, list); + } else { + dealSections(mode, doc, toolEle, cursor, list); + } + cursor.pop(); } } while (cursor.toNextSibling()); -- cgit v1.2.3