-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfastboot.py
39 lines (33 loc) · 819 Bytes
/
fastboot.py
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
import logging
import subprocess
def fastboot_erase_dtbo():
logging.info("Fastboot: Erasing DTBO")
subprocess.run(
[
'fastboot',
'erase',
'dtbo',
],
capture_output=True,
)
def fastboot_flash(partition, file):
logging.info(f"Fastboot: Flashing {file} to {partition}")
result = subprocess.run([
'fastboot',
'flash',
partition,
file,
])
if result.returncode != 0:
logging.info(f'Failed to flash {file}')
exit(1)
def fastboot_boot(file):
logging.info(f"Fastboot: booting {file}")
result = subprocess.run([
'fastboot',
'boot',
file,
])
if result.returncode != 0:
logging.fatal(f'Failed to boot {file} using fastboot')
exit(1)