blob: 11c744877338e4810d40035c2b14db86b358dcf5 [file] [log] [blame]
SUMMARY = "Write host logs to the eMMC"
DESCRIPTION = "Stream host logs to the eMMC while eMMC is available"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
inherit systemd
DEPENDS += "systemd"
RDEPENDS:${PN} += "bash"
RDEPENDS:${PN} += "obmc-console"
RDEPENDS:${PN} += "emmc-available"
RDEPENDS:${PN} += "logrotate"
SRC_URI += " \
file://emmc-host-logs@.service.in \
file://host_log_rotate.conf.in \
"
S = "${WORKDIR}"
FILES:${PN} += " \
${systemd_system_unitdir} \
"
CONFFILES:${PN} += "${sysconfdir}/logrotate.d/host_log_rotate.conf"
SYSTEMD_SERVICE:${PN} += "emmc-host-logs@.service"
# Override this for each platform, with a bbappend
HOST_CONSOLE_TTYS ?= "ttyVUART0"
# These values can overridden, if needed.
HOST_LOG_DIR ?= "/mnt/luks-mmcblk0_fs/host_logs"
LOG_MAX_SIZE ?= "10M"
do_install:append() {
# Install the emmc-host-logs service file
install -d ${D}${systemd_system_unitdir}
sed "s,@HOST_LOG_DIR@,${HOST_LOG_DIR},g" ${S}/emmc-host-logs@.service.in \
>${D}${systemd_system_unitdir}/emmc-host-logs@.service
install -d ${D}${systemd_system_unitdir}/emmc-available.target.wants
# Configure the systemd services to start when the eMMC becomes available.
for CONSOLE in ${HOST_CONSOLE_TTYS}
do
ln -fs ../emmc-host-logs@.service ${D}${systemd_system_unitdir}/emmc-available.target.wants/emmc-host-logs@${CONSOLE}.service
done
# Install log rotate policy
install -d "${D}${sysconfdir}/logrotate.d"
sed -e "s,@HOST_LOG_DIR@,${HOST_LOG_DIR},g" \
-e "s,@LOG_MAX_SIZE@,${LOG_MAX_SIZE},g" \
${S}/host_log_rotate.conf.in \
>${D}${sysconfdir}/logrotate.d/host_log_rotate.conf
}