blob: 1e81d4c68b61eafd6f91635ae3fe205bed57b213 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Heiko Schocher3cb743c2014-03-03 12:19:29 +01002/*
3 * (C) Copyright 2014
Heiko Schocher3cb743c2014-03-03 12:19:29 +01004 */
5
6#ifndef _FIT_COMMON_H_
7#define _FIT_COMMON_H_
8
9#include "imagetool.h"
10#include "mkimage.h"
11#include <image.h>
12
Jordan Hand256b7f92019-03-05 14:47:56 -080013/**
14 * Verify the format of FIT header pointed to by ptr
15 *
16 * @ptr: image header to be verified
17 * @image_size: size of while image
18 * @params: mkimage parameters
19 * @return 0 if OK, -1 on error
20 */
Heiko Schocher3cb743c2014-03-03 12:19:29 +010021int fit_verify_header(unsigned char *ptr, int image_size,
22 struct image_tool_params *params);
23
24int fit_check_image_types(uint8_t type);
25
Simon Glassd25c0d92014-06-02 22:04:52 -060026/**
27 * Map an FDT into memory, optionally increasing its size
28 *
29 * @cmdname: Tool name (for displaying with error messages)
30 * @fname: Filename containing FDT
Simon Glass802aa822014-06-02 22:04:53 -060031 * @size_inc: Amount to increase size by (0 = leave it alone)
Simon Glassd25c0d92014-06-02 22:04:52 -060032 * @blobp: Returns pointer to FDT blob
33 * @sbuf: File status information is stored here
34 * @delete_on_error: true to delete the file if we get an error
Luca Boccassibff733f2019-05-14 19:35:02 +010035 * @read_only: true to open in read-only mode
Simon Glassd25c0d92014-06-02 22:04:52 -060036 * @return 0 if OK, -1 on error.
37 */
Simon Glass802aa822014-06-02 22:04:53 -060038int mmap_fdt(const char *cmdname, const char *fname, size_t size_inc,
Luca Boccassibff733f2019-05-14 19:35:02 +010039 void **blobp, struct stat *sbuf, bool delete_on_error,
40 bool read_only);
Heiko Schocher3cb743c2014-03-03 12:19:29 +010041
42#endif /* _FIT_COMMON_H_ */