From 8a9783c1f3f75ec5cd6e869f812e62fb5bcf1406 Mon Sep 17 00:00:00 2001 From: wuyizhong Date: Wed, 9 Aug 2006 02:18:20 +0000 Subject: [PATCH] Enhance FfsLayout parsing. When specify a file for a section, then just use the file as section file. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1219 6f19259b-4bc3-4df7-8a09-765794883524 --- .../org/tianocore/build/FfsProcess.java | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java index 2d8ed0b023..5541be4b94 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java +++ b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java @@ -345,20 +345,55 @@ public class FfsProcess { **/ private void dealSection(int mode, Document doc, Element root, XmlCursor cursor, Vector list) { String type = cursor.getAttributeText(new QName("SectionType")); - list.addElement(type); + + // + // Judge if file is specified? Yes, just use the file, else call Build Macro + // If fileName is null, means without FileNames specify in FPD file + // + String fileName = null; + cursor.push(); + if (cursor.toFirstChild()) { + do { + if (cursor.getName().getLocalPart().equalsIgnoreCase("Filenames")) { + cursor.push(); + if (cursor.toFirstChild()) { + do { + if (cursor.getName().getLocalPart().equalsIgnoreCase("Filename")) { + fileName = cursor.getTextValue(); + } + } while (cursor.toNextSibling()); + } + cursor.pop(); + } + } while (cursor.toNextSibling()); + } + + cursor.pop(); + + if (fileName == null) { + list.addElement(type); + } if (mode == MODE_GUID_DEFINED) { // // // Element ele = doc.createElement("input"); - ele.setAttribute("file", "${DEST_DIR_OUTPUT}" + File.separatorChar + basename + getSectionExt(type)); + if (fileName == null) { + ele.setAttribute("file", "${DEST_DIR_OUTPUT}" + File.separatorChar + basename + getSectionExt(type)); + } else { + ele.setAttribute("file", "${PLATFORM_DIR}" + File.separatorChar + fileName); + } root.appendChild(ele); } else { // // // Element ele = doc.createElement("sectFile"); - ele.setAttribute("fileName", "${DEST_DIR_OUTPUT}" + File.separatorChar + basename + getSectionExt(type)); + if (fileName == null) { + ele.setAttribute("fileName", "${DEST_DIR_OUTPUT}" + File.separatorChar + basename + getSectionExt(type)); + } else { + ele.setAttribute("fileName", "${PLATFORM_DIR}" + File.separatorChar + fileName); + } root.appendChild(ele); } } -- 2.39.2