X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2FFfsProcess.java;h=26b93909019cd75dce831bb3af1f4970d8a950be;hp=66ad11ab5567675fd3e0d79382f51b24fd1fa4b6;hb=214b0d1914b48d651b25e58f321ddb77a46903b8;hpb=83fba802560b3446de68ac1c280773cf1a4271be diff --git a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java index 66ad11ab55..26b9390901 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java +++ b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java @@ -26,6 +26,7 @@ import org.tianocore.build.global.GlobalData; import org.tianocore.build.global.SurfaceAreaQuery; import org.tianocore.build.id.FpdModuleIdentification; import org.tianocore.common.definitions.EdkDefinitions; +import org.tianocore.common.logger.EdkLog; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -84,12 +85,6 @@ public class FfsProcess { /// public static final String[][] sectionExt = EdkDefinitions.SectionTypeExtensions; - private SurfaceAreaQuery saq = null; - - public FfsProcess(SurfaceAreaQuery saq) { - this.saq = saq; - } - /** search in the type, if componentType is listed in type, return true; otherwise return false. @@ -121,9 +116,8 @@ public class FfsProcess { // // Try to find Ffs layout from FPD file // - saq.push(GlobalData.getFpdBuildOptions()); + SurfaceAreaQuery saq = new SurfaceAreaQuery(GlobalData.getFpdBuildOptionsMap()); BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = saq.getFpdFfs(); - saq.pop(); for (int i = 0; i < ffsArray.length; i++) { if (isMatch(ffsArray[i].getFfsKey(), buildType)) { ffsXmlObject = ffsArray[i]; @@ -136,7 +130,7 @@ public class FfsProcess { // Otherwise report warning message // if (buildType == null) { - System.out.println("Warning: this module doesn't specify a FfsFormatKey. "); + EdkLog.log(EdkLog.EDK_WARNING, "Warning: this module doesn't specify a FfsFormatKey. "); } else { throw new BuildException("Can't find the FfsFormatKey [" + buildType + "] attribute in the FPD file!"); } @@ -160,11 +154,9 @@ public class FfsProcess { } Vector sectionList = new Vector(); XmlCursor cursor = null; - try { - cursor = ffsXmlObject.newCursor(); - } catch (Exception e) { - return null; - } + + cursor = ffsXmlObject.newCursor(); + int mode = MODE_NONE; Element genffsfileEle = document.createElement("genffsfile"); genffsfileEle.setAttribute("outputDir", "${BIN_DIR}"); @@ -246,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")) { @@ -263,33 +257,74 @@ 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) { + if (type.equalsIgnoreCase("COMPRESS")) { + ele.setAttribute("sectionType", "EFI_SECTION_COMPRESSION"); + }else { + 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());