s/bootimg/aboot/i

This commit is contained in:
InsanePrawn 2022-02-06 20:36:11 +01:00
parent 1b71a686cd
commit 94cd4b8331
4 changed files with 12 additions and 12 deletions

12
boot.py
View file

@ -5,18 +5,18 @@ import click
from config import config
from constants import BOOT_STRATEGIES, FLASH_PARTS, FASTBOOT, JUMPDRIVE, JUMPDRIVE_VERSION
from fastboot import fastboot_boot, fastboot_erase_dtbo
from image import get_device_and_flavour, losetup_rootfs_image, get_image_path, dump_bootimg, dump_lk2nd
from image import get_device_and_flavour, losetup_rootfs_image, get_image_path, dump_aboot, dump_lk2nd
from chroot import get_device_chroot
from wrapper import enforce_wrap
LK2ND = FLASH_PARTS['LK2ND']
BOOTIMG = FLASH_PARTS['BOOTIMG']
ABOOT = FLASH_PARTS['ABOOT']
TYPES = [LK2ND, JUMPDRIVE, BOOTIMG]
TYPES = [LK2ND, JUMPDRIVE, ABOOT]
@click.command(name='boot')
@click.argument('type', required=False, default=BOOTIMG, type=click.Choice(TYPES))
@click.argument('type', required=False, default=ABOOT, type=click.Choice(TYPES))
def cmd_boot(type):
f"""Flash one of {', '.join(TYPES)}"""
enforce_wrap()
@ -37,8 +37,8 @@ def cmd_boot(type):
urllib.request.urlretrieve(f'https://github.com/dreemurrs-embedded/Jumpdrive/releases/download/{JUMPDRIVE_VERSION}/{file}', path)
elif type == LK2ND:
path = dump_lk2nd(loop_device + 'p1')
elif type == BOOTIMG:
path = dump_bootimg(loop_device + 'p1')
elif type == ABOOT:
path = dump_aboot(loop_device + 'p1')
else:
raise Exception(f'Unknown boot image type {type}')
fastboot_erase_dtbo()

View file

@ -1,7 +1,7 @@
FASTBOOT = 'fastboot'
FLASH_PARTS = {
'ROOTFS': 'rootfs',
'BOOTIMG': 'bootimg',
'ABOOT': 'aboot',
'LK2ND': 'lk2nd',
'QHYPSTUB': 'qhypstub',
}

View file

@ -8,10 +8,10 @@ import tempfile
from constants import FLASH_PARTS, LOCATIONS
from chroot import get_device_chroot
from fastboot import fastboot_flash
from image import shrink_fs, losetup_rootfs_image, dump_bootimg, dump_lk2nd, dump_qhypstub, get_device_and_flavour, get_image_name, get_image_path
from image import shrink_fs, losetup_rootfs_image, dump_aboot, dump_lk2nd, dump_qhypstub, get_device_and_flavour, get_image_name, get_image_path
from wrapper import enforce_wrap
BOOTIMG = FLASH_PARTS['BOOTIMG']
ABOOT = FLASH_PARTS['ABOOT']
LK2ND = FLASH_PARTS['LK2ND']
QHYPSTUB = FLASH_PARTS['QHYPSTUB']
ROOTFS = FLASH_PARTS['ROOTFS']
@ -86,8 +86,8 @@ def cmd_flash(what, location):
raise Exception(f'Failed to flash {minimal_image_path} to {path}')
else:
loop_device = losetup_rootfs_image(device_image_path, sector_size)
if what == BOOTIMG:
path = dump_bootimg(f'{loop_device}p1')
if what == ABOOT:
path = dump_aboot(f'{loop_device}p1')
fastboot_flash('boot', path)
elif what == LK2ND:
path = dump_lk2nd(f'{loop_device}p1')

View file

@ -171,7 +171,7 @@ def mount_chroot(rootfs_source: str, boot_src: str, chroot: Chroot):
chroot.mount(boot_src, '/boot', options=['defaults'])
def dump_bootimg(image_path: str) -> str:
def dump_aboot(image_path: str) -> str:
path = '/tmp/aboot.img'
result = subprocess.run([
'debugfs',