Skip to contentSkip to conversation

xen: Fix menuconfig

PATCH In review Diego Sueiro 2 participants 8 messages Aug 4, 2020 – Aug 12, 2020 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 xen: Fix menuconfig

When building in OE environment the linker path needs to be passed when buildind the Kconfig tool in order to get the menuconfig task properly working.

---
 ...g-Allow-specification-of-ncurses-location.patch | 55 ++++++++++++++++++++++
 recipes-extended/xen/xen-hypervisor.inc            |  4 +-
 recipes-extended/xen/xen_4.14.bb                   |  1 +
 recipes-extended/xen/xen_git.bb                    |  1 +
 4 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +55 -0
new file mode 100644
index 0000000..74c9cb0
@@ -0,0 +1,55 @@
+Upstream-Status: Inappropriate [oe specific, cross compile issue]
+Signed-off-by: Diego Sueiro <[email protected]>
+
+From d078e29aa31ac3fa4c041bf89c46bc6372c1a02a Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <[email protected]>
+Date: Mon, 2 Jul 2018 23:10:28 -0400
+Subject: menuconfig,mconf-cfg: Allow specification of ncurses location
+
+In some cross build environments such as the Yocto Project build
+environment it provides an ncurses library that is compiled
+differently than the host's version.  This causes display corruption
+problems when the host's curses includes are used instead of the
+includes from the provided compiler are overridden.  There is a second
+case where there is no curses libraries at all on the host system and
+menuconfig will just fail entirely.
+
+The solution is simply to allow an override variable in
+check-lxdialog.sh for environments such as the Yocto Project.  Adding
+a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing
+compiling and linking against the right headers and libraries.
+
+Signed-off-by: Jason Wessel <[email protected]>
+cc: Michal Marek <[email protected]>
+cc: [email protected]
+Signed-off-by: Bruce Ashfield <[email protected]>
+---
+ xen/tools/kconfig/mconf-cfg.sh | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+ mode change 100755 => 100644 xen/tools/kconfig/mconf-cfg.sh
+
+(limited to 'xen/tools/kconfig/mconf-cfg.sh')
+
+diff --git a/xen/tools/kconfig/mconf-cfg.sh b/xen/tools/kconfig/mconf-cfg.sh
+old mode 100755
+new mode 100644
+index c812872d7f9d..65a9b9e5b8a6
+--- a/xen/tools/kconfig/mconf-cfg.sh
++++ b/xen/tools/kconfig/mconf-cfg.sh
+@@ -4,6 +4,14 @@
+ PKG="ncursesw"
+ PKG2="ncurses"
+ 
++if [ "$CROSS_CURSES_LIB" != "" ]; then
++    echo libs=\'$CROSS_CURSES_LIB\'
++    if [ x"$CROSS_CURSES_INC" != x ]; then
++	echo cflags=\'$CROSS_CURSES_INC\'
++    fi
++    exit 0
++fi
++
+ if [ -n "$(command -v pkg-config)" ]; then
+ 	if pkg-config --exists $PKG; then
+ 		echo cflags=\"$(pkg-config --cflags $PKG)\"
+-- 
+cgit v1.2.2-1-g5e49
recipes-extended/xen/xen-hypervisor.inc +3 -1
index c386917..784059b 100644
@@ -77,12 +77,14 @@ do_deploy[depends] += "xen-tools:do_populate_sysroot"
 do_deploy[depends] += "xen-tools:do_deploy"
 
 # Enable use of menuconfig directly from bitbake and also within the devshell
-OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO"
+OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO CROSS_CURSES_LIB RECIPE_SYSROOT_NATIVE"
 HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
 HOSTLDFLAGS = "${BUILD_LDFLAGS}"
 TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
 do_devshell[depends] += "ncurses-native:do_populate_sysroot"
 
+CROSS_CURSES_LIB = "-lncurses -L$RECIPE_SYSROOT_NATIVE/usr/lib"
+
 KCONFIG_CONFIG_COMMAND ??= "menuconfig"
 python do_menuconfig() {
     import shutil
recipes-extended/xen/xen_4.14.bb +1 -0
index 0413bee..91e8988 100644
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
+    file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
recipes-extended/xen/xen_git.bb +1 -0
index 408bc3b..57791fc 100644
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "master"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
+    file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 xen: Add support for config fragments and diffconfig

This patch introduces the following changes:

1. By inheriting cml1.bbclass we can drop some environment variables settings in xen-hypervisor.inc for the menuconfig task, and also be able to search for config fragmens and use the diffconfig task.

2. Change the do_configure to pre-generate the xen/.config in order to enable the merge_config.sh to run successfully when config fragments are listed in SRC_URI.

3. Copy-and-Paste the do_diffconfig function from meta/classes/cml1.bbclass and modify the path of the .config.orig and .config files.

---
 recipes-extended/xen/README             |  3 +++
 recipes-extended/xen/xen-hypervisor.inc | 46 ++++++++++++++++++++++++++-------
 2 files changed, 39 insertions(+), 10 deletions(-)
recipes-extended/xen/README +3 -0
index 34e7977..f86d269 100644
@@ -25,6 +25,9 @@ Select the config settings that you want and Save the file. If you save it to
 the default ".config" file when prompted by menuconfig, you can find it in the
 'xen' subdirectory of the build tree.
 
+Configurarion fragments are also supported. To use them you need to list the
+.cfg files in the SRC_URI.
+
 security patches
 ----------------
 
recipes-extended/xen/xen-hypervisor.inc +36 -10

67 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

Re: [meta-virtualization][PATCH 2/2] xen: Add support for config fragments and diffconfig

Quoted 7 lines · Diego Sueiro

This patch introduces the following changes:

1. By inheriting cml1.bbclass we can drop some environment variables settings in xen-hypervisor.inc for the menuconfig task, and also be able to search for config fragmens and use the diffconfig task.

Quoted 6 lines

2. Change the do_configure to pre-generate the xen/.config in order to enable the merge_config.sh to run successfully when config fragments are listed in SRC_URI.

3. Copy-and-Paste the do_diffconfig function from meta/classes/cml1.bbclass and modify the path of the .config.orig and .config files.

Thanks for another interesting submission!

recipes-extended/xen/README

Quoted 11 lines
---
 recipes-extended/xen/README             |  3 +++
 recipes-extended/xen/xen-hypervisor.inc | 46 ++++++++++++++++++++++++++-------
 2 files changed, 39 insertions(+), 10 deletions(-)
recipes-extended/xen/README +0 -0
index 34e7977..f86d269 100644

I note that you have found the README file. Please could you CC both Doug and I, as it requests in that file, with future submissions for the Xen recipes?

recipes-extended/xen/README Select the config settings that you want and Save the file. If you save it to · line 28

Quoted 5 lines
recipes-extended/xen/README +1 -0
@@ -25,6 +25,9 @@ Select the config settings that you want and Save the file. If you save it to
 the default ".config" file when prompted by menuconfig, you can find it in the
 'xen' subdirectory of the build tree.
 
+Configurarion fragments are also supported. To use them you need to list the

spelling: 'Configuration' please

Quoted 10 lines
recipes-extended/xen/README +2 -0
+.cfg files in the SRC_URI.
+
 security patches
 ----------------
 
recipes-extended/xen/xen-hypervisor.inc +0 -0
index 784059b..55effe3 100644

recipes-extended/xen/xen-hypervisor.inc FILES_${PN}-efi = " \ · line 34

Quoted 4 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
@@ -31,9 +31,13 @@ FILES_${PN}-efi = " \
     /boot/xen.efi \
     ${exec_prefix}/lib64/efi/xen* \
     "
+inherit cml1

Could this be added to the existing inherit statement?

recipes-extended/xen/xen-hypervisor.inc FILES_${PN}-efi = " \ · line 38

Quoted 4 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
 do_configure() {
     do_configure_common
+    cd ${S}/xen; XEN_CONFIG_EXPERT=y make

This looks quite a bit like building. It seems to build quite a lot when I run it in the devshell. What does this build?
Is there a specific build target you can specify? Should it use oe_runmake?

recipes-extended/xen/xen-hypervisor.inc FILES_${PN}-efi = " \ · line 39

Quoted 1 line
recipes-extended/xen/xen-hypervisor.inc +1 -0
+    ${S}/xen/tools/kconfig/merge_config.sh -m ${S}/xen/.config ${@" ".join(find_cfgs(d))}

Please could you test for the presence of at least one config fragment being present in the SRC_URI before running the merge script.

recipes-extended/xen/xen-hypervisor.inc do_deploy[depends] += "xen-tools:do_populate_sysroot" · line 84

Quoted 13 lines
recipes-extended/xen/xen-hypervisor.inc +2 -4
+    cml1_do_configure
 }
 
 do_compile() {
@@ -77,15 +81,11 @@ do_deploy[depends] += "xen-tools:do_populate_sysroot"
 do_deploy[depends] += "xen-tools:do_deploy"
 
 # Enable use of menuconfig directly from bitbake and also within the devshell
-OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO CROSS_CURSES_LIB RECIPE_SYSROOT_NATIVE"
-HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
-HOSTLDFLAGS = "${BUILD_LDFLAGS}"
-TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
+OE_TERMINAL_EXPORTS += "RECIPE_SYSROOT_NATIVE"

See feedback on the earlier patch in this series please.

Quoted 36 lines
recipes-extended/xen/xen-hypervisor.inc +20 -6
 do_devshell[depends] += "ncurses-native:do_populate_sysroot"
 
-CROSS_CURSES_LIB = "-lncurses -L$RECIPE_SYSROOT_NATIVE/usr/lib"
+CROSS_CURSES_LIB += "-L$RECIPE_SYSROOT_NATIVE/usr/lib"
 
-KCONFIG_CONFIG_COMMAND ??= "menuconfig"
 python do_menuconfig() {
     import shutil
 
@@ -107,7 +107,33 @@ python do_menuconfig() {
         bb.note("Configuration changed, recompile will be forced")
         bb.build.write_taint('do_compile', d)
 }
-do_menuconfig[depends] += "ncurses-native:do_populate_sysroot"
-do_menuconfig[nostamp] = "1"
-do_menuconfig[dirs] = "${B}"
-addtask menuconfig after do_configure
+
+python do_diffconfig() {
+    import shutil
+    import subprocess
+
+    workdir = d.getVar('WORKDIR')
+    fragment = workdir + '/fragment.cfg'
+    configorig = 'xen/.config.orig'
+    config = 'xen/.config'
+
+    try:
+        md5newconfig = bb.utils.md5_file(configorig)
+        md5config = bb.utils.md5_file(config)
+        isdiff = md5newconfig != md5config
+    except IOError as e:
+        bb.fatal("No config files found. Did you do menuconfig ?\n%s" % e)
+
+    if isdiff:
+        statement = 'diff --unchanged-line-format= --old-line-format= --new-line-format="%L" ' + configorig + ' ' + config + '>' + fragment

recipes-extended/xen/xen-hypervisor.inc python do_menuconfig() { · line 138

Quoted 10 lines
recipes-extended/xen/xen-hypervisor.inc +10 -0
+        subprocess.call(statement, shell=True)
+        # No need to check the exit code as we know it's going to be
+        # non-zero, but that's what we expect.
+        shutil.copy(configorig, config)
+
+        bb.plain("Config fragment has been dumped into:\n %s" % fragment)
+    else:
+        if os.path.exists(fragment):
+            os.unlink(fragment)
+}

At the point where this code is being copied across into this recipe, it would be good to be working on a way to fold it back together when possible. Since you're introducing inherit of the cml1 class, what do you think to submitting a patch to the class to make the menuconfig and diffconfig functions general enough -- eg. making the names of the config files overridable via variables, just like the KCONFIG_CONFIG_COMMAND variable, etc -- so that the menuconfig and diffconfig code in this recipe can be dropped later in favour of just setting a few variables for that class?

Christopher

Quoted 5 lines
recipes-extended/xen/xen-hypervisor.inc +1 -1
+
--

2.7.4

#3 lore raw

Re: [meta-virtualization][PATCH 2/2] xen: Add support for config fragments and diffconfig

Please, find my comments inline.

Quoted 35 lines

-----Original Message-----
From: Christopher Clark <[email protected]>
Sent: 05 August 2020 07:15
To: Diego Sueiro <[email protected]>
Cc: [email protected]; nd <[email protected]>; Doug Goldstein <[email protected]>
Subject: Re: [meta-virtualization][PATCH 2/2] xen: Add support for config fragments and diffconfig

Quoted 7 lines · Diego Sueiro

This patch introduces the following changes:

1. By inheriting cml1.bbclass we can drop some environment variables settings in xen-hypervisor.inc for the menuconfig task, and also be able to search for config fragmens and use the diffconfig task.

Quoted 5 lines

2. Change the do_configure to pre-generate the xen/.config in order to enable the merge_config.sh to run successfully when config fragments are listed in SRC_URI.

3. Copy-and-Paste the do_diffconfig function from

meta/classes/cml1.bbclass

Quoted 1 line

and modify the path of the .config.orig and .config files.

Thanks for another interesting submission!

Quoted 8 lines
---
 recipes-extended/xen/README             |  3 +++
 recipes-extended/xen/xen-hypervisor.inc | 46
++++++++++++++++++++++++++-------
 2 files changed, 39 insertions(+), 10 deletions(-)
Quoted 8 lines

recipes-extended/xen/README

Quoted 4 lines
recipes-extended/xen/README +0 -0
index 34e7977..f86d269 100644

I note that you have found the README file. Please could you CC both Doug and I, as it requests in that file, with future submissions for the Xen recipes?

I noticed the file but didn't pay attention to this. ;-) I'll make sure that for the next patches I will add you and Doug in CC.

Quoted 9 lines

recipes-extended/xen/README

Quoted 6 lines
recipes-extended/xen/README +0 -0
@@ -25,6 +25,9 @@ Select the config settings that you want and Save

the file. If you save it to the default ".config" file when prompted by menuconfig, you can find it in the 'xen' subdirectory of the build tree.

recipes-extended/xen/README +2 -0
+Configurarion fragments are also supported. To use them you need to
+list the

spelling: 'Configuration' please

Checked.

Quoted 5 lines
Quoted 5 lines

+.cfg files in the SRC_URI.
+
security patches
----------------

Quoted 12 lines

recipes-extended/xen/xen-hypervisor.inc FILES_${PN}-efi = " \ · line 34

Quoted 10 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
index 784059b..55effe3 100644
@@ -31,9 +31,13 @@ FILES_${PN}-efi = " \
     /boot/xen.efi \
     ${exec_prefix}/lib64/efi/xen* \
     "
+inherit cml1

Could this be added to the existing inherit statement?

Checked.

Quoted 10 lines

recipes-extended/xen/xen-hypervisor.inc FILES_${PN}-efi = " \ · line 38

Quoted 5 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
 do_configure() {
     do_configure_common
+    cd ${S}/xen; XEN_CONFIG_EXPERT=y make

This looks quite a bit like building. It seems to build quite a lot when I run it in the devshell. What does this build?
Is there a specific build target you can specify? Should it use oe_runmake?

To get the merge_config.sh working we need a .config in place. I'll investigate if the xen build system supports generating the .config without compiling the whole project.

Quoted 6 lines

recipes-extended/xen/xen-hypervisor.inc FILES_${PN}-efi = " \ · line 39

Quoted 2 lines
recipes-extended/xen/xen-hypervisor.inc +2 -0
+    ${S}/xen/tools/kconfig/merge_config.sh -m ${S}/xen/.config ${@"
+ ".join(find_cfgs(d))}

Please could you test for the presence of at least one config fragment being present in the SRC_URI before running the merge script.

Checked.

Quoted 10 lines

recipes-extended/xen/xen-hypervisor.inc do_deploy[depends] += "xen-

Quoted 5 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
+    cml1_do_configure
 }
 
 do_compile() {
@@ -77,15 +81,11 @@ do_deploy[depends] += "xen-

tools:do_populate_sysroot"

Quoted 4 lines
recipes-extended/xen/xen-hypervisor.inc +0 -0
 do_deploy[depends] += "xen-tools:do_deploy"
 
 # Enable use of menuconfig directly from bitbake and also within the

devshell -OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS

Quoted 8 lines

TERMINFO CROSS_CURSES_LIB RECIPE_SYSROOT_NATIVE"

recipes-extended/xen/xen-hypervisor.inc do_deploy[depends] += "xen-tools:do_populate_sysroot" · line 84

Quoted 4 lines
recipes-extended/xen/xen-hypervisor.inc +1 -3
-HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
-HOSTLDFLAGS = "${BUILD_LDFLAGS}"
-TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
+OE_TERMINAL_EXPORTS += "RECIPE_SYSROOT_NATIVE"

See feedback on the earlier patch in this series please.

Checked.

Quoted 48 lines
Quoted 26 lines

do_devshell[depends] += "ncurses-native:do_populate_sysroot"

recipes-extended/xen/xen-hypervisor.inc +11 -6
-CROSS_CURSES_LIB = "-lncurses -L$RECIPE_SYSROOT_NATIVE/usr/lib"
+CROSS_CURSES_LIB += "-L$RECIPE_SYSROOT_NATIVE/usr/lib"
 
-KCONFIG_CONFIG_COMMAND ??= "menuconfig"
 python do_menuconfig() {
     import shutil
@@ -107,7 +107,33 @@ python do_menuconfig() {
         bb.note("Configuration changed, recompile will be forced")
         bb.build.write_taint('do_compile', d)  }
-do_menuconfig[depends] += "ncurses-native:do_populate_sysroot"
-do_menuconfig[nostamp] = "1"
-do_menuconfig[dirs] = "${B}"
-addtask menuconfig after do_configure
+
+python do_diffconfig() {
+    import shutil
+    import subprocess
+
+    workdir = d.getVar('WORKDIR')
+    fragment = workdir + '/fragment.cfg'
+    configorig = 'xen/.config.orig'
+    config = 'xen/.config'
+

recipes-extended/xen/xen-hypervisor.inc python do_menuconfig() { · line 128

Quoted 10 lines
recipes-extended/xen/xen-hypervisor.inc +10 -0
+    try:
+        md5newconfig = bb.utils.md5_file(configorig)
+        md5config = bb.utils.md5_file(config)
+        isdiff = md5newconfig != md5config
+    except IOError as e:
+        bb.fatal("No config files found. Did you do menuconfig ?\n%s"
+ % e)
+
+    if isdiff:
+        statement = 'diff --unchanged-line-format= --old-line-format= --new-

line-format="%L" ' + configorig + ' ' + config + '>' + fragment

recipes-extended/xen/xen-hypervisor.inc python do_menuconfig() { · line 138

Quoted 10 lines
recipes-extended/xen/xen-hypervisor.inc +10 -0
+        subprocess.call(statement, shell=True)
+        # No need to check the exit code as we know it's going to be
+        # non-zero, but that's what we expect.
+        shutil.copy(configorig, config)
+
+        bb.plain("Config fragment has been dumped into:\n %s" % fragment)
+    else:
+        if os.path.exists(fragment):
+            os.unlink(fragment)
+}
Quoted 9 lines

At the point where this code is being copied across into this recipe, it would be good to be working on a way to fold it back together when possible. Since you're introducing inherit of the cml1 class, what do you think to submitting a patch to the class to make the menuconfig and diffconfig functions general enough -- eg. making the names of the config files overridable via variables, just like the KCONFIG_CONFIG_COMMAND variable, etc -- so that the menuconfig and diffconfig code in this recipe can be dropped later in favour of just setting a few variables for that class?

Good idea. Let's see what I can come up with in oe-core. The only caveat that I see with the custom menuconfig task is the custom oe_terminal call.

Quoted 8 lines

Christopher

Quoted 5 lines
recipes-extended/xen/xen-hypervisor.inc +1 -1
+
--

2.7.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [meta-virtualization][PATCH 2/2] xen: Add support for config fragments and diffconfig

Quoted 11 lines

-----Original Message-----
From: [email protected] <meta- [email protected]> On Behalf Of Diego Sueiro via lists.yoctoproject.org
Sent: 05 August 2020 08:16
To: Christopher Clark <[email protected]>
Cc: [email protected]; nd <[email protected]>; Doug Goldstein <[email protected]>
Subject: Re: [meta-virtualization][PATCH 2/2] xen: Add support for config fragments and diffconfig

Quoted 31 lines

Please, find my comments inline.

Quoted 29 lines

-----Original Message-----
From: Christopher Clark <[email protected]>
Sent: 05 August 2020 07:15
To: Diego Sueiro <[email protected]>
Cc: [email protected]; nd <[email protected]>; Doug Goldstein <[email protected]>
Subject: Re: [meta-virtualization][PATCH 2/2] xen: Add support for config fragments and diffconfig

Quoted 7 lines · Diego Sueiro

This patch introduces the following changes:

1. By inheriting cml1.bbclass we can drop some environment variables settings in xen-hypervisor.inc for the menuconfig task, and also be able to search for config fragmens and use the diffconfig task.

Quoted 5 lines

2. Change the do_configure to pre-generate the xen/.config in order to enable the merge_config.sh to run successfully when config fragments are listed in SRC_URI.

3. Copy-and-Paste the do_diffconfig function from

meta/classes/cml1.bbclass

Quoted 1 line

and modify the path of the .config.orig and .config files.

Thanks for another interesting submission!

Quoted 2 lines

Please, disregard this patch. I'll be sending a new patch shortly unifying both this and https://lists.yoctoproject.org/g/meta-virtualization/message/5683 considering Christopher's comments.

Quoted 167 lines
Quoted 6 lines
Quoted 6 lines
---
 recipes-extended/xen/README             |  3 +++
 recipes-extended/xen/xen-hypervisor.inc | 46
++++++++++++++++++++++++++-------
 2 files changed, 39 insertions(+), 10 deletions(-)
Quoted 7 lines

recipes-extended/xen/README

Quoted 4 lines
(quoted diff) +0 -0

b/recipes-extended/xen/README index 34e7977..f86d269 100644

recipes-extended/xen/README +0 -0

I note that you have found the README file. Please could you CC both Doug and I, as it requests in that file, with future submissions for the Xen

recipes?

Quoted 1 line

I noticed the file but didn't pay attention to this. ;-) I'll make sure that for the next patches I will add you and Doug in CC.

Quoted 9 lines

recipes-extended/xen/README

Quoted 6 lines
recipes-extended/xen/README +0 -0
@@ -25,6 +25,9 @@ Select the config settings that you want and Save

the file. If you save it to the default ".config" file when prompted by menuconfig, you can find it in the 'xen' subdirectory of the build tree.

recipes-extended/xen/README +2 -0
+Configurarion fragments are also supported. To use them you need to
+list the

spelling: 'Configuration' please

Checked.

Quoted 5 lines
Quoted 5 lines

+.cfg files in the SRC_URI.
+
security patches
----------------

Quoted 12 lines

recipes-extended/xen/xen-hypervisor.inc FILES_${PN}-efi = " \ · line 34

Quoted 10 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
index 784059b..55effe3 100644
@@ -31,9 +31,13 @@ FILES_${PN}-efi = " \
     /boot/xen.efi \
     ${exec_prefix}/lib64/efi/xen* \
     "
+inherit cml1

Could this be added to the existing inherit statement?

Checked.

Quoted 10 lines

recipes-extended/xen/xen-hypervisor.inc FILES_${PN}-efi = " \ · line 38

Quoted 5 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
 do_configure() {
     do_configure_common
+    cd ${S}/xen; XEN_CONFIG_EXPERT=y make

This looks quite a bit like building. It seems to build quite a lot when I run it in the devshell. What does this build?
Is there a specific build target you can specify? Should it use oe_runmake?

To get the merge_config.sh working we need a .config in place. I'll investigate if the xen build system supports generating the .config without compiling the whole project.

Quoted 6 lines

recipes-extended/xen/xen-hypervisor.inc FILES_${PN}-efi = " \ · line 39

Quoted 2 lines
recipes-extended/xen/xen-hypervisor.inc +2 -0
+    ${S}/xen/tools/kconfig/merge_config.sh -m ${S}/xen/.config ${@"
+ ".join(find_cfgs(d))}

Please could you test for the presence of at least one config fragment being present in the SRC_URI before running the merge script.

Checked.

Quoted 10 lines

recipes-extended/xen/xen-hypervisor.inc do_deploy[depends] += "xen-

Quoted 5 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
+    cml1_do_configure
 }
 
 do_compile() {
@@ -77,15 +81,11 @@ do_deploy[depends] += "xen-

tools:do_populate_sysroot"

Quoted 4 lines
recipes-extended/xen/xen-hypervisor.inc +0 -0
 do_deploy[depends] += "xen-tools:do_deploy"
 
 # Enable use of menuconfig directly from bitbake and also within the

devshell -OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS

Quoted 8 lines

TERMINFO CROSS_CURSES_LIB RECIPE_SYSROOT_NATIVE"

recipes-extended/xen/xen-hypervisor.inc do_deploy[depends] += "xen-tools:do_populate_sysroot" · line 84

Quoted 4 lines
recipes-extended/xen/xen-hypervisor.inc +1 -3
-HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
-HOSTLDFLAGS = "${BUILD_LDFLAGS}"
-TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
+OE_TERMINAL_EXPORTS += "RECIPE_SYSROOT_NATIVE"

See feedback on the earlier patch in this series please.

Checked.

Quoted 49 lines
Quoted 27 lines

do_devshell[depends] += "ncurses-native:do_populate_sysroot"

recipes-extended/xen/xen-hypervisor.inc +12 -6
-CROSS_CURSES_LIB = "-lncurses -L$RECIPE_SYSROOT_NATIVE/usr/lib"
+CROSS_CURSES_LIB += "-L$RECIPE_SYSROOT_NATIVE/usr/lib"
 
-KCONFIG_CONFIG_COMMAND ??= "menuconfig"
 python do_menuconfig() {
     import shutil
@@ -107,7 +107,33 @@ python do_menuconfig() {
         bb.note("Configuration changed, recompile will be forced")
         bb.build.write_taint('do_compile', d)  }
-do_menuconfig[depends] += "ncurses-native:do_populate_sysroot"
-do_menuconfig[nostamp] = "1"
-do_menuconfig[dirs] = "${B}"
-addtask menuconfig after do_configure
+
+python do_diffconfig() {
+    import shutil
+    import subprocess
+
+    workdir = d.getVar('WORKDIR')
+    fragment = workdir + '/fragment.cfg'
+    configorig = 'xen/.config.orig'
+    config = 'xen/.config'
+
+    try:

recipes-extended/xen/xen-hypervisor.inc python do_menuconfig() { · line 129

Quoted 10 lines
recipes-extended/xen/xen-hypervisor.inc +10 -0
+        md5newconfig = bb.utils.md5_file(configorig)
+        md5config = bb.utils.md5_file(config)
+        isdiff = md5newconfig != md5config
+    except IOError as e:
+        bb.fatal("No config files found. Did you do menuconfig ?\n%s"
+ % e)
+
+    if isdiff:
+        statement = 'diff --unchanged-line-format=
+ --old-line-format= --new-

line-format="%L" ' + configorig + ' ' + config + '>' + fragment

recipes-extended/xen/xen-hypervisor.inc python do_menuconfig() { · line 138

Quoted 10 lines
recipes-extended/xen/xen-hypervisor.inc +10 -0
+        subprocess.call(statement, shell=True)
+        # No need to check the exit code as we know it's going to be
+        # non-zero, but that's what we expect.
+        shutil.copy(configorig, config)
+
+        bb.plain("Config fragment has been dumped into:\n %s" % fragment)
+    else:
+        if os.path.exists(fragment):
+            os.unlink(fragment)
+}
Quoted 8 lines

At the point where this code is being copied across into this recipe, it would be good to be working on a way to fold it back together when possible. Since you're introducing inherit of the cml1 class, what do you think to submitting a patch to the class to make the menuconfig and diffconfig functions general enough -- eg. making the names of the config files overridable via variables, just like the KCONFIG_CONFIG_COMMAND variable, etc -- so that the menuconfig and diffconfig code in this recipe can be dropped later in favour of just setting a

few variables for that class?

Quoted 1 line

Good idea. Let's see what I can come up with in oe-core. The only caveat that I see with the custom menuconfig task is the custom oe_terminal call.

Quoted 8 lines

Christopher

Quoted 5 lines

+
--
2.7.4

#6 lore raw
In reply to Diego Sueiro
Quoted 4 lines · Diego Sueiro

When building in OE environment the linker path needs to be passed when buildind the Kconfig tool in order to get the menuconfig task properly working.

Hi Diego,

Thank-you for working on fixing this - it is nice to see this tool working correctly again. I have some feedback inline below.

Quoted 15 lines
---
 ...g-Allow-specification-of-ncurses-location.patch | 55 ++++++++++++++++++++++
 recipes-extended/xen/xen-hypervisor.inc            |  4 +-
 recipes-extended/xen/xen_4.14.bb                   |  1 +
 recipes-extended/xen/xen_git.bb                    |  1 +
 4 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +0 -0
new file mode 100644
index 0000000..74c9cb0

recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch line 1

Quoted 1 line
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +1 -0
@@ -0,0 +1,55 @@
+Upstream-Status: Inappropriate [oe specific, cross compile issue]

How have you arrived at this "Upstream-Status" for this patch? I ask because if it is possible to avoid carrying this patch in meta-virtualization indefinitely, it would be good to do so. Please can you submit it upstream for feedback and hopefully acceptance from the Xen maintainers?

Quoted 9 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +9 -0
+Signed-off-by: Diego Sueiro <[email protected]>
+
+From d078e29aa31ac3fa4c041bf89c46bc6372c1a02a Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <[email protected]>
+Date: Mon, 2 Jul 2018 23:10:28 -0400
+Subject: menuconfig,mconf-cfg: Allow specification of ncurses location
+
+In some cross build environments such as the Yocto Project build
+environment it provides an ncurses library that is compiled

recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch line 20

Quoted 10 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +10 -0
+differently than the host's version.  This causes display corruption
+problems when the host's curses includes are used instead of the
+includes from the provided compiler are overridden.  There is a second
+case where there is no curses libraries at all on the host system and
+menuconfig will just fail entirely.
+
+The solution is simply to allow an override variable in
+check-lxdialog.sh for environments such as the Yocto Project.  Adding
+a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing
+compiling and linking against the right headers and libraries.

I think it's going to be good to get feedback from the Xen build system maintainers on whether these variable names are going to be acceptable upstream. It could make sense to add documentation for them to the INSTALL file at the head of the repository where some of the other build system variables are explained.

Quoted 40 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +35 -0
+
+Signed-off-by: Jason Wessel <[email protected]>
+cc: Michal Marek <[email protected]>
+cc: [email protected]
+Signed-off-by: Bruce Ashfield <[email protected]>
+---
+ xen/tools/kconfig/mconf-cfg.sh | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+ mode change 100755 => 100644 xen/tools/kconfig/mconf-cfg.sh
+
+(limited to 'xen/tools/kconfig/mconf-cfg.sh')
+
+diff --git a/xen/tools/kconfig/mconf-cfg.sh b/xen/tools/kconfig/mconf-cfg.sh
+old mode 100755
+new mode 100644
+index c812872d7f9d..65a9b9e5b8a6
+--- a/xen/tools/kconfig/mconf-cfg.sh
++++ b/xen/tools/kconfig/mconf-cfg.sh
+@@ -4,6 +4,14 @@
+ PKG="ncursesw"
+ PKG2="ncurses"
+
++if [ "$CROSS_CURSES_LIB" != "" ]; then
++    echo libs=\'$CROSS_CURSES_LIB\'
++    if [ x"$CROSS_CURSES_INC" != x ]; then
++      echo cflags=\'$CROSS_CURSES_INC\'
++    fi
++    exit 0
++fi
++
+ if [ -n "$(command -v pkg-config)" ]; then
+       if pkg-config --exists $PKG; then
+               echo cflags=\"$(pkg-config --cflags $PKG)\"
+--
+cgit v1.2.2-1-g5e49
recipes-extended/xen/xen-hypervisor.inc +0 -0
index c386917..784059b 100644

recipes-extended/xen/xen-hypervisor.inc do_deploy[depends] += "xen-tools:do_populate_sysroot" · line 80

Quoted 5 lines
recipes-extended/xen/xen-hypervisor.inc +1 -1
@@ -77,12 +77,14 @@ do_deploy[depends] += "xen-tools:do_populate_sysroot"
 do_deploy[depends] += "xen-tools:do_deploy"
 
 # Enable use of menuconfig directly from bitbake and also within the devshell
-OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO"
+OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO CROSS_CURSES_LIB RECIPE_SYSROOT_NATIVE"

Is there a reason for exporting RECIPE_SYSROOT_NATIVE?

recipes-extended/xen/xen-hypervisor.inc do_deploy[depends] += "xen-tools:do_populate_sysroot" · line 86

Quoted 6 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
 HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
 HOSTLDFLAGS = "${BUILD_LDFLAGS}"
 TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
 do_devshell[depends] += "ncurses-native:do_populate_sysroot"
 
+CROSS_CURSES_LIB = "-lncurses -L$RECIPE_SYSROOT_NATIVE/usr/lib"

Since this definition here doesn't use { braces }, the value of RECIPE_SYSROOT_NATIVE isn't substituted into CROSS_CURSES_LIB, and so it gets evaluated later when the mconf-cfg.sh script is run. It would be good to add a comment to explain why you're not making the substitution occur within the recipe instead.

With adding /usr/lib as the suffix: would STAGING_LIBDIR_NATIVE be a more appropriate variable to use?

Do you need to define and add CROSS_CURSES_INC to the terminal exports? It looks like that is actually introduced indirectly in the next commit in your series, so is this patch correct without doing that?

thanks

Christopher

Quoted 32 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
+
 KCONFIG_CONFIG_COMMAND ??= "menuconfig"
 python do_menuconfig() {
     import shutil
recipes-extended/xen/xen_4.14.bb +1 -0
index 0413bee..91e8988 100644
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
+    file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
recipes-extended/xen/xen_git.bb +1 -1
index 408bc3b..57791fc 100644
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "master"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
+    file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
--

2.7.4

#7 lore raw

Hi Christopher,

Thanks for your comments and feedback.

Please, find my comments inline.

Quoted 30 lines · Christopher Clark
Quoted 4 lines · Diego Sueiro

When building in OE environment the linker path needs to be passed when buildind the Kconfig tool in order to get the menuconfig task properly working.

Hi Diego,

Thank-you for working on fixing this - it is nice to see this tool working correctly again. I have some feedback inline below.

Quoted 3 lines
---
 ...g-Allow-specification-of-ncurses-location.patch | 55

++++++++++++++++++++++

Quoted 5 lines
 recipes-extended/xen/xen-hypervisor.inc            |  4 +-
 recipes-extended/xen/xen_4.14.bb                   |  1 +
 recipes-extended/xen/xen_git.bb                    |  1 +
 4 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644

recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch

Quoted 2 lines

diff --git

b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch

Quoted 4 lines

new file mode 100644
index 0000000..74c9cb0
--- /dev/null
+++

b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch

Quoted 9 lines

recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch line 1

Quoted 2 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +1 -0
@@ -0,0 +1,55 @@
+Upstream-Status: Inappropriate [oe specific, cross compile issue]

How have you arrived at this "Upstream-Status" for this patch? I ask because if it is possible to avoid carrying this patch in meta-virtualization indefinitely, it would be good to do so. Please can you submit it upstream for feedback and hopefully acceptance from the Xen maintainers?

I'll send it to the upstream project and update the Upstream-Status of this patch. Like you mentioned below it will most probably have different variable names.

Quoted 18 lines
Quoted 18 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +17 -0
+Signed-off-by: Diego Sueiro <[email protected]>
+
+From d078e29aa31ac3fa4c041bf89c46bc6372c1a02a Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <[email protected]>
+Date: Mon, 2 Jul 2018 23:10:28 -0400
+Subject: menuconfig,mconf-cfg: Allow specification of ncurses location
+
+In some cross build environments such as the Yocto Project build
+environment it provides an ncurses library that is compiled
+differently than the host's version.  This causes display corruption
+problems when the host's curses includes are used instead of the
+includes from the provided compiler are overridden.  There is a second
+case where there is no curses libraries at all on the host system and
+menuconfig will just fail entirely.
+
+The solution is simply to allow an override variable in
+check-lxdialog.sh for environments such as the Yocto Project.  Adding
Quoted 9 lines

recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch line 20

Quoted 2 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +2 -0
+a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing
+compiling and linking against the right headers and libraries.

I think it's going to be good to get feedback from the Xen build system maintainers on whether these variable names are going to be acceptable upstream. It could make sense to add documentation for them to the INSTALL file at the head of the repository where some of the other build system variables are explained.

Thanks for the suggestion. Let's see how the review goes in the upstream project.

Quoted 44 lines

recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch

Quoted 13 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +13 -0
+
+Signed-off-by: Jason Wessel <[email protected]>
+cc: Michal Marek <[email protected]>
+cc: [email protected]
+Signed-off-by: Bruce Ashfield <[email protected]>
+---
+ xen/tools/kconfig/mconf-cfg.sh | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+ mode change 100755 => 100644 xen/tools/kconfig/mconf-cfg.sh
+
+(limited to 'xen/tools/kconfig/mconf-cfg.sh')
+
+diff --git a/xen/tools/kconfig/mconf-cfg.sh

b/xen/tools/kconfig/mconf-cfg.sh

Review

Quoted 23 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +22 -0
+old mode 100755
+new mode 100644
+index c812872d7f9d..65a9b9e5b8a6
+--- a/xen/tools/kconfig/mconf-cfg.sh
++++ b/xen/tools/kconfig/mconf-cfg.sh
+@@ -4,6 +4,14 @@
+ PKG="ncursesw"
+ PKG2="ncurses"
+
++if [ "$CROSS_CURSES_LIB" != "" ]; then
++    echo libs=\'$CROSS_CURSES_LIB\'
++    if [ x"$CROSS_CURSES_INC" != x ]; then
++      echo cflags=\'$CROSS_CURSES_INC\'
++    fi
++    exit 0
++fi
++
+ if [ -n "$(command -v pkg-config)" ]; then
+       if pkg-config --exists $PKG; then
+               echo cflags=\"$(pkg-config --cflags $PKG)\"
+--
+cgit v1.2.2-1-g5e49
(quoted diff) +0 -0

b/recipes-extended/xen/xen-hypervisor.inc

Quoted 6 lines

index c386917..784059b 100644

recipes-extended/xen/xen-hypervisor.inc +0 -0
@@ -77,12 +77,14 @@ do_deploy[depends] += "xen-tools:do_populate_sysroot"
 do_deploy[depends] += "xen-tools:do_deploy"
 
Quoted 8 lines

recipes-extended/xen/xen-hypervisor.inc do_deploy[depends] += "xen-tools:do_populate_sysroot" · line 79

Quoted 1 line
recipes-extended/xen/xen-hypervisor.inc +0 -0
 # Enable use of menuconfig directly from bitbake and also within the

devshell

recipes-extended/xen/xen-hypervisor.inc do_deploy[depends] += "xen-tools:do_populate_sysroot" · line 80

Quoted 2 lines
recipes-extended/xen/xen-hypervisor.inc +1 -1
-OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO"
+OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO

CROSS_CURSES_LIB RECIPE_SYSROOT_NATIVE"

Is there a reason for exporting RECIPE_SYSROOT_NATIVE?

If I don't export this variable the mconf-cfg.sh cannot resolve it. I'll give a try by using the ${STAGING_LIBDIR_NATIVE} and see how it goes.

Quoted 5 lines
Quoted 5 lines
recipes-extended/xen/xen-hypervisor.inc +0 -0
 HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
 HOSTLDFLAGS = "${BUILD_LDFLAGS}"
 TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
 do_devshell[depends] += "ncurses-native:do_populate_sysroot"
 
Quoted 8 lines

recipes-extended/xen/xen-hypervisor.inc do_deploy[depends] += "xen-tools:do_populate_sysroot" · line 86

Quoted 1 line
recipes-extended/xen/xen-hypervisor.inc +1 -0
+CROSS_CURSES_LIB = "-lncurses -L$RECIPE_SYSROOT_NATIVE/usr/lib"

Since this definition here doesn't use { braces }, the value of RECIPE_SYSROOT_NATIVE isn't substituted into CROSS_CURSES_LIB, and so it gets evaluated later when the mconf-cfg.sh script is run. It would be good to add a comment to explain why you're not making the substitution occur within the recipe instead.

I'll give it a try with braces and get rid of the extra export if it works.

Quoted 3 lines

With adding /usr/lib as the suffix: would STAGING_LIBDIR_NATIVE be a more appropriate variable to use?

Agreed.

Quoted 5 lines

Do you need to define and add CROSS_CURSES_INC to the terminal exports? It looks like that is actually introduced indirectly in the next commit in your series, so is this patch correct without doing that?

I have tested without the CROSS_CURSES_INC setting and it worked, this is why I haven't added it in here.

Quoted 43 lines

thanks

Christopher

Review

Quoted 5 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
+
 KCONFIG_CONFIG_COMMAND ??= "menuconfig"
 python do_menuconfig() {
     import shutil
(quoted diff) +0 -0

b/recipes-extended/xen/xen_4.14.bb

recipes-extended/xen/xen_4.14.bb XEN_BRANCH ?= "stable-${XEN_REL}" · line 9

Quoted 8 lines

index 0413bee..91e8988 100644

recipes-extended/xen/xen_4.14.bb +1 -0
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
+   

file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \

Review

Quoted 4 lines
recipes-extended/xen/xen_4.14.bb +0 -0
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
(quoted diff) +0 -0

b/recipes-extended/xen/xen_git.bb

recipes-extended/xen/xen_git.bb XEN_BRANCH ?= "master" · line 9

Quoted 8 lines

index 408bc3b..57791fc 100644

recipes-extended/xen/xen_git.bb +1 -0
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "master"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
+   

file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \

Quoted 7 lines
recipes-extended/xen/xen_git.bb +0 -1
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
--

2.7.4

#8 lore raw
Quoted 60 lines

-----Original Message-----
From: [email protected] <meta- [email protected]> On Behalf Of Diego Sueiro via lists.yoctoproject.org
Sent: 05 August 2020 07:57
To: [email protected]
Subject: Re: [meta-virtualization] [PATCH 1/2] xen: Fix menuconfig

Hi Christopher,

Thanks for your comments and feedback.

Please, find my comments inline.

Quoted 2 lines · Christopher Clark

On Tue, Aug 4, 2020 at 6:28 AM Diego Sueiro <[email protected]>

Quoted 31 lines · wrote:
Quoted 4 lines

When building in OE environment the linker path needs to be passed when buildind the Kconfig tool in order to get the menuconfig task properly working.

Hi Diego,

Thank-you for working on fixing this - it is nice to see this tool working correctly again. I have some feedback inline below.

Quoted 3 lines
---
 ...g-Allow-specification-of-ncurses-location.patch | 55

++++++++++++++++++++++

Quoted 5 lines
 recipes-extended/xen/xen-hypervisor.inc            |  4 +-
 recipes-extended/xen/xen_4.14.bb                   |  1 +
 recipes-extended/xen/xen_git.bb                    |  1 +
 4 files changed, 60 insertions(+), 1 deletion(-)  create mode

100644

recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specificati on-of-ncurses-location.patch

Quoted 2 lines

diff --git

b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specifica tion-of-ncurses-location.patch

Quoted 4 lines

new file mode 100644
index 0000000..74c9cb0
--- /dev/null
+++

b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specifica tion-of-ncurses-location.patch

Quoted 9 lines

recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch line 1

Quoted 2 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +1 -0
@@ -0,0 +1,55 @@
+Upstream-Status: Inappropriate [oe specific, cross compile issue]

How have you arrived at this "Upstream-Status" for this patch? I ask because if it is possible to avoid carrying this patch in meta-virtualization indefinitely, it would be good to do so. Please can you submit it upstream for feedback and hopefully acceptance from the Xen maintainers?

Quoted 3 lines

I'll send it to the upstream project and update the Upstream-Status of this patch.
Like you mentioned below it will most probably have different variable names.

Please, disregard this patch. I'll be sending a new patch shortly unifying both this and https://lists.yoctoproject.org/g/meta-virtualization/message/5689 considering Christopher's comments.

Quoted 166 lines
Quoted 5 lines

recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch

Quoted 5 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +3 -0
+Signed-off-by: Diego Sueiro <[email protected]>
+
+From d078e29aa31ac3fa4c041bf89c46bc6372c1a02a Mon Sep 17

00:00:00

Quoted 9 lines
Quoted 9 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +9 -0
+2001
+From: Bruce Ashfield <[email protected]>
+Date: Mon, 2 Jul 2018 23:10:28 -0400
+Subject: menuconfig,mconf-cfg: Allow specification of ncurses
+location
+
+In some cross build environments such as the Yocto Project build
+environment it provides an ncurses library that is compiled
+differently than the host's version.  This causes display
Quoted 8 lines

Review line 21

Quoted 8 lines
(quoted diff) +8 -0
+corruption problems when the host's curses includes are used
+instead of the includes from the provided compiler are overridden.
+There is a second case where there is no curses libraries at all on
+the host system and menuconfig will just fail entirely.
+
+The solution is simply to allow an override variable in
+check-lxdialog.sh for environments such as the Yocto Project.
+Adding a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue

and

Quoted 8 lines

Review line 22

Quoted 1 line
(quoted diff) +1 -0
+allowing compiling and linking against the right headers and libraries.

I think it's going to be good to get feedback from the Xen build system maintainers on whether these variable names are going to be acceptable upstream. It could make sense to add documentation for them to the INSTALL file at the head of the repository where some of the other build system variables are explained.

Thanks for the suggestion. Let's see how the review goes in the upstream project.

Quoted 38 lines

recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch

Quoted 13 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +13 -0
+
+Signed-off-by: Jason Wessel <[email protected]>
+cc: Michal Marek <[email protected]>
+cc: [email protected]
+Signed-off-by: Bruce Ashfield <[email protected]>
+---
+ xen/tools/kconfig/mconf-cfg.sh | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+ mode change 100755 => 100644 xen/tools/kconfig/mconf-cfg.sh
+
+(limited to 'xen/tools/kconfig/mconf-cfg.sh')
+
+diff --git a/xen/tools/kconfig/mconf-cfg.sh

b/xen/tools/kconfig/mconf-cfg.sh

Review

Quoted 23 lines
recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch new file +22 -0
+old mode 100755
+new mode 100644
+index c812872d7f9d..65a9b9e5b8a6
+--- a/xen/tools/kconfig/mconf-cfg.sh
++++ b/xen/tools/kconfig/mconf-cfg.sh
+@@ -4,6 +4,14 @@
+ PKG="ncursesw"
+ PKG2="ncurses"
+
++if [ "$CROSS_CURSES_LIB" != "" ]; then
++    echo libs=\'$CROSS_CURSES_LIB\'
++    if [ x"$CROSS_CURSES_INC" != x ]; then
++      echo cflags=\'$CROSS_CURSES_INC\'
++    fi
++    exit 0
++fi
++
+ if [ -n "$(command -v pkg-config)" ]; then
+       if pkg-config --exists $PKG; then
+               echo cflags=\"$(pkg-config --cflags $PKG)\"
+--
+cgit v1.2.2-1-g5e49
(quoted diff) +0 -0

b/recipes-extended/xen/xen-hypervisor.inc

Quoted 4 lines

recipes-extended/xen/xen-hypervisor.inc do_deploy[depends] += "xen-

Quoted 4 lines

index c386917..784059b 100644

recipes-extended/xen/xen-hypervisor.inc +0 -0
@@ -77,12 +77,14 @@ do_deploy[depends] += "xen-

tools:do_populate_sysroot"

Quoted 6 lines
Quoted 4 lines
recipes-extended/xen/xen-hypervisor.inc +0 -0
 do_deploy[depends] += "xen-tools:do_deploy"
 
 # Enable use of menuconfig directly from bitbake and also within

the

devshell

Quoted 1 line

-OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS

TERMINFO"

Quoted 1 line
Quoted 1 line

+OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS

TERMINFO

Quoted 4 lines

CROSS_CURSES_LIB RECIPE_SYSROOT_NATIVE"

Is there a reason for exporting RECIPE_SYSROOT_NATIVE?

If I don't export this variable the mconf-cfg.sh cannot resolve it. I'll give a try by using the ${STAGING_LIBDIR_NATIVE} and see how it goes.

Quoted 5 lines
Quoted 5 lines

HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTLDFLAGS = "${BUILD_LDFLAGS}"
TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo" do_devshell[depends] += "ncurses-native:do_populate_sysroot"

Quoted 8 lines
Quoted 1 line

+CROSS_CURSES_LIB = "-lncurses -L$RECIPE_SYSROOT_NATIVE/usr/lib"

Since this definition here doesn't use { braces }, the value of RECIPE_SYSROOT_NATIVE isn't substituted into CROSS_CURSES_LIB, and so it gets evaluated later when the mconf-cfg.sh script is run. It would be good to add a comment to explain why you're not making the substitution occur within the recipe instead.

I'll give it a try with braces and get rid of the extra export if it works.

Quoted 3 lines

With adding /usr/lib as the suffix: would STAGING_LIBDIR_NATIVE be a more appropriate variable to use?

Agreed.

Quoted 5 lines

Do you need to define and add CROSS_CURSES_INC to the terminal exports? It looks like that is actually introduced indirectly in the next commit in your series, so is this patch correct without doing that?

I have tested without the CROSS_CURSES_INC setting and it worked, this is why I haven't added it in here.

Quoted 10 lines

thanks

Christopher

Review

Quoted 5 lines
recipes-extended/xen/xen-hypervisor.inc +1 -0
+
 KCONFIG_CONFIG_COMMAND ??= "menuconfig"
 python do_menuconfig() {
     import shutil
(quoted diff) +0 -0

b/recipes-extended/xen/xen_4.14.bb

Quoted 14 lines

recipes-extended/xen/xen_4.14.bb XEN_BRANCH ?= "stable-${XEN_REL}" · line 9

Quoted 8 lines

index 0413bee..91e8988 100644

recipes-extended/xen/xen_4.14.bb +1 -0
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
+

file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-locati on.patch
\

Quoted 3 lines
recipes-extended/xen/xen_4.14.bb +0 -0
     "
 
 LIC_FILES_CHKSUM ?=

"file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"

Quoted 13 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/recipes-extended/xen/xen_git.bb

recipes-extended/xen/xen_git.bb XEN_BRANCH ?= "master" · line 9

Quoted 8 lines

index 408bc3b..57791fc 100644

recipes-extended/xen/xen_git.bb +1 -0
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "master"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
+

file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-locati on.patch
\

Quoted 9 lines
Quoted 3 lines

recipes-extended/xen/xen_git.bb XEN_BRANCH ?= "master" · line 12

Quoted 3 lines
recipes-extended/xen/xen_git.bb +0 -0
     "
 
 LIC_FILES_CHKSUM ?=

"file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"

Quoted 5 lines
Quoted 4 lines

--
2.7.4

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.