diff options
Diffstat (limited to 'meta-phosphor/recipes-core/systemd')
42 files changed, 637 insertions, 0 deletions
diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets.bb b/meta-phosphor/recipes-core/systemd/obmc-targets.bb new file mode 100644 index 0000000000..ac7835e6bf --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets.bb @@ -0,0 +1,91 @@ +SUMMARY = "Phosphor Systemd targets" +DESCRIPTION = "Provides well known Systemd synchronization points for OpenBMC." +HOMEPAGE = "http://github.com/openbmc" +PR = "r1" + +inherit obmc-phosphor-systemd +inherit obmc-phosphor-license +inherit allarch + +# Chassis power synchronization targets +# - start-pre: Services to run before we start power on process +# - start: Services to run to do the chassis power on +# - on: Services to run once power is on +# - stop-pre,stop,off: Same as above but applied to powering off +# - reset-on: Services to check if chassis power is on after bmc reset +CHASSIS_SYNCH_TARGETS = "start-pre start on stop-pre stop off reset-on" + +# Chassis action power targets +# - on: Services to run to power on the chassis +# - off: Services to run to power off the chassis +# - powered-off: Services to run once chassis power is off +# - reset: Services to check chassis power state and update chassis "on" target +# - hard-off: Services to force an immediate power off of the chassis +CHASSIS_ACTION_TARGETS = "poweron poweroff powered-off powerreset hard-poweroff" + +# Track all host synchronization point targets +# - start-pre: Services to run before we start host boot +# - starting: Services to run to do the host boot +# - started: Services to run once the host is booted +# - stop-pre,stopping,stopped: Same as above but applied to shutting down the host +# - reset-running: Services to check if host is running after bmc reset +HOST_SYNCH_TARGETS = "start-pre starting started stop-pre stopping stopped reset-running" + +# Track all host action targets +# - start: Will run startmin target, this target used for any additional +# services that user needs for an initial power on of host. +# For example, resetting the host reboot count could be put in +# this target so on any fresh power on, this count is reset. +# - startmin: Minimum services required to start the host. This target will +# be called by reboot and start target. +# - stop: Services to run to shutdown the host +# - quiesce: Target to enter on host boot failure +# - shutdown: Tell host to shutdown, then stop system +# - reset: Services to check if host is running and update host "start" target +# - crash: Target to run when host crashes. it is very much similar to +# quiesce target but the only delta is that this target contains +# multiple services and one of them is the quiesce target. +# - timeout: Target to run when host watchdog times out +# - reboot: Reboot the host +HOST_ACTION_TARGETS = "start startmin stop quiesce reset shutdown crash timeout reboot" + +CHASSIS_SYNCH_FMT = "obmc-power-{0}@.target" +CHASSIS_ACTION_FMT = "obmc-chassis-{0}@.target" +HOST_SYNCH_FMT = "obmc-host-{0}@.target" +HOST_ACTION_FMT = "obmc-host-{0}@.target" + +CHASSIS_LINK_SYNCH_FMT = "${CHASSIS_SYNCH_FMT}:obmc-power-{0}@{1}.target" +CHASSIS_LINK_ACTION_FMT = "${CHASSIS_ACTION_FMT}:obmc-chassis-{0}@{1}.target" +HOST_LINK_SYNCH_FMT = "${HOST_SYNCH_FMT}:obmc-host-{0}@{1}.target" +HOST_LINK_ACTION_FMT = "${HOST_ACTION_FMT}:obmc-host-{0}@{1}.target" +FAN_LINK_FMT = "obmc-fan-control-ready@.target:obmc-fan-control-ready@{0}.target" + +# Targets to be executed on checkstop and watchdog timeout +HOST_ERROR_TARGETS = "crash timeout" + +QUIESCE_TMPL = "obmc-host-quiesce@.target" +CRASH_TIMEOUT_TGTFMT = "obmc-host-{0}@{1}.target" +QUIESCE_INSTFMT = "obmc-host-quiesce@{1}.target" +QUIESCE_FMT = "../${QUIESCE_TMPL}:${CRASH_TIMEOUT_TGTFMT}.wants/${QUIESCE_INSTFMT}" + +SYSTEMD_SERVICE_${PN} += " \ + obmc-mapper.target \ + obmc-webserver-pre.target \ + obmc-fans-ready.target \ + obmc-fan-control.target \ + obmc-fan-control-ready@.target \ + obmc-fan-watchdog-takeover.target \ + obmc-standby.target \ + " + +SYSTEMD_SERVICE_${PN} += "${@compose_list(d, 'CHASSIS_SYNCH_FMT', 'CHASSIS_SYNCH_TARGETS')}" +SYSTEMD_SERVICE_${PN} += "${@compose_list(d, 'CHASSIS_ACTION_FMT', 'CHASSIS_ACTION_TARGETS')}" +SYSTEMD_SERVICE_${PN} += "${@compose_list(d, 'HOST_SYNCH_FMT', 'HOST_SYNCH_TARGETS')}" +SYSTEMD_SERVICE_${PN} += "${@compose_list(d, 'HOST_ACTION_FMT', 'HOST_ACTION_TARGETS')}" + +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'CHASSIS_LINK_SYNCH_FMT', 'CHASSIS_SYNCH_TARGETS', 'OBMC_CHASSIS_INSTANCES')}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'CHASSIS_LINK_ACTION_FMT', 'CHASSIS_ACTION_TARGETS', 'OBMC_CHASSIS_INSTANCES')}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'HOST_LINK_SYNCH_FMT', 'HOST_SYNCH_TARGETS', 'OBMC_HOST_INSTANCES')}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'HOST_LINK_ACTION_FMT', 'HOST_ACTION_TARGETS', 'OBMC_HOST_INSTANCES')}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FAN_LINK_FMT', 'OBMC_CHASSIS_INSTANCES')}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'QUIESCE_FMT', 'HOST_ERROR_TARGETS', 'OBMC_HOST_INSTANCES')}" diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-hard-poweroff@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-hard-poweroff@.target new file mode 100644 index 0000000000..48fc441694 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-hard-poweroff@.target @@ -0,0 +1,11 @@ +[Unit] +Description=Chassis%i (Hard Power Off) +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service +After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service +Conflicts=obmc-chassis-poweron@%i.target +Conflicts=obmc-chassis-powerreset@%i.target +Conflicts=obmc-host-shutdown@%i.target +Conflicts=xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-powered-off@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-powered-off@.target new file mode 100644 index 0000000000..84c1ddab1f --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-powered-off@.target @@ -0,0 +1,9 @@ +[Unit] +Description=Chassis%i (Powered Off) +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service +After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service +Conflicts=obmc-chassis-poweron@%i.target +Conflicts=obmc-chassis-powerreset@%i.target +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-poweroff@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-poweroff@.target new file mode 100644 index 0000000000..080d72456b --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-poweroff@.target @@ -0,0 +1,9 @@ +[Unit] +Description=Chassis%i (Power Off) +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service +After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service +Conflicts=obmc-chassis-poweron@%i.target +Conflicts=obmc-chassis-powerreset@%i.target +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-poweron@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-poweron@.target new file mode 100644 index 0000000000..55f6d919b0 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-poweron@.target @@ -0,0 +1,12 @@ +[Unit] +Description=Chassis%i (Power On) +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service +After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service +Wants=mapper-subtree-remove@-xyz-openbmc\x5fproject-software\x3Axyz.openbmc_project.Software.ActivationBlocksTransition.service +After=mapper-subtree-remove@-xyz-openbmc\x5fproject-software\x3Axyz.openbmc_project.Software.ActivationBlocksTransition.service +Conflicts=obmc-chassis-poweroff@%i.target +RefuseManualStop=yes +OnFailure=obmc-chassis-poweroff@%i.target +OnFailureJobMode=flush diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-powerreset@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-powerreset@.target new file mode 100644 index 0000000000..8d7c47e6bc --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-chassis-powerreset@.target @@ -0,0 +1,7 @@ +[Unit] +Description=Chassis%i (Reset Check) +Conflicts=obmc-chassis-poweroff@%i.target +RefuseManualStop=yes + +[Install] +WantedBy={SYSTEMD_DEFAULT_TARGET} diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fan-control-ready@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fan-control-ready@.target new file mode 100644 index 0000000000..e041a55080 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fan-control-ready@.target @@ -0,0 +1,4 @@ +[Unit] +Description=Fan Control Ready +RefuseManualStop=yes +Conflicts=obmc-chassis-powered-off@%i.target diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fan-control.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fan-control.target new file mode 100644 index 0000000000..50665db4a8 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fan-control.target @@ -0,0 +1,4 @@ +[Unit] +Description=Fan Control +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fan-watchdog-takeover.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fan-watchdog-takeover.target new file mode 100644 index 0000000000..8034083345 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fan-watchdog-takeover.target @@ -0,0 +1,6 @@ +#The system implementation should start this target when dynamic fan control +#is no longer desired or possible. It should also add units to this target +#that enabled continued operation after dynamic fan control is no longer +#desired or possible. +[Unit] +Description=Fan watchdog takeover target diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fans-ready.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fans-ready.target new file mode 100644 index 0000000000..59e61c626a --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-fans-ready.target @@ -0,0 +1,4 @@ +[Unit] +Description=Fans Ready +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-crash@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-crash@.target new file mode 100644 index 0000000000..ea3798b522 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-crash@.target @@ -0,0 +1,4 @@ +[Unit] +Description=Host instance %i crashed +Conflicts=obmc-chassis-poweroff@%i.target +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-quiesce@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-quiesce@.target new file mode 100644 index 0000000000..4f10419abc --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-quiesce@.target @@ -0,0 +1,6 @@ +[Unit] +Description=Quiesce Target +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +RefuseManualStop=yes +Conflicts=obmc-chassis-poweroff@%i.target diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-reboot@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-reboot@.target new file mode 100644 index 0000000000..dc280ea653 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-reboot@.target @@ -0,0 +1,10 @@ +[Unit] +Description=Reboot Host%i +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Wants=mapper-wait@-org-openbmc-control-chassis%i.service +After=mapper-wait@-org-openbmc-control-chassis%i.service +Conflicts=obmc-host-startmin@%i.target +RefuseManualStop=yes +OnFailure=obmc-chassis-poweroff@%i.target +OnFailureJobMode=flush diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-reset-running@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-reset-running@.target new file mode 100644 index 0000000000..94bb2b130d --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-reset-running@.target @@ -0,0 +1,5 @@ +[Unit] +Description=Host%i running after reset +Conflicts=obmc-host-stop@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-reset@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-reset@.target new file mode 100644 index 0000000000..ca95d843c2 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-reset@.target @@ -0,0 +1,7 @@ +[Unit] +Description=Host%i (Reset Check) +Conflicts=obmc-host-stop@%i.target +RefuseManualStop=yes + +[Install] +WantedBy={SYSTEMD_DEFAULT_TARGET} diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-shutdown@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-shutdown@.target new file mode 100644 index 0000000000..4768a567fa --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-shutdown@.target @@ -0,0 +1,6 @@ +[Unit] +Description=Power%i Host Off +Wants={SYSTEMD_DEFAULT_TARGET} +RefuseManualStop=yes +OnFailure=obmc-chassis-poweroff@%i.target +OnFailureJobMode=flush diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-start-pre@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-start-pre@.target new file mode 100644 index 0000000000..2bc270c146 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-start-pre@.target @@ -0,0 +1,7 @@ +[Unit] +Description=Start Host%i (Pre) +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Conflicts=obmc-host-stop@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-start@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-start@.target new file mode 100644 index 0000000000..144b633878 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-start@.target @@ -0,0 +1,10 @@ +[Unit] +Description=Start Host%i +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Wants=mapper-wait@-org-openbmc-control-chassis%i.service +After=mapper-wait@-org-openbmc-control-chassis%i.service +Conflicts=obmc-host-stop@%i.target +RefuseManualStop=yes +OnFailure=obmc-host-quiesce@%i.target +OnFailureJobMode=flush diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-started@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-started@.target new file mode 100644 index 0000000000..eb0a9383be --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-started@.target @@ -0,0 +1,7 @@ +[Unit] +Description=Host%i (Started) +Wants={SYSTEMD_DEFAULT_TARGET} +After=obmc-host-starting@%i.target +Conflicts=obmc-host-stop@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-starting@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-starting@.target new file mode 100644 index 0000000000..408139dd43 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-starting@.target @@ -0,0 +1,7 @@ +[Unit] +Description=Host%i (Starting) +Wants={SYSTEMD_DEFAULT_TARGET} +After=obmc-host-start-pre@%i.target +Conflicts=obmc-host-stop@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-startmin@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-startmin@.target new file mode 100644 index 0000000000..6e924adcd7 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-startmin@.target @@ -0,0 +1,10 @@ +[Unit] +Description=Start Host%i Minimum +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Wants=mapper-wait@-org-openbmc-control-chassis%i.service +After=mapper-wait@-org-openbmc-control-chassis%i.service +Conflicts=obmc-host-stop@%i.target +RefuseManualStop=yes +OnFailure=obmc-host-quiesce@%i.target +OnFailureJobMode=flush diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stop-pre@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stop-pre@.target new file mode 100644 index 0000000000..e88d3ea587 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stop-pre@.target @@ -0,0 +1,8 @@ +[Unit] +Description=Stop Host%i (Pre) +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Before=obmc-host-stopping@%i.target +Conflicts=obmc-host-startmin@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stop@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stop@.target new file mode 100644 index 0000000000..8e99bccdb9 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stop@.target @@ -0,0 +1,11 @@ +[Unit] +Description=Stop Host%i +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Wants=mapper-wait@-org-openbmc-control-chassis%i.service +After=mapper-wait@-org-openbmc-control-chassis%i.service +After=obmc-chassis-poweroff@%i.target +Conflicts=obmc-host-startmin@%i.target +RefuseManualStop=yes +OnFailure=obmc-chassis-poweroff@%i.target +OnFailureJobMode=flush diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stopped@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stopped@.target new file mode 100644 index 0000000000..74039fc25c --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stopped@.target @@ -0,0 +1,9 @@ +[Unit] +Description=Host%i (Stopped) +Wants={SYSTEMD_DEFAULT_TARGET} +Wants=obmc-host-stopping@%i.target +After=obmc-host-stopping@%i.target +Before=obmc-power-stop-pre@%i.target +Conflicts=obmc-host-startmin@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stopping@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stopping@.target new file mode 100644 index 0000000000..f087dea723 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-stopping@.target @@ -0,0 +1,10 @@ +[Unit] +Description=Host%i (Stopping) +Wants={SYSTEMD_DEFAULT_TARGET} +Wants=obmc-host-stop-pre@%i.target +After=obmc-host-stop-pre@%i.target +Before=obmc-host-stopped@%i.target +Conflicts=obmc-host-startmin@%i.target +Conflicts=obmc-host-starting@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-timeout@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-timeout@.target new file mode 100644 index 0000000000..b87507bf10 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-host-timeout@.target @@ -0,0 +1,4 @@ +[Unit] +Description=Host instance %i timed out refreshing Watchdog +Conflicts=obmc-chassis-poweroff@%i.target +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-mapper.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-mapper.target new file mode 100644 index 0000000000..5e52f4cd53 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-mapper.target @@ -0,0 +1,4 @@ +[Unit] +Description=Phosphor Object Mapper +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-off@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-off@.target new file mode 100644 index 0000000000..c47b21e477 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-off@.target @@ -0,0 +1,7 @@ +[Unit] +Description=Power%i (Off) +Wants={SYSTEMD_DEFAULT_TARGET} +After=obmc-power-stop@%i.target +Conflicts=obmc-chassis-poweron@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-on@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-on@.target new file mode 100644 index 0000000000..52135ffc9c --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-on@.target @@ -0,0 +1,7 @@ +[Unit] +Description=Power%i (On) +Wants={SYSTEMD_DEFAULT_TARGET} +After=obmc-power-start@%i.target +Conflicts=obmc-chassis-poweroff@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-reset-on@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-reset-on@.target new file mode 100644 index 0000000000..d24d401bfa --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-reset-on@.target @@ -0,0 +1,5 @@ +[Unit] +Description=Chassis%i power on after reset +Conflicts=obmc-chassis-poweroff@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-start-pre@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-start-pre@.target new file mode 100644 index 0000000000..1a1ea63191 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-start-pre@.target @@ -0,0 +1,7 @@ +[Unit] +Description=Power%i On (Pre) +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Conflicts=obmc-chassis-poweroff@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-start@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-start@.target new file mode 100644 index 0000000000..a977d5ad3c --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-start@.target @@ -0,0 +1,7 @@ +[Unit] +Description=Power%i On +After=obmc-power-start-pre@%i.target +Wants={SYSTEMD_DEFAULT_TARGET} +Conflicts=obmc-chassis-poweroff@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-stop-pre@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-stop-pre@.target new file mode 100644 index 0000000000..50d5050bb5 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-stop-pre@.target @@ -0,0 +1,9 @@ +[Unit] +Description=Power%i Off (Pre) +Wants={SYSTEMD_DEFAULT_TARGET} +After={SYSTEMD_DEFAULT_TARGET} +Wants=obmc-host-stopped@%i.target +After=obmc-host-stopped@%i.target +Conflicts=obmc-chassis-poweron@%i.target +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-stop@.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-stop@.target new file mode 100644 index 0000000000..f0429d7865 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-power-stop@.target @@ -0,0 +1,9 @@ +[Unit] +Description=Power%i Off +Wants=obmc-power-stop-pre@%i.target +After=obmc-power-stop-pre@%i.target +Wants={SYSTEMD_DEFAULT_TARGET} +Conflicts=obmc-chassis-poweron@%i.target +Conflicts=fsi-disable.service +RefuseManualStart=yes +RefuseManualStop=yes diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-standby.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-standby.target new file mode 100644 index 0000000000..95044a4044 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-standby.target @@ -0,0 +1,9 @@ +[Unit] +Description=Phosphor System - Standby +Requires=multi-user.target +RefuseManualStart=yes +RefuseManualStop=yes +AllowIsolate=yes + +[Install] +WantedBy=multi-user.target diff --git a/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-webserver-pre.target b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-webserver-pre.target new file mode 100644 index 0000000000..ea5200c006 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/obmc-targets/obmc-webserver-pre.target @@ -0,0 +1,2 @@ +[Unit] +Description=Webserver (pre) diff --git a/meta-phosphor/recipes-core/systemd/systemd/0001-sd-bus-Don-t-automatically-add-ObjectManager.patch b/meta-phosphor/recipes-core/systemd/systemd/0001-sd-bus-Don-t-automatically-add-ObjectManager.patch new file mode 100644 index 0000000000..f8f5b08a96 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/systemd/0001-sd-bus-Don-t-automatically-add-ObjectManager.patch @@ -0,0 +1,56 @@ +From 44562e33655668033a8ee0a7a686671226da2110 Mon Sep 17 00:00:00 2001 +From: Brad Bishop <bradleyb@fuzziesquirrel.com> +Date: Tue, 13 Mar 2018 15:34:30 -0400 +Subject: [PATCH] sd-bus: Don't automatically add ObjectManager + +Even though sdbus helps manage org.freedesktop.DBus.ObjectManager +it must still be explicitly enabled by a library client. + +As such do not automatically add ObjectManager to GetManagedObjects +method call responses or InterfacesAdded/Removed signals. Bus +service client applications can potentially react to the appearance +of ObjectManager in these messages and follow up with a method call +on the interface, which isn't actually implemented on the objects +within the subtree, below the manager. +--- + src/libsystemd/sd-bus/bus-objects.c | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c +index 6e00255b2..59f698402 100644 +--- a/src/libsystemd/sd-bus/bus-objects.c ++++ b/src/libsystemd/sd-bus/bus-objects.c +@@ -1076,10 +1076,6 @@ static int object_manager_serialize_path( + if (r < 0) + return r; + +- r = sd_bus_message_append(reply, "{sa{sv}}", "org.freedesktop.DBus.ObjectManager", 0); +- if (r < 0) +- return r; +- + found_something = true; + } + +@@ -2302,9 +2298,6 @@ static int object_added_append_all(sd_bus *bus, sd_bus_message *m, const char *p + if (r < 0) + return r; + r = sd_bus_message_append(m, "{sa{sv}}", "org.freedesktop.DBus.Properties", 0); +- if (r < 0) +- return r; +- r = sd_bus_message_append(m, "{sa{sv}}", "org.freedesktop.DBus.ObjectManager", 0); + if (r < 0) + return r; + +@@ -2473,9 +2466,6 @@ static int object_removed_append_all(sd_bus *bus, sd_bus_message *m, const char + if (r < 0) + return r; + r = sd_bus_message_append(m, "s", "org.freedesktop.DBus.Properties"); +- if (r < 0) +- return r; +- r = sd_bus_message_append(m, "s", "org.freedesktop.DBus.ObjectManager"); + if (r < 0) + return r; + +-- +2.14.3 + diff --git a/meta-phosphor/recipes-core/systemd/systemd/0003-basic-Factor-out-string-checking-from-name_to_prefix.patch b/meta-phosphor/recipes-core/systemd/systemd/0003-basic-Factor-out-string-checking-from-name_to_prefix.patch new file mode 100644 index 0000000000..cd4dcad164 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/systemd/0003-basic-Factor-out-string-checking-from-name_to_prefix.patch @@ -0,0 +1,103 @@ +From 899173e241f781ad4dfb6b40e7c5f35104164435 Mon Sep 17 00:00:00 2001 +From: Brad Bishop <bradleyb@fuzziesquirrel.com> +Date: Thu, 12 Jan 2017 09:56:54 -0500 +Subject: [PATCH 1/2] basic: Factor out string checking from + name_to_prefix/instance + +Add two new functions: string_to_prefix/instance that enable +prefix/instance extraction from a name before the name is +mangled. + +Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> +--- + src/basic/unit-name.c | 48 +++++++++++++++++++++++++++++++----------------- + 1 file changed, 31 insertions(+), 17 deletions(-) + +diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c +index 0a6efa4..93c4838 100644 +--- a/src/basic/unit-name.c ++++ b/src/basic/unit-name.c +@@ -135,42 +135,46 @@ bool unit_suffix_is_valid(const char *s) { + return true; + } + +-int unit_name_to_prefix(const char *n, char **ret) { ++static int string_to_prefix(const char *s, char **ret) { + const char *p; +- char *s; ++ char *r; + +- assert(n); ++ assert(s); + assert(ret); + +- if (!unit_name_is_valid(n, UNIT_NAME_ANY)) +- return -EINVAL; +- +- p = strchr(n, '@'); ++ p = strchr(s, '@'); + if (!p) +- p = strrchr(n, '.'); ++ p = strrchr(s, '.'); + + assert_se(p); + +- s = strndup(n, p - n); +- if (!s) ++ r = strndup(s, p - s); ++ if (!r) + return -ENOMEM; + +- *ret = s; ++ *ret = r; + return 0; + } + +-int unit_name_to_instance(const char *n, char **instance) { +- const char *p, *d; +- char *i; +- ++int unit_name_to_prefix(const char *n, char **ret) { + assert(n); +- assert(instance); ++ assert(ret); + + if (!unit_name_is_valid(n, UNIT_NAME_ANY)) + return -EINVAL; + ++ return string_to_prefix(n, ret); ++} ++ ++static int string_to_instance(const char *s, char **instance) { ++ const char *p, *d; ++ char *i; ++ ++ assert(s); ++ assert(instance); ++ + /* Everything past the first @ and before the last . is the instance */ +- p = strchr(n, '@'); ++ p = strchr(s, '@'); + if (!p) { + *instance = NULL; + return 0; +@@ -190,6 +194,16 @@ int unit_name_to_instance(const char *n, char **instance) { + return 1; + } + ++int unit_name_to_instance(const char *n, char **instance) { ++ assert(n); ++ assert(instance); ++ ++ if (!unit_name_is_valid(n, UNIT_NAME_ANY)) ++ return -EINVAL; ++ ++ return string_to_instance(n, instance); ++} ++ + int unit_name_to_prefix_and_instance(const char *n, char **ret) { + const char *d; + char *s; +-- +1.8.3.1 + diff --git a/meta-phosphor/recipes-core/systemd/systemd/0004-basic-Use-path-escaping-when-mangling-path-instances.patch b/meta-phosphor/recipes-core/systemd/systemd/0004-basic-Use-path-escaping-when-mangling-path-instances.patch new file mode 100644 index 0000000000..fca28de59f --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/systemd/0004-basic-Use-path-escaping-when-mangling-path-instances.patch @@ -0,0 +1,69 @@ +From b7565b3f2d3b13c4ae5734407a2c3f27658c7b4b Mon Sep 17 00:00:00 2001 +From: Brad Bishop <bradleyb@fuzziesquirrel.com> +Date: Thu, 12 Jan 2017 08:52:42 -0500 +Subject: [PATCH 2/2] basic: Use path escaping when mangling path instances + +Allow path instances with dashes in them to be unescaped +properly. + +Fixes systemd/systemd#5072 + +Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> +--- + src/basic/unit-name.c | 18 ++++++++++++++++++ + src/test/test-unit-name.c | 3 +++ + 2 files changed, 21 insertions(+) + +diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c +index 93c4838..c91b0e7 100644 +--- a/src/basic/unit-name.c ++++ b/src/basic/unit-name.c +@@ -684,6 +684,8 @@ static char *do_escape_mangle(const char *f, UnitNameMangle allow_globs, char *t + * If @allow_globs, globs characters are preserved. Otherwise, they are escaped. + */ + int unit_name_mangle_with_suffix(const char *name, UnitNameMangle allow_globs, const char *suffix, char **ret) { ++ _cleanup_free_ char *instance = NULL; ++ _cleanup_free_ char *prefix = NULL; + char *s, *t; + int r; + +@@ -723,6 +725,22 @@ int unit_name_mangle_with_suffix(const char *name, UnitNameMangle allow_globs, c + return r; + } + ++ r = string_to_instance(name, &instance); ++ if(r < 0 && r != -EINVAL) ++ return r; ++ ++ if(instance && path_is_absolute(instance)) { ++ r = string_to_prefix(name, &prefix); ++ if(r < 0 && r != -EINVAL) ++ return r; ++ ++ r = unit_name_from_path_instance(prefix, instance, suffix, ret); ++ if (r >= 0) ++ return 1; ++ if (r != -EINVAL) ++ return r; ++ } ++ + s = new(char, strlen(name) * 4 + strlen(suffix) + 1); + if (!s) + return -ENOMEM; +diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c +index 2fd83f3..f2cb047 100644 +--- a/src/test/test-unit-name.c ++++ b/src/test/test-unit-name.c +@@ -192,6 +192,9 @@ static void test_unit_name_mangle(void) { + test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo", "foo.service", 1); + test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo*", "foo*", 0); + test_unit_name_mangle_one(UNIT_NAME_GLOB, "ΓΌ*", "\\xc3\\xbc*", 1); ++ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo@/bar.service", "foo@bar.service", 1); ++ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo@/bar/baz-boo.service", "foo@bar-baz\\x2dboo.service", 1); ++ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo@bar/baz-boo.service", "foo@bar-baz-boo.service", 1); + } + + static int test_unit_printf(void) { +-- +1.8.3.1 + diff --git a/meta-phosphor/recipes-core/systemd/systemd/0005-dont-return-error-if-unable-to-create-network-namespace.patch b/meta-phosphor/recipes-core/systemd/systemd/0005-dont-return-error-if-unable-to-create-network-namespace.patch new file mode 100644 index 0000000000..d83bf72ef4 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/systemd/0005-dont-return-error-if-unable-to-create-network-namespace.patch @@ -0,0 +1,39 @@ +From 870b79559cd5841b3f680c914b4b2e770a9961cf Mon Sep 17 00:00:00 2001 +From: Ratan Gupta <ratagupt@in.ibm.com> +Date: Thu, 20 Jul 2017 11:59:14 +0530 +Subject: [PATCH] Don't return the error if unable to create the network + namespace + +On systems where kernel is not configured with namespace support +then don't return error during setting up network namespace. + +Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com> +--- + src/core/namespace.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/core/namespace.c b/src/core/namespace.c +index 1195e9a..f30dacf 100644 +--- a/src/core/namespace.c ++++ b/src/core/namespace.c +@@ -986,7 +986,7 @@ int setup_netns(int netns_storage_socket[2]) { + /* Nothing stored yet, so let's create a new namespace */ + + if (unshare(CLONE_NEWNET) < 0) { +- r = -errno; ++ r = 0; + goto fail; + } + +@@ -994,7 +994,7 @@ int setup_netns(int netns_storage_socket[2]) { + + netns = open("/proc/self/ns/net", O_RDONLY|O_CLOEXEC|O_NOCTTY); + if (netns < 0) { +- r = -errno; ++ r = 0; + goto fail; + } + +-- +1.9.1 + diff --git a/meta-phosphor/recipes-core/systemd/systemd/default.network b/meta-phosphor/recipes-core/systemd/systemd/default.network new file mode 100644 index 0000000000..c75c3d60de --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/systemd/default.network @@ -0,0 +1,4 @@ +[Match] +Name=eth* +[Network] +DHCP=ipv4 diff --git a/meta-phosphor/recipes-core/systemd/systemd_%.bbappend b/meta-phosphor/recipes-core/systemd/systemd_%.bbappend new file mode 100644 index 0000000000..b403069a58 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/systemd_%.bbappend @@ -0,0 +1,22 @@ +FILES_${PN}-catalog-extralocales = \ + "${exec_prefix}/lib/systemd/catalog/*.*.catalog" +PACKAGES =+ "${PN}-catalog-extralocales" +PACKAGECONFIG_append = " networkd coredump" +PACKAGECONFIG_remove = "machined hibernate ldconfig binfmt backlight localed \ + quotacheck kdbus ima smack polkit logind bootchart utmp \ + manpages" +FILESEXTRAPATHS_append := "${THISDIR}/${PN}:" +SRC_URI += "file://default.network" +SRC_URI += "file://0001-sd-bus-Don-t-automatically-add-ObjectManager.patch" +SRC_URI += "file://0003-basic-Factor-out-string-checking-from-name_to_prefix.patch" +SRC_URI += "file://0004-basic-Use-path-escaping-when-mangling-path-instances.patch" +#TODO upstream the below patch via below issue +#https://github.com/openbmc/openbmc/issues/2016 +SRC_URI += "file://0005-dont-return-error-if-unable-to-create-network-namespace.patch" + +RRECOMMENDS_${PN} += "obmc-targets" +FILES_${PN} += "${systemd_unitdir}/network/default.network" + +do_install_append() { + install -m 644 ${WORKDIR}/default.network ${D}${systemd_unitdir}/network/ +} |