intel / xml-cli

UFFAF - UEFI Firmware Foundational Automation Framework (formerly XmlCli)
https://intel.github.io/xml-cli/
BSD 3-Clause "New" or "Revised" License
18 stars 7 forks source link

Update Driver to existing Binary of specified GUID #12

Open YuweiChen1110 opened 1 year ago

YuweiChen1110 commented 1 year ago
  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...".

YuweiChen1110 commented 1 year ago

Update the Descriptions:

gahan9 commented 1 year ago

This Updates Driver with GUID from another binary to fulfil usecase where:

  1. User has label01.bin  which is working BIOS
  2. User tried label_different.bin which can be newer or older but eventually it does not have working driver which is expected by user.
    1. Eventually This would likely to go with failure.
    2. To aid regression without modifying code, this can replace driver from working firmware

TODO: