diff options
Diffstat (limited to 'meta-phosphor/classes')
12 files changed, 197 insertions, 219 deletions
diff --git a/meta-phosphor/classes/image_types_phosphor.bbclass b/meta-phosphor/classes/image_types_phosphor.bbclass index 8f92f7045..e4663471c 100644 --- a/meta-phosphor/classes/image_types_phosphor.bbclass +++ b/meta-phosphor/classes/image_types_phosphor.bbclass @@ -19,19 +19,15 @@ FLASH_UBI_OVERLAY_BASETYPE ?= "ubifs" FLASH_EXT4_BASETYPE ?= "ext4" FLASH_EXT4_OVERLAY_BASETYPE ?= "ext4" -IMAGE_TYPES += "mtd-static mtd-static-alltar mtd-static-tar mtd-ubi mtd-ubi-tar mmc-verity mmc-ext4-tar" +IMAGE_TYPES += "mtd-static mtd-static-alltar mtd-static-tar mtd-ubi mtd-ubi-tar mmc-ext4-tar" IMAGE_TYPEDEP_mtd-static = "${IMAGE_BASETYPE}" IMAGE_TYPEDEP_mtd-static-tar = "${IMAGE_BASETYPE}" IMAGE_TYPEDEP_mtd-static-alltar = "mtd-static" IMAGE_TYPEDEP_mtd-ubi = "${FLASH_UBI_BASETYPE}" IMAGE_TYPEDEP_mtd-ubi-tar = "${FLASH_UBI_BASETYPE}" -IMAGE_TYPEDEP_mmc-verity = "${FLASH_EXT4_BASETYPE}" IMAGE_TYPEDEP_mmc-ext4-tar = "${FLASH_EXT4_BASETYPE}" -IMAGE_TYPES_MASKED += "mtd-static mtd-static-alltar mtd-static-tar mtd-ubi mtd-ubi-tar mmc-verity mmc-ext4-tar" - -IMAGE_BLOCK_SIZE ?= "4096" -EXTRA_IMAGECMD_ext4 = "-b ${IMAGE_BLOCK_SIZE}" +IMAGE_TYPES_MASKED += "mtd-static mtd-static-alltar mtd-static-tar mtd-ubi mtd-ubi-tar mmc-ext4-tar" # Flash characteristics in KB unless otherwise noted DISTROOVERRIDES .= ":flash-${FLASH_SIZE}" @@ -58,6 +54,10 @@ FLASH_UBI_RWFS_SIZE_flash-131072 ?= "32768" FLASH_UBI_RWFS_TXT_SIZE ?= "6MiB" FLASH_UBI_RWFS_TXT_SIZE_flash-131072 ?= "32MiB" +# eMMC sizes in KB unless otherwise noted. +MMC_UBOOT_SIZE ?= "1024" +MMC_BOOT_PARTITION_SIZE ?= "65536" + SIGNING_KEY ?= "${STAGING_DIR_NATIVE}${datadir}/OpenBMC.priv" INSECURE_KEY = "${@'${SIGNING_KEY}' == '${STAGING_DIR_NATIVE}${datadir}/OpenBMC.priv'}" SIGNING_KEY_DEPENDS = "${@oe.utils.conditional('INSECURE_KEY', 'True', 'phosphor-insecure-signing-key-native:do_populate_sysroot', '', d)}" @@ -105,6 +105,12 @@ mk_empty_image() { | tr '\000' '\377' > $image_dst } +mk_empty_image_zeros() { + image_dst="$1" + image_size_kb=$2 + dd if=/dev/zero of=$image_dst bs=1k count=$image_size_kb +} + clean_rwfs() { type=$1 shift @@ -182,7 +188,7 @@ do_generate_ubi[dirs] = "${S}/ubi" do_generate_ubi[depends] += " \ ${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \ virtual/kernel:do_deploy \ - u-boot:do_populate_sysroot \ + u-boot:do_deploy \ mtd-utils-native:do_populate_sysroot \ " @@ -217,99 +223,10 @@ do_make_ubi[dirs] = "${S}/ubi" do_make_ubi[depends] += " \ ${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \ virtual/kernel:do_deploy \ - u-boot:do_populate_sysroot \ + u-boot:do_deploy \ mtd-utils-native:do_populate_sysroot \ " -python do_generate_mmc_verity() { - import os - import subprocess - - rootfs_image = os.path.join(d.getVar('IMGDEPLOYDIR', True), - '%s.%s' % ( - d.getVar('IMAGE_LINK_NAME', True), - d.getVar('FLASH_EXT4_BASETYPE', True))) - - verity_image = 'verity-%s.%s' % ( - d.getVar('IMAGE_LINK_NAME', True), - d.getVar('FLASH_EXT4_BASETYPE', True)) - - subprocess.check_call(['dd', - 'if=%s' % rootfs_image, - 'of=%s' % verity_image]) - - # dm-verity values - sector_size = 512 - block_size = int(d.getVar('IMAGE_BLOCK_SIZE', True)) - verity_algo = "sha256" - rootfs_image_size = os.stat(rootfs_image).st_size - - def align_up(number, boundary): - return ((number + (boundary - 1)) // boundary) * boundary - - # verity metadata must be aligned on the block boundary subsequent to the - # end of the data - verity_hash_offset = align_up(rootfs_image_size, block_size) - - verity_hash_blocks = verity_hash_offset // block_size - - # the output of 'veritysetup format' looks like: - # VERITY header information for obmc-phosphor-image-witherspoon.squashfs-xz - # UUID: 269b5934-de5b-45b0-99a3-56b219a7b544 - # Hash type: 1 - # Data blocks: 4523 - # Data block size: 4096 - # Hash block size: 4096 - # Hash algorithm: sha256 - # Salt: 8fca9eff342fc0cf2964057257ea80813a223cb2e540a38458142edeb190e12e - # Root hash: 38ef00d23fa89300dcf66e7494d25246d03bf846b4119b34e7b1587c0b6fe1d9 - verity_hash_file = "verity-hash-verification-data" - with open(verity_hash_file, 'w') as f: - subprocess.check_call(['veritysetup', - 'format', - '--hash=%s'% verity_algo, - '--data-block-size=%i' % block_size, - '--hash-block-size=%i' % block_size, - '--hash-offset=%i' % verity_hash_offset, - '%s' % verity_image, - '%s' % verity_image], stdout=f, stderr=f) - - for line in open(verity_hash_file, "r"): - if "Salt" in line: - verity_salt = line.split()[-1] - if "Root" in line: - verity_root = line.split()[-1] - - verity_image_size = os.stat(verity_image).st_size - - # Make an appropriately sized image for MMC - mmc_image_name = "%s.mmc" % d.getVar('IMAGE_NAME', True) - mmc_image_path = os.path.join(d.getVar('IMGDEPLOYDIR', True), - '%s' % mmc_image_name) - - # CSD size accommodates MMC limitations that are relevant to QEMU - csd_size = (1 << (9 + 9 - 1 + 2)) - - with open(mmc_image_path, 'w') as fd: - os.posix_fallocate(fd.fileno(), 0, align_up(verity_image_size, csd_size)) - subprocess.check_call(['dd', - 'if=%s' % verity_image, - 'of=%s' % mmc_image_path, - 'conv=notrunc']) - - os.chdir("%s" % d.getVar('IMGDEPLOYDIR', True)) - mmc_link_name = os.path.join(d.getVar('IMGDEPLOYDIR', True), - '%s.mmc' % d.getVar('IMAGE_LINK_NAME', True)) - if os.path.lexists(mmc_link_name): - os.remove(mmc_link_name) - os.symlink(mmc_image_name, mmc_link_name) -} -do_generate_mmc_verity[dirs] = "${S}/mmc" -do_generate_mmc_verity[depends] += " \ - ${PN}:do_image_${FLASH_EXT4_BASETYPE} \ - cryptsetup-native:do_populate_sysroot \ - " - do_mk_static_nor_image() { # Assemble the flash image mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd ${FLASH_SIZE} @@ -406,7 +323,7 @@ do_generate_static[dirs] = "${S}/static" do_generate_static[depends] += " \ ${PN}:do_image_${@d.getVar('IMAGE_BASETYPE', True).replace('-', '_')} \ virtual/kernel:do_deploy \ - u-boot:do_populate_sysroot \ + u-boot:do_deploy \ " make_signatures() { @@ -487,7 +404,7 @@ do_generate_static_tar[dirs] = " ${S}/static" do_generate_static_tar[depends] += " \ ${PN}:do_image_${@d.getVar('IMAGE_BASETYPE', True).replace('-', '_')} \ virtual/kernel:do_deploy \ - u-boot:do_populate_sysroot \ + u-boot:do_deploy \ openssl-native:do_populate_sysroot \ ${SIGNING_KEY_DEPENDS} \ ${PN}:do_copy_signing_pubkey \ @@ -505,29 +422,56 @@ do_generate_ubi_tar[dirs] = " ${S}/ubi" do_generate_ubi_tar[depends] += " \ ${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \ virtual/kernel:do_deploy \ - u-boot:do_populate_sysroot \ + u-boot:do_deploy \ openssl-native:do_populate_sysroot \ ${SIGNING_KEY_DEPENDS} \ ${PN}:do_copy_signing_pubkey \ " do_generate_ext4_tar() { - zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE} > ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst + # Generate the U-Boot image + mk_empty_image_zeros image-u-boot ${MMC_UBOOT_SIZE} + do_generate_image_uboot_file image-u-boot + + # Generate a compressed ext4 filesystem with the fitImage file in it to be + # flashed to the boot partition of the eMMC + install -d boot-image + install -m 644 ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} boot-image/fitImage + mk_empty_image_zeros boot-image.${FLASH_EXT4_BASETYPE} ${MMC_BOOT_PARTITION_SIZE} + mkfs.ext4 -F -i 4096 -d boot-image boot-image.${FLASH_EXT4_BASETYPE} + # Error codes 0-3 indicate successfull operation of fsck + fsck.ext4 -pvfD boot-image.${FLASH_EXT4_BASETYPE} || [ $? -le 3 ] + zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} boot-image.${FLASH_EXT4_BASETYPE} > boot-image.${FLASH_EXT4_BASETYPE}.zst + + # Generate the compressed ext4 rootfs + zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE} > ${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst + + ln -sf boot-image.${FLASH_EXT4_BASETYPE}.zst image-kernel + ln -sf ${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst image-rofs + ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.${FLASH_EXT4_OVERLAY_BASETYPE} image-rwfs ln -sf ${S}/MANIFEST MANIFEST ln -sf ${S}/publickey publickey - make_image_links rwfs.${FLASH_EXT4_OVERLAY_BASETYPE} ${FLASH_EXT4_BASETYPE}.zst - make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey - make_tar_of_images ext4.mmc MANIFEST publickey ${signature_files} + + hostfw_update_file="${DEPLOY_DIR_IMAGE}/hostfw/update/image-hostfw" + if [ -e "${hostfw_update_file}" ]; then + ln -sf "${hostfw_update_file}" image-hostfw + make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey image-hostfw + make_tar_of_images ext4.mmc MANIFEST publickey ${signature_files} image-hostfw + else + make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey + make_tar_of_images ext4.mmc MANIFEST publickey ${signature_files} + fi } do_generate_ext4_tar[dirs] = " ${S}/ext4" do_generate_ext4_tar[depends] += " \ zstd-native:do_populate_sysroot \ ${PN}:do_image_${FLASH_EXT4_BASETYPE} \ virtual/kernel:do_deploy \ - u-boot:do_populate_sysroot \ + u-boot:do_deploy \ openssl-native:do_populate_sysroot \ ${SIGNING_KEY_DEPENDS} \ ${PN}:do_copy_signing_pubkey \ + phosphor-hostfw-image:do_deploy \ " def get_pubkey_basedir(d): @@ -609,10 +553,6 @@ python() { 'do_image_complete', 'do_generate_rwfs_ubi do_generate_phosphor_manifest', d) - if 'mmc-verity' in types: - bb.build.addtask( - 'do_generate_mmc_verity', - 'do_image_complete','', d) if 'mmc-ext4-tar' in types: bb.build.addtask( 'do_generate_ext4_tar', diff --git a/meta-phosphor/classes/obmc-phosphor-c-daemon.bbclass b/meta-phosphor/classes/obmc-phosphor-c-daemon.bbclass deleted file mode 100644 index ded11d8cd..000000000 --- a/meta-phosphor/classes/obmc-phosphor-c-daemon.bbclass +++ /dev/null @@ -1,13 +0,0 @@ -# Common code for dbus applications using c. -inherit obmc-phosphor-systemd - -DEPENDS += "glib-2.0" - -INSTALL_NAME ?= "${PN}" -BIN_NAME ?= "${INSTALL_NAME}" - -do_install_append() { - # install the binary - install -d ${D}${sbindir} - install -m 0755 ${S}/${BIN_NAME} ${D}${sbindir}/${INSTALL_NAME} -} diff --git a/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass b/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass index e912beadc..48760f3db 100644 --- a/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass +++ b/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass @@ -72,7 +72,8 @@ python discovery_services_postinstall() { fd.write('<?xml version="1.0" ?>\n') fd.write('<!DOCTYPE service-group SYSTEM "avahi-service.dtd">\n') fd.write('<service-group>\n') - fd.write(' <name>%s</name>\n' % service_name) + fd.write(' <name replace-wildcards="yes">%s on %%h</name>\n' + % service_name) fd.write(' <service>\n') fd.write(' <type>%s</type>\n' % service_type) fd.write(' <port>%s</port>\n' % service_port) diff --git a/meta-phosphor/classes/obmc-phosphor-image.bbclass b/meta-phosphor/classes/obmc-phosphor-image.bbclass index 6e13a6520..b2d3b5ef3 100644 --- a/meta-phosphor/classes/obmc-phosphor-image.bbclass +++ b/meta-phosphor/classes/obmc-phosphor-image.bbclass @@ -3,116 +3,98 @@ # Additional IMAGE_FEATURES available with Phosphor OpenBMC: # # - obmc-bmc-state-mgmt - OpenBMC BMC state management +# - obmc-bmcweb - OpenBMC webserver # - obmc-chassis-mgmt - OpenBMC chassis management # - obmc-chassis-state-mgmt - OpenBMC chassis state management +# - obmc-console - OpenBMC serial over LAN +# - obmc-dbus-monitor - OpenBMC dbus monitoring +# - obmc-devtools - OpenBMC development and debugging tools # - obmc-fan-control - OpenBMC fan management # - obmc-fan-mgmt - Deprecated - use obmc-fan-control instead # - obmc-flash-mgmt - OpenBMC flash management +# - obmc-fru-ipmi - OpenBMC IPMI FRU EEPROM support +# - obmc-health-monitor - OpenBMC health monitoring # - obmc-host-ctl - OpenBMC host control # - obmc-host-ipmi - OpenBMC host IPMI # - obmc-host-state-mgmt - OpenBMC host state management +# - obmc-ikvm - OpenBMC KVM over IP # - obmc-inventory - OpenBMC inventory support # - obmc-leds - OpenBMC LED support # - obmc-logging-mgmt - OpenBMC logging management # - obmc-remote-logging-mgmt - OpenBMC remote logging management +# - obmc-rng - OpenBMC random number generator # - obmc-sensors - OpenBMC sensor support # - obmc-settings-mgmt - OpenBMC settings management # - obmc-software - OpenBMC software management # - obmc-system-mgmt - OpenBMC system management # - obmc-user-mgmt - OpenBMC user management +# - obmc-user-mgmt-ldap - OpenBMC LDAP users # - obmc-debug-collector - OpenBMC debug collector inherit core-image inherit obmc-phosphor-utils - -LICENSE = "Apache-2.0" +inherit phosphor-deploy-ssh-keys FEATURE_PACKAGES_obmc-bmc-state-mgmt ?= "packagegroup-obmc-apps-bmc-state-mgmt" -FEATURE_PACKAGES_obmc-chassis-mgmt ?= "${@cf_enabled(d, 'obmc-phosphor-chassis-mgmt', 'virtual-obmc-chassis-mgmt')}" +FEATURE_PACKAGES_obmc-bmcweb ?= "packagegroup-obmc-apps-bmcweb" +FEATURE_PACKAGES_obmc-chassis-mgmt ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-phosphor-chassis-mgmt', 'virtual-obmc-chassis-mgmt', '', d)}" FEATURE_PACKAGES_obmc-chassis-state-mgmt ?= "packagegroup-obmc-apps-chassis-state-mgmt" +FEATURE_PACKAGES_obmc-console ?= "packagegroup-obmc-apps-console" +FEATURE_PACKAGES_obmc-dbus-monitor ?= "packagegroup-obmc-apps-dbus-monitor" +FEATURE_PACKAGES_obmc-devtools ?= "packagegroup-obmc-apps-devtools" FEATURE_PACKAGES_obmc-fan-control ?= "packagegroup-obmc-apps-fan-control" -FEATURE_PACKAGES_obmc-fan-mgmt ?= "${@cf_enabled(d, 'obmc-phosphor-fan-mgmt', 'virtual-obmc-fan-mgmt')}" -FEATURE_PACKAGES_obmc-flash-mgmt ?= "${@cf_enabled(d, 'obmc-phosphor-flash-mgmt', 'virtual-obmc-flash-mgmt')}" -FEATURE_PACKAGES_obmc-host-ctl ?= "${@cf_enabled(d, 'obmc-host-ctl', 'virtual-obmc-host-ctl')}" -FEATURE_PACKAGES_obmc-host-ipmi ?= "${@cf_enabled(d, 'obmc-host-ipmi', 'virtual-obmc-host-ipmi-hw')}" +FEATURE_PACKAGES_obmc-fan-mgmt ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-phosphor-fan-mgmt', 'virtual-obmc-fan-mgmt', '', d)}" +FEATURE_PACKAGES_obmc-flash-mgmt ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-phosphor-flash-mgmt', 'virtual-obmc-flash-mgmt', '', d)}" +FEATURE_PACKAGES_obmc-fru-ipmi ?= "packagegroup-obmc-apps-fru-ipmi" +FEATURE_PACKAGES_obmc-health-monitor ?= "packagegroup-obmc-apps-health-monitor" +FEATURE_PACKAGES_obmc-host-ctl ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-host-ctl', 'virtual-obmc-host-ctl', '', d)}" +FEATURE_PACKAGES_obmc-host-ipmi ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-host-ipmi', 'virtual-obmc-host-ipmi-hw', '', d)}" FEATURE_PACKAGES_obmc-host-state-mgmt ?= "packagegroup-obmc-apps-host-state-mgmt" +FEATURE_PACKAGES_obmc-ikvm ?= "packagegroup-obmc-apps-ikvm" FEATURE_PACKAGES_obmc-inventory ?= "packagegroup-obmc-apps-inventory" FEATURE_PACKAGES_obmc-leds ?= "packagegroup-obmc-apps-leds" FEATURE_PACKAGES_obmc-logging-mgmt ?= "packagegroup-obmc-apps-logging" FEATURE_PACKAGES_obmc-remote-logging-mgmt ?= "packagegroup-obmc-apps-remote-logging" +FEATURE_PACKAGES_obmc-rng ?= "packagegroup-obmc-apps-rng" FEATURE_PACKAGES_obmc-net-ipmi ?= "phosphor-ipmi-net" FEATURE_PACKAGES_obmc-sensors ?= "packagegroup-obmc-apps-sensors" FEATURE_PACKAGES_obmc-software ?= "packagegroup-obmc-apps-software" -FEATURE_PACKAGES_obmc-system-mgmt ?= "${@df_enabled(d, 'obmc-phosphor-system-mgmt', 'virtual-obmc-system-mgmt')}" +FEATURE_PACKAGES_obmc-system-mgmt ?= "${@bb.utils.contains('DISTRO_FEATURES', 'obmc-phosphor-system-mgmt', 'virtual-obmc-system-mgmt', '', d)}" FEATURE_PACKAGES_obmc-debug-collector ?= "packagegroup-obmc-apps-debug-collector" FEATURE_PACKAGES_obmc-settings-mgmt ?= "packagegroup-obmc-apps-settings" FEATURE_PACKAGES_obmc-network-mgmt ?= "packagegroup-obmc-apps-network" FEATURE_PACKAGES_obmc-user-mgmt ?= "packagegroup-obmc-apps-user-mgmt" +FEATURE_PACKAGES_obmc-user-mgmt-ldap ?= "packagegroup-obmc-apps-user-mgmt-ldap" # FIXME: phosphor-net-ipmi depends on phosphor-ipmi-host !?!? and # cannot be built on core-qemu machines because of the dependency # tree under phosphor-ipmi-host FEATURE_PACKAGES_obmc-net-ipmi_qemuall = "" -# Install entire Phosphor application stack by default -IMAGE_FEATURES += " \ - obmc-bmc-state-mgmt \ - obmc-chassis-mgmt \ - obmc-chassis-state-mgmt \ - obmc-fan-control \ - obmc-fan-mgmt \ - obmc-flash-mgmt \ - obmc-host-ctl \ - obmc-host-ipmi \ - obmc-host-state-mgmt \ - obmc-inventory \ - obmc-leds \ - obmc-logging-mgmt \ - obmc-remote-logging-mgmt \ - obmc-net-ipmi \ - obmc-sensors \ - obmc-software \ - obmc-system-mgmt \ - obmc-user-mgmt \ - ssh-server-dropbear \ - obmc-debug-collector \ - obmc-network-mgmt \ - obmc-settings-mgmt \ - " - -IMAGE_FEATURES_append_df-obmc-ubi-fs = " read-only-rootfs" - -CORE_IMAGE_EXTRA_INSTALL_append = " bash \ +# Add new packages to be installed to a package group in +# packagegroup-obmc-apps, not here. +OBMC_IMAGE_BASE_INSTALL = " \ packagegroup-obmc-apps-extras \ - packagegroup-obmc-apps-extrasdevtools \ - i2c-tools \ - obmc-console \ - pam-plugin-access \ - pam-ipmi \ ${OBMC_IMAGE_EXTRA_INSTALL} \ - ffdc \ - rsync \ - rng-tools \ - lrzsz \ " OBMC_IMAGE_EXTRA_INSTALL ?= "" -# The /etc/version file is misleading and not useful. Remove it. -# Users should instead rely on /etc/os-release. +CORE_IMAGE_EXTRA_INSTALL += "${OBMC_IMAGE_BASE_INSTALL}" + remove_etc_version() { rm ${IMAGE_ROOTFS}${sysconfdir}/version } -ROOTFS_POSTPROCESS_COMMAND += "remove_etc_version ; " -# Disable the pager to prevent systemd injecting control characters into the -# output stream that are not interpreted by busybox tools. disable_systemd_pager() { echo "SYSTEMD_PAGER=" >> ${IMAGE_ROOTFS}${sysconfdir}/profile echo "export SYSTEMD_PAGER" >> ${IMAGE_ROOTFS}${sysconfdir}/profile } -ROOTFS_POSTPROCESS_COMMAND += "disable_systemd_pager ; " -# The shadow recipe provides the binaries(like useradd, usermod) needed by the -# phosphor-user-manager. -ROOTFS_RO_UNNEEDED_remove = "shadow" +enable_ldap_nsswitch() { + sed -i 's/\(\(passwd\|group\|shadow\):\s*\).*/\1files ldap/' \ + "${IMAGE_ROOTFS}${sysconfdir}/nsswitch.conf" +} + +ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('IMAGE_FEATURES', 'obmc-user-mgmt-ldap', 'enable_ldap_nsswitch ;', '', d)}" + diff --git a/meta-phosphor/classes/obmc-phosphor-utils.bbclass b/meta-phosphor/classes/obmc-phosphor-utils.bbclass index 04db8bcd0..a8f7175df 100644 --- a/meta-phosphor/classes/obmc-phosphor-utils.bbclass +++ b/meta-phosphor/classes/obmc-phosphor-utils.bbclass @@ -1,19 +1,3 @@ -# Helper functions for checking feature variables. - -def df_enabled(d, feature, truevalue, falsevalue=""): - return bb.utils.contains("DISTRO_FEATURES", feature, truevalue, falsevalue, d) - - -def mf_enabled(d, feature, truevalue, falsevalue=""): - return bb.utils.contains("MACHINE_FEATURES", feature, truevalue, falsevalue, d) - - -def cf_enabled(d, feature, truevalue, falsevalue=""): - return truevalue if df_enabled(d, feature, truevalue) \ - and mf_enabled(d, feature, truevalue) \ - else falsevalue - - def set_append(d, var, val, sep=' '): values = (d.getVar(var, True) or '').split(sep) if filter(bool, values): @@ -39,11 +23,3 @@ def compose_list_zip(d, fmtvar, *listvars, **kw): lists = [listvar_to_list(d, x) for x in listvars] lst = [fmt.format(*x) for x in zip(*lists)] return (kw.get('sep') or ' ').join(lst) - - -def append_suffix(val, suffix): - words = val.split(' ') - newval = [] - for w in words: - newval.append(w + suffix) - return ' '.join(newval) diff --git a/meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass b/meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass new file mode 100644 index 000000000..a85d2ac2d --- /dev/null +++ b/meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass @@ -0,0 +1,62 @@ +#### +# Copyright 2020 Hewlett Packard Enterprise Development LP. +# +# +# Add a basic class to add a privileged user from an ssh +# standpoint and a public key passed as an input parameter +# from the local.conf file +# Example: +# INHERIT += "phosphor-deploy-ssh-keys" +# SSH_KEYS = "vejmarie:/home/openbmc/openbmc/meta-hpe/keys/test.pub;" +#### + +inherit useradd_base + +IMAGE_PREPROCESS_COMMAND += "deploy_local_user;" + +deploy_local_user () { + if [ "${SSH_KEYS}" != "" ]; then + group_settings="${SSH_KEYS}" + current_setting=`echo $group_settings | cut -d ';' -f1` + remaining=`echo $group_settings | cut -d ';' -f2-` + while test "x$current_setting" != "x"; do + + username=`echo ${SSH_KEYS} | awk -F":" '{ print $1}'` + key_path=`echo ${SSH_KEYS} | awk -F":" '{ print $2}'` + + if [ ! -d ${IMAGE_ROOTFS}/home/${username} ]; then + perform_useradd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -p '' ${username}" + fi + + if [ ! -d ${IMAGE_ROOTFS}/home/${username}.ssh/ ]; then + install -d ${IMAGE_ROOTFS}/home/${username}/.ssh/ + fi + + if [ ! -f ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys ]; then + install -m 0600 ${key_path} ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys + else + cat ${key_path} >> ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys + fi + + uid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $3}'` + guid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $4}'` + + chown -R ${uid}:${guid} ${IMAGE_ROOTFS}/home/${username}/.ssh + chmod 600 ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys + chmod 700 ${IMAGE_ROOTFS}/home/${username}/.ssh + + is_group=`grep "priv-admin" ${IMAGE_ROOTFS}/etc/group || true` + + if [ -z "${is_group}" ]; then + perform_groupadd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} priv-admin" + fi + + perform_usermod "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -a -G priv-admin ${username}" + + current_setting=`echo $remaining | cut -d ";" -f1` + remaining=`echo $remaining | cut -d ';' -f2-` + done + else + bbwarn "Trying to deploy SSH keys but input variable is empty (SSH_KEYS)" + fi +} diff --git a/meta-phosphor/classes/phosphor-logging-yaml-provider.bbclass b/meta-phosphor/classes/phosphor-logging-yaml-provider.bbclass new file mode 100644 index 000000000..89d031caa --- /dev/null +++ b/meta-phosphor/classes/phosphor-logging-yaml-provider.bbclass @@ -0,0 +1,22 @@ +inherit phosphor-dbus-yaml + +LOGGING_YAML_SUBDIRS ??= "${OBMC_ORG_YAML_SUBDIRS}" + +do_install_append() { + for yaml_d in ${LOGGING_YAML_SUBDIRS} ; + do + if [ ! -d ${S}/${yaml_d} ]; + then + continue + fi + + for yaml_f in $(find ${S}/${yaml_d} -name "*.errors.yaml" -or \ + -name "*.metadata.yaml") ; + do + subpath=$(realpath --relative-to=${S} ${yaml_f}) + install -d $(dirname ${D}${yaml_dir}/$subpath) + + install -m 0644 ${yaml_f} ${D}${yaml_dir}/$subpath + done + done +} diff --git a/meta-phosphor/classes/phosphor-networkd-rev.bbclass b/meta-phosphor/classes/phosphor-networkd-rev.bbclass index 80c68dcf4..7556591cb 100644 --- a/meta-phosphor/classes/phosphor-networkd-rev.bbclass +++ b/meta-phosphor/classes/phosphor-networkd-rev.bbclass @@ -1,2 +1,2 @@ SRC_URI += "git://github.com/openbmc/phosphor-networkd" -SRCREV = "06345733e3389ec54018a9d8d3bf6a272b914f12" +SRCREV = "ffcba341a893318588afe83e8d767d8c20fd9189" diff --git a/meta-phosphor/classes/phosphor-pid-control.bbclass b/meta-phosphor/classes/phosphor-pid-control.bbclass deleted file mode 100644 index 3f69338aa..000000000 --- a/meta-phosphor/classes/phosphor-pid-control.bbclass +++ /dev/null @@ -1,5 +0,0 @@ -config_datadir="${datadir}/swampd/" -# config_path is the location swampd expects to find a json configuration. -# the file is expected to be named config.json -config_path="${config_datadir}config.json" - diff --git a/meta-phosphor/classes/phosphor-software-manager-mmc.bbclass b/meta-phosphor/classes/phosphor-software-manager-mmc.bbclass new file mode 100644 index 000000000..f30f0c04f --- /dev/null +++ b/meta-phosphor/classes/phosphor-software-manager-mmc.bbclass @@ -0,0 +1,21 @@ +# eMMC-specific configuration for the phosphor-manager-software package + +PACKAGECONFIG_append = " mmc_layout" + +EXTRA_OEMESON += "-Dactive-bmc-max-allowed=2" +EXTRA_OEMESON += "-Dmedia-dir='/media'" +EXTRA_OEMESON += "-Doptional-images='image-hostfw'" + +RDEPENDS_phosphor-software-manager-updater-mmc += " \ + gptfdisk \ + parted \ + zstd \ +" + +SYSTEMD_SERVICE_phosphor-software-manager-updater-mmc += " \ + obmc-flash-mmc@.service \ + obmc-flash-mmc-remove@.service \ + obmc-flash-mmc-setprimary@.service \ + obmc-flash-mmc-mount.service \ + obmc-flash-mmc-umount.service \ +" diff --git a/meta-phosphor/classes/phosphor-software-manager-ubi-fs.bbclass b/meta-phosphor/classes/phosphor-software-manager-ubi-fs.bbclass index cc1ad3738..6ca1fb162 100644 --- a/meta-phosphor/classes/phosphor-software-manager-ubi-fs.bbclass +++ b/meta-phosphor/classes/phosphor-software-manager-ubi-fs.bbclass @@ -6,17 +6,9 @@ RDEPENDS_phosphor-software-manager-updater-ubi += " \ mtd-utils-ubifs \ " -# Remove default configs -EXTRA_OECONF_remove_df-obmc-ubi-fs += " \ - ACTIVE_BMC_MAX_ALLOWED=1 \ - MEDIA_DIR=/run/media \ -" - # Add ubi-fs configs -EXTRA_OECONF_append_df-obmc-ubi-fs += " \ - ACTIVE_BMC_MAX_ALLOWED=2 \ - MEDIA_DIR=/media \ -" +EXTRA_OEMESON += "-Dactive-bmc-max-allowed=2" +EXTRA_OEMESON += "-Dmedia-dir='/media'" SYSTEMD_SERVICE_phosphor-software-manager-updater-ubi += " \ obmc-flash-bmc-ubirw.service \ diff --git a/meta-phosphor/classes/skeleton-rev.bbclass b/meta-phosphor/classes/skeleton-rev.bbclass index 4ae3c03a9..d9f5aadce 100644 --- a/meta-phosphor/classes/skeleton-rev.bbclass +++ b/meta-phosphor/classes/skeleton-rev.bbclass @@ -1,4 +1,4 @@ -SRCREV ?= "1146f8c6e5f955fb10f5e846de31052be942a7f2" +SRCREV ?= "3fbb4443dbc6ae6a7d8b5165a4f3b1992502570f" SKELETON_URI ?= "git://github.com/openbmc/skeleton" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${WORKDIR}/git/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" |