From 8b2e4812fcd852ab2342d1f5924161fafb363f7d Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Thu, 12 Mar 2015 14:47:44 +0100 Subject: [PATCH] meta-digi-dey: create sares-image bbclass Remove 'dey-test' image feature and create a SARES bbclass with the same functionality. This makes easier the creation of images suitable for SARES testing just adding: INHERIT += "sares-image" to your project's local.conf https://jira.digi.com/browse/DEL-1558 Signed-off-by: Javier Viguera --- meta-digi-dey/classes/dey-image.bbclass | 34 ----------------- meta-digi-dey/classes/sares-image.bbclass | 46 +++++++++++++++++++++++ meta-digi-dey/conf/distro/dey.conf | 3 -- sdk/build.sh | 8 ++++ 4 files changed, 54 insertions(+), 37 deletions(-) create mode 100644 meta-digi-dey/classes/sares-image.bbclass diff --git a/meta-digi-dey/classes/dey-image.bbclass b/meta-digi-dey/classes/dey-image.bbclass index 8d6aa026f..bd45cd9d9 100644 --- a/meta-digi-dey/classes/dey-image.bbclass +++ b/meta-digi-dey/classes/dey-image.bbclass @@ -46,38 +46,4 @@ dey_rootfs_tuning() { mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd fi fi - ####################################################################### - ## WARNING: - ## enable passwordless 'root' autologin in serial console and telnetd - ## for testing purposes (when IMAGE_FEATURES contains 'dey-test') - ####################################################################### - if echo "${IMAGE_FEATURES}" | grep -qs dey-test; then - if [ -f "${IMAGE_ROOTFS}/etc/inittab" ]; then - cat >${IMAGE_ROOTFS}/sbin/rootlogin <<-_EOF_ - #!/bin/sh - exec /bin/login -f root - _EOF_ - chmod u+x ${IMAGE_ROOTFS}/sbin/rootlogin - - # The 'echo' trick is needed because the SERIAL_CONSOLES variable - # is expanded by bitbake and contains a semicolon ';' - for i in $(echo "${SERIAL_CONSOLES}"); do - label="$(echo $i | sed -e 's,.*tty\(.*\),\1,g')" - sed -i -e " - /^$label:.*getty/{ - i\## WARNING: passwordless 'root' autologin enabled - s,getty,getty -n -l /sbin/rootlogin,g - }" ${IMAGE_ROOTFS}/etc/inittab - done - - # Install a telnetd daemon if there isn't one - if ! grep -qs telnetd ${IMAGE_ROOTFS}/etc/inittab; then - cat >>${IMAGE_ROOTFS}/etc/inittab <<-_EOF_ - ## WARNING: passwordless 'root' telnet daemon - ~~::sysinit:/usr/sbin/telnetd -l /sbin/rootlogin - _EOF_ - fi - rm -f ${IMAGE_ROOTFS}/etc/securetty - fi - fi } diff --git a/meta-digi-dey/classes/sares-image.bbclass b/meta-digi-dey/classes/sares-image.bbclass new file mode 100644 index 000000000..82c40e22f --- /dev/null +++ b/meta-digi-dey/classes/sares-image.bbclass @@ -0,0 +1,46 @@ +# +# Helper class for automated testing in SARES +# +# Copyright (C) 2015 Digi International. +# +# To enable, use INHERIT in local.conf: +# +# INHERIT += "sares-image" +# + +IMAGE_FEATURES += "dey-debug dey-examples" + +sares() { + ################################################################## + ## WARNING: enable passwordless 'root' autologin in serial console + ## and telnetd for testing purposes + ################################################################## + if [ -f "${IMAGE_ROOTFS}/etc/inittab" ]; then + cat >${IMAGE_ROOTFS}/sbin/rootlogin <<-_EOF_ + #!/bin/sh + exec /bin/login -f root + _EOF_ + chmod u+x ${IMAGE_ROOTFS}/sbin/rootlogin + + # The 'echo' trick is needed because the SERIAL_CONSOLES variable + # is expanded by bitbake and contains a semicolon ';' + for i in $(echo "${SERIAL_CONSOLES}"); do + label="$(echo $i | sed -e 's,.*tty\(.*\),\1,g')" + sed -i -e " + /^$label:.*getty/{ + i\## WARNING: passwordless 'root' autologin enabled + s,getty,getty -n -l /sbin/rootlogin,g + }" ${IMAGE_ROOTFS}/etc/inittab + done + + # Install a telnetd daemon if there isn't one + if ! grep -qs telnetd ${IMAGE_ROOTFS}/etc/inittab; then + cat >>${IMAGE_ROOTFS}/etc/inittab <<-_EOF_ + ## WARNING: passwordless 'root' telnet daemon + ~~::sysinit:/usr/sbin/telnetd -l /sbin/rootlogin + _EOF_ + fi + fi +} + +IMAGE_PREPROCESS_COMMAND += "sares;" diff --git a/meta-digi-dey/conf/distro/dey.conf b/meta-digi-dey/conf/distro/dey.conf index 8e57d2ffb..a8bf1d59e 100644 --- a/meta-digi-dey/conf/distro/dey.conf +++ b/meta-digi-dey/conf/distro/dey.conf @@ -31,9 +31,6 @@ FEATURE_PACKAGES_dey-network = "packagegroup-dey-network" FEATURE_PACKAGES_dey-qt = "packagegroup-dey-qt" FEATURE_PACKAGES_dey-wireless = "packagegroup-dey-wireless" -# Features without a packagegroup need to be explicitely added. -IMAGE_FEATURES[validitems] += "dey-test" - # Set the PREFERRED_PROVIDER for jpeg functionality based on the MACHINE # architecture. For armv7a devices libjpeg-turbo should be used to take # advantage of the SIMD instructions. diff --git a/sdk/build.sh b/sdk/build.sh index b54e88f3e..cd0cbeab2 100755 --- a/sdk/build.sh +++ b/sdk/build.sh @@ -20,6 +20,7 @@ # DY_PLATFORMS: Platforms to build # DY_REVISION: Revision of the manifest repository (for 'repo init') # DY_RM_WORK: Remove the package working folders to save disk space. +# DY_SARES: Build SARES test image # DY_TARGET: Target image (the default is 'dey-image-minimal') # DY_USE_MIRROR: Use internal Digi mirror to download packages # @@ -51,6 +52,10 @@ INHERIT += \"rm_work\" RM_WORK_EXCLUDE += \"dey-image-graphical dey-image-minimal linux-dey u-boot-dey\" " +SARES_CFG=" +INHERIT += \"sares-image\" +" + X11_REMOVAL_CFG=" DISTRO_FEATURES_remove = \"x11\" " @@ -229,6 +234,9 @@ for platform in ${DY_PLATFORMS}; do if [ "${DY_RM_WORK}" = "true" ]; then printf "${RM_WORK_CFG}" >> conf/local.conf fi + if [ "${DY_SARES}" = "true" ]; then + printf "${SARES_CFG}" >> conf/local.conf + fi # Remove 'x11' distro feature if building minimal images if echo "${DY_TARGET}" | grep -qs "dey-image-minimal"; then printf "${X11_REMOVAL_CFG}" >> conf/local.conf