高通c6490 为过GMS,修改fingerprint属性

首先通过adb查看含有fingerprint的属性值

lahaina:/ $ getprop | grep finger
[ro.bootimage.build.fingerprint]: [qti/lahaina/lahaina:11/RKQ1.230607.001/asw06281258:user/test-keys]
[ro.build.fingerprint]: [qti/lahaina/lahaina:13/PB-A6490ACT-Android13-EDP-/V1.3-20240628:user/test-keys]
[ro.build.version.preview_sdk_fingerprint]: [REL]
[ro.odm.build.fingerprint]: [qti/lahaina/lahaina:11/RKQ1.230607.001/asw06281258:user/test-keys]
[ro.product.build.fingerprint]: [qti/qssi/qssi:13/PB-A6490ACT-Android13-EDP-/asw06281034:user/test-keys]
[ro.system.build.fingerprint]: [qti/qssi/qssi:13/PB-A6490ACT-Android13-EDP-/asw06281034:user/test-keys]
[ro.system_ext.build.fingerprint]: [qti/qssi/qssi:13/PB-A6490ACT-Android13-EDP-/asw06281034:user/test-keys]
[ro.vendor.build.fingerprint]: [qti/lahaina/lahaina:11/RKQ1.230607.001/asw06281258:user/test-keys]
lahaina:/ $

 修改方法如下:

Index: QCM6490_apps_qssi13/LINUX/android/build/make/core/Makefile
===================================================================
--- QCM6490_apps_qssi13/LINUX/android/build/make/core/Makefile	(revision 2959)
+++ QCM6490_apps_qssi13/LINUX/android/build/make/core/Makefile	(working copy)
@@ -15,6 +15,24 @@
 ODM_DLKM_NOTICE_DEPS :=
 SYSTEM_DLKM_NOTICE_DEPS :=
 
+MY_BRAND="xxx"
+MY_MANUFACTURER="xxxxxx"
+MY_DEVICE="xxxx"
+MY_MODEL="xxxxxx"
+MY_NAME="xxxxxxx"
+MY_BUILD_NUMBER="20240726"
+
+define generate-common-build-props
+	PRODUCT_BRAND="$(MY_BRAND)" \
+	TARGET_DEVICE="$(MY_DEVICE)" \
+	PRODUCT_MANUFACTURER="$(MY_MANUFACTURER)" \
+	PRODUCT_MODEL="$(MY_MODEL)" \
+	TARGET_PRODUCT="$(MY_NAME)" \
+	BF_BUILD_NUMBER="$(MY_BUILD_NUMBER)" \
+	$(call generate-common-build-props-with-product-vars-set,$(1),$(2))
+endef
+
+
 # -----------------------------------------------------------------
 # Define rules to copy PRODUCT_COPY_FILES defined by the product.
 # PRODUCT_COPY_FILES contains words like <source file>:<dest file>[:<owner>].
Index: QCM6490_apps_qssi13/LINUX/android/build/make/core/sysprop.mk
===================================================================
--- QCM6490_apps_qssi13/LINUX/android/build/make/core/sysprop.mk	(revision 2959)
+++ QCM6490_apps_qssi13/LINUX/android/build/make/core/sysprop.mk	(working copy)
@@ -41,11 +41,15 @@
         echo "ro.product.$(1).model=$(PRODUCT_SYSTEM_MODEL)" >> $(2);\
         echo "ro.product.$(1).name=$(PRODUCT_SYSTEM_NAME)" >> $(2);\
       ,\
-        echo "ro.product.$(1).brand=$(PRODUCT_BRAND)" >> $(2);\
-        echo "ro.product.$(1).device=$(TARGET_DEVICE)" >> $(2);\
-        echo "ro.product.$(1).manufacturer=$(PRODUCT_MANUFACTURER)" >> $(2);\
-        echo "ro.product.$(1).model=$(PRODUCT_MODEL)" >> $(2);\
-        echo "ro.product.$(1).name=$(TARGET_PRODUCT)" >> $(2);\
+        echo "ro.product.$(1).brand=$(MY_BRAND)" >> $(2);\
+        echo "ro.product.$(1).device=$(MY_DEVICE)" >> $(2);\
+        echo "ro.product.$(1).manufacturer=$(MY_MANUFACTURER)" >> $(2);\
+        echo "ro.product.$(1).model=$(MY_MODEL)" >> $(2);\
+        echo "ro.product.$(1).name=$(MY_NAME)" >> $(2);\
+        echo "ro.product.brand=$(MY_BRAND)" >> $(2);\
+        echo "ro.product.name=$(MY_NAME)" >> $(2);\
+        echo "ro.product.device=$(MY_DEVICE)" >> $(2);\
+        echo "ro.build.version.incremental=$(MY_BUILD_NUMBER)" >> $(2);\
+        echo "ro.com.google.clientidbase=android-ragentek" >> $(2);\ )\ $(if $(filter true,$(ZYGOTE_FORCE_64)),\ $(if $(filter vendor,$(1)),\ @@ -157,7 +161,7 @@ # Both of these tags will be removed and replaced with "release-keys" # when the target-files is signed in a post-build step. ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey) -BUILD_KEYS := test-keys +BUILD_KEYS := release-keys else BUILD_KEYS := dev-keys endif @@ -172,7 +176,7 @@ else BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE)) endif - BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) + BUILD_FINGERPRINT := $(MY_BRAND)/$(MY_NAME)/$(MY_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(MY_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) endif # unset it for safety. BF_BUILD_NUMBER := Index: LINUX/android/build/make/core/Makefile =================================================================== --- LINUX/android/build/make/core/Makefile (revision 2959) +++ LINUX/android/build/make/core/Makefile (working copy) @@ -4,6 +4,27 @@ # intermedites-dir-for LOCAL_PATH := $(BUILD_SYSTEM) +MY_BRAND="xxxxx" +MY_MANUFACTURER="xxxx" +MY_DEVICE="xxxx" +MY_MODEL="xxxxxx" +MY_NAME="xxxxx" +MY_BUILD_NUMBER="20240726" +MY_PLATFORM_VERSION="13" +MY_BUILD_ID="PB-A6490ACT" + +define generate-common-build-props + PRODUCT_BRAND="$(MY_BRAND)" \ + TARGET_DEVICE="$(MY_DEVICE)" \ + PRODUCT_MANUFACTURER="$(MY_MANUFACTURER)" \ + PRODUCT_MODEL="$(MY_MODEL)" \ + TARGET_PRODUCT="$(MY_NAME)" \ + BF_BUILD_NUMBER="$(MY_BUILD_NUMBER)" \ + PLATFORM_VERSION="$(MY_PLATFORM_VERSION)" \ + BUILD_ID="$(MY_BUILD_ID)" \ + $(call generate-common-build-props-with-product-vars-set,$(1),$(2)) +endef + # ----------------------------------------------------------------- # Define rules to copy PRODUCT_COPY_FILES defined by the product. # PRODUCT_COPY_FILES contains words like <source file>:<dest file>[:<owner>]. @@ -324,7 +345,7 @@ # Both of these tags will be removed and replaced with "release-keys" # when the target-files is signed in a post-build step. ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey) -BUILD_KEYS := test-keys +BUILD_KEYS := release-keys else BUILD_KEYS := dev-keys endif @@ -342,7 +363,7 @@ else BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE)) endif - BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) + BUILD_FINGERPRINT := $(MY_BRAND)/$(MY_NAME)/$(MY_DEVICE):$(MY_PLATFORM_VERSION)/$(MY_BUILD_ID)/$(MY_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) endif # unset it for safety. BF_BUILD_NUMBER := @@ -536,7 +557,7 @@ echo "#" >> $@; $(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@ $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@ - $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@ + $(hide) echo ro.bootimage.build.fingerprint="xxxx/xxxx/xxx:13/PB-A6490ACT/20240726:user/release-keys">>$@ $(hide) echo "#" >> $@; \ echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \ echo "#" >> $@;

 

最后通过adb可以看到属性修改符合客户需求的了。

 

注意,高通的SDK是有两套android源码的。然后ro.build.fingerprint 在QCM6490_apps_qssi13/LINUX/android/system/core/init/property_service.cpp 下面有设置。代码如下,build.prop 中添加ro.build.fingerprint属性,init会根据上面的系统属性自动拼接

所以我直接在sysprop.mk里面添加了ro.product.brand 等属性。

 

// If the ro.build.fingerprint property has not been set, derive it from constituent pieces
static void property_derive_build_fingerprint() {
    std::string build_fingerprint = GetProperty("ro.build.fingerprint", "");
    if (!build_fingerprint.empty()) {
        return;
    }

    build_fingerprint = ConstructBuildFingerprint(false /* legacy fingerprint */);
    LOG(INFO) << "Setting property '" << FINGERPRINT_PROP << "' to '" << build_fingerprint << "'";

    std::string error;
    uint32_t res = PropertySet(FINGERPRINT_PROP, build_fingerprint, &error);
    if (res != PROP_SUCCESS) {
        LOG(ERROR) << "Error setting property '" << FINGERPRINT_PROP << "': err=" << res << " ("
                   << error << ")";
    }
}


static std::string ConstructBuildFingerprint(bool legacy) {
    const std::string UNKNOWN = "unknown";
    std::string build_fingerprint = GetProperty("ro.product.brand", UNKNOWN);
    build_fingerprint += '/';
    build_fingerprint += GetProperty("ro.product.name", UNKNOWN);
    build_fingerprint += '/';
    build_fingerprint += GetProperty("ro.product.device", UNKNOWN);
    build_fingerprint += ':';
    build_fingerprint += GetProperty("ro.build.version.release_or_codename", UNKNOWN);
    build_fingerprint += '/';

    std::string build_id =
            legacy ? GetProperty(LEGACY_ID_PROP, UNKNOWN) : GetProperty(ID_PROP, UNKNOWN);
    build_fingerprint += build_id;
    build_fingerprint += '/';
    build_fingerprint += GetProperty("ro.build.version.incremental", UNKNOWN);
    build_fingerprint += ':';
    build_fingerprint += GetProperty("ro.build.type", UNKNOWN);
    build_fingerprint += '/';
    build_fingerprint += GetProperty("ro.build.tags", UNKNOWN);

    return build_fingerprint;
}

 

posted @ 2024-08-02 14:08  simple雨  阅读(244)  评论(0编辑  收藏  举报