From 30eb98b2759d67f2c9fd996378a1888e429c9563 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Wed, 9 May 2018 17:19:07 +0100 Subject: [PATCH] fw/target: add hostid to TargetInfo Add hostid entry, as reported by busybox's hostid applet, to TargetInfo. This is intended to be a "unique 32-bit identifier for the current machine". In practice, it may not be set, or may be generated from something like an IP address, so may not be unique. However, if set, it is still likely to be more unique than kernel/os version so may be worth recording. --- wa/framework/target/info.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wa/framework/target/info.py b/wa/framework/target/info.py index e1bb84bc..8390d17a 100644 --- a/wa/framework/target/info.py +++ b/wa/framework/target/info.py @@ -171,6 +171,9 @@ def get_target_info(target): # best effort -- debugfs might not be mounted pass + hostid_string = target.execute('{} hostid'.format(target.busybox)).strip() + info.hostid = int(hostid_string, 16) + for i, name in enumerate(target.cpuinfo.cpu_names): cpu = CpuInfo() cpu.id = i @@ -215,6 +218,7 @@ class TargetInfo(object): instance.cpus = [CpuInfo.from_pod(c) for c in pod['cpus']] instance.os = pod['os'] instance.os_version = pod['os_version'] + instance.hostid = pod['hostid'] instance.abi = pod['abi'] instance.is_rooted = pod['is_rooted'] instance.kernel_version = kernel_version_from_pod(pod) @@ -233,6 +237,7 @@ class TargetInfo(object): self.cpus = [] self.os = None self.os_version = None + self.hostid = None self.abi = None self.is_rooted = None self.kernel_version = None @@ -246,6 +251,7 @@ class TargetInfo(object): pod['cpus'] = [c.to_pod() for c in self.cpus] pod['os'] = self.os pod['os_version'] = self.os_version + pod['hostid'] = self.hostid pod['abi'] = self.abi pod['is_rooted'] = self.is_rooted pod['kernel_release'] = self.kernel_version.release