Skip to content

Commit 00417b3

Browse files
andyrosskartben
authored andcommitted
soc/mediatek/adsp: Build zephyr.ri using rimage when available
This is mostly a cut/paste copy of similar code in intel_adsp and imx, which sadly can't be shared given the way the design works. Also includes a bonus, slightly-passive-aggressive description of why that is. Signed-off-by: Andy Ross <[email protected]>
1 parent 82c5f54 commit 00417b3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

soc/mediatek/mt8xxx/CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,33 @@ add_custom_target(dsp_img ALL
1212
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen_img.py
1313
${ZEPHYR_BINARY_DIR}/${KERNEL_ELF_NAME}
1414
${CMAKE_BINARY_DIR}/zephyr/zephyr.img)
15+
16+
# Sign zephyr.ri using west (if the underlying rimage tool is
17+
# available; generally it isn't except in SOF builds). Note that the
18+
# "target" string to use for rimage is set at the board level as a
19+
# RIMAGE_TARGET cached (cached so that the python script can read it!)
20+
# cmake variable (not kconfig!). See board_set_rimage_target().
21+
# Thankfully the SOC name and the rimage target names for these
22+
# platforms are identical. The west sign integration similarly needs
23+
# a RIMAGE_CONFIG_PATH cmake cached (!) variable set to a directory
24+
# containing the .toml files for the platforms, which SOF will set on
25+
# its own at build time. And likewise the signing key isn't provided
26+
# by Zephyr and needs tob e found by a SOF build by passing it in
27+
# RIMAGE_SIGN_KEY.
28+
#
29+
# The short version is that zephyr.ri can only realistically be
30+
# exercised from a SOF build and it doesn't belong here in Zephyr;
31+
# rimage is a SOF tool. Signing audio firmware is only done for SOF
32+
# firmware and not general Zephyr apps for the same hardware. This
33+
# should live in SOF where it doesn't have to be duplicated for every
34+
# device and where it won't be forced to communicate via side channels.
35+
board_set_rimage_target(${CONFIG_SOC})
36+
set(RIMAGE_SIGN_KEY "otc_private_key_3k.pem" CACHE STRING "default rimage key")
37+
add_custom_target(zephyr.ri ALL DEPENDS ${CMAKE_BINARY_DIR}/zephyr/zephyr.ri)
38+
add_custom_command(
39+
OUTPUT ${CMAKE_BINARY_DIR}/zephyr/zephyr.ri
40+
COMMENT "Sign with rimage..."
41+
COMMAND west $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose> sign
42+
--if-tool-available --tool rimage --build-dir ${CMAKE_BINARY_DIR}
43+
DEPENDS ${CMAKE_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME}
44+
)

0 commit comments

Comments
 (0)