summaryrefslogtreecommitdiff
path: root/meta-openpower/recipes-phosphor/host/op-proc-control-systemd-links.bb
blob: 521ff02b98e35d4f4e447833d92e13a86ed819f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
SUMMARY = "OpenPOWER processor control services installation"
PR = "r1"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"

inherit allarch

RDEPENDS_${PN} += "op-proc-control"
RDEPENDS_${PN} += "phosphor-state-manager-obmc-targets"

ALLOW_EMPTY_${PN} = "1"

pkg_postinst_${PN}() {
	mkdir -p $D$systemd_system_unitdir/obmc-host-stop@0.target.wants
	mkdir -p $D$systemd_system_unitdir/obmc-host-force-warm-reboot@0.target.requires
	mkdir -p $D$systemd_system_unitdir/obmc-host-startmin@0.target.requires
	mkdir -p $D$systemd_system_unitdir/obmc-host-diagnostic-mode@0.target.requires
	mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@0.target.requires

	LINK="$D$systemd_system_unitdir/obmc-host-stop@0.target.wants/op-stop-instructions@0.service"
	TARGET="../op-stop-instructions@.service"
	ln -s $TARGET $LINK

	LINK="$D$systemd_system_unitdir/obmc-host-startmin@0.target.requires/op-cfam-reset.service"
	TARGET="../op-cfam-reset.service"
	ln -s $TARGET $LINK

	LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@0.target.requires/op-cfam-reset.service"
	TARGET="../op-cfam-reset.service"
	ln -s $TARGET $LINK

	# Only install cfam override if p9 system
	if [ "${@bb.utils.contains("MACHINE_FEATURES", "p9-cfam-override", "True", "False", d)}" = True ]; then
		mkdir -p $D$systemd_system_unitdir/obmc-host-startmin@0.target.requires
		LINK="$D$systemd_system_unitdir/obmc-host-startmin@0.target.requires/cfam_override@0.service"
		TARGET="../cfam_override@.service"
		ln -s $TARGET $LINK
	fi

	LINK="$D$systemd_system_unitdir/obmc-host-startmin@0.target.requires/op-continue-mpreboot@0.service"
	TARGET="../op-continue-mpreboot@.service"
	ln -s $TARGET $LINK

	LINK="$D$systemd_system_unitdir/obmc-host-diagnostic-mode@0.target.requires/op-enter-mpreboot@0.service"
	TARGET="../op-enter-mpreboot@.service"
	ln -s $TARGET $LINK

	# Only install phal reinit service if phal enabled
	if [ "${@bb.utils.filter('OBMC_MACHINE_FEATURES', 'phal', d)}" = phal ]; then
		mkdir -p $D$systemd_system_unitdir/obmc-host-start@0.target.requires
		LINK="$D$systemd_system_unitdir/obmc-host-start@0.target.requires/phal-reinit-devtree.service"
		TARGET="../phal-reinit-devtree.service"
		ln -s $TARGET $LINK
	fi
}

pkg_prerm_${PN}() {
	LINK="$D$systemd_system_unitdir/obmc-host-stop@0.target.wants/op-stop-instructions@0.service"
	rm $LINK
	LINK="$D$systemd_system_unitdir/obmc-host-startmin@0.target.requires/op-cfam-reset.service"
	rm $LINK
	LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@0.target.requires/op-cfam-reset.service"
	rm $LINK
	# Only uninstall cfam override if p9 system
	if [ "${@bb.utils.contains("MACHINE_FEATURES", "p9-cfam-override", "True", "False", d)}" = True ]; then
		LINK="$D$systemd_system_unitdir/obmc-host-startmin@0.target.requires/cfam_override@0.service"
		rm $LINK
	fi
	LINK="$D$systemd_system_unitdir/obmc-host-startmin@0.target.requires/op-continue-mpreboot@0.service"
	rm $LINK
	LINK="$D$systemd_system_unitdir/obmc-host-diagnostic-mode@0.target.requires/op-enter-mpreboot@0.service"
	rm $LINK

	# Only phal reinit service if phal enabled
	if [ "${@bb.utils.filter('OBMC_MACHINE_FEATURES', 'phal', d)}" = phal ]; then
		LINK="$D$systemd_system_unitdir/obmc-host-start@0.target.requires/phal-reinit-devtree.service"
		rm $LINK
	fi
}