mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-23 05:35:44 -05:00
constants: remove BOOT_STRATEGIES, read from deviceinfo
This commit is contained in:
parent
c50166051d
commit
a3d60e768a
2 changed files with 6 additions and 10 deletions
8
boot.py
8
boot.py
|
@ -5,7 +5,7 @@ import click
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from config import config
|
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 exec.file import makedir
|
||||||
from fastboot import fastboot_boot, fastboot_erase_dtbo
|
from fastboot import fastboot_boot, fastboot_erase_dtbo
|
||||||
from image import get_device_name, losetup_rootfs_image, get_image_path, dump_aboot, dump_lk2nd
|
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:
|
if not sector_size:
|
||||||
raise Exception(f"Device {device.name} has no flash_pagesize specified")
|
raise Exception(f"Device {device.name} has no flash_pagesize specified")
|
||||||
image_path = get_image_path(device, flavour)
|
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 strategy == FASTBOOT:
|
||||||
if type == JUMPDRIVE:
|
if type == JUMPDRIVE:
|
||||||
|
@ -51,3 +53,5 @@ def cmd_boot(type: str, profile: Optional[str] = None):
|
||||||
raise Exception(f'Unknown boot image type {type}')
|
raise Exception(f'Unknown boot image type {type}')
|
||||||
fastboot_erase_dtbo()
|
fastboot_erase_dtbo()
|
||||||
fastboot_boot(path)
|
fastboot_boot(path)
|
||||||
|
else:
|
||||||
|
raise Exception(f"Unknown flash strategy {strategy} for device {device.name}")
|
||||||
|
|
|
@ -14,14 +14,6 @@ LOCATIONS = [EMMC, MICROSD]
|
||||||
JUMPDRIVE = 'jumpdrive'
|
JUMPDRIVE = 'jumpdrive'
|
||||||
JUMPDRIVE_VERSION = '0.8'
|
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_LOCAL_PACKAGES: list[str] = [
|
||||||
'base-kupfer',
|
'base-kupfer',
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Reference in a new issue