blob: d4fdb052826f78380f7857f9f4d0e8d7bec82c01 [file] [log] [blame]
wdenk5b1d7132002-11-03 00:07:02 +00001/*
2 * (C) Copyright 2000
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24#ifndef __IMAGE_H__
25#define __IMAGE_H__
26
27/*
28 * Operating System Codes
29 */
30#define IH_OS_INVALID 0 /* Invalid OS */
31#define IH_OS_OPENBSD 1 /* OpenBSD */
32#define IH_OS_NETBSD 2 /* NetBSD */
33#define IH_OS_FREEBSD 3 /* FreeBSD */
34#define IH_OS_4_4BSD 4 /* 4.4BSD */
35#define IH_OS_LINUX 5 /* Linux */
36#define IH_OS_SVR4 6 /* SVR4 */
37#define IH_OS_ESIX 7 /* Esix */
38#define IH_OS_SOLARIS 8 /* Solaris */
39#define IH_OS_IRIX 9 /* Irix */
40#define IH_OS_SCO 10 /* SCO */
41#define IH_OS_DELL 11 /* Dell */
42#define IH_OS_NCR 12 /* NCR */
43#define IH_OS_LYNXOS 13 /* LynxOS */
44#define IH_OS_VXWORKS 14 /* VxWorks */
45#define IH_OS_PSOS 15 /* pSOS */
46#define IH_OS_QNX 16 /* QNX */
47#define IH_OS_U_BOOT 17 /* Firmware */
wdenkd791b1d2003-04-20 14:04:18 +000048#define IH_OS_RTEMS 18 /* RTEMS */
wdenk7f70e852003-05-20 14:25:27 +000049#define IH_OS_ARTOS 19 /* ARTOS */
wdenk27b207f2003-07-24 23:38:38 +000050#define IH_OS_UNITY 20 /* Unity OS */
wdenk5b1d7132002-11-03 00:07:02 +000051
52/*
53 * CPU Architecture Codes (supported by Linux)
54 */
55#define IH_CPU_INVALID 0 /* Invalid CPU */
56#define IH_CPU_ALPHA 1 /* Alpha */
57#define IH_CPU_ARM 2 /* ARM */
58#define IH_CPU_I386 3 /* Intel x86 */
59#define IH_CPU_IA64 4 /* IA64 */
60#define IH_CPU_MIPS 5 /* MIPS */
61#define IH_CPU_MIPS64 6 /* MIPS 64 Bit */
62#define IH_CPU_PPC 7 /* PowerPC */
63#define IH_CPU_S390 8 /* IBM S390 */
64#define IH_CPU_SH 9 /* SuperH */
65#define IH_CPU_SPARC 10 /* Sparc */
66#define IH_CPU_SPARC64 11 /* Sparc 64 Bit */
wdenk8564acf2003-07-14 22:13:32 +000067#define IH_CPU_M68K 12 /* M68K */
wdenk4a551702003-10-08 23:26:14 +000068#define IH_CPU_NIOS 13 /* Nios-32 */
wdenk5b1d7132002-11-03 00:07:02 +000069
70/*
71 * Image Types
72 *
73 * "Standalone Programs" are directly runnable in the environment
74 * provided by U-Boot; it is expected that (if they behave
75 * well) you can continue to work in U-Boot after return from
76 * the Standalone Program.
77 * "OS Kernel Images" are usually images of some Embedded OS which
78 * will take over control completely. Usually these programs
79 * will install their own set of exception handlers, device
80 * drivers, set up the MMU, etc. - this means, that you cannot
81 * expect to re-enter U-Boot except by resetting the CPU.
82 * "RAMDisk Images" are more or less just data blocks, and their
83 * parameters (address, size) are passed to an OS kernel that is
84 * being started.
85 * "Multi-File Images" contain several images, typically an OS
86 * (Linux) kernel image and one or more data images like
87 * RAMDisks. This construct is useful for instance when you want
88 * to boot over the network using BOOTP etc., where the boot
89 * server provides just a single image file, but you want to get
90 * for instance an OS kernel and a RAMDisk image.
91 *
92 * "Multi-File Images" start with a list of image sizes, each
93 * image size (in bytes) specified by an "uint32_t" in network
94 * byte order. This list is terminated by an "(uint32_t)0".
95 * Immediately after the terminating 0 follow the images, one by
96 * one, all aligned on "uint32_t" boundaries (size rounded up to
97 * a multiple of 4 bytes).
98 *
99 * "Firmware Images" are binary images containing firmware (like
100 * U-Boot or FPGA images) which usually will be programmed to
101 * flash memory.
102 *
103 * "Script files" are command sequences that will be executed by
104 * U-Boot's command interpreter; this feature is especially
105 * useful when you configure U-Boot to use a real shell (hush)
wdenk27b207f2003-07-24 23:38:38 +0000106 * as command interpreter (=> Shell Scripts).
wdenk5b1d7132002-11-03 00:07:02 +0000107 */
108
109#define IH_TYPE_INVALID 0 /* Invalid Image */
110#define IH_TYPE_STANDALONE 1 /* Standalone Program */
111#define IH_TYPE_KERNEL 2 /* OS Kernel Image */
112#define IH_TYPE_RAMDISK 3 /* RAMDisk Image */
113#define IH_TYPE_MULTI 4 /* Multi-File Image */
114#define IH_TYPE_FIRMWARE 5 /* Firmware Image */
115#define IH_TYPE_SCRIPT 6 /* Script file */
wdenkfbe4b5c2003-10-06 21:55:32 +0000116#define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */
wdenk5b1d7132002-11-03 00:07:02 +0000117
118/*
119 * Compression Types
120 */
121#define IH_COMP_NONE 0 /* No Compression Used */
122#define IH_COMP_GZIP 1 /* gzip Compression Used */
123#define IH_COMP_BZIP2 2 /* bzip2 Compression Used */
124
125#define IH_MAGIC 0x27051956 /* Image Magic Number */
126#define IH_NMLEN 32 /* Image Name Length */
127
wdenk5b1d7132002-11-03 00:07:02 +0000128/*
129 * all data in network byte order (aka natural aka bigendian)
130 */
131
132typedef struct image_header {
133 uint32_t ih_magic; /* Image Header Magic Number */
134 uint32_t ih_hcrc; /* Image Header CRC Checksum */
135 uint32_t ih_time; /* Image Creation Timestamp */
136 uint32_t ih_size; /* Image Data Size */
137 uint32_t ih_load; /* Data Load Address */
138 uint32_t ih_ep; /* Entry Point Address */
139 uint32_t ih_dcrc; /* Image Data CRC Checksum */
140 uint8_t ih_os; /* Operating System */
141 uint8_t ih_arch; /* CPU architecture */
142 uint8_t ih_type; /* Image Type */
143 uint8_t ih_comp; /* Compression Type */
144 uint8_t ih_name[IH_NMLEN]; /* Image Name */
145} image_header_t;
146
147
148#endif /* __IMAGE_H__ */