blob: 452554c288b8b6bb6bc27e14b593d8219723c755 [file] [log] [blame]
Tung Nguyen189431e2020-12-16 08:11:51 +00001FILESEXTRAPATHS_append := "${THISDIR}/${PN}:"
2RDEPENDS_${PN} += "bash"
3
4# Remove what installed by common recipe
5OBMC_CONSOLE_HOST_TTY = ""
6SYSTEMD_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"
8SYSTEMD_SERVICE_${PN}_remove = " \
9 ${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
30SYSTEMD_SERVICE_${PN} = " \
31 ${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 "
35do_install_append() {
36 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}