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 <diego.sueiro@arm.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Diego Sueiro 2020-08-14 10:56:33 +01:00 committed by Bruce Ashfield
parent 3fafab50cf
commit b2cd5f340e
5 changed files with 73 additions and 30 deletions

View File

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

View File

@ -0,0 +1,49 @@
Upstream-Status: Xen: Inappropriate [oe specific, cross compile issue]
Upstream-Status: Kernel: 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>
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)\"

View File

@ -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
# Pass the native library path for kconfig build when running the do_menuconfig
# task
CROSS_CURSES_LIB += "-L${STAGING_LIBDIR_NATIVE}"
try:
mtime = os.path.getmtime("xen/.config")
shutil.copy("xen/.config", "xen/.config.orig")
except OSError:
mtime = 0
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"

View File

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

View File

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