examples: zephyr: Revive Zephyr's sample#29
Open
ceolin wants to merge 8 commits intoIntelLabs:masterfrom
Open
Conversation
added 5 commits
September 15, 2023 15:42
Lets assume that Zephyr repository and needed tools are available and properly setup. Trying to fetch and setup everything is very fragile and don't work in different environments. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Use find_package() instead of manually including deprecated boilerplate.cmake Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Zephyr headers are in zephyr/* Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
It seems that icount does not play well with kvm. Just disabling it. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Use west tool to build Zephyr and simplify the build logic. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Contributor
|
Thanks for this PR and reviving the Zephyr target @ceolin ! I tried to repro your work, but I'm unlucky so far. FROM zephyrprojectrtos/zephyr-build
ARG ZEPHYR_VER=v3.4.0
ENV ZEPHYR_BASE=/opt
ENV ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-0.16.3-rc1
USER root
# setup Zephyr
RUN west init --mr ${ZEPHYR_VER} $ZEPHYR_BASE
WORKDIR /workdir
RUN west updateAnd I ran it inside the And I tried to build the test app: $ ./run.sh build TEST
# Detected Zephyr environment:
ZEPHYR_BASE=/opt
ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-0.16.3-rc1
ZEPHYR_TOOLCHAIN_VARIANT=zephyr
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
CMake Error at /opt/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include):
include could not find requested file:
zephyr_default
Call Stack (most recent call first):
/opt/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
CMakeLists.txt:5 (find_package)
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:8 (set_property):
set_property could not find TARGET app. Perhaps it has not yet been
created.
CMake Error at CMakeLists.txt:10 (target_sources):
Cannot specify sources for target "app" which is not built by this project.
CMake Error at CMakeLists.txt:13 (target_sources_ifdef):
Unknown CMake command "target_sources_ifdef".
-- Configuring incomplete, errors occurred!
See also "/workdir/build/CMakeFiles/CMakeOutput.log".
FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/workdir/build -GNinja -DBOARD=qemu_x86 -DKAFL_TEST=y -S/workdirBut I'm getting cmake errors. Anything I'm doing wrong ? Poke @il-steffen, if you know better how to setup Zephyr for these examples ! Thanks |
Contributor
|
I added a couple of fixes plus the Dockerfile image to compile the targets inside Docker, and avoid installing Zephyr locally. cd zephyr_x86_64
docker build -t kafl_zephyr .
docker run -ti --rm -v $PWD:/workdir -v $PWD/../nyx_api.h:/usr/local/include/nyx_api.h kafl_zephyr
./run.sh build TEST
# CTRL-D (exit container)
./run.sh fuzz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small fixes to use upstream Zephyr. The major change is removing instructions to fetch Zephyr and its tools since it is barely reproducible. Lets just assume that the host is capable of building a Zephyr application.