misc IMAGE_FEATURE fixings
v3 cover misc IMAGE_FEATURE fixings
This patch set fixed the bug [YOCTO #2605].
It allows to login to openssh with empty password if the IMAGE_FEATURE debug-tweak feature is set.
It processes conflicting IMAGE_FEATURE features, i.e. ssh-server-dropbear and ssh-server-openssh.
It also adds the "openssh-sftp-server" into the IMAGE_FEATURE tools-debug.
The following changes since commit e2cc4a44d510e0d473d15f207c1c886db6a5ccf7:
Bogdan Marinescu (1):
guile: fix compilation on MIPS/PPC
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib llu/bug2605
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=llu/bug2605
Lianhao Lu (3):
classes/image: Allow openssh empty passwords login. image/core-image: Handle conflicting IMAGE_FEATURES.
task-core-tools-debug: Added openssh-sftp-server.
meta/classes/core-image.bbclass | 13 +++++++++++- meta/classes/image.bbclass | 24 ++++++++++++++++++++++ meta/recipes-core/tasks/task-core-tools-debug.bb | 3 ++ meta/recipes-sato/images/core-image-sato-sdk.bb | 2 + 4 files changed, 41 insertions(+), 1 deletions(-)
PATCH v3 1/3 classes/image: Allow openssh empty passwords login.
Allow empty passwords login so that the default root user can login in through openssh.
--- meta/classes/core-image.bbclass | 2 ++ meta/classes/image.bbclass | 7 +++++++ 2 files changed, 9 insertions(+), 0 deletions(-)
meta/classes/core-image.bbclass +2 -0
@@ -69,4 +69,6 @@ ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; " # Zap the root password if debug-tweaks feature is not enabled ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "", "zap_root_password ; ",d)}' +# Allow openssh accept empty password login if both debug-tweaks and ssh-server-openssh are enabled +ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks ssh-server-openssh", "openssh_allow_empty_password; ", "",d)}'
meta/classes/image.bbclass +7 -0
@@ -318,6 +318,13 @@ zap_root_password () { mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd } +# allow openssh accept login with empty password string +openssh_allow_empty_password () { + if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then + sed -i 's#.*PermitEmptyPasswords.*#PermitEmptyPasswords yes#' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config + fi +} + # Turn any symbolic /sbin/init link into a file remove_init_link () { if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
Signature · 1 line
1.7.0.4
PATCH v3 2/3 image/core-image: Handle conflicting IMAGE_FEATURES.
IMAGE_FEATURES such as 'ssh-server-dropbear' and 'ssh-server-openssh' can't be both enabled. User can use the following variables to define the relationship of image features:
IMAGE_FEATURES_REPLACES_foo = "bar" means including image feature "foo" would replace the image feature "bar".
IMAGE_FEATURES_CONFLICTS_foo = "bar" means including both image features "foo" and "bar" would cause an parsing error.
--- meta/classes/core-image.bbclass | 11 ++++++++++- meta/classes/image.bbclass | 17 +++++++++++++++++ meta/recipes-sato/images/core-image-sato-sdk.bb | 2 ++ 3 files changed, 29 insertions(+), 1 deletions(-)
meta/classes/core-image.bbclass +10 -1
@@ -47,6 +47,14 @@ PACKAGE_GROUP_ssh-server-openssh = "task-core-ssh-openssh" PACKAGE_GROUP_package-management = "${ROOTFS_PKGMANAGE}" PACKAGE_GROUP_qt4-pkgs = "task-core-qt-demos" + +# IMAGE_FEAETURES_REPLACES_foo = 'bar1 bar2' +# Including image feature foo would replace the image features bar1 and bar2 +IMAGE_FEATURES_REPLACES_ssh-server-openssh = "ssh-server-dropbear" + +# IMAGE_FEATURES_CONFLICTS_foo = 'bar1 bar2' +# An error exception would be raised if both image features foo and bar1(or bar2) are included + CORE_IMAGE_BASE_INSTALL = '\ task-core-boot \ task-base-extended \
@@ -60,7 +68,8 @@ IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}" X11_IMAGE_FEATURES = "x11-base apps-x11-core package-management" ENHANCED_IMAGE_FEATURES = "${X11_IMAGE_FEATURES} apps-x11-games apps-x11-pimlico package-management" -SATO_IMAGE_FEATURES = "${ENHANCED_IMAGE_FEATURES} x11-sato ssh-server-dropbear" +SSHSERVER_IMAGE_FEATURES ??= "ssh-server-dropbear" +SATO_IMAGE_FEATURES = "${ENHANCED_IMAGE_FEATURES} x11-sato ${SSHSERVER_IMAGE_FEATURES}" inherit image
meta/classes/image.bbclass +17 -0
@@ -87,6 +87,23 @@ python () { deps += " %s:do_populate_sysroot" % dep d.setVarFlag('do_rootfs', 'depends', deps) + #process IMAGE_FEATURES, we must do this before runtime_mapping_rename + #Check for replaces image features + features = set(oe.data.typed_value('IMAGE_FEATURES', d)) + remain_features = features.copy() + for feature in features: + replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature, True) or "").split()) + remain_features -= replaces + + #Check for conflict image features + for feature in remain_features: + conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature, True) or "").split()) + temp = conflicts & remain_features + if temp: + raise bb.parse.SkipPackage("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN', True), feature, ' '.join(list(temp)))) + + d.setVar('IMAGE_FEATURES', ' '.join(list(remain_features))) + # If we don't do this we try and run the mapping hooks while parsing which is slow # bitbake should really provide something to let us know this... if d.getVar('BB_WORKERCONTEXT', True) is not None:
meta/recipes-sato/images/core-image-sato-sdk.bb +2 -0
@@ -8,6 +8,8 @@ form a standalone SDK." IMAGE_FEATURES += "apps-console-core ${SATO_IMAGE_FEATURES} dev-pkgs tools-sdk qt4-pkgs" EXTRA_IMAGE_FEATURES += "tools-debug tools-profile tools-testapps debug-tweaks" +SSHSERVER_IMAGE_FEATURES = "ssh-server-openssh" + LICENSE = "MIT" inherit core-image
Signature · 1 line
1.7.0.4
Re: [PATCH V3 2/3] image/core-image: Handle conflicting IMAGE_FEATURES.
Quoted 58 lines · Lianhao Lu
IMAGE_FEATURESsuch as 'ssh-server-dropbear' and 'ssh-server-openssh' can't be both enabled. User can use the following variables to define the relationship of image features:
IMAGE_FEATURES_REPLACES_foo= "bar" means including image feature "foo" would replace the image feature "bar".
IMAGE_FEATURES_CONFLICTS_foo= "bar" means including both image features "foo" and "bar" would cause an parsing error.Signed-off-by Lianhao Lu <[email protected]>--- meta/classes/core-image.bbclass | 11 ++++++++++- meta/classes/image.bbclass | 17 +++++++++++++++++ meta/recipes-sato/images/core-image-sato-sdk.bb | 2 ++ 3 files changed, 29 insertions(+), 1 deletions(-)meta/classes/core-image.bbclass +10
-1@@ -47,6 +47,14 @@ PACKAGE_GROUP_ssh-server-openssh = "task-core-ssh-openssh" PACKAGE_GROUP_package-management = "${ROOTFS_PKGMANAGE}" PACKAGE_GROUP_qt4-pkgs = "task-core-qt-demos" + +# IMAGE_FEAETURES_REPLACES_foo = 'bar1 bar2' +# Including image feature foo would replace the image features bar1 and bar2 +IMAGE_FEATURES_REPLACES_ssh-server-openssh = "ssh-server-dropbear" + +# IMAGE_FEATURES_CONFLICTS_foo = 'bar1 bar2' +# An error exception would be raised if both image features foo and bar1(or bar2) are included + CORE_IMAGE_BASE_INSTALL = '\ task-core-boot \ task-base-extended \@@ -60,7 +68,8 @@ IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}" X11_IMAGE_FEATURES = "x11-base apps-x11-core package-management" ENHANCED_IMAGE_FEATURES = "${X11_IMAGE_FEATURES} apps-x11-games apps-x11-pimlico package-management" -SATO_IMAGE_FEATURES = "${ENHANCED_IMAGE_FEATURES} x11-sato ssh-server-dropbear" +SSHSERVER_IMAGE_FEATURES ??= "ssh-server-dropbear" +SATO_IMAGE_FEATURES = "${ENHANCED_IMAGE_FEATURES} x11-sato ${SSHSERVER_IMAGE_FEATURES}" inherit imagemeta/classes/image.bbclass +4
-0@@ -87,6 +87,23 @@ python () { deps += " %s:do_populate_sysroot" % dep d.setVarFlag('do_rootfs', 'depends', deps) + #process IMAGE_FEATURES, we must do this before runtime_mapping_rename + #Check for replaces image features + features = set(oe.data.typed_value('IMAGE_FEATURES', d)) + remain_features = features.copy()
meta/classes/image.bbclass python () { · line 103
Quoted 10 lines
meta/classes/image.bbclass +10
-0+ for feature in features: + replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature, True) or "").split()) + remain_features -= replaces + + #Check for conflict image features + for feature in remain_features: + conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature, True) or "").split()) + temp = conflicts & remain_features + if temp: + raise bb.parse.SkipPackage("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN', True), feature, ' '.join(list(temp))))
I'm not sure that SkipPackage is the right error here. This will simply make the image target "disappear" when in this case we really want to raise a "proper" error?
Cheers,
Richard
Re: [PATCH V3 2/3] image/core-image: Handle conflicting IMAGE_FEATURES.
Richard Purdie wrote on 2012-07-02:
Quoted 68 lines · Lianhao Lu
Quoted 54 lines
IMAGE_FEATURESsuch as 'ssh-server-dropbear' and 'ssh-server-openssh' can't be both enabled. User can use the following variables to define the relationship of image features:
IMAGE_FEATURES_REPLACES_foo= "bar" means including image feature "foo" would replace the image feature "bar".
IMAGE_FEATURES_CONFLICTS_foo= "bar" means including both image features "foo" and "bar" would cause an parsing error.Signed-off-by Lianhao Lu <[email protected]>--- meta/classes/core-image.bbclass | 11 ++++++++++- meta/classes/image.bbclass | 17 +++++++++++++++++ meta/recipes-sato/images/core-image-sato-sdk.bb | 2 ++ 3 files changed, 29 insertions(+), 1 deletions(-)meta/classes/core-image.bbclass +10
-1@@ -47,6 +47,14 @@ PACKAGE_GROUP_ssh-server-openssh = "task-core-ssh-openssh" PACKAGE_GROUP_package-management = "${ROOTFS_PKGMANAGE}" PACKAGE_GROUP_qt4-pkgs = "task-core-qt-demos" + +# IMAGE_FEAETURES_REPLACES_foo = 'bar1 bar2' +# Including image feature foo would replace the image features bar1 and bar2 +IMAGE_FEATURES_REPLACES_ssh-server-openssh = "ssh-server-dropbear" + +# IMAGE_FEATURES_CONFLICTS_foo = 'bar1 bar2' +# An error exception would be raised if both image features foo and bar1(or bar2) are included + CORE_IMAGE_BASE_INSTALL = '\ task-core-boot \ task-base-extended \@@ -60,7 +68,8 @@ IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}" X11_IMAGE_FEATURES = "x11-base apps-x11-core package-management" ENHANCED_IMAGE_FEATURES = "${X11_IMAGE_FEATURES} apps-x11-games apps-x11-pimlico package-management" -SATO_IMAGE_FEATURES = "${ENHANCED_IMAGE_FEATURES} x11-sato ssh-server-dropbear" +SSHSERVER_IMAGE_FEATURES ??= "ssh-server-dropbear" +SATO_IMAGE_FEATURES = "${ENHANCED_IMAGE_FEATURES} x11-sato ${SSHSERVER_IMAGE_FEATURES}" inherit imagemeta/classes/image.bbclass +4
-0@@ -87,6 +87,23 @@ python () { deps += " %s:do_populate_sysroot" % dep d.setVarFlag('do_rootfs', 'depends', deps) + #process IMAGE_FEATURES, we must do this before runtime_mapping_rename + #Check for replaces image features + features = set(oe.data.typed_value('IMAGE_FEATURES', d)) + remain_features = features.copy()meta/classes/image.bbclass python () { · line 102
Quoted 10 lines
meta/classes/image.bbclass +10
-0+ for feature in features: + replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature, True) or "").split()) + remain_features -= replaces + + #Check for conflict image features + for feature in remain_features: + conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature, True) or "").split()) + temp = conflicts & remain_features + if temp: + raise bb.parse.SkipPackage("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN', True), feature, ''.join(list(temp))))
Quoted 4 lines
I'm not sure that SkipPackage is the right error here. This will simply make the image target "disappear" when in this case we really want to raise a "proper" error?
How about directly bb.fatal? Just like the base.bbclass handles the recipes without setting the LICENSE field.
Best Regards,
Lianhao
Re: [PATCH V3 2/3] image/core-image: Handle conflicting IMAGE_FEATURES.
Quoted 69 lines · Lianhao
Richard Purdie wrote on 2012-07-02:
Quoted 68 lines · Lianhao Lu
Quoted 54 lines
IMAGE_FEATURESsuch as 'ssh-server-dropbear' and 'ssh-server-openssh' can't be both enabled. User can use the following variables to define the relationship of image features:
IMAGE_FEATURES_REPLACES_foo= "bar" means including image feature "foo" would replace the image feature "bar".
IMAGE_FEATURES_CONFLICTS_foo= "bar" means including both image features "foo" and "bar" would cause an parsing error.Signed-off-by Lianhao Lu <[email protected]>--- meta/classes/core-image.bbclass | 11 ++++++++++- meta/classes/image.bbclass | 17 +++++++++++++++++ meta/recipes-sato/images/core-image-sato-sdk.bb | 2 ++ 3 files changed, 29 insertions(+), 1 deletions(-)meta/classes/core-image.bbclass +10
-1@@ -47,6 +47,14 @@ PACKAGE_GROUP_ssh-server-openssh = "task-core-ssh-openssh" PACKAGE_GROUP_package-management = "${ROOTFS_PKGMANAGE}" PACKAGE_GROUP_qt4-pkgs = "task-core-qt-demos" + +# IMAGE_FEAETURES_REPLACES_foo = 'bar1 bar2' +# Including image feature foo would replace the image features bar1 and bar2 +IMAGE_FEATURES_REPLACES_ssh-server-openssh = "ssh-server-dropbear" + +# IMAGE_FEATURES_CONFLICTS_foo = 'bar1 bar2' +# An error exception would be raised if both image features foo and bar1(or bar2) are included + CORE_IMAGE_BASE_INSTALL = '\ task-core-boot \ task-base-extended \@@ -60,7 +68,8 @@ IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}" X11_IMAGE_FEATURES = "x11-base apps-x11-core package-management" ENHANCED_IMAGE_FEATURES = "${X11_IMAGE_FEATURES} apps-x11-games apps-x11-pimlico package-management" -SATO_IMAGE_FEATURES = "${ENHANCED_IMAGE_FEATURES} x11-sato ssh-server-dropbear" +SSHSERVER_IMAGE_FEATURES ??= "ssh-server-dropbear" +SATO_IMAGE_FEATURES = "${ENHANCED_IMAGE_FEATURES} x11-sato ${SSHSERVER_IMAGE_FEATURES}" inherit imagemeta/classes/image.bbclass +4
-0@@ -87,6 +87,23 @@ python () { deps += " %s:do_populate_sysroot" % dep d.setVarFlag('do_rootfs', 'depends', deps) + #process IMAGE_FEATURES, we must do this before runtime_mapping_rename + #Check for replaces image features + features = set(oe.data.typed_value('IMAGE_FEATURES', d)) + remain_features = features.copy()meta/classes/image.bbclass python () { · line 102
Quoted 10 lines
meta/classes/image.bbclass +10
-0+ for feature in features: + replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature, True) or "").split()) + remain_features -= replaces + + #Check for conflict image features + for feature in remain_features: + conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature, True) or "").split()) + temp = conflicts & remain_features + if temp: + raise bb.parse.SkipPackage("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN', True), feature, ''.join(list(temp))))
Quoted 6 lines
Quoted 4 lines
I'm not sure that SkipPackage is the right error here. This will simply make the image target "disappear" when in this case we really want to raise a "proper" error?
How about directly bb.fatal? Just like the base.bbclass handles the recipes without setting the LICENSE field.
Yes, I think that is more appropriate in this case.
Cheers,
Richard
PATCH v3 3/3 task-core-tools-debug: Added openssh-sftp-server.
In reply to Lianhao LuAdded openssh-sftp-server to the tools-debug IMAGE_FEATURE.
--- meta/recipes-core/tasks/task-core-tools-debug.bb | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
meta/recipes-core/tasks/task-core-tools-debug.bb +3 -0
@@ -13,6 +13,8 @@ PACKAGES = "\ ${PN}-dev \ " +PR = "r1" + PACKAGE_ARCH = "${MACHINE_ARCH}" ALLOW_EMPTY = "1"
@@ -24,6 +26,7 @@ RDEPENDS_${PN} = "\ gdb \ gdbserver \ tcf-agent \ + openssh-sftp-server \ rsync \ strace \ ${MTRACE} \
Signature · 1 line
1.7.0.4