Skip to contentSkip to conversation

xen: Add menuconfig task and enable menuconfig from devshell

PATCH In review [email protected] 2 participants 2 messages Sep 14, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: Add menuconfig task and enable menuconfig from devshell

From: Christopher Clark <[email protected]>

Xen supports Kconfig for configuring optional build settings. This commit adds the menuconfig task to simplify interactive use:

bitbake xen -c menuconfig

and also ensures that menuconfig works when using the devshell. This change adds ncurses-native as a build dependency.

---

Please use my gmail address for any correspondence.

 recipes-extended/xen/xen.inc | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
recipes-extended/xen/xen.inc +35 -0
index ab69987..3ca38fb 100644
@@ -30,6 +30,7 @@ DEPENDS = " \
     flex-native \
     file-native \
     iasl-native \
+    ncurses-native \
     util-linux-native \
     xz-native \
     bridge-utils \
@@ -1006,3 +1007,37 @@ do_deploy() {
 }
 
 addtask deploy after do_populate_sysroot
+
+# 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
+
+    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
Signature · 1 line
2.7.4
#1 lore raw

merged.

Bruce

Quoted 75 lines · On Wed, Sep 13, 2017 at 9:16 PM, <[email protected]> wrote:

From: Christopher Clark <[email protected]>

Xen supports Kconfig for configuring optional build settings. This commit adds the menuconfig task to simplify interactive use:

bitbake xen -c menuconfig

and also ensures that menuconfig works when using the devshell. This change adds ncurses-native as a build dependency.

---

Please use my gmail address for any correspondence.

 recipes-extended/xen/xen.inc | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
recipes-extended/xen/xen.inc +3 -0
index ab69987..3ca38fb 100644
@@ -30,6 +30,7 @@ DEPENDS = " \
     flex-native \
     file-native \
     iasl-native \
+    ncurses-native \
     util-linux-native \
     xz-native \
     bridge-utils \
@@ -1006,3 +1007,37 @@ do_deploy() {
 }
 
 addtask deploy after do_populate_sysroot
+
+# Enable use of menuconfig directly from bitbake and also within the

devshell

recipes-extended/xen/xen.inc +17 -0
+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
+
+    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'),

recipes-extended/xen/xen.inc +15 -1
+        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
--

2.7.4

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"