Commit Graph

41 Commits

Author SHA1 Message Date
Ahmad Fatoum
1e224789ba Add Firmware Image Package (FIP) support
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>
2022-04-22 09:51:45 +02:00
Michael Olbrich
cfd0426a62 make rootpath optional
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>
2022-03-25 16:43:36 +01:00
Tomas Mudrunka
1c5457cacd Initial F2FS support
Signed-off-by: Tomas Mudrunka <tomas@mudrunka.cz>
2022-03-25 15:53:00 +01:00
Rasmus Villemoes
b5edc44d87 add --configdump option
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>
2022-01-07 10:41:53 +01:00
Rasmus Villemoes
0778817e7c add --includepath option
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>
2021-06-04 22:10:42 +02:00
Rasmus Villemoes
e2108573ff config.c: remove redundant helper add_opt()
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>
2021-06-04 22:10:42 +02:00
Rasmus Villemoes
18b3cfd857 config.c: allow hiding specific command line options from --help
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>
2021-06-04 22:10:42 +02:00
Rasmus Villemoes
65548f6788 config.c: remove unused member cmdlineopt
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2021-06-04 22:10:42 +02:00
Michael Olbrich
086380a882 config: don't try to access non-existent section
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>
2021-04-10 12:09:19 +02:00
Uwe Kleine-König
a4b4418808 Make sparse clean
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
2020-10-07 10:09:22 +02:00
Leo Soares
6282816b1c introduce -v/--version option
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>
2020-06-15 15:00:11 +01:00
Michael Olbrich
e2f88d5af0 config: allow parsing percentages
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2019-05-06 08:59:08 +02:00
Michael Olbrich
48378f7d94 config: don't hide global variable
Found by LGTM.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2019-03-01 12:54:04 +01:00
Michael Olbrich
614e8023da image-ext: make it possible to create the image with mke2fs
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2018-03-28 23:30:11 +02:00
Alexandre Fournier
9e1e7c5860 add qemu handler 2018-03-19 21:55:28 +01:00
Sascha Hauer
ec65ecc5b4 Add FIT image support
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>
2018-03-19 15:53:26 +01:00
Sascha Hauer
ab152c7894 genimage: Use absolute pathes
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>
2018-03-19 15:53:26 +01:00
Sascha Hauer
361e860e19 config: Change reality to match documentation
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>
2018-03-19 14:09:22 +01:00
Michael Olbrich
a51b0c57d9 image-ext: add option to set initial timestamps
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>
2017-11-19 10:34:38 +01:00
Michael Olbrich
43c0b84f2e config: add some basic help output
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2017-11-18 10:37:02 +01:00
Gaël PORTAY
04c417a7b6 fix double `;'
Small nitpick.

Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>
2017-11-16 22:25:10 -05:00
Julien Viard de Galbert
5984e56a7f cramfs: add handler to create cramfs filesystem images
Signed-off-by: Julien Viard de Galbert <julien.viarddegalbert@openwide.fr>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2016-09-13 14:51:29 +02:00
Michael Olbrich
6de3e5aaa5 add image type to create rauc bundles
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2016-08-15 12:35:48 +02:00
Michael Olbrich
728ff9a4aa config: avoid unnecessary allocation
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2016-01-12 17:47:16 +01:00
Michael Olbrich
8028a9b1f8 add license file and remove old FSF address from the source files
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2016-01-12 17:47:16 +01:00
Michael Olbrich
5fcde004f6 config: define 'mmd' tool
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2014-08-12 11:56:56 +02:00
Michael Olbrich
a0d4704f69 cleanup logging
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2014-08-12 11:41:46 +02:00
Juergen Beisert
3171e7020d squashfs: add handler to create squashfs filesystem images
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2014-03-10 15:56:58 +01:00
Michael Olbrich
84c732a648 add ISO image support
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2012-11-25 13:31:09 +01:00
Michael Olbrich
d86a19dbfa sort and document tools
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2012-09-30 15:18:07 +02:00
Michael Olbrich
a23519e5bf add cpio image support
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2012-09-21 10:22:48 +02:00
Michael Olbrich
067aafb7b3 add vfat handler
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2012-06-30 13:06:29 +02:00
Michael Olbrich
c850c8b404 build with autotools
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2012-06-12 10:02:44 +02:00
Michael Olbrich
ceaafa9eb7 image-ext2: add support for ext3/ext4
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-12 09:14:40 +02:00
Michael Olbrich
315c86e4b5 private functions should be static
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-11 08:56:10 +02:00
Michael Olbrich
a4da954a12 config: reset optint so we can parse argc/argv multiple times
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>
2011-07-01 09:59:17 +02:00
Michael Olbrich
0f7ec5b9da compare with unsigned so use unsigned
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-06-29 22:20:55 +02:00
Sascha Hauer
39cad33889 add gpl headers
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-06-27 10:52:05 +02:00
Sascha Hauer
9a9875f33b move cfg_getint_suffix to config.c
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-06-27 09:47:48 +02:00
Sascha Hauer
432dbea2e2 add commandline parsing, add some function documentation
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-06-27 09:38:33 +02:00
Sascha Hauer
7e5122f621 initial import
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-06-27 08:39:51 +02:00