diff --git a/meta-zephyr-core/classes/zephyr.bbclass b/meta-zephyr-core/classes/zephyr.bbclass index 5b71bda..4f4c88d 100644 --- a/meta-zephyr-core/classes/zephyr.bbclass +++ b/meta-zephyr-core/classes/zephyr.bbclass @@ -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}" @@ -12,6 +12,7 @@ CROSS_CURSES_INC = '-DCURSES_LOC=""' 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 @@ -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 @@ -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 () {