Skip to content

Commit

Permalink
ginkgo: upstream
Browse files Browse the repository at this point in the history
Change-Id: I001ae78088eb46a456f239ff2df7af93d4f12c99
  • Loading branch information
erwinabs committed Nov 18, 2023
1 parent 2df3ce4 commit 261a78a
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 11 deletions.
9 changes: 6 additions & 3 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4

# System as root
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
TARGET_RECOVERY_FSTAB := $(DEVICE_PATH)/recovery/root/system/etc/recovery.fstab

# File systems
TARGET_USERIMAGES_USE_EXT4 := true
Expand All @@ -98,6 +99,10 @@ TARGET_USERIMAGES_USE_F2FS := true
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
TARGET_COPY_OUT_VENDOR := vendor

# Init
TARGET_INIT_VENDOR_LIB := //$(DEVICE_PATH):libinit_ginkgo
TARGET_RECOVERY_DEVICE_MODULES := libinit_ginkgo

# Encryption
BOARD_USES_METADATA_PARTITION := true
TW_INCLUDE_FBE_METADATA_DECRYPT := true
Expand All @@ -112,7 +117,7 @@ PRODUCT_ENFORCE_VINTF_MANIFEST := true

# Extras
BOARD_SUPPRESS_SECURE_ERASE := true
#TARGET_SYSTEM_PROP += $(DEVICE_PATH)/system.prop
TARGET_SYSTEM_PROP += $(DEVICE_PATH)/system.prop

# Recovery
BOARD_HAS_LARGE_FILESYSTEM := true
Expand All @@ -124,8 +129,6 @@ TW_RECOVERY_ADDITIONAL_RELINK_LIBRARY_FILES += \
$(TARGET_OUT_SHARED_LIBRARIES)/libion.so \
$(TARGET_OUT_SHARED_LIBRARIES)/libxml2.so

#TARGET_RECOVERY_FSTAB := $(DEVICE_PATH)/recovery/root/system/etc/recovery.fstab

# TWRP specific build flags
RECOVERY_SDCARD_ON_DATA := true
TARGET_RECOVERY_QCOM_RTC_FIX := true
Expand Down
14 changes: 14 additions & 0 deletions init/Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cc_library_static {
name: "libinit_ginkgo",
header_libs: [
"libbase_headers",
],
cflags: [
"-Wall",
],
static_libs: [
"libbase",
],
srcs: ["init_ginkgo.cpp"],
recovery_available: true,
}
60 changes: 60 additions & 0 deletions init/init_ginkgo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <android-base/properties.h>
#include <android-base/logging.h>
#include <sys/resource.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>

using android::base::GetProperty;

void property_override(const std::string& name, const std::string& value)
{
size_t valuelen = value.size();

prop_info* pi = (prop_info*) __system_property_find(name.c_str());
if (pi != nullptr) {
__system_property_update(pi, value.c_str(), valuelen);
}
else {
int rc = __system_property_add(name.c_str(), name.size(), value.c_str(), valuelen);
if (rc < 0) {
LOG(ERROR) << "property_set(\"" << name << "\", \"" << value << "\") failed: "
<< "__system_property_add failed";
}
}
}

void model_property_override(const std::string& device, const std::string& model)
{
property_override("ro.product.device", device);
property_override("ro.product.odm.device", device);
property_override("ro.product.system.device", device);
property_override("ro.product.vendor.device", device);
property_override("ro.build.product", device);
property_override("ro.product.name", device);
property_override("ro.product.odm.name", device);
property_override("ro.product.product.device", device);
property_override("ro.product.product.name", device);
property_override("ro.product.system.name", device);
property_override("ro.product.system_ext.device", device);
property_override("ro.product.system_ext.name", device);
property_override("ro.product.vendor.name", device);
property_override("ro.product.model", model);
property_override("ro.product.odm.model", model);
property_override("ro.product.system.model", model);
property_override("ro.product.vendor.model", model);
property_override("ro.product.product.model", model);
property_override("ro.product.system_ext.model", model);
}

void vendor_load_properties() {
const std::string hwc = GetProperty("ro.boot.hwc", "");
if (hwc == "Global_B") {
model_property_override("willow", "Redmi Note 8T");
} else if (hwc == "Global") {
model_property_override("ginkgo", "Redmi Note 8");
}
}
3 changes: 3 additions & 0 deletions recovery/root/init.recovery.qcom.rc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

import /init.recovery.qcom_decrypt.rc

on init
setprop prepdecrypt.loglevel 2

on fs
wait /dev/block/platform/soc/${ro.boot.bootdevice}
symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
Expand Down
11 changes: 11 additions & 0 deletions recovery/root/system/etc/vintf/manifest/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<manifest version="1.0" type="framework">
<hal>
<name>android.hidl.allocator</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IAllocator</name>
<instance>ashmem</instance>
</interface>
</hal>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<manifest version="1.0" type="framework"> <hal
format="aidl">
<name>android.system.keystore2</name> <interface>
<name>IKeystoreService</name>
<manifest version="1.0" type="framework">
<hal format="aidl">
<name>android.system.keystore2</name>
<interface>
<name>IKeystoreService</name>
<instance>default</instance>
</interface> </hal>
</interface>
</hal>
</manifest>
11 changes: 11 additions & 0 deletions recovery/root/system/etc/vintf/manifest/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<manifest version="1.0" type="framework">
<hal>
<name>android.system.suspend</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>ISystemSuspend</name>
<instance>default</instance>
</interface>
</hal>
</manifest>
3 changes: 0 additions & 3 deletions system.prop
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ persist.sys.isUsbOtgEnabled=true
vendor.gatekeeper.disable_spu=true
ro.boot.avb_version=1.0
ro.boot.vbmeta.avb_version=1.0
ro.crypto.volume.filenames_mode=aes-256-cts
ro.crypto.allow_encrypt_override=true
ro.hardware.keystore_desede=true

0 comments on commit 261a78a

Please sign in to comment.