diff options
author | Luca Boccassi <luca.boccassi@microsoft.com> | 2019-05-14 19:35:02 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-05-18 12:32:02 -0400 |
commit | 7d57485a8a3c45c254919f01337c14cc2856accd (patch) | |
tree | d153de42617f0bcfc783da793caa39487e26b39e /tools/fit_image.c | |
parent | 26992928e80a7f8d86267985b211a858094dc389 (diff) | |
download | u-boot-7d57485a8a3c45c254919f01337c14cc2856accd.tar.gz |
tools: use read-only mmap in fit_check_sign
Add an option to open files in read-only mode in mmap_fdt so
that fit_check_sign can be used to inspect files on read-only
filesystems.
For example, this is useful when a key is shipped in a read-only
rootfs or squashfs.
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
Diffstat (limited to 'tools/fit_image.c')
-rw-r--r-- | tools/fit_image.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/fit_image.c b/tools/fit_image.c index 3b867e0656..5aca634b5e 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -33,7 +33,8 @@ static int fit_add_file_data(struct image_tool_params *params, size_t size_inc, void *ptr; int ret = 0; - tfd = mmap_fdt(params->cmdname, tmpfile, size_inc, &ptr, &sbuf, true); + tfd = mmap_fdt(params->cmdname, tmpfile, size_inc, &ptr, &sbuf, true, + false); if (tfd < 0) return -EIO; @@ -41,7 +42,8 @@ static int fit_add_file_data(struct image_tool_params *params, size_t size_inc, struct stat dest_sbuf; destfd = mmap_fdt(params->cmdname, params->keydest, size_inc, - &dest_blob, &dest_sbuf, false); + &dest_blob, &dest_sbuf, false, + false); if (destfd < 0) { ret = -EIO; goto err_keydest; @@ -420,7 +422,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname) int images; int node; - fd = mmap_fdt(params->cmdname, fname, 0, &fdt, &sbuf, false); + fd = mmap_fdt(params->cmdname, fname, 0, &fdt, &sbuf, false, false); if (fd < 0) return -EIO; fit_size = fdt_totalsize(fdt); @@ -531,7 +533,7 @@ static int fit_import_data(struct image_tool_params *params, const char *fname) int images; int node; - fd = mmap_fdt(params->cmdname, fname, 0, &old_fdt, &sbuf, false); + fd = mmap_fdt(params->cmdname, fname, 0, &old_fdt, &sbuf, false, false); if (fd < 0) return -EIO; fit_size = fdt_totalsize(old_fdt); |