The FMMT python tool is used for firmware files operation, which has the Fv/FFs-based 'View'&'Add'&'Delete'&'Replace' operation function: 1.Parse a FD(Firmware Device) / FV(Firmware Volume) / FFS(Firmware Files) 2.Add a new FFS into a FV file (both included in a FD file or not) 3.Replace an FFS in a FV file with a new FFS file 4.Delete an FFS in a FV file (both included in a FD file or not) 5.Extract the FFS from a FV file (both included in a FD file or not) This version of FMMT Python tool does not support PEIM rebase feature, this feature will be added in future update. Currently the FMMT C tool is saved in edk2-staging repo, but its quality and coding style can't meet the Edk2 quality, which is hard to maintain (Hard/Duplicate Code; Regression bugs; Restrict usage). The new Python version keeps same functions with origin C version. It has higher quality and better coding style, and it is much easier to extend new functions and to maintain. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1847 RFC Link: https://edk2.groups.io/g/devel/message/82877 Staging Link: https://github.com/tianocore/edk2-staging/tree/PyFMMT Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
		
			
				
	
	
		
			32 lines
		
	
	
		
			841 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			841 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| ## @file
 | |
| # This file is used to define the Fmmt Logger.
 | |
| #
 | |
| # Copyright (c) 2021-, Intel Corporation. All rights reserved.<BR>
 | |
| # SPDX-License-Identifier: BSD-2-Clause-Patent
 | |
| 
 | |
| ##
 | |
| 
 | |
| import logging
 | |
| import sys
 | |
| import os
 | |
| 
 | |
| logfile = 'FMMT_Build.log'
 | |
| if os.path.exists(logfile):
 | |
|     os.remove(logfile)
 | |
| 
 | |
| FmmtLogger = logging.getLogger('FMMT')
 | |
| FmmtLogger.setLevel(logging.DEBUG)
 | |
| 
 | |
| log_stream_handler=logging.StreamHandler(sys.stdout)
 | |
| log_file_handler=logging.FileHandler(logfile)
 | |
| log_stream_handler.setLevel(logging.INFO)
 | |
| 
 | |
| stream_format=logging.Formatter("%(levelname)-8s: %(message)s")
 | |
| file_format=logging.Formatter("%(levelname)-8s: %(message)s")
 | |
| 
 | |
| log_stream_handler.setFormatter(stream_format)
 | |
| log_file_handler.setFormatter(file_format)
 | |
| 
 | |
| FmmtLogger.addHandler(log_stream_handler)
 | |
| FmmtLogger.addHandler(log_file_handler)
 |