7373BUILD_DIR=build/${variant}
7474VARIANT_DIR=variants/${variant}
7575rm -rf ${BUILD_DIR}
76- west build -d ${BUILD_DIR} -b ${target} loader -t llext-edk ${args}
7776
78- # Extract the generated EDK tarball and copy it to the variant directory
79- mkdir -p ${VARIANT_DIR} firmwares
80- (set -e ; cd ${BUILD_DIR} && rm -rf llext-edk && tar xf zephyr/llext-edk.tar.Z)
81- rsync -a --delete ${BUILD_DIR} /llext-edk ${VARIANT_DIR} /
77+ LLEXT_EDK_ENABLED=0
78+ grep " CONFIG_LLEXT_EDK=n" loader/prj.conf || LLEXT_EDK_ENABLED=1
79+
80+ if [ " ${LLEXT_EDK_ENABLED} " -eq " 1" ]; then
81+ args=" -t llext-edk ${args} "
82+ fi
8283
83- # remove all inline comments in macro definitions
84- # (especially from devicetree_generated.h and sys/util_internal.h)
85- line_preproc_ok=' ^\s*#\s*(if|else|elif|endif)' # match conditional preproc lines
86- line_comment_only=' ^\s*\/\*' # match lines starting with comment
87- line_continuation=' \\$' # match lines ending with '\'
88- c_comment=' \s*\/\*.*?\*\/' # match C-style comments and any preceding space
89- perl -i -pe " s/${c_comment} //gs unless /${line_preproc_ok} / || (/${line_comment_only} / && !/${line_continuation} /)" $( find ${VARIANT_DIR} /llext-edk/include/ -type f)
84+ west build -d ${BUILD_DIR} -b ${target} loader ${args}
85+
86+ mkdir -p ${VARIANT_DIR} firmwares
87+ if [ " ${LLEXT_EDK_ENABLED} " -eq " 1" ]; then
88+ # Extract the generated EDK tarball and copy it to the variant directory
89+ (set -e ; cd ${BUILD_DIR} && rm -rf llext-edk && tar xf zephyr/llext-edk.tar.Z)
90+ rsync -a --delete ${BUILD_DIR} /llext-edk ${VARIANT_DIR} /
91+
92+ # remove all inline comments in macro definitions
93+ # (especially from devicetree_generated.h and sys/util_internal.h)
94+ line_preproc_ok=' ^\s*#\s*(if|else|elif|endif)' # match conditional preproc lines
95+ line_comment_only=' ^\s*\/\*' # match lines starting with comment
96+ line_continuation=' \\$' # match lines ending with '\'
97+ c_comment=' \s*\/\*.*?\*\/' # match C-style comments and any preceding space
98+ perl -i -pe " s/${c_comment} //gs unless /${line_preproc_ok} / || (/${line_comment_only} / && !/${line_continuation} /)" $( find ${VARIANT_DIR} /llext-edk/include/ -type f)
99+ fi
90100
91101for ext in elf bin hex; do
92102 rm -f firmwares/zephyr-$variant .$ext
@@ -99,7 +109,11 @@ cp ${BUILD_DIR}/zephyr/.config firmwares/zephyr-$variant.config
99109
100110# Generate the provides.ld file for linked builds
101111echo " Generating exported symbol scripts"
102- extra/gen_provides.py " ${BUILD_DIR} /zephyr/zephyr.elf" -L > ${VARIANT_DIR} /syms-dynamic.ld
112+
113+ if [ " ${LLEXT_EDK_ENABLED} " -eq " 1" ]; then
114+ extra/gen_provides.py " ${BUILD_DIR} /zephyr/zephyr.elf" -L > ${VARIANT_DIR} /syms-dynamic.ld
115+ fi
116+
103117extra/gen_provides.py " ${BUILD_DIR} /zephyr/zephyr.elf" -LF \
104118 " +kheap_llext_heap" \
105119 " +kheap__system_heap" \
0 commit comments