1. Functions Introduction
Functions:
1. Parse the input FV file into a origin binary tree. Currently, we just support FV level replacement operation, so we define two different types of tree nodes - FV/ FFS.
2. Given a new FFS file , parse the new FFS file into a new binary tree and get the new FFS Node from the new binary tree.
3. Find target FFS node from the origin binary tree with new FFS's driver guid.
4. Replace the target FFS node with New FFS node in the binary tree.
5. Encapsulate binary with replaced FFS.
Design thoughts:
A binary tree will be created for binary file to include all the info.
The whole binary file will be seen as a Root Node of the tree. When parse the binary, the FV and FFS part will be seen as the FVNode/FFSNode which is the Child of the ROOT/FVNode.
With the tree, both the structure and data of ROOT/FV/FFS... can be saved which can be used for function extensions.
2. Use method
Method 1:
Step 1: Copy the origin "bios_image.bin" & target "driver_image.ffs" (The file name can not be changed) into the XmlCli repo root folder.
Step 2: Open windows console with XmlCli repo root folder, then run "py -3 src\xmlcli\common\bios_fw_parser.py".
Then the expected output binary file "replaced_image.bin" will be generated into the root folder.
Method 2:
Step 1: Copy the origin "bios_image.bin" & target "driver_image.ffs"( with your own file name )into the XmlCli repo root folder.
Step 2: Open windows console with XmlCli repo root folder, then run "py -3 src\xmlcli\common\bios_fw_parser.py -r $(input_binary_file) $(target_driver_ffs).ffs $(output_binary_file)".
Then the expected output binary file $(output_binary_file) will be generated into the root folder.
3. Known Issue
3.1 Only support replace the first find driver ffs.
3.2 Only support replace the same guid driver ffs file.
3.3 The entry extension in xmlcli_registry_listener.py does not been complemented.
4. Extension direction
4.1 All the Known Issues can be enhanced with more details requirements descriptions.
4.2 The binary tree can be extended to save all level's FV and FFS and Section Node through binary parsing.
4.3 The existed binary Tree can be used to extend more functions like "Add a new driver / Delete a driver...".
Signed-off-by: Yuwei Chen <[email protected]>
Signed-off-by: Yuting Yang <[email protected]>