|
@@ -92,6 +92,7 @@ int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length)
|
|
|
char cpuid_str[cpuid_length * 2 + 1];
|
|
|
u64 serialno;
|
|
|
char serialno_str[17];
|
|
|
+ const char *oldid;
|
|
|
int i;
|
|
|
|
|
|
memset(cpuid_str, 0, sizeof(cpuid_str));
|
|
@@ -113,8 +114,16 @@ int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length)
|
|
|
serialno |= (u64)crc32_no_comp(serialno, high, 8) << 32;
|
|
|
snprintf(serialno_str, sizeof(serialno_str), "%016llx", serialno);
|
|
|
|
|
|
+ oldid = env_get("cpuid#");
|
|
|
+ if (oldid && strcmp(oldid, cpuid_str) != 0)
|
|
|
+ printf("cpuid: value %s present in env does not match hardware %s\n",
|
|
|
+ oldid, cpuid_str);
|
|
|
+
|
|
|
env_set("cpuid#", cpuid_str);
|
|
|
- env_set("serial#", serialno_str);
|
|
|
+
|
|
|
+ /* Only generate serial# when none is set yet */
|
|
|
+ if (!env_get("serial#"))
|
|
|
+ env_set("serial#", serialno_str);
|
|
|
|
|
|
return 0;
|
|
|
}
|