image: create new module from {image,boot,fastboot,flash}.py
This commit is contained in:
parent
afca099ede
commit
50bcd0de63
9 changed files with 18 additions and 16 deletions
37
image/fastboot.py
Normal file
37
image/fastboot.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
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:
|
||||
raise Exception(f'Failed to flash {file}')
|
||||
|
||||
|
||||
def fastboot_boot(file):
|
||||
logging.info(f"Fastboot: booting {file}")
|
||||
result = subprocess.run([
|
||||
'fastboot',
|
||||
'boot',
|
||||
file,
|
||||
])
|
||||
if result.returncode != 0:
|
||||
raise Exception(f'Failed to boot {file} using fastboot')
|
Loading…
Add table
Add a link
Reference in a new issue