IPMI Whitelisted commands for FRU and OEM repositories

The IPMI whitelisted commands for phosphor-ipmi-fru and openpower-ipmi-oem
is added. Only the IPMI whitelisted listed commands are allowed in
restricted mode.

The IPMI whitelisted commands for phosphor-ipmi-fru and openpower-ipmi-oem
are added as native packages and host-ipmid depends on those.

Change-Id: Ic4184773656567eb0dffa30ef29f8bc3ced3aff4
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-whitelist-native.bb b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-whitelist-native.bb
new file mode 100644
index 0000000..30c2443
--- /dev/null
+++ b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-whitelist-native.bb
@@ -0,0 +1,6 @@
+SUMMARY = "Whitelisted IPMI FRU Parser commands"
+DESCRIPTION = "Whitelisted IPMI FRU Parser commands for OpenBMC"
+
+inherit obmc-phosphor-license
+inherit native
+inherit phosphor-ipmi-host-whitelist
\ No newline at end of file
diff --git a/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-whitelist/phosphor-ipmi-fru-whitelist-native.conf b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-whitelist/phosphor-ipmi-fru-whitelist-native.conf
new file mode 100644
index 0000000..365c3d9
--- /dev/null
+++ b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-whitelist/phosphor-ipmi-fru-whitelist-native.conf
@@ -0,0 +1,2 @@
+#<NetFn>:<Command>
+0x0A:0x12    //<Storage>:<Write FRU Data>
\ No newline at end of file
diff --git a/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb b/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
index 0b8b93d..285df5e 100644
--- a/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
+++ b/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
@@ -13,6 +13,7 @@
 DEPENDS += "phosphor-logging"
 DEPENDS += "phosphor-mapper"
 DEPENDS += "autoconf-archive-native"
+DEPENDS += "packagegroup-obmc-ipmid-providers"
 RDEPENDS_${PN}-dev += "phosphor-logging"
 RDEPENDS_${PN}-dev += "phosphor-mapper-dev"
 RDEPENDS_${PN} += "clear-once"
@@ -24,6 +25,15 @@
 
 SRCREV = "513d68e11cf6d392e847d39c743ce54ccaa0ebf7"
 
+# Setup IPMI Whitelist Conf files
+WHITELIST_CONF = " \
+        ${STAGING_ETCDIR_NATIVE}/phosphor-ipmi-host/*.conf \
+        ${S}/host-ipmid-whitelist.conf \
+        "
+EXTRA_OECONF = " \
+        WHITELIST_CONF="${WHITELIST_CONF}" \
+        "
+
 S = "${WORKDIR}/git"
 
 HOSTIPMI_PROVIDER_LIBRARY += "libapphandler.so"
diff --git a/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bb b/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bb
index 6f82cb3..476ad50 100644
--- a/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bb
+++ b/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bb
@@ -7,7 +7,12 @@
 PROVIDES = "${PACKAGES}"
 PACKAGES = "${PN}-libs"
 
+OBMC_IPMID_PROVIDERS = "phosphor-ipmi-fru"
+
 SUMMARY_${PN}-libs = "Extra providers for ipmid."
-RDEPENDS_${PN}-libs = " \
-        phosphor-ipmi-fru \
-        "
+RDEPENDS_${PN}-libs = "${OBMC_IPMID_PROVIDERS}"
+
+WHITELIST_FORMAT = "{0}-whitelist-native"
+OBMC_IPMID_WHITELISTS = "${@compose_list(d, 'WHITELIST_FORMAT', 'OBMC_IPMID_PROVIDERS')}"
+
+DEPENDS_append = "${OBMC_IPMID_WHITELISTS}"
\ No newline at end of file