From b2cd5f340ea220360e3fb90282c75994d9e553ca Mon Sep 17 00:00:00 2001 From: Diego Sueiro Date: Fri, 14 Aug 2020 10:56:33 +0100 Subject: xen: Fix menuconfig and add support for config fragments and diffconfig 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. Change-Id: I8d61ec76d92de7d1613b79edf55b4868fe712334 Signed-off-by: Diego Sueiro Signed-off-by: Bruce Ashfield --- recipes-extended/xen/README | 3 ++ ...g-Allow-specification-of-ncurses-location.patch | 49 ++++++++++++++++++++++ recipes-extended/xen/xen-hypervisor.inc | 49 +++++++++------------- recipes-extended/xen/xen_4.14.bb | 1 + recipes-extended/xen/xen_git.bb | 1 + 5 files changed, 73 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 34e79774..f286bb54 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. +Configuration 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 00000000..22b67c40 --- /dev/null +++ b/recipes-extended/xen/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch @@ -0,0 +1,49 @@ +Upstream-Status: Xen: Inappropriate [oe specific, cross compile issue] +Upstream-Status: Kernel: Pending +Signed-off-by: Diego Sueiro +commit e6972e689a980ab28637e94e48c77eeace6abde5 +Author: Bruce Ashfield +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 + cc: Michal Marek + cc: linux-kbuild@vger.kernel.org + Signed-off-by: Bruce Ashfield + +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 c386917d..3bfee8ee 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,18 @@ FILES_${PN}-efi = " \ do_configure() { do_configure_common + + # Handle the config fragments + cfgs="${@' '.join(find_cfgs(d))}" + if [ -n "${cfgs}" ]; 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 "${cfgs}" + fi } do_compile() { @@ -77,35 +89,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 0413bee1..91e89883 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 408bc3b3..57791fc4 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" -- cgit v1.2.3-54-g00ecf