Platforms where ARM Trusted Firmware is the first stage bootloader are
converging to use FIP as bundle format for further firmware including
trusted OS and non secure bootloader. Teach genimage to call fiptool to
generate FIP images.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
When none of the images need files from the rootpath, then make it
optional. Some types never need it. For others the image must be explicitly
marked as empty.
Fixes: #181
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
libconfuse has a cfg_print() function for sort-of pretty-printing a
cfg_t* object. Let's expose that via a --configdump option, to make
debugging of complicated setups with several layers of include() a
little easier.
If I can get it to work, I will also be using the output dump directly
on target, i.e. merely using the host genimage as a preprocessor - so
that I can still reuse include() fragments in my image definition, but
I don't have to copy all those files to target when bootstrapping the
eMMC.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
When ${B} was made distinct from ${S} and ${WORKDIR} in
genimage.bbclass in meta-ptx commit 9eaa29b7, use of include() in the
main configuration file to include other fragments from SRC_URI broke.
It can be worked around in a recipe by copying all the fragments to
${B} in a do_genimage[prefunc], but that's awkward. It's more natural
for genimage to take a --includepath option and genimage.bbclass to
pass --includepath ${S}.
This does require libconfuse >= 2.8, while meta-ptx currently has a
recipe for 2.7 (the last release downloadable from savannah, but the
project has moved to github).
confuse.h says:
* Note that the current directory is not added to the searchpath
* by default.
That's probably not expected, so when this option is used, always add
"." as well.
In order for this to be meaningful in a config{} section inside the
configuration file, one would have to get libconfuse to call a custom
function when encountering this; it cannot just be a simple
CFG_STR. Because if it doesn't take effect immediately, parsing the
rest of the config file will most likely fail when it hits the
include()s. But the whole option parsing machinery is basically built
around the assumption that options take single string arguments (which
is also why this had to accept a colon-separated list instead of
supporting --includepath being given multiple times). I don't think
it's a huge loss, C files also don't have the proper values of -I
embedded into them. But it does require relaxing the wording in
README.rst a bit.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
In order to make the .hidden member actually visible to show_help(),
init_config() would have to pass on yet another argument to
add_opt(). At that point, one would surely change add_opt() to take
the source 'struct config' by reference.
But taking a closer look, there's actually no reason at all to memdup
each struct option; we might as well just weave the elements of opts[]
array itself into the linked list. And for that we don't need a helper
function at all.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Since --includepath will be conditionally supported, add a flag to
struct config so we can suppress it from --help if genimage was built
against an old libconfuse. We will still accept the option and then
display an error message better than "invalid option --includepath",
but there's no reason to advertise it in --help.
This also makes writing a test case a little easier - or rather, the
condition for when to skip the test.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
If the config file does not include a 'config' section, the parsing
produces a warning: "no sub-section title/index for 'config'".
Silence this by checking if the section exists before accessing it.
Fixes#144
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This fixes the following warnings when compiling with CC=cgcc:
config.c:197:46: warning: Using plain integer as NULL pointer
image-ext2.c:208:9: warning: Using plain integer as NULL pointer
image-ext2.c:212:9: warning: Using plain integer as NULL pointer
image-ext2.c:213:9: warning: Using plain integer as NULL pointer
image-hd.c:663:11: warning: symbol 'hdimage_opts' was not declared. Should it be static?
image-iso.c:52:9: warning: Using plain integer as NULL pointer
image-rauc.c:191:9: warning: Using plain integer as NULL pointer
image-vfat.c:130:9: warning: Using plain integer as NULL pointer
this option will print an easily parse-able
`genimage` version defined as PACKAGE_VERSION`
in the `config.h` file.
Signed-off-by: Leo Soares <leojrfs@gmail.com>
This adds support for U-Boot FIT images to the genimage tool.
FIT images are effectively device tree blobs (dtbs) which have
the actual image data as binary properties in the device tree.
FIT image support works by invoking the U-Boot mkimage tool
with a device tree source file (its) as input. The its file
must be handwritten, but the image data is included automatically
by genimage which generates suitable /incbin/ directives on the
fly.
Images in the its file are in a /images/<imagename> node. The
FIT image is seen as a partitioned device, for each /images/<imagename>
there must be a partition named <imagename> in the genimage config
file section for a FIT image.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
[mol: add test files to Makefile.am, handle readonly .its file]
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Relative pathes can be error prone when it's not clear to
which path the pathes are relative to. For FIT image support
we have to create pathes that are not relative to the current
directory, but to the path where the current its input file is.
This patch lets imagepath(), inputpath(), rootpath() and tmppath()
return absolute filenames rather than directly the (absolute or
relative) input pathes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The documentation claims "rootpath" defaults to "root, "inputpath"
defaults to "input", "tmppath" to "tmp" and "outputpath" defaults to
"output". In reality there are no defaults at all and instead only
(null) is used for all of them. Actually add the defaults mentioned
in the documentation.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
If this option is given, then the filesystem creation, last fsck,
and modification timestamps are set to the given value. This makes the
filesystem more reproducible.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
otherwise the command line options are droped when set_config_opts
is called the second time.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>