Thang Q. Nguyen | fa1aa4d | 2021-08-07 05:09:50 +0000 | [diff] [blame] | 1 | FILESEXTRAPATHS:append := "${THISDIR}/${PN}:" |
| 2 | RDEPENDS:${PN} += "bash" |
Tung Nguyen | 189431e | 2020-12-16 08:11:51 +0000 | [diff] [blame] | 3 | |
| 4 | # Remove what installed by common recipe |
| 5 | OBMC_CONSOLE_HOST_TTY = "" |
Patrick Williams | d5c716d | 2022-02-17 07:30:57 -0600 | [diff] [blame] | 6 | SYSTEMD_SUBSTITUTIONS:remove = "OBMC_CONSOLE_HOST_TTY:${OBMC_CONSOLE_HOST_TTY}:${PN}-ssh@.service" |
| 7 | SYSTEMD_SUBSTITUTIONS:remove = "OBMC_CONSOLE_HOST_TTY:${OBMC_CONSOLE_HOST_TTY}:${PN}-ssh.socket" |
Thang Q. Nguyen | fa1aa4d | 2021-08-07 05:09:50 +0000 | [diff] [blame] | 8 | SYSTEMD_SERVICE:${PN}:remove = " \ |
Tung Nguyen | 189431e | 2020-12-16 08:11:51 +0000 | [diff] [blame] | 9 | ${PN}-ssh.socket \ |
| 10 | ${PN}-ssh@.service \ |
| 11 | " |
| 12 | |
| 13 | # Declare port spcific conf and service files |
| 14 | HOST_CONSOLE_TTY = "ttyS0 ttyS1 ttyS2 ttyS3" |
| 15 | |
| 16 | CONSOLE_CONF_FMT = "file://server.{0}.conf" |
| 17 | SRC_URI += "${@compose_list(d, 'CONSOLE_CONF_FMT', 'HOST_CONSOLE_TTY')}" |
| 18 | SRC_URI += "file://${BPN}-server-setup.sh" |
| 19 | SRC_URI += "file://${BPN}@.service" |
| 20 | SRC_URI += "file://ampere_uartmux_ctrl.sh" |
| 21 | |
| 22 | CONSOLE_SSH_SOCKET_FILE_FMT = "file://${PN}-{0}-ssh.socket" |
| 23 | CONSOLE_SSH_SERVICE_FILE_FMT = "file://${PN}-{0}-ssh@.service" |
| 24 | SRC_URI += "${@compose_list(d, 'CONSOLE_SSH_SOCKET_FILE_FMT', 'HOST_CONSOLE_TTY')}" |
| 25 | SRC_URI += "${@compose_list(d, 'CONSOLE_SSH_SERVICE_FILE_FMT', 'HOST_CONSOLE_TTY')}" |
| 26 | |
| 27 | CONSOLE_SSH_SOCKET_FMT = "${PN}-{0}-ssh.socket" |
| 28 | CONSOLE_SSH_SERVICE_FMT = "${PN}-{0}-ssh@.service" |
| 29 | |
Thang Q. Nguyen | fa1aa4d | 2021-08-07 05:09:50 +0000 | [diff] [blame] | 30 | SYSTEMD_SERVICE:${PN} = " \ |
Tung Nguyen | 189431e | 2020-12-16 08:11:51 +0000 | [diff] [blame] | 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 | " |
Thang Q. Nguyen | fa1aa4d | 2021-08-07 05:09:50 +0000 | [diff] [blame] | 35 | do_install:append() { |
Tung Nguyen | 189431e | 2020-12-16 08:11:51 +0000 | [diff] [blame] | 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 | } |