blob: 655a44626ba6cd753927528251c2117b1ef9c1db [file] [log] [blame]
Thang Q. Nguyenfa1aa4d2021-08-07 05:09:50 +00001FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
2RDEPENDS:${PN} += "bash"
Tung Nguyen189431e2020-12-16 08:11:51 +00003
4# Remove what installed by common recipe
5OBMC_CONSOLE_HOST_TTY = ""
Patrick Williamsd5c716d2022-02-17 07:30:57 -06006SYSTEMD_SUBSTITUTIONS:remove = "OBMC_CONSOLE_HOST_TTY:${OBMC_CONSOLE_HOST_TTY}:${PN}-ssh@.service"
7SYSTEMD_SUBSTITUTIONS:remove = "OBMC_CONSOLE_HOST_TTY:${OBMC_CONSOLE_HOST_TTY}:${PN}-ssh.socket"
Thang Q. Nguyenfa1aa4d2021-08-07 05:09:50 +00008SYSTEMD_SERVICE:${PN}:remove = " \
Tung Nguyen189431e2020-12-16 08:11:51 +00009 ${PN}-ssh.socket \
10 ${PN}-ssh@.service \
11 "
12
13# Declare port spcific conf and service files
14HOST_CONSOLE_TTY = "ttyS0 ttyS1 ttyS2 ttyS3"
15
16CONSOLE_CONF_FMT = "file://server.{0}.conf"
17SRC_URI += "${@compose_list(d, 'CONSOLE_CONF_FMT', 'HOST_CONSOLE_TTY')}"
18SRC_URI += "file://${BPN}-server-setup.sh"
19SRC_URI += "file://${BPN}@.service"
20SRC_URI += "file://ampere_uartmux_ctrl.sh"
21
22CONSOLE_SSH_SOCKET_FILE_FMT = "file://${PN}-{0}-ssh.socket"
23CONSOLE_SSH_SERVICE_FILE_FMT = "file://${PN}-{0}-ssh@.service"
24SRC_URI += "${@compose_list(d, 'CONSOLE_SSH_SOCKET_FILE_FMT', 'HOST_CONSOLE_TTY')}"
25SRC_URI += "${@compose_list(d, 'CONSOLE_SSH_SERVICE_FILE_FMT', 'HOST_CONSOLE_TTY')}"
26
27CONSOLE_SSH_SOCKET_FMT = "${PN}-{0}-ssh.socket"
28CONSOLE_SSH_SERVICE_FMT = "${PN}-{0}-ssh@.service"
29
Thang Q. Nguyenfa1aa4d2021-08-07 05:09:50 +000030SYSTEMD_SERVICE:${PN} = " \
Tung Nguyen189431e2020-12-16 08:11:51 +000031 ${PN}@.service \
32 ${@compose_list(d, 'CONSOLE_SSH_SOCKET_FMT', 'HOST_CONSOLE_TTY')} \
33 ${@compose_list(d, 'CONSOLE_SSH_SERVICE_FMT', 'HOST_CONSOLE_TTY')} \
34 "
Thang Q. Nguyenfa1aa4d2021-08-07 05:09:50 +000035do_install:append() {
Tung Nguyen189431e2020-12-16 08:11:51 +000036 for i in ${HOST_CONSOLE_TTY}
37 do
38 install -m 0644 ${WORKDIR}/server.${i}.conf ${D}${sysconfdir}/${BPN}/server.${i}.conf
39 install -m 0644 ${WORKDIR}/${BPN}-${i}-ssh.socket ${D}${systemd_unitdir}/system/${BPN}-${i}-ssh.socket
40 install -m 0644 ${WORKDIR}/${BPN}-${i}-ssh@.service ${D}${systemd_unitdir}/system/${BPN}-${i}-ssh@.service
41 done
42 install -m 0755 ${WORKDIR}/${BPN}-server-setup.sh ${D}${sbindir}/${BPN}-server-setup.sh
43
44 # Deal with files installed by the base package's .bb install function
45 rm -f ${D}${sysconfdir}/${BPN}.conf
46 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
47 rm -rf ${D}${systemd_unitdir}/system/${BPN}-ssh@.service.d/
48 rm -f ${D}${systemd_unitdir}/system/${BPN}-ssh@.service
49 rm -f ${D}${systemd_unitdir}/system/${BPN}-ssh.socket
50 # Overwrite base package's obmc-console@.service with our own
51 install -m 0644 ${WORKDIR}/${BPN}@.service ${D}${systemd_unitdir}/system/${BPN}@.service
52 install -d ${D}/usr/sbin
53 install -m 0755 ${WORKDIR}/ampere_uartmux_ctrl.sh ${D}/${sbindir}/ampere_uartmux_ctrl.sh
54}