All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-virtualization][PATCH] xen: Fix menuconfig and add support for config fragments and diffconfig
@ 2020-08-12 16:53 Diego Sueiro
  2020-08-12 18:46 ` Christopher Clark
  0 siblings, 1 reply; 5+ messages in thread
From: Diego Sueiro @ 2020-08-12 16:53 UTC (permalink / raw)
  To: meta-virtualization; +Cc: nd

This patch introduces the following changes:

1. 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.

2. 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. Also,
   there is no need to have a custom do_menuconfig task anymore.

Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
---
 recipes-extended/xen/README                        |  3 +
 ...g-Allow-specification-of-ncurses-location.patch | 64 ++++++++++++++++++++++
 recipes-extended/xen/xen-hypervisor.inc            | 48 ++++++----------
 recipes-extended/xen/xen_4.14.bb                   |  1 +
 recipes-extended/xen/xen_git.bb                    |  1 +
 5 files changed, 87 insertions(+), 30 deletions(-)
 create mode 100644 recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch

diff --git a/recipes-extended/xen/README b/recipes-extended/xen/README
index 34e7977..f86d269 100644
--- a/recipes-extended/xen/README
+++ b/recipes-extended/xen/README
@@ -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
 ----------------
 
diff --git a/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch
new file mode 100644
index 0000000..64319d6
--- /dev/null
+++ b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch
@@ -0,0 +1,64 @@
+Upstream-Status: Inappropriate [oe specific, cross compile issue]
+Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
+commit e6972e689a980ab28637e94e48c77eeace6abde5
+Author: Bruce Ashfield <bruce.ashfield@windriver.com>
+Date:   Mon Jul 2 23:10:28 2018 -0400
+
+    xen/kconfig,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.
+    
+    Change-Id: Ibe8dfafc90655e3be2671dbbb0cb7f5631fc4d44
+    Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
+    cc: Michal Marek <mmarek@suse.cz>
+    cc: linux-kbuild@vger.kernel.org
+    Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
+    Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
+
+diff --git a/INSTALL b/INSTALL
+index 0d3eb89..9dcda8f 100644
+--- a/INSTALL
++++ b/INSTALL
+@@ -33,6 +33,10 @@ small subset of the options.  Attempts to change other options will be
+ silently overridden.  The only way to find which configuration options
+ are available is to run `make menuconfig' or the like.
+ 
++To use the menuconfig in cross build environments, e.g. openembedded,
++set the CROSS_CURSES_LIB and CROSS_CURSES_INC environment variables with
++the proper values required for libs and cflags compilation settings.
++
+ You can counter-override this behaviour by setting XEN_CONFIG_EXPERT=y
+ in your environment.  However, doing this is not supported and the
+ resulting configurations do not receive security support.  If you set
+diff --git a/xen/tools/kconfig/mconf-cfg.sh b/xen/tools/kconfig/mconf-cfg.sh
+old mode 100755
+new mode 100644
+index c812872..65a9b9e
+--- 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)\"
diff --git a/recipes-extended/xen/xen-hypervisor.inc b/recipes-extended/xen/xen-hypervisor.inc
index c386917..28d64c5 100644
--- a/recipes-extended/xen/xen-hypervisor.inc
+++ b/recipes-extended/xen/xen-hypervisor.inc
@@ -9,7 +9,7 @@ DESCRIPTION = "The Xen hypervisor"
 # The Xen hypervisor has a narrower compatible platform range than the Xen tools
 COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux|arm-.*-linux-gnueabi'
 
-inherit deploy python3native
+inherit deploy python3native cml1
 
 PACKAGES = " \
     ${PN} \
@@ -34,6 +34,17 @@ FILES_${PN}-efi = " \
 
 do_configure() {
     do_configure_common
+
+    # Handle the config fragments
+    if [ -n "${@' '.join(find_cfgs(d))}" ]; then
+        # If .config is not present generate one in order
+        # to use the merge_config.sh
+        if [ ! -f "${S}/xen/.config" ] ; then
+            oe_runmake -C ${S}/xen defconfig
+        fi
+        ${S}/xen/tools/kconfig/merge_config.sh -m -O \
+            ${S}/xen ${S}/xen/.config ${@" ".join(find_cfgs(d))}
+    fi
 }
 
 do_compile() {
@@ -77,35 +88,12 @@ 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"
-HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
-HOSTLDFLAGS = "${BUILD_LDFLAGS}"
-TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
 do_devshell[depends] += "ncurses-native:do_populate_sysroot"
 
-KCONFIG_CONFIG_COMMAND ??= "menuconfig"
-python do_menuconfig() {
-    import shutil
-
-    try:
-        mtime = os.path.getmtime("xen/.config")
-        shutil.copy("xen/.config", "xen/.config.orig")
-    except OSError:
-        mtime = 0
+# Pass the native library path for kconfig build when running the do_menuconfig
+# task
+CROSS_CURSES_LIB += "-L${STAGING_LIBDIR_NATIVE}"
 
-    oe_terminal("${SHELL} -c \"cd xen; XEN_CONFIG_EXPERT=y make %s; if [ \$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
-        d.getVar('PN') + ' Configuration', d)
-
-    try:
-        newmtime = os.path.getmtime("xen/.config")
-    except OSError:
-        newmtime = 0
-
-    if newmtime > mtime:
-        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
+# Specify the root dir of the .config file for do_menuconfig and do_diffconfig
+# tasks
+KCONFIG_CONFIG_ROOTDIR = "${S}/xen"
diff --git a/recipes-extended/xen/xen_4.14.bb b/recipes-extended/xen/xen_4.14.bb
index 0413bee..91e8988 100644
--- a/recipes-extended/xen/xen_4.14.bb
+++ b/recipes-extended/xen/xen_4.14.bb
@@ -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"
diff --git a/recipes-extended/xen/xen_git.bb b/recipes-extended/xen/xen_git.bb
index 408bc3b..57791fc 100644
--- a/recipes-extended/xen/xen_git.bb
+++ b/recipes-extended/xen/xen_git.bb
@@ -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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [meta-virtualization][PATCH] xen: Fix menuconfig and add support for config fragments and diffconfig
  2020-08-12 16:53 [meta-virtualization][PATCH] xen: Fix menuconfig and add support for config fragments and diffconfig Diego Sueiro
@ 2020-08-12 18:46 ` Christopher Clark
  2020-08-13  7:14   ` Diego Sueiro
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Clark @ 2020-08-12 18:46 UTC (permalink / raw)
  To: Diego Sueiro; +Cc: meta-virtualization, nd

On Wed, Aug 12, 2020 at 9:53 AM Diego Sueiro <diego.sueiro@arm.com> wrote:
>
> This patch introduces the following changes:
>
> 1. 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.
>
> 2. 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. Also,
>    there is no need to have a custom do_menuconfig task anymore.
>
> Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
> ---
>  recipes-extended/xen/README                        |  3 +
>  ...g-Allow-specification-of-ncurses-location.patch | 64 ++++++++++++++++++++++
>  recipes-extended/xen/xen-hypervisor.inc            | 48 ++++++----------
>  recipes-extended/xen/xen_4.14.bb                   |  1 +
>  recipes-extended/xen/xen_git.bb                    |  1 +
>  5 files changed, 87 insertions(+), 30 deletions(-)
>  create mode 100644 recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch
>
> diff --git a/recipes-extended/xen/README b/recipes-extended/xen/README
> index 34e7977..f86d269 100644
> --- a/recipes-extended/xen/README
> +++ b/recipes-extended/xen/README
> @@ -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

Configuration

> +.cfg files in the SRC_URI.
> +
>  security patches
>  ----------------
>
> diff --git a/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch
> new file mode 100644
> index 0000000..64319d6
> --- /dev/null
> +++ b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch
> @@ -0,0 +1,64 @@
> +Upstream-Status: Inappropriate [oe specific, cross compile issue]

Is this being considered for submission upstream?
https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
so: Pending?

> +Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
> +commit e6972e689a980ab28637e94e48c77eeace6abde5
> +Author: Bruce Ashfield <bruce.ashfield@windriver.com>
> +Date:   Mon Jul 2 23:10:28 2018 -0400
> +
> +    xen/kconfig,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.
> +
> +    Change-Id: Ibe8dfafc90655e3be2671dbbb0cb7f5631fc4d44
> +    Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
> +    cc: Michal Marek <mmarek@suse.cz>
> +    cc: linux-kbuild@vger.kernel.org
> +    Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
> +    Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
> +
> +diff --git a/INSTALL b/INSTALL
> +index 0d3eb89..9dcda8f 100644
> +--- a/INSTALL
> ++++ b/INSTALL
> +@@ -33,6 +33,10 @@ small subset of the options.  Attempts to change other options will be
> + silently overridden.  The only way to find which configuration options
> + are available is to run `make menuconfig' or the like.
> +
> ++To use the menuconfig in cross build environments, e.g. openembedded,
> ++set the CROSS_CURSES_LIB and CROSS_CURSES_INC environment variables with
> ++the proper values required for libs and cflags compilation settings.
> ++
> + You can counter-override this behaviour by setting XEN_CONFIG_EXPERT=y
> + in your environment.  However, doing this is not supported and the
> + resulting configurations do not receive security support.  If you set

The doc has a couple of existing sections for variables that affect
the build -- better to add the new documentation there?

> +diff --git a/xen/tools/kconfig/mconf-cfg.sh b/xen/tools/kconfig/mconf-cfg.sh
> +old mode 100755
> +new mode 100644

??

> +index c812872..65a9b9e
> +--- 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)\"
> diff --git a/recipes-extended/xen/xen-hypervisor.inc b/recipes-extended/xen/xen-hypervisor.inc
> index c386917..28d64c5 100644
> --- a/recipes-extended/xen/xen-hypervisor.inc
> +++ b/recipes-extended/xen/xen-hypervisor.inc
> @@ -9,7 +9,7 @@ DESCRIPTION = "The Xen hypervisor"
>  # The Xen hypervisor has a narrower compatible platform range than the Xen tools
>  COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux|arm-.*-linux-gnueabi'
>
> -inherit deploy python3native
> +inherit deploy python3native cml1
>
>  PACKAGES = " \
>      ${PN} \
> @@ -34,6 +34,17 @@ FILES_${PN}-efi = " \
>
>  do_configure() {
>      do_configure_common
> +
> +    # Handle the config fragments
> +    if [ -n "${@' '.join(find_cfgs(d))}" ]; then
> +        # If .config is not present generate one in order
> +        # to use the merge_config.sh
> +        if [ ! -f "${S}/xen/.config" ] ; then
> +            oe_runmake -C ${S}/xen defconfig
> +        fi
> +        ${S}/xen/tools/kconfig/merge_config.sh -m -O \
> +            ${S}/xen ${S}/xen/.config ${@" ".join(find_cfgs(d))}
> +    fi
>  }
>
>  do_compile() {
> @@ -77,35 +88,12 @@ 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"
> -HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
> -HOSTLDFLAGS = "${BUILD_LDFLAGS}"
> -TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
>  do_devshell[depends] += "ncurses-native:do_populate_sysroot"
>
> -KCONFIG_CONFIG_COMMAND ??= "menuconfig"
> -python do_menuconfig() {
> -    import shutil
> -
> -    try:
> -        mtime = os.path.getmtime("xen/.config")
> -        shutil.copy("xen/.config", "xen/.config.orig")
> -    except OSError:
> -        mtime = 0
> +# Pass the native library path for kconfig build when running the do_menuconfig
> +# task
> +CROSS_CURSES_LIB += "-L${STAGING_LIBDIR_NATIVE}"

I think this illustrates why the new variable names that this patch
introduces could be improved: they are set with values that enable the
build to generate binaries that run on the host (ie. native), not the
target (cross). Alternatively, in the kconfig Makefile, a HOST prefix
denotes variables that are used to build binaries that run on the
host.

Christopher

>
> -    oe_terminal("${SHELL} -c \"cd xen; XEN_CONFIG_EXPERT=y make %s; if [ \$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
> -        d.getVar('PN') + ' Configuration', d)
> -
> -    try:
> -        newmtime = os.path.getmtime("xen/.config")
> -    except OSError:
> -        newmtime = 0
> -
> -    if newmtime > mtime:
> -        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
> +# Specify the root dir of the .config file for do_menuconfig and do_diffconfig
> +# tasks
> +KCONFIG_CONFIG_ROOTDIR = "${S}/xen"
> diff --git a/recipes-extended/xen/xen_4.14.bb b/recipes-extended/xen/xen_4.14.bb
> index 0413bee..91e8988 100644
> --- a/recipes-extended/xen/xen_4.14.bb
> +++ b/recipes-extended/xen/xen_4.14.bb
> @@ -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"
> diff --git a/recipes-extended/xen/xen_git.bb b/recipes-extended/xen/xen_git.bb
> index 408bc3b..57791fc 100644
> --- a/recipes-extended/xen/xen_git.bb
> +++ b/recipes-extended/xen/xen_git.bb
> @@ -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
>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [meta-virtualization][PATCH] xen: Fix menuconfig and add support for config fragments and diffconfig
  2020-08-12 18:46 ` Christopher Clark
@ 2020-08-13  7:14   ` Diego Sueiro
  2020-08-13 13:34     ` Bruce Ashfield
  0 siblings, 1 reply; 5+ messages in thread
From: Diego Sueiro @ 2020-08-13  7:14 UTC (permalink / raw)
  To: Christopher Clark
  Cc: meta-virtualization, nd, Doug Goldstein, Bruce Ashfield,
	Bertrand Marquis

Hello Christopher,

Please, find my comments inline.

>-----Original Message-----
>From: Christopher Clark <christopher.w.clark@gmail.com>
>Sent: 12 August 2020 19:46
>To: Diego Sueiro <Diego.Sueiro@arm.com>
>Cc: meta-virtualization@lists.yoctoproject.org; nd <nd@arm.com>
>Subject: Re: [meta-virtualization][PATCH] xen: Fix menuconfig and add support
>for config fragments and diffconfig
>
>On Wed, Aug 12, 2020 at 9:53 AM Diego Sueiro <diego.sueiro@arm.com>
>wrote:
>>
>> This patch introduces the following changes:
>>
>> 1. 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.
>>
>> 2. 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. Also,
>>    there is no need to have a custom do_menuconfig task anymore.
>>
>> Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
>> ---
>>  recipes-extended/xen/README                        |  3 +
>>  ...g-Allow-specification-of-ncurses-location.patch | 64
>++++++++++++++++++++++
>>  recipes-extended/xen/xen-hypervisor.inc            | 48 ++++++----------
>>  recipes-extended/xen/xen_4.14.bb                   |  1 +
>>  recipes-extended/xen/xen_git.bb                    |  1 +
>>  5 files changed, 87 insertions(+), 30 deletions(-)  create mode
>> 100644
>> recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specificati
>> on-of-ncurses-location.patch
>>
>> diff --git a/recipes-extended/xen/README b/recipes-extended/xen/README
>> index 34e7977..f86d269 100644
>> --- a/recipes-extended/xen/README
>> +++ b/recipes-extended/xen/README
>> @@ -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
>
>Configuration

Ooops, I forgot about this one.

>
>> +.cfg files in the SRC_URI.
>> +
>>  security patches
>>  ----------------
>>
>> diff --git
>> a/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specifica
>> tion-of-ncurses-location.patch
>> b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specifica
>> tion-of-ncurses-location.patch
>> new file mode 100644
>> index 0000000..64319d6
>> --- /dev/null
>> +++ b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-speci
>> +++ fication-of-ncurses-location.patch
>> @@ -0,0 +1,64 @@
>> +Upstream-Status: Inappropriate [oe specific, cross compile issue]
>
>Is this being considered for submission upstream?
>https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
>so: Pending?

In a thread of emails, @Doug mentioned that this patch was not going to be
accepted in the Xen source tree. We discussed that we are going to submit the
solution to the kernel mainline and if accepted, Doug will sync-up the Xen
kconfig source with the kernel. Since this patch is targeting the Xen source tree
and will not be accepted by the Xen project as is, I thought that the
Upstream-Status should be set as Inappropriate. @Bruce, can you please
advice what is the best description to add in it?

>
>> +Signed-off-by: Diego Sueiro <diego.sueiro@arm.com> commit
>> +e6972e689a980ab28637e94e48c77eeace6abde5
>> +Author: Bruce Ashfield <bruce.ashfield@windriver.com>
>> +Date:   Mon Jul 2 23:10:28 2018 -0400
>> +
>> +    xen/kconfig,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.
>> +
>> +    Change-Id: Ibe8dfafc90655e3be2671dbbb0cb7f5631fc4d44
>> +    Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
>> +    cc: Michal Marek <mmarek@suse.cz>
>> +    cc: linux-kbuild@vger.kernel.org
>> +    Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
>> +    Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
>> +
>> +diff --git a/INSTALL b/INSTALL
>> +index 0d3eb89..9dcda8f 100644
>> +--- a/INSTALL
>> ++++ b/INSTALL
>> +@@ -33,6 +33,10 @@ small subset of the options.  Attempts to change
>> +other options will be  silently overridden.  The only way to find
>> +which configuration options  are available is to run `make menuconfig' or
>the like.
>> +
>> ++To use the menuconfig in cross build environments, e.g.
>> ++openembedded, set the CROSS_CURSES_LIB and CROSS_CURSES_INC
>> ++environment variables with the proper values required for libs and cflags
>compilation settings.
>> ++
>> + You can counter-override this behaviour by setting
>> + XEN_CONFIG_EXPERT=y in your environment.  However, doing this is not
>> + supported and the resulting configurations do not receive security
>> + support.  If you set
>
>The doc has a couple of existing sections for variables that affect the build --
>better to add the new documentation there?
>

Well, the introduction of these variables are not affecting the build itself since
they are only used when building kconfig in a cross build environment for the
menuconfig target. Either way, since this patch will not be merged directly to
the Xen source tree, I'm thinking about dropping the documentation changes
since for the normal Yocto use cases the user does not need to care about it
because the build system is already setting it properly.
Do you agree with removing the documentation changes in this patch?

>> +diff --git a/xen/tools/kconfig/mconf-cfg.sh
>> +b/xen/tools/kconfig/mconf-cfg.sh old mode 100755 new mode 100644
>
>??

This came from the original patch. Shall I remove the file mode modification?  

>
>> +index c812872..65a9b9e
>> +--- 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)\"
>> diff --git a/recipes-extended/xen/xen-hypervisor.inc
>> b/recipes-extended/xen/xen-hypervisor.inc
>> index c386917..28d64c5 100644
>> --- a/recipes-extended/xen/xen-hypervisor.inc
>> +++ b/recipes-extended/xen/xen-hypervisor.inc
>> @@ -9,7 +9,7 @@ DESCRIPTION = "The Xen hypervisor"
>>  # The Xen hypervisor has a narrower compatible platform range than
>> the Xen tools  COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux|arm-
>.*-linux-gnueabi'
>>
>> -inherit deploy python3native
>> +inherit deploy python3native cml1
>>
>>  PACKAGES = " \
>>      ${PN} \
>> @@ -34,6 +34,17 @@ FILES_${PN}-efi = " \
>>
>>  do_configure() {
>>      do_configure_common
>> +
>> +    # Handle the config fragments
>> +    if [ -n "${@' '.join(find_cfgs(d))}" ]; then
>> +        # If .config is not present generate one in order
>> +        # to use the merge_config.sh
>> +        if [ ! -f "${S}/xen/.config" ] ; then
>> +            oe_runmake -C ${S}/xen defconfig
>> +        fi
>> +        ${S}/xen/tools/kconfig/merge_config.sh -m -O \
>> +            ${S}/xen ${S}/xen/.config ${@" ".join(find_cfgs(d))}
>> +    fi
>>  }
>>
>>  do_compile() {
>> @@ -77,35 +88,12 @@ 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"
>> -HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
>> -HOSTLDFLAGS = "${BUILD_LDFLAGS}"
>> -TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
>>  do_devshell[depends] += "ncurses-native:do_populate_sysroot"
>>
>> -KCONFIG_CONFIG_COMMAND ??= "menuconfig"
>> -python do_menuconfig() {
>> -    import shutil
>> -
>> -    try:
>> -        mtime = os.path.getmtime("xen/.config")
>> -        shutil.copy("xen/.config", "xen/.config.orig")
>> -    except OSError:
>> -        mtime = 0
>> +# Pass the native library path for kconfig build when running the
>> +do_menuconfig # task CROSS_CURSES_LIB += "-
>L${STAGING_LIBDIR_NATIVE}"
>
>I think this illustrates why the new variable names that this patch introduces
>could be improved: they are set with values that enable the build to generate
>binaries that run on the host (ie. native), not the target (cross). Alternatively, in
>the kconfig Makefile, a HOST prefix denotes variables that are used to build
>binaries that run on the host.

If we change the variable name, I'll have to change the original patch and also
add in this recipe the following:
OE_TERMINAL_EXPORTS += "HOST_CURSES_LIB HOST_CURSES_INC"
HOST_CURSES_LIB = "${CROSS_CURSES_LIB} -L${STAGING_LIBDIR_NATIVE}"
HOST_CURSES_INC = "${CROSS_CURSES_INC}"

I'm trying to avoid as much as possible extra customisations to extend what cml1.bbclass
is already providing , and keep this recipe as clean as possible.
Please, confirm that you want me to go ahead with this extra settings/customisations.

Diego

>
>Christopher
>
>>
>> -    oe_terminal("${SHELL} -c \"cd xen; XEN_CONFIG_EXPERT=y make %s; if
>[ \$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... ';
>read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
>> -        d.getVar('PN') + ' Configuration', d)
>> -
>> -    try:
>> -        newmtime = os.path.getmtime("xen/.config")
>> -    except OSError:
>> -        newmtime = 0
>> -
>> -    if newmtime > mtime:
>> -        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
>> +# Specify the root dir of the .config file for do_menuconfig and
>> +do_diffconfig # tasks KCONFIG_CONFIG_ROOTDIR = "${S}/xen"
>> diff --git a/recipes-extended/xen/xen_4.14.bb
>> b/recipes-extended/xen/xen_4.14.bb
>> index 0413bee..91e8988 100644
>> --- a/recipes-extended/xen/xen_4.14.bb
>> +++ b/recipes-extended/xen/xen_4.14.bb
>> @@ -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-loca
>> + tion.patch \
>>      "
>>
>>  LIC_FILES_CHKSUM ?=
>"file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
>> diff --git a/recipes-extended/xen/xen_git.bb
>> b/recipes-extended/xen/xen_git.bb index 408bc3b..57791fc 100644
>> --- a/recipes-extended/xen/xen_git.bb
>> +++ b/recipes-extended/xen/xen_git.bb
>> @@ -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-loca
>> + tion.patch \
>>      "
>>
>>  LIC_FILES_CHKSUM ?=
>"file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
>> --
>> 2.7.4
>>
>> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [meta-virtualization][PATCH] xen: Fix menuconfig and add support for config fragments and diffconfig
  2020-08-13  7:14   ` Diego Sueiro
@ 2020-08-13 13:34     ` Bruce Ashfield
  2020-08-13 22:43       ` Christopher Clark
  0 siblings, 1 reply; 5+ messages in thread
From: Bruce Ashfield @ 2020-08-13 13:34 UTC (permalink / raw)
  To: Diego Sueiro
  Cc: Christopher Clark, meta-virtualization, nd, Doug Goldstein,
	Bertrand Marquis

[-- Attachment #1: Type: text/plain, Size: 13631 bytes --]

On Thu, Aug 13, 2020 at 3:14 AM Diego Sueiro <Diego.Sueiro@arm.com> wrote:

> Hello Christopher,
>
> Please, find my comments inline.
>
> >-----Original Message-----
> >From: Christopher Clark <christopher.w.clark@gmail.com>
> >Sent: 12 August 2020 19:46
> >To: Diego Sueiro <Diego.Sueiro@arm.com>
> >Cc: meta-virtualization@lists.yoctoproject.org; nd <nd@arm.com>
> >Subject: Re: [meta-virtualization][PATCH] xen: Fix menuconfig and add
> support
> >for config fragments and diffconfig
> >
> >On Wed, Aug 12, 2020 at 9:53 AM Diego Sueiro <diego.sueiro@arm.com>
> >wrote:
> >>
> >> This patch introduces the following changes:
> >>
> >> 1. 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.
> >>
> >> 2. 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. Also,
> >>    there is no need to have a custom do_menuconfig task anymore.
> >>
> >> Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
> >> ---
> >>  recipes-extended/xen/README                        |  3 +
> >>  ...g-Allow-specification-of-ncurses-location.patch | 64
> >++++++++++++++++++++++
> >>  recipes-extended/xen/xen-hypervisor.inc            | 48
> ++++++----------
> >>  recipes-extended/xen/xen_4.14.bb                   |  1 +
> >>  recipes-extended/xen/xen_git.bb                    |  1 +
> >>  5 files changed, 87 insertions(+), 30 deletions(-)  create mode
> >> 100644
> >> recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specificati
> >> on-of-ncurses-location.patch
> >>
> >> diff --git a/recipes-extended/xen/README b/recipes-extended/xen/README
> >> index 34e7977..f86d269 100644
> >> --- a/recipes-extended/xen/README
> >> +++ b/recipes-extended/xen/README
> >> @@ -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
> >
> >Configuration
>
> Ooops, I forgot about this one.
>
> >
> >> +.cfg files in the SRC_URI.
> >> +
> >>  security patches
> >>  ----------------
> >>
> >> diff --git
> >> a/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specifica
> >> tion-of-ncurses-location.patch
> >> b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specifica
> >> tion-of-ncurses-location.patch
> >> new file mode 100644
> >> index 0000000..64319d6
> >> --- /dev/null
> >> +++ b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-speci
> >> +++ fication-of-ncurses-location.patch
> >> @@ -0,0 +1,64 @@
> >> +Upstream-Status: Inappropriate [oe specific, cross compile issue]
> >
> >Is this being considered for submission upstream?
> >https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
> >so: Pending?
>
> In a thread of emails, @Doug mentioned that this patch was not going to be
> accepted in the Xen source tree. We discussed that we are going to submit
> the
> solution to the kernel mainline and if accepted, Doug will sync-up the Xen
> kconfig source with the kernel. Since this patch is targeting the Xen
> source tree
> and will not be accepted by the Xen project as is, I thought that the
> Upstream-Status should be set as Inappropriate. @Bruce, can you please
> advice what is the best description to add in it?
>

The field isn't too strictly regulated, and since there are two potential
"upstreams", we can just put two entries.

I'd suggest one for Xen upstream (which is what you have), i.e.
Upstream-status: Xen: ......

And a second for the kernel, and in that one, we can put "pending".

Bruce



>
> >
> >> +Signed-off-by: Diego Sueiro <diego.sueiro@arm.com> commit
> >> +e6972e689a980ab28637e94e48c77eeace6abde5
> >> +Author: Bruce Ashfield <bruce.ashfield@windriver.com>
> >> +Date:   Mon Jul 2 23:10:28 2018 -0400
> >> +
> >> +    xen/kconfig,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.
> >> +
> >> +    Change-Id: Ibe8dfafc90655e3be2671dbbb0cb7f5631fc4d44
> >> +    Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
> >> +    cc: Michal Marek <mmarek@suse.cz>
> >> +    cc: linux-kbuild@vger.kernel.org
> >> +    Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
> >> +    Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
> >> +
> >> +diff --git a/INSTALL b/INSTALL
> >> +index 0d3eb89..9dcda8f 100644
> >> +--- a/INSTALL
> >> ++++ b/INSTALL
> >> +@@ -33,6 +33,10 @@ small subset of the options.  Attempts to change
> >> +other options will be  silently overridden.  The only way to find
> >> +which configuration options  are available is to run `make menuconfig'
> or
> >the like.
> >> +
> >> ++To use the menuconfig in cross build environments, e.g.
> >> ++openembedded, set the CROSS_CURSES_LIB and CROSS_CURSES_INC
> >> ++environment variables with the proper values required for libs and
> cflags
> >compilation settings.
> >> ++
> >> + You can counter-override this behaviour by setting
> >> + XEN_CONFIG_EXPERT=y in your environment.  However, doing this is not
> >> + supported and the resulting configurations do not receive security
> >> + support.  If you set
> >
> >The doc has a couple of existing sections for variables that affect the
> build --
> >better to add the new documentation there?
> >
>
> Well, the introduction of these variables are not affecting the build
> itself since
> they are only used when building kconfig in a cross build environment for
> the
> menuconfig target. Either way, since this patch will not be merged
> directly to
> the Xen source tree, I'm thinking about dropping the documentation changes
> since for the normal Yocto use cases the user does not need to care about
> it
> because the build system is already setting it properly.
> Do you agree with removing the documentation changes in this patch?
>
> >> +diff --git a/xen/tools/kconfig/mconf-cfg.sh
> >> +b/xen/tools/kconfig/mconf-cfg.sh old mode 100755 new mode 100644
> >
> >??
>
> This came from the original patch. Shall I remove the file mode
> modification?
>
> >
> >> +index c812872..65a9b9e
> >> +--- 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)\"
> >> diff --git a/recipes-extended/xen/xen-hypervisor.inc
> >> b/recipes-extended/xen/xen-hypervisor.inc
> >> index c386917..28d64c5 100644
> >> --- a/recipes-extended/xen/xen-hypervisor.inc
> >> +++ b/recipes-extended/xen/xen-hypervisor.inc
> >> @@ -9,7 +9,7 @@ DESCRIPTION = "The Xen hypervisor"
> >>  # The Xen hypervisor has a narrower compatible platform range than
> >> the Xen tools  COMPATIBLE_HOST =
> '(x86_64.*).*-linux|aarch64.*-linux|arm-
> >.*-linux-gnueabi'
> >>
> >> -inherit deploy python3native
> >> +inherit deploy python3native cml1
> >>
> >>  PACKAGES = " \
> >>      ${PN} \
> >> @@ -34,6 +34,17 @@ FILES_${PN}-efi = " \
> >>
> >>  do_configure() {
> >>      do_configure_common
> >> +
> >> +    # Handle the config fragments
> >> +    if [ -n "${@' '.join(find_cfgs(d))}" ]; then
> >> +        # If .config is not present generate one in order
> >> +        # to use the merge_config.sh
> >> +        if [ ! -f "${S}/xen/.config" ] ; then
> >> +            oe_runmake -C ${S}/xen defconfig
> >> +        fi
> >> +        ${S}/xen/tools/kconfig/merge_config.sh -m -O \
> >> +            ${S}/xen ${S}/xen/.config ${@" ".join(find_cfgs(d))}
> >> +    fi
> >>  }
> >>
> >>  do_compile() {
> >> @@ -77,35 +88,12 @@ 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"
> >> -HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
> >> -HOSTLDFLAGS = "${BUILD_LDFLAGS}"
> >> -TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
> >>  do_devshell[depends] += "ncurses-native:do_populate_sysroot"
> >>
> >> -KCONFIG_CONFIG_COMMAND ??= "menuconfig"
> >> -python do_menuconfig() {
> >> -    import shutil
> >> -
> >> -    try:
> >> -        mtime = os.path.getmtime("xen/.config")
> >> -        shutil.copy("xen/.config", "xen/.config.orig")
> >> -    except OSError:
> >> -        mtime = 0
> >> +# Pass the native library path for kconfig build when running the
> >> +do_menuconfig # task CROSS_CURSES_LIB += "-
> >L${STAGING_LIBDIR_NATIVE}"
> >
> >I think this illustrates why the new variable names that this patch
> introduces
> >could be improved: they are set with values that enable the build to
> generate
> >binaries that run on the host (ie. native), not the target (cross).
> Alternatively, in
> >the kconfig Makefile, a HOST prefix denotes variables that are used to
> build
> >binaries that run on the host.
>
> If we change the variable name, I'll have to change the original patch and
> also
> add in this recipe the following:
> OE_TERMINAL_EXPORTS += "HOST_CURSES_LIB HOST_CURSES_INC"
> HOST_CURSES_LIB = "${CROSS_CURSES_LIB} -L${STAGING_LIBDIR_NATIVE}"
> HOST_CURSES_INC = "${CROSS_CURSES_INC}"
>
> I'm trying to avoid as much as possible extra customisations to extend
> what cml1.bbclass
> is already providing , and keep this recipe as clean as possible.
> Please, confirm that you want me to go ahead with this extra
> settings/customisations.
>
> Diego
>
> >
> >Christopher
> >
> >>
> >> -    oe_terminal("${SHELL} -c \"cd xen; XEN_CONFIG_EXPERT=y make %s; if
> >[ \$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to
> continue... ';
> >read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
> >> -        d.getVar('PN') + ' Configuration', d)
> >> -
> >> -    try:
> >> -        newmtime = os.path.getmtime("xen/.config")
> >> -    except OSError:
> >> -        newmtime = 0
> >> -
> >> -    if newmtime > mtime:
> >> -        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
> >> +# Specify the root dir of the .config file for do_menuconfig and
> >> +do_diffconfig # tasks KCONFIG_CONFIG_ROOTDIR = "${S}/xen"
> >> diff --git a/recipes-extended/xen/xen_4.14.bb
> >> b/recipes-extended/xen/xen_4.14.bb
> >> index 0413bee..91e8988 100644
> >> --- a/recipes-extended/xen/xen_4.14.bb
> >> +++ b/recipes-extended/xen/xen_4.14.bb
> >> @@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
> >>  SRC_URI = " \
> >>      git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH}
> <http://xenbits.xen.org/xen.git;branch=$%7BXEN_BRANCH%7D> \
> >>      file://xen-arm64-implement-atomic-fetch-add.patch \
> >> +
> >> + file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-loca
> >> + tion.patch \
> >>      "
> >>
> >>  LIC_FILES_CHKSUM ?=
> >"file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> >> diff --git a/recipes-extended/xen/xen_git.bb
> >> b/recipes-extended/xen/xen_git.bb index 408bc3b..57791fc 100644
> >> --- a/recipes-extended/xen/xen_git.bb
> >> +++ b/recipes-extended/xen/xen_git.bb
> >> @@ -6,6 +6,7 @@ XEN_BRANCH ?= "master"
> >>  SRC_URI = " \
> >>      git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH}
> <http://xenbits.xen.org/xen.git;branch=$%7BXEN_BRANCH%7D> \
> >>      file://xen-arm64-implement-atomic-fetch-add.patch \
> >> +
> >> + file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-loca
> >> + tion.patch \
> >>      "
> >>
> >>  LIC_FILES_CHKSUM ?=
> >"file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> >> --
> >> 2.7.4
> >>
> >> 
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II

[-- Attachment #2: Type: text/html, Size: 19189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [meta-virtualization][PATCH] xen: Fix menuconfig and add support for config fragments and diffconfig
  2020-08-13 13:34     ` Bruce Ashfield
@ 2020-08-13 22:43       ` Christopher Clark
  0 siblings, 0 replies; 5+ messages in thread
From: Christopher Clark @ 2020-08-13 22:43 UTC (permalink / raw)
  To: meta-virtualization, Diego Sueiro
  Cc: nd, Doug Goldstein, Bertrand Marquis, Bruce Ashfield

On Thu, Aug 13, 2020 at 6:35 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
> On Thu, Aug 13, 2020 at 3:14 AM Diego Sueiro <Diego.Sueiro@arm.com> wrote:
>> > On Wed, 12 Aug, Christopher Clark <christopher.w.clark@gmail.com> wrote:
>> >On Wed, Aug 12, 2020 at 9:53 AM Diego Sueiro <diego.sueiro@arm.com>
>> >wrote:
>> >>
>> >> This patch introduces the following changes:
>> >>
>> >> 1. 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.
>> >>
>> >> 2. 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. Also,
>> >>    there is no need to have a custom do_menuconfig task anymore.
>> >>
>> >> Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>

>> >> diff --git
>> >> a/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specifica
>> >> tion-of-ncurses-location.patch
>> >> b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specifica
>> >> tion-of-ncurses-location.patch
>> >> new file mode 100644
>> >> index 0000000..64319d6
>> >> --- /dev/null
>> >> +++ b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-speci
>> >> +++ fication-of-ncurses-location.patch
>> >> @@ -0,0 +1,64 @@
>> >> +Upstream-Status: Inappropriate [oe specific, cross compile issue]
>> >
>> >Is this being considered for submission upstream?
>> >https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
>> >so: Pending?
>>
>> In a thread of emails, @Doug mentioned that this patch was not going to be
>> accepted in the Xen source tree. We discussed that we are going to submit the
>> solution to the kernel mainline and if accepted, Doug will sync-up the Xen
>> kconfig source with the kernel.

ok, I hadn't interpreted Doug's comment as a nack of this patch for Xen, but I
did see that you guys are going to first work with it towards inclusion in the
mainline kernel -- good, thanks for taking that on.

>> Since this patch is targeting the Xen source tree
>> and will not be accepted by the Xen project as is, I thought that the
>> Upstream-Status should be set as Inappropriate. @Bruce, can you please
>> advice what is the best description to add in it?
>
>
> The field isn't too strictly regulated, and since there are two potential "upstreams", we can just put two entries.
>
> I'd suggest one for Xen upstream (which is what you have), i.e. Upstream-status: Xen: ......
>
> And a second for the kernel, and in that one, we can put "pending".
>
> Bruce
>
>>
>> >
>> >> +Signed-off-by: Diego Sueiro <diego.sueiro@arm.com> commit
>> >> +e6972e689a980ab28637e94e48c77eeace6abde5
>> >> +Author: Bruce Ashfield <bruce.ashfield@windriver.com>
>> >> +Date:   Mon Jul 2 23:10:28 2018 -0400
>> >> +
>> >> +    xen/kconfig,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.
>> >> +
>> >> +    Change-Id: Ibe8dfafc90655e3be2671dbbb0cb7f5631fc4d44
>> >> +    Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
>> >> +    cc: Michal Marek <mmarek@suse.cz>
>> >> +    cc: linux-kbuild@vger.kernel.org
>> >> +    Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
>> >> +    Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
>> >> +
>> >> +diff --git a/INSTALL b/INSTALL
>> >> +index 0d3eb89..9dcda8f 100644
>> >> +--- a/INSTALL
>> >> ++++ b/INSTALL
>> >> +@@ -33,6 +33,10 @@ small subset of the options.  Attempts to change
>> >> +other options will be  silently overridden.  The only way to find
>> >> +which configuration options  are available is to run `make menuconfig' or
>> >the like.
>> >> +
>> >> ++To use the menuconfig in cross build environments, e.g.
>> >> ++openembedded, set the CROSS_CURSES_LIB and CROSS_CURSES_INC
>> >> ++environment variables with the proper values required for libs and cflags
>> >compilation settings.
>> >> ++
>> >> + You can counter-override this behaviour by setting
>> >> + XEN_CONFIG_EXPERT=y in your environment.  However, doing this is not
>> >> + supported and the resulting configurations do not receive security
>> >> + support.  If you set
>> >
>> >The doc has a couple of existing sections for variables that affect the build --
>> >better to add the new documentation there?
>> >
>>
>> Well, the introduction of these variables are not affecting the build itself since
>> they are only used when building kconfig in a cross build environment for the
>> menuconfig target. Either way, since this patch will not be merged directly to
>> the Xen source tree, I'm thinking about dropping the documentation changes
>> since for the normal Yocto use cases the user does not need to care about it
>> because the build system is already setting it properly.
>> Do you agree with removing the documentation changes in this patch?

Sure. The commit message and patch content is clear enough for here.

>>
>> >> +diff --git a/xen/tools/kconfig/mconf-cfg.sh
>> >> +b/xen/tools/kconfig/mconf-cfg.sh old mode 100755 new mode 100644
>> >
>> >??
>>
>> This came from the original patch. Shall I remove the file mode modification?

I haven't tested your patch but it looked like you were modifying the mode on
the 'merge_config.sh' script that you're about to run in do_configure; I see
now that this is a different script, so ok, no change needed.

>>
>> >
>> >> +index c812872..65a9b9e
>> >> +--- 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)\"
>> >> diff --git a/recipes-extended/xen/xen-hypervisor.inc
>> >> b/recipes-extended/xen/xen-hypervisor.inc
>> >> index c386917..28d64c5 100644
>> >> --- a/recipes-extended/xen/xen-hypervisor.inc
>> >> +++ b/recipes-extended/xen/xen-hypervisor.inc
>> >> @@ -9,7 +9,7 @@ DESCRIPTION = "The Xen hypervisor"
>> >>  # The Xen hypervisor has a narrower compatible platform range than
>> >> the Xen tools  COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux|arm-
>> >.*-linux-gnueabi'
>> >>
>> >> -inherit deploy python3native
>> >> +inherit deploy python3native cml1
>> >>
>> >>  PACKAGES = " \
>> >>      ${PN} \
>> >> @@ -34,6 +34,17 @@ FILES_${PN}-efi = " \
>> >>
>> >>  do_configure() {
>> >>      do_configure_common
>> >> +
>> >> +    # Handle the config fragments
>> >> +    if [ -n "${@' '.join(find_cfgs(d))}" ]; then
>> >> +        # If .config is not present generate one in order
>> >> +        # to use the merge_config.sh
>> >> +        if [ ! -f "${S}/xen/.config" ] ; then
>> >> +            oe_runmake -C ${S}/xen defconfig
>> >> +        fi
>> >> +        ${S}/xen/tools/kconfig/merge_config.sh -m -O \
>> >> +            ${S}/xen ${S}/xen/.config ${@" ".join(find_cfgs(d))}

If you're going to resubmit your patch, it would be nice to avoid running
find_cfgs twice; but I won't insist.


>> >> +    fi
>> >>  }
>> >>
>> >>  do_compile() {
>> >> @@ -77,35 +88,12 @@ 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"
>> >> -HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
>> >> -HOSTLDFLAGS = "${BUILD_LDFLAGS}"
>> >> -TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
>> >>  do_devshell[depends] += "ncurses-native:do_populate_sysroot"
>> >>
>> >> -KCONFIG_CONFIG_COMMAND ??= "menuconfig"
>> >> -python do_menuconfig() {
>> >> -    import shutil
>> >> -
>> >> -    try:
>> >> -        mtime = os.path.getmtime("xen/.config")
>> >> -        shutil.copy("xen/.config", "xen/.config.orig")
>> >> -    except OSError:
>> >> -        mtime = 0
>> >> +# Pass the native library path for kconfig build when running the
>> >> +do_menuconfig # task CROSS_CURSES_LIB += "-
>> >L${STAGING_LIBDIR_NATIVE}"
>> >
>> >I think this illustrates why the new variable names that this patch introduces
>> >could be improved: they are set with values that enable the build to generate
>> >binaries that run on the host (ie. native), not the target (cross). Alternatively, in
>> >the kconfig Makefile, a HOST prefix denotes variables that are used to build
>> >binaries that run on the host.
>>
>> If we change the variable name, I'll have to change the original patch and also
>> add in this recipe the following:
>> OE_TERMINAL_EXPORTS += "HOST_CURSES_LIB HOST_CURSES_INC"
>> HOST_CURSES_LIB = "${CROSS_CURSES_LIB} -L${STAGING_LIBDIR_NATIVE}"
>> HOST_CURSES_INC = "${CROSS_CURSES_INC}"
>>
>> I'm trying to avoid as much as possible extra customisations to extend what cml1.bbclass
>> is already providing , and keep this recipe as clean as possible.
>> Please, confirm that you want me to go ahead with this extra settings/customisations.

ok, understood. I would much prefer that the cml1.bbclass had not used those
variable names but since they are established, that's what you should work with
rather than adding further complexity here.

Thanks for being clear with your explanations; and best of luck with
the upstreaming.

Christopher

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-13 22:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12 16:53 [meta-virtualization][PATCH] xen: Fix menuconfig and add support for config fragments and diffconfig Diego Sueiro
2020-08-12 18:46 ` Christopher Clark
2020-08-13  7:14   ` Diego Sueiro
2020-08-13 13:34     ` Bruce Ashfield
2020-08-13 22:43       ` Christopher Clark

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.