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 <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2015-03-12 14:47:44 +01:00
parent 6c3e81825c
commit 8b2e4812fc
4 changed files with 54 additions and 37 deletions

View File

@ -46,38 +46,4 @@ dey_rootfs_tuning() {
mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd
fi fi
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
} }

View File

@ -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;"

View File

@ -31,9 +31,6 @@ FEATURE_PACKAGES_dey-network = "packagegroup-dey-network"
FEATURE_PACKAGES_dey-qt = "packagegroup-dey-qt" FEATURE_PACKAGES_dey-qt = "packagegroup-dey-qt"
FEATURE_PACKAGES_dey-wireless = "packagegroup-dey-wireless" 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 # Set the PREFERRED_PROVIDER for jpeg functionality based on the MACHINE
# architecture. For armv7a devices libjpeg-turbo should be used to take # architecture. For armv7a devices libjpeg-turbo should be used to take
# advantage of the SIMD instructions. # advantage of the SIMD instructions.

View File

@ -20,6 +20,7 @@
# DY_PLATFORMS: Platforms to build # DY_PLATFORMS: Platforms to build
# DY_REVISION: Revision of the manifest repository (for 'repo init') # DY_REVISION: Revision of the manifest repository (for 'repo init')
# DY_RM_WORK: Remove the package working folders to save disk space. # 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_TARGET: Target image (the default is 'dey-image-minimal')
# DY_USE_MIRROR: Use internal Digi mirror to download packages # 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\" RM_WORK_EXCLUDE += \"dey-image-graphical dey-image-minimal linux-dey u-boot-dey\"
" "
SARES_CFG="
INHERIT += \"sares-image\"
"
X11_REMOVAL_CFG=" X11_REMOVAL_CFG="
DISTRO_FEATURES_remove = \"x11\" DISTRO_FEATURES_remove = \"x11\"
" "
@ -229,6 +234,9 @@ for platform in ${DY_PLATFORMS}; do
if [ "${DY_RM_WORK}" = "true" ]; then if [ "${DY_RM_WORK}" = "true" ]; then
printf "${RM_WORK_CFG}" >> conf/local.conf printf "${RM_WORK_CFG}" >> conf/local.conf
fi fi
if [ "${DY_SARES}" = "true" ]; then
printf "${SARES_CFG}" >> conf/local.conf
fi
# Remove 'x11' distro feature if building minimal images # Remove 'x11' distro feature if building minimal images
if echo "${DY_TARGET}" | grep -qs "dey-image-minimal"; then if echo "${DY_TARGET}" | grep -qs "dey-image-minimal"; then
printf "${X11_REMOVAL_CFG}" >> conf/local.conf printf "${X11_REMOVAL_CFG}" >> conf/local.conf