meta-quanta: olympus-nuvoton: console: add udev support

Listing tty mapped to UART2

Tested: Verified for Olympus platform with ttyS2

Signed-off-by: Joseph Liu <kwliu@nuvoton.com>
Change-Id: I80bda3f82cc2c867fe7eebd80f8c4a4c7b7b62e2
diff --git a/meta-olympus-nuvoton/recipes-phosphor/console/obmc-console/80-olympus-nuvoton-sol.rules b/meta-olympus-nuvoton/recipes-phosphor/console/obmc-console/80-olympus-nuvoton-sol.rules
new file mode 100644
index 0000000..0a73f0c
--- /dev/null
+++ b/meta-olympus-nuvoton/recipes-phosphor/console/obmc-console/80-olympus-nuvoton-sol.rules
@@ -0,0 +1 @@
+SUBSYSTEM=="tty", ATTRS{iomem_base}=="0xF0003000", ENV{SYSTEMD_WANTS}="obmc-console@ttyS2" SYMLINK+="ttyS2", TAG+="systemd"
diff --git a/meta-olympus-nuvoton/recipes-phosphor/console/files/obmc-console.conf b/meta-olympus-nuvoton/recipes-phosphor/console/obmc-console/obmc-console.conf
similarity index 100%
rename from meta-olympus-nuvoton/recipes-phosphor/console/files/obmc-console.conf
rename to meta-olympus-nuvoton/recipes-phosphor/console/obmc-console/obmc-console.conf
diff --git a/meta-olympus-nuvoton/recipes-phosphor/console/obmc-console_%.bbappend b/meta-olympus-nuvoton/recipes-phosphor/console/obmc-console_%.bbappend
index 5967ce1..fe0e346 100644
--- a/meta-olympus-nuvoton/recipes-phosphor/console/obmc-console_%.bbappend
+++ b/meta-olympus-nuvoton/recipes-phosphor/console/obmc-console_%.bbappend
@@ -1,12 +1,14 @@
-SUMMARY = "Nuvoton OpenBMC console daemon"
-DESCRIPTION = "Nuvoton Daemon to handle UART console connections"
-HOMEPAGE = "http://github.com/openbmc/obmc-console"
-PR = "r1"
+FILESEXTRAPATHS_prepend_olympus-nuvoton := "${THISDIR}/${PN}:"
 
-FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+SRC_URI_append_olympus-nuvoton = " file://80-olympus-nuvoton-sol.rules"
 
-OBMC_CONSOLE_HOST_TTY := "ttyS2"
+do_install_append_olympus-nuvoton() {
+        install -m 0755 -d ${D}${sysconfdir}/${BPN}
+        rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
+        install -m 0644 ${WORKDIR}/${BPN}.conf ${D}${sysconfdir}/
+        ln -sr ${D}${sysconfdir}/${BPN}.conf ${D}${sysconfdir}/${BPN}/server.ttyS2.conf
 
-do_build_append() {
-        install -m 0644 ${THISDIR}/files/${PN}.conf ${WORKDIR}/${PN}.conf
+        install -d ${D}/lib/udev/rules.d
+        rm -f ${D}/lib/udev/rules.d/80-obmc-console-uart.rules
+        install -m 0644 ${WORKDIR}/80-olympus-nuvoton-sol.rules ${D}/lib/udev/rules.d
 }