Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc942ef4 authored by Sahil Sonar's avatar Sahil Sonar 💬
Browse files

Merge branch '1701-a16-retrofit' into 'a16'

flash: factory.common: Add early A-only/AB image flashing

See merge request !250
parents 10512fda 4961782b
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -144,6 +144,11 @@ switch_to_fastbootd() {
  echo "INFO: Device is now in fastbootd mode."
}

# Flash (or manipulate) relevant early partitions
flash_device_early() {
  flash_images_ab_or_abort "${sn}" "${FLASH_AB_EARLY_IMGS}"
  flash_images_a_or_abort  "${sn}" "${FLASH_A_EARLY_IMGS}"
}

# Flash (or manipulate) relevant partitions
flash_device() {
@@ -156,6 +161,12 @@ then
  "${FASTBOOT_BIN}" -s "${sn}" reboot bootloader
fi

if [ "${WIPE_SUPER}" = "true" ]
then
  echo "INFO: Wiping super image"
  "${FASTBOOT_BIN}" -s "${sn}" wipe-super "${IMAGES_DIR}/super_empty.img"
fi

  flash_images_ab_or_abort "${sn}" "${FLASH_AB_IMGS}"
  flash_images_a_or_abort  "${sn}" "${FLASH_A_IMGS}"

@@ -177,9 +188,12 @@ flash_factory() {
  USE_FASTBOOTD="${USE_FASTBOOTD:-false}"
  FW_BL_RESTART="${FW_BL_RESTART:-false}"
  CLEAN_FLASH="${CLEAN_FLASH:-false}"
  WIPE_SUPER="${WIPE_SUPER:-false}"
  VIRTUAL_AB="${VIRTUAL_AB:-false}"
  FLASH_AB_FW_IMGS="${FLASH_AB_FW_IMGS:-}"
  FLASH_A_FW_IMGS="${FLASH_A_FW_IMGS:-}"
  FLASH_AB_EARLY_IMGS="${FLASH_AB_EARLY_IMGS:-}"
  FLASH_A_EARLY_IMGS="${FLASH_A_EARLY_IMGS:-}"
  FLASH_AB_IMGS="${FLASH_AB_IMGS:-}"
  FLASH_A_IMGS="${FLASH_A_IMGS:-}"
  ERASE_IMGS="${ERASE_IMGS:-}"
@@ -190,13 +204,16 @@ flash_factory() {
  # If only one device is found $sn will store its serial number
  find_device

  # Check if the device is properly unlocked
  check_unlock_status

  # Retrofit devices require flashing boot before switching to fastbootd
  flash_device_early

  if [ "${USE_FASTBOOTD}" = "true" ]; then
    switch_to_fastbootd
  fi

  # Check if the device is properly unlocked
  check_unlock_status

  # Flash the device
  flash_device