1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-04-20 01:30:58 +01:00

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.
This commit is contained in:
Sergei Trofimov 2018-05-09 17:19:07 +01:00 committed by Marc Bonnici
parent 181862b7ff
commit 30eb98b275

View File

@ -171,6 +171,9 @@ def get_target_info(target):
# best effort -- debugfs might not be mounted # best effort -- debugfs might not be mounted
pass 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): for i, name in enumerate(target.cpuinfo.cpu_names):
cpu = CpuInfo() cpu = CpuInfo()
cpu.id = i cpu.id = i
@ -215,6 +218,7 @@ class TargetInfo(object):
instance.cpus = [CpuInfo.from_pod(c) for c in pod['cpus']] instance.cpus = [CpuInfo.from_pod(c) for c in pod['cpus']]
instance.os = pod['os'] instance.os = pod['os']
instance.os_version = pod['os_version'] instance.os_version = pod['os_version']
instance.hostid = pod['hostid']
instance.abi = pod['abi'] instance.abi = pod['abi']
instance.is_rooted = pod['is_rooted'] instance.is_rooted = pod['is_rooted']
instance.kernel_version = kernel_version_from_pod(pod) instance.kernel_version = kernel_version_from_pod(pod)
@ -233,6 +237,7 @@ class TargetInfo(object):
self.cpus = [] self.cpus = []
self.os = None self.os = None
self.os_version = None self.os_version = None
self.hostid = None
self.abi = None self.abi = None
self.is_rooted = None self.is_rooted = None
self.kernel_version = None self.kernel_version = None
@ -246,6 +251,7 @@ class TargetInfo(object):
pod['cpus'] = [c.to_pod() for c in self.cpus] pod['cpus'] = [c.to_pod() for c in self.cpus]
pod['os'] = self.os pod['os'] = self.os
pod['os_version'] = self.os_version pod['os_version'] = self.os_version
pod['hostid'] = self.hostid
pod['abi'] = self.abi pod['abi'] = self.abi
pod['is_rooted'] = self.is_rooted pod['is_rooted'] = self.is_rooted
pod['kernel_release'] = self.kernel_version.release pod['kernel_release'] = self.kernel_version.release