From 8623bbe4d4a187018cc3c265aaca5fa05b78d13b Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Fri, 9 Mar 2018 00:04:00 -0500 Subject: Convert obmc-ubi-fs to a distro feature As with MRW the use of the UBI image scheme is distro policy. Convert the existing machine feature to a distro feature. Enable the new distro feature on the systems that use it(Witherspoon). Add a distro override and fix-up MF checks to use this override instead for improved readability. Tested: Built a Witherspoon image and validated image Change-Id: I8ab03115bbfc2ecc77cff5c9eb8628903ae88051 Signed-off-by: Brad Bishop --- .../common/recipes-core/systemd/systemd_%.bbappend | 22 ++++++++++++++++------ .../conf/distro/openbmc-witherspoon.conf | 1 + .../meta-witherspoon/conf/machine/witherspoon.conf | 2 +- meta-phosphor/classes/image_types_phosphor.bbclass | 6 +++--- meta-phosphor/classes/obmc-phosphor-image.bbclass | 3 ++- .../common/recipes-bsp/u-boot/u-boot-aspeed.inc | 18 +++++++++--------- .../recipes-core/base-files/base-files_%.bbappend | 4 ++-- .../common/recipes-core/systemd/systemd_%.bbappend | 8 ++++---- .../common/recipes-kernel/linux/linux-obmc.inc | 2 +- .../dump/phosphor-debug-collector.bb | 4 ++-- .../packagegroups/packagegroup-obmc-apps.bb | 15 +++++++++------ meta-phosphor/conf/distro/include/phosphor-ubi.inc | 2 ++ .../conf/machine/include/obmc-bsp-common.inc | 6 +++--- 13 files changed, 55 insertions(+), 38 deletions(-) create mode 100644 meta-phosphor/conf/distro/include/phosphor-ubi.inc diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-core/systemd/systemd_%.bbappend b/meta-openbmc-machines/meta-openpower/common/recipes-core/systemd/systemd_%.bbappend index 134bab5f1..751940467 100644 --- a/meta-openbmc-machines/meta-openpower/common/recipes-core/systemd/systemd_%.bbappend +++ b/meta-openbmc-machines/meta-openpower/common/recipes-core/systemd/systemd_%.bbappend @@ -1,13 +1,23 @@ SRC_URI += "${@mf_enabled(d, 'openpower-ubi-fs', 'file://software.conf')}" -do_install_append() { - +install_tmpfile() { # /tmp/images is the software image upload directory. # It should not be deleted since it is watched by the Image Manager for - # new images. Don't install software.conf if obmc-ubi-fs is set since - # the bbappend in the meta-phosphor layer already installs if - # obmc-ubi-fs is set. - if ${@bb.utils.contains('MACHINE_FEATURES', 'openpower-ubi-fs', 'true', 'false', d)} && ! ${@bb.utils.contains('MACHINE_FEATURES', 'obmc-ubi-fs', 'true', 'false', d)}; then + # new images. + + if ${@bb.utils.contains('MACHINE_FEATURES', 'openpower-ubi-fs', 'true', 'false', d)}; then install -m 0644 ${WORKDIR}/software.conf ${D}${exec_prefix}/lib/tmpfiles.d/ fi } + +install_tmpfile_df-obmc-ubi-fs() { + # Don't install software.conf if obmc-ubi-fs is set since + # the bbappend in the meta-phosphor layer already installs + # if obmc-ubi-fs is set. + + : +} + +do_install_append() { + install_tmpfile +} diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/distro/openbmc-witherspoon.conf b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/distro/openbmc-witherspoon.conf index 27bf88123..c00930a2b 100644 --- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/distro/openbmc-witherspoon.conf +++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/distro/openbmc-witherspoon.conf @@ -1,2 +1,3 @@ require conf/distro/include/phosphor-base.inc +require conf/distro/include/phosphor-ubi.inc require conf/distro/include/openpower-mrw.inc diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf index 5d2f25f90..13831a731 100644 --- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf +++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf @@ -3,7 +3,7 @@ KERNEL_DEVICETREE = "${KMACHINE}-bmc-opp-${MACHINE}.dtb" UBOOT_MACHINE = "ast_g5_ncsi_config" -OBMC_MACHINE_FEATURES += "obmc-ubi-fs openpower-ubi-fs" +OBMC_MACHINE_FEATURES += "openpower-ubi-fs" OBMC_POWER_SUPPLY_INSTANCES = "0 1" diff --git a/meta-phosphor/classes/image_types_phosphor.bbclass b/meta-phosphor/classes/image_types_phosphor.bbclass index 35843ea81..78ff846f6 100644 --- a/meta-phosphor/classes/image_types_phosphor.bbclass +++ b/meta-phosphor/classes/image_types_phosphor.bbclass @@ -19,9 +19,9 @@ inherit image_version # The reference BMC software update implementation. # Image composition -FLASH_KERNEL_IMAGE ?= "${@bb.utils.contains('MACHINE_FEATURES', \ - 'obmc-ubi-fs', 'fitImage-${MACHINE}.bin', \ - 'fitImage-${INITRAMFS_IMAGE}-${MACHINE}.bin', d)}" +FLASH_KERNEL_IMAGE ?= "fitImage-${INITRAMFS_IMAGE}-${MACHINE}.bin" +FLASH_KERNEL_IMAGE_df-obmc-ubi-fs ?= "fitImage-${MACHINE}.bin" + IMAGE_BASETYPE ?= "squashfs-xz" OVERLAY_BASETYPE ?= "jffs2" FLASH_UBI_BASETYPE ?= "${IMAGE_BASETYPE}" diff --git a/meta-phosphor/classes/obmc-phosphor-image.bbclass b/meta-phosphor/classes/obmc-phosphor-image.bbclass index 5391257fa..95a915261 100644 --- a/meta-phosphor/classes/obmc-phosphor-image.bbclass +++ b/meta-phosphor/classes/obmc-phosphor-image.bbclass @@ -76,9 +76,10 @@ IMAGE_FEATURES += " \ obmc-debug-collector \ obmc-network-mgmt \ obmc-settings-mgmt \ - ${@mf_enabled(d, 'obmc-ubi-fs', 'read-only-rootfs')} \ " +IMAGE_FEATURES_append_df-obmc-ubi-fs = " read-only-rootfs" + CORE_IMAGE_EXTRA_INSTALL_append = " bash \ packagegroup-obmc-apps-extras \ packagegroup-obmc-apps-extrasdev \ diff --git a/meta-phosphor/common/recipes-bsp/u-boot/u-boot-aspeed.inc b/meta-phosphor/common/recipes-bsp/u-boot/u-boot-aspeed.inc index 983c33f54..e1eb73807 100644 --- a/meta-phosphor/common/recipes-bsp/u-boot/u-boot-aspeed.inc +++ b/meta-phosphor/common/recipes-bsp/u-boot/u-boot-aspeed.inc @@ -2,17 +2,17 @@ inherit image_version SRC_URI_append_aspeed = " file://0001-configs-ast-Add-redundnant-env.patch" -SRC_URI_append_aspeed = " ${@bb.utils.contains('MACHINE_FEATURES', 'obmc-ubi-fs', \ - 'file://0002-config-ast-common-hack-bootopts.patch \ - file://0003-config-ast-common-Add-bootopts-to-support-ubi-and-mt.patch \ - file://0004-config-ast-common-Add-conditional-factory-reset-comm.patch', '', d)}" +SRC_URI_append_aspeed_df-obmc-ubi-fs = " \ + file://0002-config-ast-common-hack-bootopts.patch \ + file://0003-config-ast-common-Add-bootopts-to-support-ubi-and-mt.patch \ + file://0004-config-ast-common-Add-conditional-factory-reset-comm.patch \ + " -python do_configure_aspeed () { - if "obmc-ubi-fs" in d.getVar("MACHINE_FEATURES", True): - version_id=do_get_versionID(d) - d.setVar('VERSION_ID', version_id) - bb.build.exec_func("patch_uboot", d) +python do_configure_aspeed_df-obmc-ubi-fs () { + version_id=do_get_versionID(d) + d.setVar('VERSION_ID', version_id) + bb.build.exec_func("patch_uboot", d) } patch_uboot () { diff --git a/meta-phosphor/common/recipes-core/base-files/base-files_%.bbappend b/meta-phosphor/common/recipes-core/base-files/base-files_%.bbappend index e632d563c..172c9a5e1 100644 --- a/meta-phosphor/common/recipes-core/base-files/base-files_%.bbappend +++ b/meta-phosphor/common/recipes-core/base-files/base-files_%.bbappend @@ -1,8 +1,8 @@ inherit obmc-phosphor-utils -FILESEXTRAPATHS_prepend := "${@mf_enabled(d, 'obmc-ubi-fs', '${THISDIR}/${PN}:')}" +FILESEXTRAPATHS_prepend_df-obmc-ubi-fs := "${THISDIR}/${PN}:" -RDEPENDS_${PN}_append += "${@mf_enabled(d, 'obmc-ubi-fs', 'preinit-mounts')}" +RDEPENDS_${PN}_append_df-obmc-ubi-fs = " preinit-mounts" do_install_append() { install -d ${D}/srv diff --git a/meta-phosphor/common/recipes-core/systemd/systemd_%.bbappend b/meta-phosphor/common/recipes-core/systemd/systemd_%.bbappend index 3b8a8d934..e7eeb5a5a 100644 --- a/meta-phosphor/common/recipes-core/systemd/systemd_%.bbappend +++ b/meta-phosphor/common/recipes-core/systemd/systemd_%.bbappend @@ -22,7 +22,7 @@ PACKAGECONFIG[journald-dbus] = "--enable-journald-dbus,--disable-journald-dbus" FILES_${PN} += "${datadir}/dbus-1/system.d/org.freedesktop.journal1.conf" SRC_URI += "file://0007-journal-Add-Synchronize-dbus-method.patch" -SRC_URI += "${@mf_enabled(d, 'obmc-ubi-fs', 'file://software.conf')}" +SRC_URI_append_df-obmc-ubi-fs = " file://software.conf" SRC_URI += "file://0008-man-update-machine-id-5-with-a-note-about-privacy-46.patch" SRC_URI += "file://0009-sd-id128-add-new-sd_id128_get_machine_app_specific-A.patch" SRC_URI += "file://0010-core-add-khash-API-to-src-basic-as-wrapper-around-ke.patch" @@ -40,11 +40,11 @@ do_install_append() { #TODO Remove after this issue is resolved #https://github.com/openbmc/openbmc/issues/152 ln -s /dev/null ${D}/etc/systemd/system/systemd-hwdb-update.service +} +do_install_append_df-obmc-ubi-fs() { # /tmp/images is the software image upload directory. # It should not be deleted since it is watched by the Image Manager # for new images. - if ${@bb.utils.contains('MACHINE_FEATURES', 'obmc-ubi-fs', 'true', 'false', d)}; then - install -m 0644 ${WORKDIR}/software.conf ${D}${exec_prefix}/lib/tmpfiles.d/ - fi + install -m 0644 ${WORKDIR}/software.conf ${D}${exec_prefix}/lib/tmpfiles.d/ } diff --git a/meta-phosphor/common/recipes-kernel/linux/linux-obmc.inc b/meta-phosphor/common/recipes-kernel/linux/linux-obmc.inc index 72c2334ba..97978115f 100644 --- a/meta-phosphor/common/recipes-kernel/linux/linux-obmc.inc +++ b/meta-phosphor/common/recipes-kernel/linux/linux-obmc.inc @@ -14,7 +14,7 @@ SRC_URI += "file://phosphor-gpio-keys.scc" SRC_URI += "file://phosphor-gpio-keys.cfg" SRC_URI += "file://phosphor-vlan.scc" SRC_URI += "file://phosphor-vlan.cfg" -SRC_URI += "${@mf_enabled(d, 'obmc-ubi-fs', 'file://0001-ARM-dts-Aspeed-Witherspoon-Update-BMC-partitioning.patch')}" +SRC_URI_append_df-obmc-ubi-fs = " file://0001-ARM-dts-Aspeed-Witherspoon-Update-BMC-partitioning.patch" LINUX_VERSION_EXTENSION ?= "-${SRCREV}" diff --git a/meta-phosphor/common/recipes-phosphor/dump/phosphor-debug-collector.bb b/meta-phosphor/common/recipes-phosphor/dump/phosphor-debug-collector.bb index 24b233f85..fcbe8ae5e 100644 --- a/meta-phosphor/common/recipes-phosphor/dump/phosphor-debug-collector.bb +++ b/meta-phosphor/common/recipes-phosphor/dump/phosphor-debug-collector.bb @@ -161,8 +161,8 @@ python install_dreport_user_scripts() { os.symlink(srclink, destlink) } -#Enable ubifs-workaround by MACHINE_FEATURE obmc-ubi-fs. -PACKAGECONFIG_append = "${@mf_enabled(d, 'obmc-ubi-fs', 'ubifs-workaround')}" +#Enable ubifs-workaround by DISTRO_FEATURE obmc-ubi-fs. +PACKAGECONFIG_append_df-obmc-ubi-fs = " ubifs-workaround" PACKAGECONFIG[ubifs-workaround] = " \ --enable-ubifs-workaround, \ --disable-ubifs-workaround \ diff --git a/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb b/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb index fef72dcf8..ee6e13cb0 100644 --- a/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb +++ b/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb @@ -89,17 +89,20 @@ RDEPENDS_${PN}-sensors = " \ ${VIRTUAL-RUNTIME_obmc-sensors-hwmon} \ " +# These packages are not required with UBI enabled +${PN}-software-extras = " \ + obmc-flash-bmc \ + obmc-mgr-download \ + " + +${PN}-software-extras_df-obmc-ubi-fs = "" + SUMMARY_${PN}-software = "Software applications" RDEPENDS_${PN}-software = " \ ${VIRTUAL-RUNTIME_obmc-bmc-download-mgr} \ ${VIRTUAL-RUNTIME_obmc-bmc-updater} \ ${VIRTUAL-RUNTIME_obmc-bmc-version} \ - " -# Determine if the non-UBI flash packages are required -RDEPENDS_${PN}-software += " \ - ${@mf_enabled(d, 'obmc-ubi-fs', \ - '', \ - 'obmc-flash-bmc obmc-mgr-download')} \ + ${${PN}-software-extras} \ " SUMMARY_${PN}-debug-collector = "BMC debug collector" diff --git a/meta-phosphor/conf/distro/include/phosphor-ubi.inc b/meta-phosphor/conf/distro/include/phosphor-ubi.inc new file mode 100644 index 000000000..61604461a --- /dev/null +++ b/meta-phosphor/conf/distro/include/phosphor-ubi.inc @@ -0,0 +1,2 @@ +DISTRO_FEATURES += "obmc-ubi-fs" +DISTROOVERRIDES .= ":df-obmc-ubi-fs" diff --git a/meta-phosphor/conf/machine/include/obmc-bsp-common.inc b/meta-phosphor/conf/machine/include/obmc-bsp-common.inc index 165eca422..2cbdd89d4 100644 --- a/meta-phosphor/conf/machine/include/obmc-bsp-common.inc +++ b/meta-phosphor/conf/machine/include/obmc-bsp-common.inc @@ -11,7 +11,7 @@ UBOOT_SUFFIX ?= "bin" MACHINEOVERRIDES =. "openbmc:" IMAGE_FSTYPES += "cpio.${INITRAMFS_CTYPE}.u-boot" -IMAGE_FSTYPES += "${@bb.utils.contains('MACHINE_FEATURES', \ +IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', \ 'obmc-ubi-fs', \ 'mtd-ubi mtd-ubi-tar', \ 'mtd-static mtd-static-tar mtd-static-alltar', d)}" @@ -19,8 +19,8 @@ OBMC_IMAGE_EXTRA_INSTALL_append = " u-boot-fw-utils" INITRAMFS_CTYPE ?= "lzma" INITRAMFS_FSTYPES += "cpio.${INITRAMFS_CTYPE}" -INITRAMFS_IMAGE = "${@bb.utils.contains('MACHINE_FEATURES', \ - 'obmc-ubi-fs', '', 'obmc-phosphor-initramfs', d)}" +INITRAMFS_IMAGE ?= "obmc-phosphor-initramfs" +INITRAMFS_IMAGE_df-obmc-ubi-fs ?= "" MACHINE_FEATURES_BACKFILL_CONSIDERED = "qemu-usermode" -- cgit v1.2.3