blob: d92a3ff811782b2da907e6efca096d33677e02c5 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Marian Balakowiczb97a2a02008-01-08 18:14:09 +01002/*
3 * (C) Copyright 2000-2004
4 * DENX Software Engineering
5 * Wolfgang Denk, wd@denx.de
Marian Balakowiczb97a2a02008-01-08 18:14:09 +01006 */
7
Prafulla Wadaskar89a4d6b2009-08-19 17:36:46 +05308#ifndef _MKIIMAGE_H_
9#define _MKIIMAGE_H_
10
Peter Tyser2f8d3962009-03-13 18:54:51 -050011#include "os_support.h"
Marian Balakowiczb97a2a02008-01-08 18:14:09 +010012#include <errno.h>
13#include <fcntl.h>
14#include <stdio.h>
15#include <stdlib.h>
16#include <string.h>
Marian Balakowiczb97a2a02008-01-08 18:14:09 +010017#include <sys/stat.h>
18#include <time.h>
19#include <unistd.h>
Mingli Yu99d430f2023-06-19 14:22:50 +080020#include <limits.h>
Jeroen Hofstee2b9912e2014-06-12 22:27:12 +020021#include <u-boot/sha1.h>
Bartlomiej Sieka8cf30802008-02-29 16:00:24 +010022#include "fdt_host.h"
Guilherme Maciel Ferreiraf86ed6a2013-12-01 12:43:10 -070023#include "imagetool.h"
Marian Balakowiczb97a2a02008-01-08 18:14:09 +010024
Prafulla Wadaskar89a4d6b2009-08-19 17:36:46 +053025#undef MKIMAGE_DEBUG
Marian Balakowicz5dfb5212008-02-29 21:24:06 +010026
27#ifdef MKIMAGE_DEBUG
28#define debug(fmt,args...) printf (fmt ,##args)
29#else
30#define debug(fmt,args...)
31#endif /* MKIMAGE_DEBUG */
32
Simon Glassc5819702021-02-15 17:08:09 -070033#define log_debug(fmt, args...) debug(fmt, ##args)
34
Simon Glass2434c662013-05-16 13:53:20 +000035static inline void *map_sysmem(ulong paddr, unsigned long len)
36{
37 return (void *)(uintptr_t)paddr;
38}
39
40static inline ulong map_to_sysmem(void *ptr)
41{
42 return (ulong)(uintptr_t)ptr;
43}
44
Joel Stanleyc5e24422022-06-20 16:31:17 +093045#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) type name[size]
Sean Andersonb5833482022-03-24 11:26:11 -040046
Bartlomiej Sieka9d254382008-03-11 12:34:47 +010047#define MKIMAGE_TMPFILE_SUFFIX ".tmp"
Mingli Yu99d430f2023-06-19 14:22:50 +080048#define MKIMAGE_MAX_TMPFILE_LEN PATH_MAX
Bartlomiej Sieka9d254382008-03-11 12:34:47 +010049#define MKIMAGE_DEFAULT_DTC_OPTIONS "-I dts -O dtb -p 500"
Sven Roedererfc21a882020-04-27 02:08:38 +020050#define MKIMAGE_MAX_DTC_CMDLINE_LEN 2 * MKIMAGE_MAX_TMPFILE_LEN + 35
Prafulla Wadaskar89a4d6b2009-08-19 17:36:46 +053051
Prafulla Wadaskar89a4d6b2009-08-19 17:36:46 +053052#endif /* _MKIIMAGE_H_ */