code-update: simplified interface for code update
Current code update invocation flow has no explicit interface but
rather rely on discovery of a new file in tmpfs. This makes it more
involved and hard to use. The intent of this proposal is to define an
explicit interface which is easy to use. For more details, please refer
to design doc -
https://gerrit.openbmc.org/c/openbmc/docs/+/65739
Change-Id: I65f186856c446cf7d957591c213054dc2d5c3861
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/gen/xyz/openbmc_project/Software/Update/meson.build b/gen/xyz/openbmc_project/Software/Update/meson.build
new file mode 100644
index 0000000..5d88c41
--- /dev/null
+++ b/gen/xyz/openbmc_project/Software/Update/meson.build
@@ -0,0 +1,15 @@
+# Generated file; do not modify.
+generated_sources += custom_target(
+ 'xyz/openbmc_project/Software/Update__cpp'.underscorify(),
+ input: [ '../../../../../yaml/xyz/openbmc_project/Software/Update.interface.yaml', ],
+ output: [ 'error.cpp', 'error.hpp', 'common.hpp', 'server.cpp', 'server.hpp', 'aserver.hpp', 'client.hpp', ],
+ depend_files: sdbusplusplus_depfiles,
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'cpp',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../../yaml',
+ 'xyz/openbmc_project/Software/Update',
+ ],
+)
+
diff --git a/gen/xyz/openbmc_project/Software/meson.build b/gen/xyz/openbmc_project/Software/meson.build
index 8608c9f..11845c6 100644
--- a/gen/xyz/openbmc_project/Software/meson.build
+++ b/gen/xyz/openbmc_project/Software/meson.build
@@ -149,6 +149,21 @@
],
)
+subdir('Update')
+generated_others += custom_target(
+ 'xyz/openbmc_project/Software/Update__markdown'.underscorify(),
+ input: [ '../../../../yaml/xyz/openbmc_project/Software/Update.interface.yaml', ],
+ output: [ 'Update.md' ],
+ depend_files: sdbusplusplus_depfiles,
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'markdown',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../yaml',
+ 'xyz/openbmc_project/Software/Update',
+ ],
+)
+
subdir('Version')
generated_others += custom_target(
'xyz/openbmc_project/Software/Version__markdown'.underscorify(),
diff --git a/yaml/xyz/openbmc_project/Software/Update.errors.yaml b/yaml/xyz/openbmc_project/Software/Update.errors.yaml
new file mode 100644
index 0000000..039577b
--- /dev/null
+++ b/yaml/xyz/openbmc_project/Software/Update.errors.yaml
@@ -0,0 +1,10 @@
+- name: Incompatible
+ description: >
+ The system component has a software version which is incompatible with the
+ new image or the image is not meant for the system component.
+- name: InvalidSignature
+ description: >
+ Signature Validation failed for the supplied firmware image.
+- name: InvalidImage
+ description: >
+ The supplied firmware image is invalid or corrupt.
diff --git a/yaml/xyz/openbmc_project/Software/Update.interface.yaml b/yaml/xyz/openbmc_project/Software/Update.interface.yaml
new file mode 100644
index 0000000..5bd388f
--- /dev/null
+++ b/yaml/xyz/openbmc_project/Software/Update.interface.yaml
@@ -0,0 +1,51 @@
+description: >
+ Interface for performing code update for various firwmare entities.
+
+methods:
+ - name: StartUpdate
+ description: >
+ Start a firware update to be performed asynchronously.
+ parameters:
+ - name: Image
+ type: unixfd
+ description: >
+ This property indicates the file descriptor of the firmware
+ image.
+ - name: ApplyTime
+ type: enum[self.ApplyTimes]
+ description: >
+ This property indicates when the software image update should be
+ applied.
+ returns:
+ - name: ObjectPath
+ type: object_path
+ description: >
+ The object path where the image interfaces will be hosted, for
+ example, required interfaces such as ActivationStatus,
+ ActivationProgress and optional interfaces such as Version.
+ errors:
+ - xyz.openbmc_project.Software.Update.Error.Incompatible
+ - xyz.openbmc_project.Software.Update.Error.InvalidSignature
+ - xyz.openbmc_project.Software.Update.Error.InvalidImage
+ - xyz.openbmc_project.Common.Error.Unavailable
+
+properties:
+ - name: AllowedApplyTimes
+ type: set[enum[self.ApplyTimes]]
+ description: >
+ This property indicates the apply times allowed for this device.
+ flags:
+ - readonly
+
+enumerations:
+ - name: ApplyTimes
+ description: >
+ The possible values of this property indicate when the newly updated
+ software image will be activated.
+ values:
+ - name: Immediate
+ description: >
+ Apply immediately.
+ - name: OnReset
+ description: >
+ Apply on reset of device being updated.
diff --git a/yaml/xyz/openbmc_project/Software/Version.interface.yaml b/yaml/xyz/openbmc_project/Software/Version.interface.yaml
index ee4d5ac..58fe2b5 100644
--- a/yaml/xyz/openbmc_project/Software/Version.interface.yaml
+++ b/yaml/xyz/openbmc_project/Software/Version.interface.yaml
@@ -42,3 +42,24 @@
- name: PSU
description: >
The version is a version for a PSU.
+
+associations:
+ - name: running
+ description: >
+ This indicates the current running version for the associated
+ inventory item.
+ reverse_names:
+ - ran_on
+ required_endpoint_interfaces:
+ - xyz.openbmc_project.Inventory.Item
+ - name: activating
+ description: >
+ This indicates the current activated version for the associated
+ inventory item. There can be more than one active version associated
+ with the same inventory item. In such a case, RedundancyPriority
+ interface will help to decide the correct priority order for the
+ active version transition to running.
+ reverse_names:
+ - activated_on
+ required_endpoint_interfaces:
+ - xyz.openbmc_project.Inventory.Item