Skip to content

Commit

Permalink
zephyr-core/zephyr.bbclass: Fix do_menuconfig
Browse files Browse the repository at this point in the history
Update do_menuconfig to run ninja menuconfig as the default
CMake generator is ninja.

Also fix directory path for .config.

[YOCTO #15040]

Signed-off-by: Tan Wen Yan <wen.yan.tan@intel.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
  • Loading branch information
wenyanta authored and saininav committed May 31, 2023
1 parent 87738cb commit 0ef6033
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions meta-zephyr-core/classes/zephyr.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ inherit terminal
inherit python3native

PYTHONPATH="${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR}/site-packages"
DEPENDS += "python3-pyelftools-native python3-pyyaml-native python3-pykwalify-native"
DEPENDS += "python3-pyelftools-native python3-pyyaml-native python3-pykwalify-native ninja-native"

OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO CROSS_CURSES_LIB CROSS_CURSES_INC"
HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
Expand All @@ -12,6 +12,7 @@ CROSS_CURSES_INC = '-DCURSES_LOC="<curses.h>"'
TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"

KCONFIG_CONFIG_COMMAND ??= "menuconfig"
KCONFIG_CONFIG_ROOTDIR ??= "${B}"
ZEPHYR_BOARD ?= "${MACHINE}"

# qemuboot writes into IMGDEPLOYDIR, force to write to DEPLOY_DIR_IMAGE
Expand All @@ -28,20 +29,24 @@ python () {
EXTRA_OECMAKE:append = " -DZEPHYR_MODULES=${ZEPHYR_MODULES}"

python do_menuconfig() {
os.chdir(d.getVar('ZEPHYR_SRC_DIR', True))
configdir = d.getVar('ZEPHYR_SRC_DIR', True) + '/outdir/' + d.getVar('BOARD', True)
import shutil

config = d.getVar('KCONFIG_CONFIG_ROOTDIR', True) + '/zephyr/' + '.config'
configorig = d.getVar('KCONFIG_CONFIG_ROOTDIR', True) + '/zephyr/' + '.config.orig'

try:
mtime = os.path.getmtime(configdir +"/.config")
mtime = os.path.getmtime(config)
shutil.copy(config, configorig)
except OSError:
mtime = 0

oe_terminal("${SHELL} -c \"ZEPHYR_BASE=%s make BOARD=%s %s; if [ \$? -ne 0 ]; then echo 'Command failed.'; \
oe_terminal("sh -c \"ninja %s; if [ \\$? -ne 0 ]; then echo 'Command failed.'; \
printf 'Press any key to continue... '; \
read r; fi\"" % (d.getVar('ZEPHYR_BASE', True), d.getVar('BOARD', True),d.getVar('KCONFIG_CONFIG_COMMAND', True)),
d.getVar('PN', True) + ' Configuration', d)
read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'), \
d.getVar('PN') + ' Configuration', d)

try:
newmtime = os.path.getmtime(configdir +"/.config")
newmtime = os.path.getmtime(config)
except OSError:
newmtime = 0

Expand All @@ -51,7 +56,7 @@ python do_menuconfig() {
}
do_menuconfig[depends] += "ncurses-native:do_populate_sysroot"
do_menuconfig[nostamp] = "1"
do_menuconfig[dirs] = "${B}"
do_menuconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
addtask menuconfig after do_configure

python do_devshell:prepend () {
Expand Down

0 comments on commit 0ef6033

Please sign in to comment.