Skip to content

Commit

Permalink
Add eMMC wipe functionality to BF_DPU_Update
Browse files Browse the repository at this point in the history
- Integrated eMMC wipe step into the firmware update process.
- Implemented send_emmc_wipe method to wipe the eMMC and reboot the
  system.

Signed-off-by: Qian Sun <[email protected]>
  • Loading branch information
Qian Sun committed Nov 29, 2024
1 parent b6ea52a commit 529e1de
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
2 changes: 2 additions & 0 deletions OobUpdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def get_arg_parser():
parser.add_argument('-T', metavar="<module>", dest="module", type=str, required=False, help='The module to be updated: BMC|CEC|BIOS|FRU|CONFIG', choices=('BMC', 'CEC', 'BIOS', 'FRU', 'CONFIG'))
parser.add_argument('-H', metavar="<bmc_ip>", dest="bmc_ip", type=str, required=False, help='IP/Host of BMC')
parser.add_argument('-C', action='store_true', dest="clear_config", required=False, help='Reset to factory configuration (Only used for BMC|BIOS)')
parser.add_argument('-E', action='store_true', dest="wipe_emmc", required=False, help='Wipe eMMC during the configuration image update (Only used for CONFIG)')
parser.add_argument('-o', '--output', metavar="<output_log_file>", dest="output_file", type=str, required=False, help='Output log file')
parser.add_argument('-p', '--port', metavar="<bmc_port>", dest="bmc_port", type=str, required=False, help='Port of BMC (443 by default).')
parser.add_argument('--bios_update_protocol', metavar='<bios_update_protocol>', dest="bios_update_protocol", required=False, help=argparse.SUPPRESS, choices=('HTTP', 'SCP'))
Expand Down Expand Up @@ -58,6 +59,7 @@ def main():
args.oem_fru,
args.skip_same_version,
args.debug,
args.wipe_emmc,
args.output_file,
bfb_update_protocol = args.bios_update_protocol,
use_curl = True)
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ OobUpdate.sh is a program for updating various component firmware of BlueField D
-T <module> The module to be updated: BMC|CEC|BIOS|FRU|CONFIG
-H <bmc_ip> IP/Host of BMC
-C Reset to factory configuration (Only used for BMC|BIOS)
-E Wipe eMMC during the configuration image update (Only used for CONFIG)
-o <output_log_file>, --output <output_log_file>
Output log file
-p <bmc_port>, --port <bmc_port>
Expand Down Expand Up @@ -77,8 +78,19 @@ OobUpdate.sh is a program for updating various component firmware of BlueField D
Process-: 100%: ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Factory reset BIOS configuration(ResetBios) (will reboot the system)
Process|: 100%: ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Factory reset BMC configuration
Restart BMC to make new firmware take effect
Process|: 100%: ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

Wipe eMMC during image update:

# ./OobUpdate.sh -U dingzhi -P Nvidia20240604-- -H 10.237.121.98 -T CONFIG -E -F /opt/BD-config-image-4.9.0.13354-1.0.0.bfb
Wiping eMMC (EmmcWipe)
Start to Simple Update (HTTP)
Process-: 100%: ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Factory reset BIOS configuration(ResetBios) (will reboot the system)
Process|: 100%: ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Restart BMC to make new firmware take effect
Process|: 100%: ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

### Update FRU data

Expand Down
23 changes: 22 additions & 1 deletion src/bf_dpu_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class BF_DPU_Update(object):
}


def __init__(self, bmc_ip, bmc_port, username, password, fw_file_path, module, oem_fru, skip_same_version, debug=False, log_file=None, use_curl=True, bfb_update_protocol = None):
def __init__(self, bmc_ip, bmc_port, username, password, fw_file_path, module, oem_fru, skip_same_version, debug=False, wipe_emmc=False, log_file=None, use_curl=True, bfb_update_protocol = None):
self.bmc_ip = self._parse_bmc_addr(bmc_ip)
self.bmc_port = bmc_port
self.username = username
Expand All @@ -46,6 +46,7 @@ def __init__(self, bmc_ip, bmc_port, username, password, fw_file_path, module, o
self.oem_fru = oem_fru
self.skip_same_version = skip_same_version
self.debug = debug
self.wipe_emmc = wipe_emmc
self.log_file = log_file
self.protocol = 'https://'
self.redfish_root = '/redfish/v1'
Expand Down Expand Up @@ -1061,6 +1062,22 @@ def send_reset_efi_vars(self):
self._wait_for_system_power_on()


def send_emmc_wipe(self):
print("Wiping eMMC (EmmcWipe)")
url = self._get_url_base() + '/Systems/Bluefield/Bios/Settings'
headers = {
'Content-Type' : 'application/json'
}
data = {
'Attributes': {
'EmmcWipe': True,
},
}
response = self._http_patch(url, data=json.dumps(data), headers=headers)
self.log('Wiping eMMC (EmmcWipe)', response)
self._handle_status_code(response, [200])


def reboot_system(self):
url = self._get_url_base() + '/Systems/Bluefield/Actions/ComputerSystem.Reset'
headers = {
Expand Down Expand Up @@ -1173,6 +1190,10 @@ def update_conf(self):
if not self.is_fw_file_for_conf():
raise Err_Exception(Err_Num.FW_FILE_NOT_MATCH_MODULE)

# 0. Wipe the eMMC
if self.wipe_emmc:
self.send_emmc_wipe()

# 1. Update config image in DPU BMC Flash using Redfish
self._start_and_wait_simple_update_task()

Expand Down

0 comments on commit 529e1de

Please sign in to comment.