2021-08-17 20:57:31 +02:00
|
|
|
import logging
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
def fastboot_erase_dtbo():
|
2022-02-20 19:23:28 +01:00
|
|
|
logging.info("Fastboot: Erasing DTBO")
|
2021-08-17 20:57:31 +02:00
|
|
|
subprocess.run(
|
|
|
|
[
|
|
|
|
'fastboot',
|
|
|
|
'erase',
|
|
|
|
'dtbo',
|
|
|
|
],
|
|
|
|
capture_output=True,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def fastboot_flash(partition, file):
|
2021-10-26 06:02:55 +02:00
|
|
|
logging.info(f"Fastboot: Flashing {file} to {partition}")
|
2021-08-17 20:57:31 +02:00
|
|
|
result = subprocess.run([
|
|
|
|
'fastboot',
|
|
|
|
'flash',
|
|
|
|
partition,
|
|
|
|
file,
|
|
|
|
])
|
|
|
|
if result.returncode != 0:
|
|
|
|
logging.info(f'Failed to flash {file}')
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
def fastboot_boot(file):
|
2021-10-26 06:02:55 +02:00
|
|
|
logging.info(f"Fastboot: booting {file}")
|
2021-08-17 20:57:31 +02:00
|
|
|
result = subprocess.run([
|
|
|
|
'fastboot',
|
|
|
|
'boot',
|
|
|
|
file,
|
|
|
|
])
|
|
|
|
if result.returncode != 0:
|
|
|
|
logging.fatal(f'Failed to boot {file} using fastboot')
|
|
|
|
exit(1)
|