Compile-time assertions can be helpful to ensure the compiler actually
lays out sturcts as one expects, and for a lot of other things as
well.
<assert.h> exposes a static_assert() macro that maps to _Static_assert
if one compiles with -std=c11 or later, but I don't think we can
mandate that. Also, that standard macro suffers from the defect of
requiring a separate string message - it's usually completely obvious
from the stringification of the expression what it is that is being
asserted. So just define our own ct_assert().
[Side note: We seem to be relying implicitly on gcc defaulting to some
gnuXX mode - building with -std=c99 or -std=c89 breaks with complaints
about the use of typeof().]
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Arbitrary blobs of data should be passed around via a void pointer (as
evidenced by the need for casts in the majority of callers). If one
doesn't want to rely the compiler extension allowing arithmetic on
void pointers, there's a single conversion to do inside the
implementation.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
When using something like
image @IMAGE@ {
....
partition sysdata {
image = "sysdata"
in-partition-table = true
partition-type-uuid = "L"
}
}
image sysdata {
size = 200M
ext4 {}
empty = true
}
to create a partition containing an empty file system, it's
undesirable to leave such an empty file system image in the output
directory (especially when building with Yocto, where it then gets
copied to the shared deploy directory).
So allow specifying an image as temporary, putting it in in tmppath()
rather than imagepath().
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
This is useful when creating multiple images with on config and some of
them should be empty. Also, vfat filesystems cannot be empty right now, so
this makes it possible.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
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>
We have image_error, image_log, error and logmsg which all do the
actual printing themselves. Create a set of error(), info() and
debug() functions which all do the actual printing in the same
function. Also add the same set of functions with a image_ prefix
to do image specific logging. All messages now get a [type] prefix
to make it easier to distinguish them from the stdout/stderr from
invoked commands (see next patch).
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
[mol: don't change the loglevel numbers]
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Bare images (kernel, U-Boot, its environment) need to reside inside
static UBI volumes. Add read-only partition flag and use it for that
purpose. Also make partition's "image" voluntary as ubinize will yell
anyway. Once this behavior gets modified eventually, it will bring us
possibility to create empty volumes ready for runtime update.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Since imageoutfile does not modify the image, make it const.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
util.c: In function ‘insert_data’:
util.c:269:8: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
useful for bootloaders that need more than just putting an image
at the right position.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>