Initial D-Bus interface

This sets up an initial D-Bus interface without any real functionality.
It doesn't interact with any storage hardware yet.

The yaml files are included temporarily until the
phosphor-dbus-interfaces review is complete:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/48636

The .clang-tidy file has been removed because clang-tidy can't filter
out the generated files. It should be re-enabled when we no longer need
to generate the D-Bus sources in this repo.

Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: If704e69ef7225257efc7c865424df4421999f62d
Signed-off-by: John Wedig <johnwedig@google.com>
diff --git a/.clang-tidy b/.clang-tidy
deleted file mode 100644
index 87789a8..0000000
--- a/.clang-tidy
+++ /dev/null
@@ -1,261 +0,0 @@
-Checks: '
--*,
-readability-identifier-naming,
-clang-analyzer-apiModeling.StdCLibraryFunctions,
-clang-analyzer-apiModeling.TrustNonnull,
-clang-analyzer-apiModeling.google.GTest,
-clang-analyzer-apiModeling.llvm.CastValue,
-clang-analyzer-apiModeling.llvm.ReturnValue,
-clang-analyzer-core.CallAndMessageModeling,
-clang-analyzer-core.DivideZero,
-clang-analyzer-core.DynamicTypePropagation,
-clang-analyzer-core.NonNullParamChecker,
-clang-analyzer-core.NonnilStringConstants,
-clang-analyzer-core.NullDereference,
-clang-analyzer-core.StackAddrEscapeBase,
-clang-analyzer-core.StackAddressEscape,
-clang-analyzer-core.UndefinedBinaryOperatorResult,
-clang-analyzer-core.VLASize,
-clang-analyzer-core.builtin.BuiltinFunctions,
-clang-analyzer-core.builtin.NoReturnFunctions,
-clang-analyzer-core.uninitialized.ArraySubscript,
-clang-analyzer-core.uninitialized.Assign,
-clang-analyzer-core.uninitialized.Branch,
-clang-analyzer-core.uninitialized.CapturedBlockVariable,
-clang-analyzer-core.uninitialized.UndefReturn,
-clang-analyzer-cplusplus.InnerPointer,
-clang-analyzer-cplusplus.Move,
-clang-analyzer-cplusplus.NewDelete,
-clang-analyzer-cplusplus.NewDeleteLeaks,
-clang-analyzer-cplusplus.PlacementNew,
-clang-analyzer-cplusplus.PureVirtualCall,
-clang-analyzer-cplusplus.SelfAssignment,
-clang-analyzer-cplusplus.SmartPtrModeling,
-clang-analyzer-cplusplus.VirtualCallModeling,
-clang-analyzer-deadcode.DeadStores,
-clang-analyzer-fuchsia.HandleChecker,
-clang-analyzer-nullability.NullPassedToNonnull,
-clang-analyzer-nullability.NullReturnedFromNonnull,
-clang-analyzer-nullability.NullabilityBase,
-clang-analyzer-nullability.NullableDereferenced,
-clang-analyzer-nullability.NullablePassedToNonnull,
-clang-analyzer-nullability.NullableReturnedFromNonnull,
-clang-analyzer-optin.cplusplus.UninitializedObject,
-clang-analyzer-optin.cplusplus.VirtualCall,
-clang-analyzer-optin.mpi.MPI-Checker,
-clang-analyzer-optin.osx.OSObjectCStyleCast,
-clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,
-clang-analyzer-optin.osx.cocoa.localizability.NonLocalizedStringChecker,
-clang-analyzer-optin.performance.GCDAntipattern,
-clang-analyzer-optin.performance.Padding,
-clang-analyzer-optin.portability.UnixAPI,
-clang-analyzer-osx.API,
-clang-analyzer-osx.MIG,
-clang-analyzer-osx.NSOrCFErrorDerefChecker,
-clang-analyzer-osx.NumberObjectConversion,
-clang-analyzer-osx.OSObjectRetainCount,
-clang-analyzer-osx.ObjCProperty,
-clang-analyzer-osx.SecKeychainAPI,
-clang-analyzer-osx.cocoa.AtSync,
-clang-analyzer-osx.cocoa.AutoreleaseWrite,
-clang-analyzer-osx.cocoa.ClassRelease,
-clang-analyzer-osx.cocoa.Dealloc,
-clang-analyzer-osx.cocoa.IncompatibleMethodTypes,
-clang-analyzer-osx.cocoa.Loops,
-clang-analyzer-osx.cocoa.MissingSuperCall,
-clang-analyzer-osx.cocoa.NSAutoreleasePool,
-clang-analyzer-osx.cocoa.NSError,
-clang-analyzer-osx.cocoa.NilArg,
-clang-analyzer-osx.cocoa.NonNilReturnValue,
-clang-analyzer-osx.cocoa.ObjCGenerics,
-clang-analyzer-osx.cocoa.RetainCount,
-clang-analyzer-osx.cocoa.RetainCountBase,
-clang-analyzer-osx.cocoa.RunLoopAutoreleaseLeak,
-clang-analyzer-osx.cocoa.SelfInit,
-clang-analyzer-osx.cocoa.SuperDealloc,
-clang-analyzer-osx.cocoa.UnusedIvars,
-clang-analyzer-osx.cocoa.VariadicMethodTypes,
-clang-analyzer-osx.coreFoundation.CFError,
-clang-analyzer-osx.coreFoundation.CFNumber,
-clang-analyzer-osx.coreFoundation.CFRetainRelease,
-clang-analyzer-osx.coreFoundation.containers.OutOfBounds,
-clang-analyzer-osx.coreFoundation.containers.PointerSizedValues,
-clang-analyzer-security.FloatLoopCounter,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-clang-analyzer-security.insecureAPI.SecuritySyntaxChecker,
-clang-analyzer-security.insecureAPI.UncheckedReturn,
-clang-analyzer-security.insecureAPI.bcmp,
-clang-analyzer-security.insecureAPI.bcopy,
-clang-analyzer-security.insecureAPI.bzero,
-clang-analyzer-security.insecureAPI.decodeValueOfObjCType,
-clang-analyzer-security.insecureAPI.getpw,
-clang-analyzer-security.insecureAPI.gets,
-clang-analyzer-security.insecureAPI.mkstemp,
-clang-analyzer-security.insecureAPI.mktemp,
-clang-analyzer-security.insecureAPI.rand,
-clang-analyzer-security.insecureAPI.strcpy,
-clang-analyzer-security.insecureAPI.vfork,
-clang-analyzer-unix.API,
-clang-analyzer-unix.DynamicMemoryModeling,
-clang-analyzer-unix.Malloc,
-clang-analyzer-unix.MallocSizeof,
-clang-analyzer-unix.MismatchedDeallocator,
-clang-analyzer-unix.Vfork,
-clang-analyzer-unix.cstring.BadSizeArg,
-clang-analyzer-unix.cstring.CStringModeling,
-clang-analyzer-unix.cstring.NullArg,
-clang-analyzer-valist.CopyToSelf,
-clang-analyzer-valist.Uninitialized,
-clang-analyzer-valist.Unterminated,
-clang-analyzer-valist.ValistBase,
-clang-analyzer-webkit.NoUncountedMemberChecker,
-clang-analyzer-webkit.RefCntblBaseVirtualDtor,
-cert-con36-c,
-cert-con54-cpp,
-cert-dcl03-c,
-cert-dcl16-c,
-cert-dcl21-cpp,
-cert-dcl37-c,
-cert-dcl50-cpp,
-cert-dcl51-cpp,
-cert-dcl54-cpp,
-cert-dcl58-cpp,
-cert-dcl59-cpp,
-cert-env33-c,
-cert-err09-cpp,
-cert-err34-c,
-cert-err52-cpp,
-cert-err60-cpp,
-cert-err61-cpp,
-cert-fio38-c,
-cert-flp30-c,
-cert-mem57-cpp,
-cert-msc30-c,
-cert-msc32-c,
-cert-msc50-cpp,
-cert-msc51-cpp,
-cert-oop11-cpp,
-cert-oop54-cpp,
-cert-oop57-cpp,
-modernize-avoid-bind,
-modernize-deprecated-headers,
-modernize-deprecated-ios-base-aliases,
-modernize-loop-convert,
-modernize-make-shared,
-modernize-make-unique,
-modernize-raw-string-literal,
-modernize-replace-auto-ptr,
-modernize-replace-random-shuffle,
-modernize-return-braced-init-list,
-modernize-shrink-to-fit,
-modernize-unary-static-assert,
-modernize-use-bool-literals,
-modernize-use-default-member-init,
-modernize-use-emplace,
-modernize-use-equals-default,
-modernize-use-equals-delete,
-modernize-use-noexcept,
-modernize-use-nullptr,
-modernize-use-override,
-modernize-use-transparent-functors,
-modernize-use-uncaught-exceptions,
-modernize-use-using,
-bugprone-argument-comment,
-bugprone-assert-side-effect,
-bugprone-bad-signal-to-kill-thread,
-bugprone-bool-pointer-implicit-conversion,
-bugprone-branch-clone,
-bugprone-copy-constructor-init,
-bugprone-dangling-handle,
-bugprone-dynamic-static-initializers,
-bugprone-fold-init-type,
-bugprone-forward-declaration-namespace,
-bugprone-forwarding-reference-overload,
-bugprone-inaccurate-erase,
-bugprone-incorrect-roundings,
-bugprone-infinite-loop,
-bugprone-integer-division,
-bugprone-lambda-function-name,
-bugprone-macro-parentheses,
-bugprone-macro-repeated-side-effects,
-bugprone-misplaced-operator-in-strlen-in-alloc,
-bugprone-misplaced-pointer-arithmetic-in-alloc,
-bugprone-misplaced-widening-cast,
-bugprone-multiple-statement-macro,
-bugprone-narrowing-conversions,
-bugprone-no-escape,
-bugprone-not-null-terminated-result,
-bugprone-parent-virtual-call,
-bugprone-posix-return,
-bugprone-reserved-identifier,
-bugprone-signed-char-misuse,
-bugprone-sizeof-container,
-bugprone-sizeof-expression,
-bugprone-spuriously-wake-up-functions,
-bugprone-string-constructor,
-bugprone-string-integer-assignment,
-bugprone-string-literal-with-embedded-nul,
-bugprone-suspicious-enum-usage,
-bugprone-suspicious-include,
-bugprone-suspicious-memset-usage,
-bugprone-suspicious-missing-comma,
-bugprone-suspicious-semicolon,
-bugprone-suspicious-string-compare,
-bugprone-swapped-arguments,
-bugprone-terminating-continue,
-bugprone-throw-keyword-missing,
-bugprone-too-small-loop-variable,
-bugprone-undefined-memory-manipulation,
-bugprone-undelegated-constructor,
-bugprone-unhandled-self-assignment,
-bugprone-unused-raii,
-bugprone-unused-return-value,
-bugprone-use-after-move,
-bugprone-virtual-near-miss,
-misc-misplaced-const,
-misc-no-recursion,
-misc-redundant-expression,
-misc-static-assert,
-misc-throw-by-value-catch-by-reference,
-misc-unconventional-assign-operator,
-misc-uniqueptr-reset-release,
-misc-unused-using-decls,
-performance-for-range-copy,
-performance-implicit-conversion-in-loop,
-performance-inefficient-algorithm,
-performance-inefficient-vector-operation,
-performance-move-constructor-init,
-performance-no-automatic-move,
-performance-trivially-destructible,
-performance-type-promotion-in-math-fn,
-performance-unnecessary-copy-initialization,
-performance-faster-string-find,
-performance-for-range-copy,
-performance-implicit-conversion-in-loop,
-performance-inefficient-algorithm,
-performance-inefficient-string-concatenation,
-performance-inefficient-vector-operation,
-performance-move-const-arg,
-performance-move-constructor-init,
-performance-no-automatic-move,
-performance-noexcept-move-constructor,
-performance-trivially-destructible,
-performance-type-promotion-in-math-fn,
-performance-unnecessary-copy-initialization,
-performance-unnecessary-value-param,
-readability-identifier-naming,
-readability-braces-around-statements,
-readability-const-return-type,
-readability-delete-null-pointer,
-readability-deleted-default,
-readability-else-after-return'
-
-WarningsAsErrors: '*'
-HeaderFilterRegex: '^((?!linux).)*$'
-CheckOptions:
-  - { key: readability-identifier-naming.ClassCase,     value: CamelCase  }
-  - { key: readability-identifier-naming.VariableCase,  value: camelBack }
-  - { key: readability-identifier-naming.FunctionCase,  value: camelBack }
-  - { key: readability-identifier-naming.ParameterCase, value: camelBack }
-  - { key: readability-identifier-naming.NamespaceCase, value: lower_case }
-  - { key: readability-identifier-naming.StructCase,    value: CamelCase  }
diff --git a/include/estoraged.hpp b/include/estoraged.hpp
new file mode 100644
index 0000000..557c490
--- /dev/null
+++ b/include/estoraged.hpp
@@ -0,0 +1,69 @@
+#pragma once
+
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/exception.hpp>
+#include <sdbusplus/server/object.hpp>
+#include <xyz/openbmc_project/eStoraged/server.hpp>
+
+#include <string>
+#include <vector>
+
+namespace estoraged
+{
+using eStoragedInherit = sdbusplus::server::object_t<
+    sdbusplus::xyz::openbmc_project::server::eStoraged>;
+
+/** @class eStoraged
+ *  @brief eStoraged object to manage a LUKS encrypted storage device.
+ */
+class eStoraged : eStoragedInherit
+{
+  public:
+    eStoraged(sdbusplus::bus::bus& bus, const char* path,
+              const std::string& devPath, const std::string& containerName) :
+        eStoragedInherit(bus, path),
+        devPath(devPath), containerName(containerName)
+    {}
+
+    /** @brief Format the LUKS encrypted device and create empty filesystem.
+     *
+     *  @param[in] password - password to set for the LUKS device.
+     */
+    void format(std::vector<uint8_t> password) override;
+
+    /** @brief Erase the contents of the storage device.
+     *
+     *  @param[in] password - password for the LUKS device.
+     *  @param[in] eraseType - type of erase operation.
+     */
+    void erase(std::vector<uint8_t> password, EraseMethod eraseType) override;
+
+    /** @brief Unmount filesystem and lock the LUKS device.
+     *
+     *  @param[in] password - password for the LUKS device.
+     */
+    void lock(std::vector<uint8_t> password) override;
+
+    /** @brief Unlock device and mount the filesystem.
+     *
+     *  @param[in] password - password for the LUKS device.
+     */
+    void unlock(std::vector<uint8_t> password) override;
+
+    /** @brief Change the password for the LUKS device.
+     *
+     *  @param[in] oldPassword - old password for the LUKS device.
+     *  @param[in] newPassword - new password for the LUKS device.
+     */
+    void changePassword(std::vector<uint8_t> oldPassword,
+                        std::vector<uint8_t> newPassword) override;
+
+  private:
+    /* Full path of the device file, e.g. /dev/mmcblk0 */
+    std::string devPath;
+
+    /* Name of the LUKS container. */
+    std::string containerName;
+};
+
+} // namespace estoraged
diff --git a/include/meson.build b/include/meson.build
new file mode 100644
index 0000000..da1595b
--- /dev/null
+++ b/include/meson.build
@@ -0,0 +1,2 @@
+
+eStoraged_headers = include_directories('.')
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..224b6ea
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,17 @@
+project(
+    'eStoraged',
+    'cpp',
+    version: '1.0', meson_version: '>=0.57.0',
+    default_options: [
+      'warning_level=3',
+      'werror=true',
+      'cpp_std=c++20',
+    ],
+)
+
+eStoraged_root = meson.current_source_dir()
+eStoraged_dbus_headers = include_directories('.')
+
+subdir('include/')
+subdir('xyz/openbmc_project/eStoraged')
+subdir('src/')
diff --git a/src/estoraged.cpp b/src/estoraged.cpp
new file mode 100644
index 0000000..ae29bdd
--- /dev/null
+++ b/src/estoraged.cpp
@@ -0,0 +1,35 @@
+
+#include "estoraged.hpp"
+
+#include <iostream>
+#include <vector>
+
+namespace estoraged
+{
+
+void eStoraged::format(std::vector<uint8_t>)
+{
+    std::cerr << "Formatting encrypted eMMC" << std::endl;
+}
+
+void eStoraged::erase(std::vector<uint8_t>, EraseMethod)
+{
+    std::cerr << "Erasing encrypted eMMC" << std::endl;
+}
+
+void eStoraged::lock(std::vector<uint8_t>)
+{
+    std::cerr << "Locking encrypted eMMC" << std::endl;
+}
+
+void eStoraged::unlock(std::vector<uint8_t>)
+{
+    std::cerr << "Unlocking encrypted eMMC" << std::endl;
+}
+
+void eStoraged::changePassword(std::vector<uint8_t>, std::vector<uint8_t>)
+{
+    std::cerr << "Changing password for encrypted eMMC" << std::endl;
+}
+
+} // namespace estoraged
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..9fa9c7d
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,82 @@
+
+#include "estoraged.hpp"
+
+#include <unistd.h>
+
+#include <sdbusplus/bus.hpp>
+
+#include <filesystem>
+#include <iostream>
+#include <string>
+
+static void usage(std::string_view name)
+{
+    std::cerr
+        << "Usage: " << name
+        << "eStorageD service on the BMC\n\n"
+           "  -b <blockDevice>          The phyical encrypted device\n"
+           "                            If omitted, default is /dev/mmcblk0.\n"
+           "  -c <containerName>        The LUKS container name to be created\n"
+           "                            If omitted, default is luks-<devName>";
+}
+
+int main(int argc, char** argv)
+{
+
+    std::string physicalBlockDev = "/dev/mmcblk0";
+    std::string containerBlockDev;
+    int opt;
+    while ((opt = getopt(argc, argv, "b:c:")) != -1)
+    {
+        switch (opt)
+        {
+            case 'b':
+                physicalBlockDev = optarg;
+                break;
+            case 'c':
+                containerBlockDev = optarg;
+                break;
+            default:
+                usage(argv[0]);
+                exit(EXIT_FAILURE);
+        }
+    }
+
+    /* Get the filename of the device (without "/dev/"). */
+    auto deviceName =
+        std::filesystem::path(physicalBlockDev).filename().string();
+
+    /* If containerName arg wasn't provided, create one based on deviceName. */
+    if (containerBlockDev.empty())
+    {
+        containerBlockDev = "luks-" + deviceName;
+    }
+
+    /* DBus path location to place the object. */
+    std::string path = "/xyz/openbmc_project/storage/" + deviceName;
+
+    /*
+     * Create a new bus and affix an object manager for the subtree path we
+     * intend to place objects at.
+     */
+    auto b = sdbusplus::bus::new_default();
+    sdbusplus::server::manager_t m{b, path.c_str()};
+
+    /* Reserve the dbus service name. */
+    std::string busName = "xyz.openbmc_project.eStoraged." + deviceName;
+    b.request_name(busName.c_str());
+
+    /* Create an eStoraged object. */
+    estoraged::eStoraged esObject{b, path.c_str(), physicalBlockDev,
+                                  containerBlockDev};
+
+    std::cerr << "eStoraged has started" << std::endl;
+
+    while (true)
+    {
+        b.wait();
+        b.process_discard();
+    }
+
+    return 1;
+}
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..046ae47
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,27 @@
+
+libeStoraged_deps = [
+  dependency('sdbusplus'),
+  eStoraged_dbus,
+]
+
+libeStoraged_lib = static_library(
+  'eStoraged-lib',
+  'estoraged.cpp',
+  include_directories : eStoraged_headers,
+  implicit_include_directories: false,
+  dependencies: libeStoraged_deps,
+)
+
+libeStoraged = declare_dependency(
+  dependencies: libeStoraged_deps,
+  include_directories: eStoraged_headers,
+  link_with: libeStoraged_lib)
+
+executable(
+  'eStoraged',
+  'main.cpp',
+  implicit_include_directories: false,
+  dependencies: libeStoraged,
+  install: true,
+  install_dir: get_option('bindir')
+)
diff --git a/xyz/openbmc_project/eStoraged.errors.yaml b/xyz/openbmc_project/eStoraged.errors.yaml
new file mode 100644
index 0000000..d3d3603
--- /dev/null
+++ b/xyz/openbmc_project/eStoraged.errors.yaml
@@ -0,0 +1,6 @@
+- name: EncryptionError
+  description: One of the cryptsetup APIs returned an error.
+- name: EraseError
+  description: Failed to erase the device.
+- name: FilesystemError
+  description: Failed to create or remove the filesystem.
diff --git a/xyz/openbmc_project/eStoraged.interface.yaml b/xyz/openbmc_project/eStoraged.interface.yaml
new file mode 100644
index 0000000..29bb85c
--- /dev/null
+++ b/xyz/openbmc_project/eStoraged.interface.yaml
@@ -0,0 +1,110 @@
+description: >
+    D-bus interface to manage an encrypted storage device.
+
+methods:
+    - name: Format
+      description: >
+        Format the encrypted device and create an ext4 filesystem.
+      parameters:
+        - name: Password
+          type: array[byte]
+          description: >
+            Array of bytes to use as the LUKS password.
+      errors:
+        - self.Error.EncryptionError
+        - self.Error.FilesystemError
+
+    - name: Erase
+      description: >
+        Erase the contents of the device.
+      parameters:
+        - name: Password
+          type: array[byte]
+          description: >
+            Array of bytes to use as the LUKS password.
+        - name: EraseType
+          type: enum[self.EraseMethod]
+          description: >
+            Describes what type of erase is done.
+      errors:
+        - self.Error.EncryptionError
+        - self.Error.EraseError
+        - self.Error.FilesystemError
+
+    - name: Lock
+      description: >
+        Unmount the filesystem, lock the device, and remove sensitive data
+        (e.g. volume key) from memory.
+      parameters:
+        - name: Password
+          type: array[byte]
+          description: >
+            Array of bytes to use as the LUKS password.
+      errors:
+        - self.Error.EncryptionError
+        - self.Error.FilesystemError
+
+    - name: Unlock
+      description: >
+        Activate the device and mount the filesystem.
+      parameters:
+        - name: Password
+          type: array[byte]
+          description: >
+            Array of bytes to use as the LUKS password.
+      errors:
+        - self.Error.EncryptionError
+        - self.Error.FilesystemError
+
+    - name: ChangePassword
+      description: >
+        Change the password that unlocks the storage device.
+      parameters:
+        - name: OldPassword
+          type: array[byte]
+          description: >
+            Array of bytes for the old LUKS password.
+        - name: NewPassword
+          type: array[byte]
+          description: >
+            Array of bytes to use as the LUKS password.
+      errors:
+        - self.Error.EncryptionError
+
+properties:
+    - name: Locked
+      type: boolean
+      default: false
+      description: >
+        Indicates whether the device is locked.
+
+enumerations:
+    - name: EraseMethod
+      description: >
+        Indicates which erase method/step is being requested.
+      values:
+        - name: CryptoErase
+          description: >
+            Destroys the encryption key slots, preventing decyrption.
+        - name: VerifyGeometry
+          description: >
+            Confirms a set percent of the disk is accessible.
+        - name: LogicalOverWrite
+          description: >
+            Overwrites the disk with a reproducible incompressible pattern.
+        - name: LogicalVerify
+          description: >
+            Verifies a reproducible pattern has been written to the disk.
+        - name: VendorSanitize
+          description: >
+            Uses the sanitization provided by the device firmware.
+        - name: ZeroOverWrite
+          description: >
+            Writes zeros over the whole disk.
+        - name: ZeroVerify
+          description: >
+            Verifies the the entire disk has been zeroed.
+        - name: SecuredLocked
+          description: >
+            Locks the disk to prevent data being written to it.
+
diff --git a/xyz/openbmc_project/eStoraged/meson.build b/xyz/openbmc_project/eStoraged/meson.build
new file mode 100644
index 0000000..d143487
--- /dev/null
+++ b/xyz/openbmc_project/eStoraged/meson.build
@@ -0,0 +1,74 @@
+sdbuspp_prog = find_program('sdbus++')
+
+domain = 'xyz.openbmc_project.eStoraged'
+if_yaml_file = files('../eStoraged.interface.yaml')
+
+if_cpp = custom_target(
+  'server.cpp',
+  output: 'server.cpp',
+  input: if_yaml_file,
+  capture: true,
+  command: [sdbuspp_prog, '-r', eStoraged_root, 'interface', 'server-cpp', domain])
+
+if_hpp = custom_target(
+  'server.hpp',
+  output: 'server.hpp',
+  input: if_yaml_file,
+  capture: true,
+  command: [sdbuspp_prog, '-r', eStoraged_root, 'interface', 'server-header', domain],
+  install: true,
+  install_dir: get_option('includedir') / 'xyz/openbmc_project/eStoraged')
+
+error_yaml_file = files('../eStoraged.errors.yaml')
+
+error_cpp = custom_target(
+  'error.cpp',
+  output: 'error.cpp',
+  input: error_yaml_file,
+  capture: true,
+  command: [sdbuspp_prog, '-r', eStoraged_root, 'error', 'exception-cpp', domain])
+
+error_hpp = custom_target(
+  'error.hpp',
+  output: 'error.hpp',
+  input: error_yaml_file,
+  capture: true,
+  command: [sdbuspp_prog, '-r', eStoraged_root, 'error', 'exception-header', domain],
+  install: true,
+  install_dir: get_option('includedir') / 'xyz/openbmc_project/eStoraged')
+
+eStoraged_dbus_deps = [
+  dependency('sdbusplus'),
+]
+
+eStoraged_dbus_lib = library(
+  'eStoraged-dbus',
+  if_cpp,
+  if_hpp,
+  error_cpp,
+  error_hpp,
+  implicit_include_directories: false,
+  include_directories: eStoraged_dbus_headers,
+  version: meson.project_version(),
+  dependencies: eStoraged_dbus_deps,
+  install: true)
+
+eStoraged_dbus = declare_dependency(
+  dependencies: eStoraged_dbus_deps,
+  sources: [if_hpp, error_hpp],
+  include_directories: eStoraged_dbus_headers,
+  link_with: eStoraged_dbus_lib)
+
+eStoraged_dbus_reqs = []
+foreach dep : eStoraged_dbus_deps
+  if dep.type_name() == 'pkgconfig'
+    eStoraged_dbus_reqs += dep
+  endif
+endforeach
+
+import('pkgconfig').generate(
+  name: 'eStoraged-dbus',
+  description: 'eStoraged DBus Bindings',
+  version: meson.project_version(),
+  libraries: eStoraged_dbus,
+  requires: eStoraged_dbus_reqs)