From 1ccad4b98b412197ef72a2bb978cf26327b54fd6 Mon Sep 17 00:00:00 2001
From: John Klug <john.klug@multitech.com>
Date: Wed, 4 Dec 2019 13:35:28 -0600
Subject: Create mlinux-basetest-image which has no login for console

---
 recipes-core/images/mlinux-basetest-image.bb       | 72 ++++++++++++++++++++++
 recipes-core/images/mlinux-minimal-image.bb        |  3 +
 recipes-core/sysvinit/files/start_getty_open       |  6 ++
 .../sysvinit/sysvinit-inittab_2.88dsf.bbappend     | 23 +++++++
 4 files changed, 104 insertions(+)
 create mode 100644 recipes-core/images/mlinux-basetest-image.bb
 create mode 100644 recipes-core/sysvinit/files/start_getty_open

diff --git a/recipes-core/images/mlinux-basetest-image.bb b/recipes-core/images/mlinux-basetest-image.bb
new file mode 100644
index 0000000..6e000c1
--- /dev/null
+++ b/recipes-core/images/mlinux-basetest-image.bb
@@ -0,0 +1,72 @@
+# Conduit 0.0 or 0.1 without RS9113
+DESCRIPTION = "mLinux base image"
+LICENSE = "MIT"
+
+require mlinux-minimal-image.bb
+
+# Open console for test image
+CONSOLE = "sysvinit-inittab-start-open"
+
+FILESYSTEM_FEATURES = "dosfstools \
+                 cifs-utils \
+				 lsof \
+                 "
+
+NETWORKING_FEATURES += "bridge-utils \
+                       inetutils-ftp \
+                       openssl \
+                       rsync \
+                       iperf \
+                       lldpd \
+					   mii-diag \
+					   tcpdump \
+					   netcat \
+					   wget \
+					   strongswan \
+					   busybox-ifplugd \
+                       "
+
+WIFI_FEATURES = " \
+                libnl \
+                wpa-supplicant \
+                wireless-tools \
+                iw \
+                hostap-daemon hostap-utils \
+                "
+
+BLUETOOTH_FEATURES = "bluez5"
+
+# Add all timezones available
+# ntpdate will sync time every 30 min by default via cron
+TIME_FEATURES = "tzdata tzdata-africa tzdata-americas tzdata-antarctica tzdata-arctic \
+				 tzdata-asia tzdata-atlantic tzdata-australia tzdata-europe tzdata-pacific \
+				 tzdata-misc \
+				 cronie \
+                 ntpdate \
+                 "
+
+# u-boot-linux-utils: U-Boot environment access from Linux
+# mlinux-scripts: sample scripts for setting up Conduit for various tasks
+# reset-handler: default reset button handler
+# radio-cmd: supports cellular radio activation and other configuration commands
+# radio-query: queries cellular radio for common info (IMEI, RSSI, etc)
+# jsparser: command line tool to parse JSON files
+MULTITECH_FEATURES += " \
+                     u-boot-linux-utils \
+                     mlinux-scripts \
+					 reset-handler \
+					 radio-cmd radio-query \
+					 jsparser \
+                     "
+
+MISC_FEATURES = "minicom lrzsz nano"
+
+# Extra stuff to install
+IMAGE_INSTALL += " \
+                kernel-modules \
+		${WIFI_FEATURES} \
+		${BLUETOOTH_FEATURES} \
+		${FILESYSTEM_FEATURES} \
+                ${TIME_FEATURES} \
+                ${MISC_FEATURES} \
+                "
diff --git a/recipes-core/images/mlinux-minimal-image.bb b/recipes-core/images/mlinux-minimal-image.bb
index 8090f57..0e1d4a3 100644
--- a/recipes-core/images/mlinux-minimal-image.bb
+++ b/recipes-core/images/mlinux-minimal-image.bb
@@ -57,10 +57,13 @@ MULTITECH_MTAC = "kernel-module-mtac \
 
 UPGRADE_FEATURES = "upgrade-reboot mtd-utils-static"
 
+CONSOLE = "sysvinit-inittab-start"
+
 IMAGE_INSTALL = "${CORE_FEATURES} \
                  ${NETWORKING_FEATURES} \
                  ${UPGRADE_FEATURES} \
                  ${MULTITECH_FEATURES} \
                  ${MULTITECH_MTAC} \
+		 ${CONSOLE} \
                  "
 
diff --git a/recipes-core/sysvinit/files/start_getty_open b/recipes-core/sysvinit/files/start_getty_open
new file mode 100644
index 0000000..3afce00
--- /dev/null
+++ b/recipes-core/sysvinit/files/start_getty_open
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Open console for testing
+if [ -c /dev/$2 ]
+then 
+        /sbin/getty -L $1 $2 xterm -n -l /bin/bash
+fi
diff --git a/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bbappend b/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bbappend
index 6c79846..be33f10 100644
--- a/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bbappend
+++ b/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bbappend
@@ -1,2 +1,25 @@
 # enable gadget serial console for supported hardware
+SUMMARY_${PN}-start-open = "Open debug console for development only"
+SUMMARY_${PN}-start = "Production console"
 SERIAL_CONSOLES_append_mtcdt = " 115200;ttyGS0"
+PACKAGES =+ "${PN}-start ${PN}-start-open"
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+SRC_URI += "file://start_getty_open"
+
+FILES_${PN} = "${sysconfdir}/inittab"
+FILES_${PN}-start = "${base_bindir}/start_getty"
+FILES_${PN}-start-open = "${base_bindir}/start_getty_open"
+RCONFLICTS_${PN}-start = "${PN}-start-open"
+RCONFLICTS_${PN}-start-open = "${PN}-start"
+RDEPENDS_${PN}-start-open = "${PN}"
+
+do_install_append() {
+	install -m 0755 ${WORKDIR}/start_getty_open ${D}${base_bindir}/start_getty_open
+}
+pkg_postinst_${PN}-start-open() {
+	sed -i 's?^S0:.*?S0:12345:respawn:/bin/start_getty_open 115200 ttyS0?' $D/etc/inittab
+}
+
+pkg_prerm_${PN}-start-open() {
+	sed -i 's?^S0:.*?S0:12345:respawn:/bin/start_getty 115200 ttyS0?' $D/etc/inittab
+}
-- 
cgit v1.2.3