Commit Graph

124 Commits

Author SHA1 Message Date
Adrian Bonislawski f23b2c2d07 rimage: use lma if available
some sections may use different lma than vma address,
in such case rimage needs to use lma

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-05-12 09:10:54 +01:00
Adrian Bonislawski 932478abd6 rimage: show LMA and VMA in section view
Sometimes they will be different and this will make developer
aware of the differences

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-05-12 09:10:54 +01:00
Karol Trzcinski ece04f9656 manifest: ads: meu: Fill FW version description also when MEU is used
This part of binary should contain valid firmware version.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-05-07 11:45:18 +01:00
Karol Trzcinski 537255bdd0 ext_man: Remove redundant variable assign
ret variable is always set in elf_read_section(), to initial value
is not important.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-05-07 11:45:18 +01:00
Karol Trzcinski 76b6301e57 ext_man: Make extended manifest build optional
Try to build extended manifest only when `e` flag will be set,
to prevent error and warning printing during creating optional
part of formware image.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-04-24 11:08:36 +01:00
Karol Trzcinski 328867431c ext_man: Fix write flow when ext_man should be build
elf_read_section() returns section size when everything is ok,
so ret value should be reset to 0 after this function call

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-04-24 11:08:36 +01:00
Karol Trzcinski 0fa22ac38c ext_man: elf: Split module and section searching
Such a solution improve code hermentization and flexibility.
Also such a solution is more relevant because of focus on particular
module during section reading, so there won't be possibility to
implicity scan section 'A' from first module and section 'B' from
second one.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-04-24 11:08:36 +01:00
Karol Trzcinski 6b34a04527 ext_man: Move data section name to global define
This name is used in different part of source code so should refer
to single place instead by copied.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-04-24 11:08:36 +01:00
Karol Trzcinski f0c6ee0f3a ext_man: Create extended manifest
Extended manifest is a place to store metadata about firmware, known during
compilation time - for example firmware version or used compiler.
Given information are read on host side before firmware startup.
This part of output binary is not signed.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-04-21 09:09:18 +01:00
Karol Trzcinski f79d8d7f1e elf: Add function to read section content with allocation
In many functions there is need to read user section content
and check firmware version or write section content to some
manifest or dictionary. Previously to do it, in each function
was loop to search for proper section in proper module,
then allocate buffer, read content and check for possible error
between each step what is quite overwhelming. After change there
will be one function responsible for this task.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-04-21 09:09:18 +01:00
Pan Xiuli aecc0b51d0 CI: Travis: init build test for rimage
Enable simple build test for rimage.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-04-17 10:47:44 +01:00
Andrei Emeltchenko ca65a442bb Handle missing .init_array section
Fixes issue ".init_array" is not copied to ri image making it zero
filled. This causes Zephyr crashing trying to execute functions from
this section.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-04-16 09:12:47 +01:00
Andrei Emeltchenko cc5eabb349 Fix compiler errors
Fixes following error when compiling code:
...
src/elf.c: In function ‘elf_find_section’:
src/elf.c:469:20: error: initialization discards ‘const’ qualifier
           from pointer target type [-Werror=discarded-qualifiers]
  469 |  Elf32_Ehdr *hdr = &module->hdr;
      |                    ^
cc1: all warnings being treated as errors
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-04-15 15:46:38 +01:00
Daniel Leung 6c4c873b9d Match LICENSE from the main SOF repo
This changes the LICENSE file to match the LICENSE file
from the main SOF repo, except they entries for the kconfig
scripts which are not here in this repo.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2020-04-15 15:44:51 +01:00
Karol Trzcinski e433e87865 rimage: Remove unused 'image' argument in elf_find_section()
Unused arguments shouldn't be passed to function because it
makes code messy.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-04-07 16:14:48 +01:00
Karol Trzcinski c4701c7664 rimage: Align function arguments in rimage.h
Code formatting should be consistent and function arguments
should be aligned to opening parenthesis.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-04-07 16:14:48 +01:00
Daniel Leung ea04cb816e Remove cmake option SOF_SOURCE_DIR
Since both fw.h and manifest.h are being used in the main SOF
repo and also here in the standalone rimage repo, to prevent
them getting out of sync, the SOF main repo is going to use
the ones coming from the rimage repo. So there is no need for
the option anymore.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2020-04-05 20:02:13 +01:00
Daniel Leung e09354a5b5 Update rimage to remove ldc generation ability
This reflects the changes on SOF project commit
b3c16790cd.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2020-04-05 20:02:13 +01:00
Daniel Leung a264697961 Use CMake to build rimage
This adds the necessary bits to allow building rimage
with CMake with similar configure options as the just
removed autotools files.

Also update README.md for new build instructions.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2020-03-26 09:41:34 +00:00
Daniel Leung 58acbefc8e Remove autotools files
CMake is to be used instead of autotools. So remove the autotools
files.

This revert commit f6bf4b0d72 and
commit 0d33e87433

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2020-03-26 09:41:34 +00:00
Daniel Leung 0adacd5ac2 Update source files from main SOF repo
Update source files from main SOF repository
@ commit 4e87899f25.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2020-03-26 09:41:34 +00:00
Liam Girdwood 502b5817e3
Merge pull request #2 from dbaluta/db
rimage: Add support for i.MX8X
2020-01-14 13:41:10 +00:00
Daniel Baluta 713e0f8513 rimage: Add support for i.MX8X
i.MX8X is very similar with i.MX8. Memory layout is the same
except IRQSTEER address.

Code will be shared but there will be different firmware binaries
named:
	* sof-imx8.ri, for i.MX8
	* sof-imx8x.ri, for i.MX8X

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-01-13 20:27:23 +02:00
Liam Girdwood f4e515bcd7
Merge pull request #1 from dcpleung/standalone_rimage
Initial commit of rimage tool
2019-11-18 15:39:30 +00:00
Daniel Leung f2e92812af Add building instructions to README.md
This adds intructions to build the rimage tool.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2019-11-12 09:50:17 -08:00
Daniel Leung f6bf4b0d72 Add files created after running autoreconf
This adds the files created after running `autoreconf -i`.
This allows the project to be 'configure'-d and built.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2019-11-12 09:50:17 -08:00
Daniel Leung 0d33e87433 Enable autotools to build rimage
This adds the necessary configuration files to enable
autotools for configure/make files generation.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2019-11-12 09:50:17 -08:00
Daniel Leung 41cba2f663 Take firmware version and build ID as command line arguments
Since rimage is no longer built with the SOF code, the firmware
version (SOF_MAJOR and SOF_MINOR) and build ID (SOF_BUILD) are
no longer defined during build. So these needs to be passed as
command line arguments.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2019-11-12 09:50:17 -08:00
Daniel Leung 606b4f0442 Add .gitignore
Signed-off-by: Daniel Leung <danielcp@gmail.com>
2019-11-12 09:50:13 -08:00
Daniel Leung 5bf839e995 Make log dictionary output optional
Signed-off-by: Daniel Leung <danielcp@gmail.com>
2019-11-12 09:34:36 -08:00
Daniel Leung d821534fed Remove PEM_KEY_PREFIX and always requires key as cmd argument
This removes the macro PEM_KEY_PREFIX and make rimage to always
require key to be specified in command line.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2019-11-12 09:34:31 -08:00
Daniel Leung e94452934f Do not include version.h
The #define in version.h will be passed as command line
argument instead, as the tool has to build on its own.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2019-11-12 09:33:13 -08:00
Daniel Leung 0b34af27fa Add a minimal set of necessary SOF headers
These headers are required for building rimage outside of
the SOF source tree as a standalone tool.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2019-11-12 09:31:42 -08:00
Daniel Leung 27a9e91834 Rename rimage to src and move headers into src/include/rimage
This renames the rimage directory to "src". This also moves
the header files into src/include/rimage. This is in
preparation to allow rimage to be built outside of SOF tree,
and it requires some SOF header files. Moving headers under
src/include/rimage makes it obvious that these headers are
for rimage.

Signed-off-by: Daniel Leung <danielcp@gmail.com>
2019-11-12 09:27:14 -08:00
Pan Xiuli f3be41dc40 rimage: add support for jsl
JSL should have almost same config as ICL, but they should
have different fw name.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-11-12 09:25:12 -08:00
Janusz Jankowski dd77445f01 rimage: update tgl
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:24:55 -08:00
Janusz Jankowski 2fd99129c3 rimage: manifest v2.5 for MEU
Add function writing manifest v2.5 for MEU.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:24:51 -08:00
Janusz Jankowski 3bf866a961 rimage: image manifest v2.5
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:24:48 -08:00
Janusz Jankowski d33ced649f rimage: add SHA384 hashing
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:24:46 -08:00
Janusz Jankowski 1fabda97be rimage: rename module_sha functions
These functions are generic and can be used for other SHA algorithms.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:24:44 -08:00
Janusz Jankowski 3084369064 rimage: rename ri_hash
We are going to have more hashing function,
so they should be named after hashing algorithms.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:24:41 -08:00
Janusz Jankowski b0d68a6bc6 manifest: add v2.5 definitions
New version of manifest introduced with TGL platform
uses SHA384 for component hash.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:24:32 -08:00
Janusz Jankowski 009cd503aa rimage: tgl machine definition
Add support for tgl platform in rimage tool.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:24:15 -08:00
Janusz Jankowski 43e08a0426 rimage: xcc module offset option
This argument is needed in case of platforms that have different
modules padding in xcc binaries.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:24:12 -08:00
Adrian Bonislawski dad03fc17a rimage: change error to warning if section not found
Thats because this function is used also to find optional sections so it will be decided later (outside of this func) if this is actually error

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-11-12 09:24:11 -08:00
Adrian Bonislawski 55d7954898 rimage: make .static_log_entries optional section
Thats because this section is optional in FW, it will be created only with TRACE enabled

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-11-12 09:24:08 -08:00
Janusz Jankowski ccce0999ba rimage: ignore sections not used by bootloader
In case of multiple modules, rimage should not expect these sections
in bootloader module: .bss, .static_log_entries .fw_ready.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:23:56 -08:00
Janusz Jankowski 865f31152a rimage: fix possible strcpy and sprintf overflows
It's for preventing possible buffer overflow.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:23:52 -08:00
Janusz Jankowski b737019a6f cmake: add spdx license identifier
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:18:03 -08:00
Janusz Jankowski a44fb2c3d8 rimage: change license to bsd
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-12 09:18:03 -08:00