Skip to content

Commit a675edf

Browse files
Andrey Borisovichkv2019i
authored andcommitted
LMDK: fixed rimage and key paths and discovery
Path to rimage and private key had been failing to be used while provided in form of relative path using dots. Changed how rimage is discovered in the scripts: * rimage is searched for using find_program with paths and hints provided * changed RIMAGE_COMMAND to RIMAGE_INSTALL_DIR so end-user may specify directory where rimage executable is placed. It will be used by find_program. * If RIMAGE_INSTALL_DIR is not provided, find_program will try to search for rimage in the directory where SOF project installs it (west_dir/build-rimage). * Updated README.md with instructions on how to build: - simplified configure and build commands - updated explanations on how to use RIMAGE_INSTALL_DIR - added information on how to use toolchain file * private key path was parsed incorrectly when provided windows path style using backslashes. It was passed to rimage as is resulting in the invalid path as the last slash was made by rimage as forward slash. Added path normalization what fixed the problem. Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
1 parent 0fec81b commit a675edf

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

lmdk/README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
To build dummy loadable library execute:
66

77
cd libraries/dummy
8-
mkdir build
9-
cd build
10-
11-
cmake -DRIMAGE_COMMAND="/path/to/rimage" -DSIGNING_KEY="/path/to/signing/key.pem" ..
12-
cmake --build .
13-
14-
Here RIMAGE_COMMAND is path to rimage executable binary, SIGNING_KEY is path to
15-
signing key for rimage.
8+
cmake -B build -G <Ninja/Makefile> -DRIMAGE_INSTALL_DIR="path/where/rimage/executable/is" -DSNIGNING_KEY="path/to/key"
9+
cd --build build
10+
11+
12+
Here RIMAGE_INSTALL_DIR is a path to directory where rimage executable is, SIGNING_KEY is a path to
13+
signing key for rimage. If RIMAGE_INSTALL_DIR is not provided, rimage will be searched for in the directory
14+
where SOF project installs it. Dummy module sets up toolchain file in the project file.
15+
However, in your library you can select toolchain file in the configure step command:
16+
17+
cmake -B build -G <Ninja/Makefile> --toolchain "../../cmake/xtensa-toolchain.cmake" -DSNIGNING_KEY="path/to/key"

lmdk/cmake/build.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ endforeach()
4646
set(RIMAGE_OUTPUT_FILE ${PROJECT_NAME}_noextmft)
4747
set(OUTPUT_FILE ${PROJECT_NAME}.bin)
4848

49+
if(RIMAGE_INSTALL_DIR)
50+
cmake_path(ABSOLUTE_PATH RIMAGE_INSTALL_DIR BASE_DIRECTORY ${CMAKE_SOURCE_DIR} NORMALIZE)
51+
endif()
52+
53+
# Create a hint - rimage may be installed to directory where SOF project installs it
54+
cmake_path(APPEND SOF_BASE "../build-rimage" OUTPUT_VARIABLE RIMAGE_SOF_INSTALL_DIR)
55+
cmake_path(NORMAL_PATH RIMAGE_SOF_INSTALL_DIR)
56+
cmake_path(ABSOLUTE_PATH SIGNING_KEY BASE_DIRECTORY ${CMAKE_SOURCE_DIR} NORMALIZE)
57+
58+
find_program(RIMAGE_COMMAND NAMES rimage
59+
PATHS "${RIMAGE_INSTALL_DIR}"
60+
HINTS "${RIMAGE_SOF_INSTALL_DIR}"
61+
REQUIRED)
62+
4963
add_custom_target(${PROJECT_NAME}_target ALL
5064
DEPENDS ${MODULES_LIST}
5165
COMMAND ${RIMAGE_COMMAND} -k ${SIGNING_KEY} -f 2.0.0 -b 1 -o ${RIMAGE_OUTPUT_FILE} -c ${TOML} -e ${MODULES_LIST}

lmdk/cmake/config.cmake

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11

2-
if(NOT DEFINED RIMAGE_COMMAND)
3-
message(FATAL_ERROR
4-
" Please define RIMAGE_COMMAND: path to rimage executable.\n"
5-
" E.g. using cmake -DRIMAGE_COMMAND=/path/rimage command line parameter."
6-
)
7-
endif()
8-
92
if(NOT DEFINED SIGNING_KEY)
103
message(FATAL_ERROR
114
" Please define SIGNING_KEY: path to signing key for rimage.\n"

0 commit comments

Comments
 (0)