From a3d60e768a2f71093d9c8d6d4d2441817c0914f8 Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Tue, 27 Sep 2022 03:53:01 +0200 Subject: [PATCH] constants: remove BOOT_STRATEGIES, read from deviceinfo --- boot.py | 8 ++++++-- constants.py | 8 -------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/boot.py b/boot.py index 02177c2..65bc687 100644 --- a/boot.py +++ b/boot.py @@ -5,7 +5,7 @@ import click from typing import Optional from config import config -from constants import BOOT_STRATEGIES, FLASH_PARTS, FASTBOOT, JUMPDRIVE, JUMPDRIVE_VERSION +from constants import FLASH_PARTS, FASTBOOT, JUMPDRIVE, JUMPDRIVE_VERSION from exec.file import makedir from fastboot import fastboot_boot, fastboot_erase_dtbo from image import get_device_name, losetup_rootfs_image, get_image_path, dump_aboot, dump_lk2nd @@ -32,7 +32,9 @@ def cmd_boot(type: str, profile: Optional[str] = None): if not sector_size: raise Exception(f"Device {device.name} has no flash_pagesize specified") image_path = get_image_path(device, flavour) - strategy = BOOT_STRATEGIES[device] + strategy = deviceinfo.flash_method + if not strategy: + raise Exception(f"Device {device.name} has no flash strategy defined") if strategy == FASTBOOT: if type == JUMPDRIVE: @@ -51,3 +53,5 @@ def cmd_boot(type: str, profile: Optional[str] = None): raise Exception(f'Unknown boot image type {type}') fastboot_erase_dtbo() fastboot_boot(path) + else: + raise Exception(f"Unknown flash strategy {strategy} for device {device.name}") diff --git a/constants.py b/constants.py index 27236be..de87f04 100644 --- a/constants.py +++ b/constants.py @@ -14,14 +14,6 @@ LOCATIONS = [EMMC, MICROSD] JUMPDRIVE = 'jumpdrive' JUMPDRIVE_VERSION = '0.8' -BOOT_STRATEGIES: dict[str, str] = { - 'oneplus-enchilada': FASTBOOT, - 'oneplus-fajita': FASTBOOT, - 'xiaomi-beryllium-ebbg': FASTBOOT, - 'xiaomi-beryllium-tianma': FASTBOOT, - 'bq-paella': FASTBOOT, -} - BASE_LOCAL_PACKAGES: list[str] = [ 'base-kupfer', ]