-
Notifications
You must be signed in to change notification settings - Fork 8
/
bfb
executable file
·41 lines (34 loc) · 1.12 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
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3
import argparse
import requests
import time
import common_bf
def main() -> None:
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 {round(time.time() - start, 2)}s to download the BFB image")
fn = f"/dev/rshim{args.id//2}/boot"
print(f"Loading BFB image onto the BF using {fn}. This will take a while")
start = time.time()
with open(fn, "wb") as f:
f.write(r.content)
print(f"It took {round(time.time() - start, 2)}s to load the BFB image")
if __name__ == "__main__":
main()