This makes the output of file2hex.py deterministic by default while also
letting the user set the mtime in the gzip header manually if desired.
Use the option without any argument to restore the previous behavior
that sets the current (and obviously changing) "now" timestamp.
To test: ./sanitycheck --tag gen_inc_file
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Zero functional change, this is pure refactoring and preparation for
using the mtime= parameter which the gzip.compress() shortcut does not
make available.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is useful if there is a need to generate a file
that can be included into the application at build time.
The file can also be compressed automatically when embedding it.
Files to be generated are listed in
generate_inc_file
generate_inc_gz_file
variables.
How to use this commit in your application:
1. Add this to your application Makefile
SRC = $(ZEPHYR_BASE)/<your-app-dir>/src
include $(ZEPHYR_BASE)/scripts/Makefile.gen
2. Add needed binary/other embedded files into src/Makefile
to "generate_inc_file" or "generate_inc_gz_file" variables:
# List of files that are used to generate a file that can be
# included into .c file.
generate_inc_file += \
echo-apps-cert.der \
echo-apps-key.der \
file.bin
generate_inc_gz_file += \
index.html
include $(ZEPHYR_BASE)/scripts/Makefile.gen
3. In the application, do something with the embedded file
static const unsigned char inc_file[] = {
#include "file.bin.inc"
};
static const unsigned char gz_inc_file[] = {
#include "index.html.gz.inc"
};
The generated files in ${SRC}/*.inc are automatically removed
when you do "make pristine"
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>