forked from bn222/dpu-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bfb
executable file
·30 lines (24 loc) · 1.01 KB
/
bfb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
import common_bf
import argparse
import requests
import time
def main():
parser = argparse.ArgumentParser(description='Downloads BFB images and sends it to the BF.')
parser.add_argument('-i', '--id', dest='id', default=0, action='store', type=int, help='Specify the id of the BF.')
args = parser.parse_args()
_ = common_bf.find_bf_pci_addresses_or_quit(args.id)
bfb_image = "DOCA_2.0.2_BSP_4.0.3_Ubuntu_22.04-8.23-04.prod.bfb"
bfb_url = f"https://content.mellanox.com/BlueField/BFBs/Ubuntu22.04/{bfb_image}"
print(f"Downloading bfb image from {bfb_url}")
start = time.time()
r = requests.get(bfb_url)
print(f"It took {time.time() - start}s to download the BFB image")
fn = f"/dev/rshim{args.id//2}/boot"
print("Loading BFB image onto the BF. This will take a while")
start = time.time()
with open(fn, "wb") as f:
f.write(r.content)
print(f"It took {time.time() - start}s to load the BFB image")
if __name__ == "__main__":
main()