Add TARGET_MACHINE to /etc/os-release
Joseph Reynolds
jrey at linux.vnet.ibm.com
Thu Dec 6 10:13:28 AEDT 2018
On 2018-11-29 17:03, Joseph Reynolds wrote:
>> Proposal to add TARGET_MACHINE to /etc/os-release.
>
I've pushed this as gerrit review 16489.
https://gerrit.openbmc-project.xyz/#/c/openbmc/meta-phosphor/+/16489/
> I've updated the details to explain why the uname command is
> unsatisfactory.
>
>>
>> In an OpenBMC image, the /etc/os-release file includes distro
>> ("openbmc-phosphor") and version (as a git tag or commit). It should
>> also include the target machine (the kind of device the OpenBMC image
>> is intended to control). This is needed to be able to track the image
>> back to its source code: the distro and version indicate the exact
>> source code that was used, and the target says which Bitbake layer
>> configuration within that source was used.
>>
>> Specifically, the proposal is to enhance the generated /etc/os-release
>> file with a new OS identification parameter like:
>> OPENBMC_PHOSPHOR_TARGET_MACHINE="$MACHINE"
>> where MACHINE="romulus", for example.
>>
>> All OpenBMC images should define this os-release parameter.
>>
>> Proposed documentation for the new parameter: Indicates the kind of
>> device the OpenBMC image is targeted to control.
>>
>> ... tl;dr details follow ... snip ...
>>
>> The MACHINE is set in
>> openbmc/meta-COMPANY/meta-MACHINE/conf/local.conf.sample. (This is
>> where TEMPLATECONF points to.)
>>
>> Note MACHINE is not guaranteed to be unique across all future OpenBMC
>> layer configurations. (That is, meta-A/meta-B/conf and
>> meta-X/meta-Y/conf may inadvertently define the same machine name.) To
>> guarantee uniqueness, an alternate design would be to use the
>> TEMPLATECONF parameter as the machine name. (e.g.,
>> "meta-ibm/meta-romulus/conf"). In practice I expect the machine name
>> will be sufficiently unique: as unique as different company's brand
>> and model names.
>>
>> The manual page for "os-release" recommends prefixing the parameter
>> name with the distro name. Ideas for alternate parameter names are
>> welcome ("OBMC_TARGET_HARDWARE" anyone?). See
>> https://www.freedesktop.org/software/systemd/man/os-release.html.
>>
>> The os-release file is generated by the os-release.bb and
>> os-release.bbappend recipes.
>
> The "uname" command options -m (machine) and -i (hardware platform)
> will continue to refer to the BMC and not its host.
More information about the openbmc
mailing list