blob: f5ca65e2edfd78a1869e1bcdf2a2a62e1fd08c55 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Marian Balakowicz41d71ed2008-01-08 18:14:09 +01002/*
3 * (C) Copyright 2000-2004
4 * DENX Software Engineering
5 * Wolfgang Denk, wd@denx.de
Marian Balakowicz41d71ed2008-01-08 18:14:09 +01006 */
7
Prafulla Wadaskarfabf3cf2009-08-19 17:36:46 +05308#ifndef _MKIIMAGE_H_
9#define _MKIIMAGE_H_
10
Peter Tyserb06976d2009-03-13 18:54:51 -050011#include "os_support.h"
Marian Balakowicz41d71ed2008-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 Balakowicz41d71ed2008-01-08 18:14:09 +010017#include <sys/stat.h>
18#include <time.h>
19#include <unistd.h>
Jeroen Hofsteebfe88fe2014-06-12 22:27:12 +020020#include <u-boot/sha1.h>
Bartlomiej Sieka61250862008-02-29 16:00:24 +010021#include "fdt_host.h"
Guilherme Maciel Ferreira8ed4d1c2013-12-01 12:43:10 -070022#include "imagetool.h"
Marian Balakowicz41d71ed2008-01-08 18:14:09 +010023
Prafulla Wadaskarfabf3cf2009-08-19 17:36:46 +053024#undef MKIMAGE_DEBUG
Marian Balakowicze227fbb2008-02-29 21:24:06 +010025
26#ifdef MKIMAGE_DEBUG
27#define debug(fmt,args...) printf (fmt ,##args)
28#else
29#define debug(fmt,args...)
30#endif /* MKIMAGE_DEBUG */
31
Simon Glassd563c252021-02-15 17:08:09 -070032#define log_debug(fmt, args...) debug(fmt, ##args)
33
Simon Glassa6193f12013-05-16 13:53:20 +000034static inline void *map_sysmem(ulong paddr, unsigned long len)
35{
36 return (void *)(uintptr_t)paddr;
37}
38
39static inline ulong map_to_sysmem(void *ptr)
40{
41 return (ulong)(uintptr_t)ptr;
42}
43
Joel Stanley447cc7a2022-06-20 16:31:17 +093044#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) type name[size]
Sean Anderson615e31c2022-03-24 11:26:11 -040045
Bartlomiej Siekad7816fb2008-03-11 12:34:47 +010046#define MKIMAGE_TMPFILE_SUFFIX ".tmp"
47#define MKIMAGE_MAX_TMPFILE_LEN 256
48#define MKIMAGE_DEFAULT_DTC_OPTIONS "-I dts -O dtb -p 500"
Sven Roederer904b87d2020-04-27 02:08:38 +020049#define MKIMAGE_MAX_DTC_CMDLINE_LEN 2 * MKIMAGE_MAX_TMPFILE_LEN + 35
Prafulla Wadaskarfabf3cf2009-08-19 17:36:46 +053050
Prafulla Wadaskarfabf3cf2009-08-19 17:36:46 +053051#endif /* _MKIIMAGE_H_ */