Fix and improve rootfs flashing
This commit is contained in:
parent
da8a437341
commit
e1ddf636b7
2 changed files with 115 additions and 29 deletions
23
boot.py
23
boot.py
|
@ -2,6 +2,7 @@ import os
|
|||
import urllib.request
|
||||
from image import get_device_and_flavour, get_image_name
|
||||
from logger import logging, setup_logging, verbose_option
|
||||
from flash import dump_bootimg, erase_dtbo
|
||||
import click
|
||||
import subprocess
|
||||
|
||||
|
@ -17,20 +18,6 @@ boot_strategies = {
|
|||
}
|
||||
|
||||
|
||||
def dump_bootimg(image_name: str) -> str:
|
||||
path = '/tmp/boot.img'
|
||||
result = subprocess.run([
|
||||
'debugfs',
|
||||
image_name,
|
||||
'-R',
|
||||
f'dump /boot/boot.img {path}',
|
||||
])
|
||||
if result.returncode != 0:
|
||||
logging.fatal(f'Faild to dump boot.img')
|
||||
exit(1)
|
||||
return path
|
||||
|
||||
|
||||
@click.command(name='boot', help=f'Leave TYPE empty or choose \'{JUMPDRIVE}\'')
|
||||
@verbose_option
|
||||
@click.argument('type', required=False)
|
||||
|
@ -49,7 +36,13 @@ def cmd_boot(verbose, type):
|
|||
else:
|
||||
path = dump_bootimg(image_name)
|
||||
|
||||
result = subprocess.run(['fastboot', 'boot', path])
|
||||
erase_dtbo()
|
||||
|
||||
result = subprocess.run([
|
||||
'fastboot',
|
||||
'boot',
|
||||
path,
|
||||
])
|
||||
if result.returncode != 0:
|
||||
logging.fatal(f'Failed to boot {path} using fastboot')
|
||||
exit(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue