violet: Flash dummy super image if needed

* Needed because stock does not use dynamic partitions so
  there's no existing metadata that could be used

Change-Id: Icbc828389465f3d4681ca8e4c3adec782540752e
This commit is contained in:
Linux4
2023-03-12 17:41:56 +07:00
committed by Joker-V2
parent 3d3e117d5d
commit 2a5c2e2b66
4 changed files with 49 additions and 5 deletions

View File

@@ -10,6 +10,19 @@ LOCAL_PATH := $(call my-dir)
ifeq ($(TARGET_DEVICE),violet)
include $(call all-makefiles-under,$(LOCAL_PATH))
LPFLASH := $(HOST_OUT_EXECUTABLES)/lpflash$(HOST_EXECUTABLE_SUFFIX)
INSTALLED_SUPERIMAGE_DUMMY_TARGET := $(PRODUCT_OUT)/super_dummy.img
$(INSTALLED_SUPERIMAGE_DUMMY_TARGET): $(PRODUCT_OUT)/super_empty.img $(LPFLASH)
$(call pretty,"Target dummy super image: $@")
$(hide) touch $@
$(hide) $(LPFLASH) $@ $(PRODUCT_OUT)/super_empty.img
.PHONY: super_dummyimage
super_dummyimage: $(INSTALLED_SUPERIMAGE_DUMMY_TARGET)
INSTALLED_RADIOIMAGE_TARGET += $(INSTALLED_SUPERIMAGE_DUMMY_TARGET)
include $(CLEAR_VARS)
# A/B builds require us to create the mount points at compile time.

View File

@@ -0,0 +1,20 @@
#!/system/bin/sh
#
# Copyright (C) 2021 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
SUPER="/dev/block/by-name/system"
mkdir /tmp/super-mnt
mount $SUPER /tmp/super-mnt 2>/dev/null
if [ "$?" = "0" ]; then
echo "Detected stock /system in super partition, flashing super_dummy.img!"
umount /tmp/super-mnt
dd if=/tmp/super_dummy.img of=$SUPER
fi
rmdir /tmp/super-mnt

View File

@@ -40,6 +40,9 @@ TARGET_SCREEN_WIDTH := 1080
PRODUCT_USE_DYNAMIC_PARTITIONS := true
PRODUCT_RETROFIT_DYNAMIC_PARTITIONS := true
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/flash_super_dummy.sh:install/bin/flash_super_dummy.sh
# Permissions
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml \

View File

@@ -17,6 +17,14 @@
import common
import re
def FullOTA_InstallBegin(info):
input_zip = info.input_zip
AddImage(info, "RADIO", input_zip, "super_dummy.img", "/tmp/super_dummy.img");
info.script.AppendExtra('package_extract_file("install/bin/flash_super_dummy.sh", "/tmp/flash_super_dummy.sh");')
info.script.AppendExtra('set_metadata("/tmp/flash_super_dummy.sh", "uid", 0, "gid", 0, "mode", 0755);')
info.script.AppendExtra('run_program("/tmp/flash_super_dummy.sh");')
return
def FullOTA_InstallEnd(info):
input_zip = info.input_zip
OTA_UpdateFirmware(info)
@@ -62,9 +70,9 @@ def OTA_UpdateFirmware(info):
info.script.AppendExtra('package_extract_file("install/firmware-update/xbl.elf", "/dev/block/bootdevice/by-name/xblbak");')
info.script.AppendExtra('package_extract_file("install/firmware-update/xbl_config.elf", "/dev/block/bootdevice/by-name/xbl_config");')
def AddImage(info, input_zip, basename, dest):
def AddImage(info, dir, input_zip, basename, dest):
name = basename
path = "IMAGES/" + name
path = dir + "/" + name
if path not in input_zip.namelist():
return
@@ -74,7 +82,7 @@ def AddImage(info, input_zip, basename, dest):
info.script.AppendExtra('package_extract_file("%s", "%s");' % (name, dest))
def OTA_InstallEnd(info, input_zip):
AddImage(info, input_zip, "vbmeta.img", "/dev/block/bootdevice/by-name/vbmeta")
AddImage(info, input_zip, "vbmeta_system.img", "/dev/block/bootdevice/by-name/vbmeta_system")
AddImage(info, input_zip, "dtbo.img", "/dev/block/bootdevice/by-name/dtbo")
AddImage(info, "IMAGES", input_zip, "vbmeta.img", "/dev/block/bootdevice/by-name/vbmeta")
AddImage(info, "IMAGES", input_zip, "vbmeta_system.img", "/dev/block/bootdevice/by-name/vbmeta_system")
AddImage(info, "IMAGES", input_zip, "dtbo.img", "/dev/block/bootdevice/by-name/dtbo")
return