From: "Sun, Zailiang" <zailiang.sun@intel.com>
To: Gary Lin <glin@suse.com>, "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Qian, Yi" <yi.qian@intel.com>
Subject: Re: [PATCH 2/2] Vlv2TbltDevicePkg/PreBuild.py: Remove unused functions
Date: Wed, 12 Feb 2020 06:33:30 +0000 [thread overview]
Message-ID: <7CB7EF03E15B5D48981329A508747A9850D28902@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20200212062403.21714-2-glin@suse.com>
Reviewed-by: Zailiang Sun <Zailiang.sun@intel.com>
-----Original Message-----
From: Gary Lin <glin@suse.com>
Sent: Wednesday, February 12, 2020 2:24 PM
To: devel@edk2.groups.io
Cc: Sun, Zailiang <zailiang.sun@intel.com>; Qian, Yi <yi.qian@intel.com>
Subject: [PATCH 2/2] Vlv2TbltDevicePkg/PreBuild.py: Remove unused functions
Clean up the script.
Cc: Zailiang Sun <zailiang.sun@intel.com>
cc: Yi Qian <yi.qian@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
---
Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py | 97 ----------------------------
1 file changed, 97 deletions(-)
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py b/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
index 220515c809..be1d23560e 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
@@ -59,108 +59,12 @@ def NormalizePath(target):
else:
return os.path.normpath (target)
-def RemoveFile(target):
- target = NormalizePath(target)
- if not target or target == os.pathsep:
- Error ('RemoveFile() invalid target')
- if os.path.exists(target):
- os.remove (target)
- Log ('remove %s' % (RelativePath (target)))
-
-def RemoveDirectory(target):
- target = NormalizePath(target)
- if not target or target == os.pathsep:
- Error ('RemoveDirectory() invalid target')
- if os.path.exists(target):
- Log ('rmdir %s' % (RelativePath (target)))
- shutil.rmtree(target)
-
def CreateDirectory(target):
target = NormalizePath(target)
if not os.path.exists(target):
Log ('mkdir %s' % (RelativePath (target)))
os.makedirs (target)
-def Copy(src, dst):
- src = NormalizePath(src)
- dst = NormalizePath(dst)
- for File in glob.glob(src):
- Log ('copy %s -> %s' % (RelativePath (File), RelativePath (dst)))
- shutil.copy (File, dst)
-
-def GenCapsuleDevice (BaseName, PayloadFileName, Guid, Version, Lsv, CapsulesPath, CapsulesSubDir):
- global gBaseToolsPath
- LogAlways ('Generate Capsule: {0} {1:08x} {2:08x} {3}'.format (Guid, Version, Lsv, PayloadFileName))
-
- VersionString = '.'.join([str(ord(x)) for x in struct.pack('>I', Version).decode()])
-
- FmpCapsuleFile = NormalizePath ((CapsulesPath, CapsulesSubDir, BaseName + '.' + VersionString + '.cap'))
- Command = GenerateCapsuleCommand.format (
- FMP_CAPSULE_GUID = Guid,
- FMP_CAPSULE_VERSION = Version,
- FMP_CAPSULE_LSV = Lsv,
- BASE_TOOLS_PATH = gBaseToolsPath,
- FMP_CAPSULE_FILE = FmpCapsuleFile,
- FMP_CAPSULE_PAYLOAD = PayloadFileName
- )
- Command = ' '.join(Command.splitlines()).strip()
- if gArgs.Verbose:
- Command = Command + ' -v'
-
- Log (Command)
-
- Process = subprocess.Popen(Command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- ProcessOutput = Process.communicate()
-
- if Process.returncode == 0:
- Log (ProcessOutput[0].decode())
- else:
- LogAlways (Command)
- LogAlways (ProcessOutput[0].decode())
- Error ('GenerateCapsule returned an error')
-
- Copy (PayloadFileName, (CapsulesPath, 'firmware.bin'))
- MetaInfoXml = MetaInfoXmlTemplate
- MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_GUID', Guid)
- MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_BASE_NAME', BaseName)
- MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_VERSION_DECIMAL', str(Version))
- MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_STRING', VersionString)
- MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_DATE', str(datetime.date.today()))
- f = open (NormalizePath ((CapsulesPath, 'firmware.metainfo.xml')), 'w')
- f.write(MetaInfoXml)
- f.close()
-
- f = open (NormalizePath ((CapsulesPath, 'Lvfs.ddf')), 'w')
- f.write(LvfsDdfTemplate)
- f.close()
-
- if sys.platform == "win32":
- Command = 'makecab /f ' + NormalizePath ((CapsulesPath, 'Lvfs.ddf'))
- else:
- Command = 'gcab --create firmware.cab firmware.bin firmware.metainfo.xml'
- Log (Command)
-
- Process = subprocess.Popen(Command, cwd=CapsulesPath, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- ProcessOutput = Process.communicate()
-
- if Process.returncode == 0:
- Log (ProcessOutput[0].decode())
- else:
- LogAlways (Command)
- LogAlways (ProcessOutput[0].decode())
- Error ('GenerateCapsule returned an error')
-
- FmpCabinetFile = NormalizePath ((CapsulesPath, CapsulesSubDir, BaseName + '.' + VersionString + '.cab'))
-
- Copy ((CapsulesPath, 'firmware.cab'), FmpCabinetFile)
-
- RemoveFile ((CapsulesPath, 'firmware.cab'))
- RemoveFile ((CapsulesPath, 'setup.inf'))
- RemoveFile ((CapsulesPath, 'setup.rpt'))
- RemoveFile ((CapsulesPath, 'Lvfs.ddf'))
- RemoveFile ((CapsulesPath, 'firmware.metainfo.xml'))
- RemoveFile ((CapsulesPath, 'firmware.bin'))
-
BiosIdTemplate = '''
BOARD_ID = MNW2MAX
BOARD_REV = $BOARD_REV
@@ -170,7 +74,6 @@ BUILD_TYPE = $BUILD_TYPE
VERSION_MINOR = 01
'''
-
if __name__ == '__main__':
#
# Create command line argument parser object
--
2.16.4
next prev parent reply other threads:[~2020-02-12 6:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-12 6:24 [PATCH 1/2] Vlv2TbltDevicePkg/GenerateCapsule: Create cab files with signed capsules Gary Lin
2020-02-12 6:24 ` [PATCH 2/2] Vlv2TbltDevicePkg/PreBuild.py: Remove unused functions Gary Lin
2020-02-12 6:33 ` Sun, Zailiang [this message]
2020-02-12 6:31 ` [PATCH 1/2] Vlv2TbltDevicePkg/GenerateCapsule: Create cab files with signed capsules Sun, Zailiang
2020-02-12 6:41 ` [edk2-devel] " Gary Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7CB7EF03E15B5D48981329A508747A9850D28902@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox