wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 1 | /* |
Wolfgang Denk | f08abe3 | 2005-11-25 16:38:03 +0100 | [diff] [blame] | 2 | * (C) Copyright 2000-2005 |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 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 |
Wolfgang Denk | f08abe3 | 2005-11-25 16:38:03 +0100 | [diff] [blame] | 22 | * |
| 23 | ******************************************************************** |
| 24 | * NOTE: This header file defines an interface to U-Boot. Including |
| 25 | * this (unmodified) header file in another file is considered normal |
| 26 | * use of U-Boot, and does *not* fall under the heading of "derived |
| 27 | * work". |
| 28 | ******************************************************************** |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 29 | */ |
| 30 | |
| 31 | #ifndef __IMAGE_H__ |
| 32 | #define __IMAGE_H__ |
| 33 | |
| 34 | /* |
| 35 | * Operating System Codes |
| 36 | */ |
| 37 | #define IH_OS_INVALID 0 /* Invalid OS */ |
| 38 | #define IH_OS_OPENBSD 1 /* OpenBSD */ |
| 39 | #define IH_OS_NETBSD 2 /* NetBSD */ |
| 40 | #define IH_OS_FREEBSD 3 /* FreeBSD */ |
| 41 | #define IH_OS_4_4BSD 4 /* 4.4BSD */ |
| 42 | #define IH_OS_LINUX 5 /* Linux */ |
| 43 | #define IH_OS_SVR4 6 /* SVR4 */ |
| 44 | #define IH_OS_ESIX 7 /* Esix */ |
| 45 | #define IH_OS_SOLARIS 8 /* Solaris */ |
| 46 | #define IH_OS_IRIX 9 /* Irix */ |
| 47 | #define IH_OS_SCO 10 /* SCO */ |
| 48 | #define IH_OS_DELL 11 /* Dell */ |
| 49 | #define IH_OS_NCR 12 /* NCR */ |
| 50 | #define IH_OS_LYNXOS 13 /* LynxOS */ |
| 51 | #define IH_OS_VXWORKS 14 /* VxWorks */ |
| 52 | #define IH_OS_PSOS 15 /* pSOS */ |
| 53 | #define IH_OS_QNX 16 /* QNX */ |
| 54 | #define IH_OS_U_BOOT 17 /* Firmware */ |
wdenk | d791b1d | 2003-04-20 14:04:18 +0000 | [diff] [blame] | 55 | #define IH_OS_RTEMS 18 /* RTEMS */ |
wdenk | 7f70e85 | 2003-05-20 14:25:27 +0000 | [diff] [blame] | 56 | #define IH_OS_ARTOS 19 /* ARTOS */ |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 57 | #define IH_OS_UNITY 20 /* Unity OS */ |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 58 | |
| 59 | /* |
| 60 | * CPU Architecture Codes (supported by Linux) |
| 61 | */ |
| 62 | #define IH_CPU_INVALID 0 /* Invalid CPU */ |
| 63 | #define IH_CPU_ALPHA 1 /* Alpha */ |
| 64 | #define IH_CPU_ARM 2 /* ARM */ |
| 65 | #define IH_CPU_I386 3 /* Intel x86 */ |
| 66 | #define IH_CPU_IA64 4 /* IA64 */ |
| 67 | #define IH_CPU_MIPS 5 /* MIPS */ |
| 68 | #define IH_CPU_MIPS64 6 /* MIPS 64 Bit */ |
| 69 | #define IH_CPU_PPC 7 /* PowerPC */ |
| 70 | #define IH_CPU_S390 8 /* IBM S390 */ |
| 71 | #define IH_CPU_SH 9 /* SuperH */ |
| 72 | #define IH_CPU_SPARC 10 /* Sparc */ |
| 73 | #define IH_CPU_SPARC64 11 /* Sparc 64 Bit */ |
wdenk | 507bbe3 | 2004-04-18 21:13:41 +0000 | [diff] [blame] | 74 | #define IH_CPU_M68K 12 /* M68K */ |
| 75 | #define IH_CPU_NIOS 13 /* Nios-32 */ |
| 76 | #define IH_CPU_MICROBLAZE 14 /* MicroBlaze */ |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 77 | #define IH_CPU_NIOS2 15 /* Nios-II */ |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 78 | |
| 79 | /* |
| 80 | * Image Types |
| 81 | * |
| 82 | * "Standalone Programs" are directly runnable in the environment |
| 83 | * provided by U-Boot; it is expected that (if they behave |
| 84 | * well) you can continue to work in U-Boot after return from |
| 85 | * the Standalone Program. |
| 86 | * "OS Kernel Images" are usually images of some Embedded OS which |
| 87 | * will take over control completely. Usually these programs |
| 88 | * will install their own set of exception handlers, device |
| 89 | * drivers, set up the MMU, etc. - this means, that you cannot |
| 90 | * expect to re-enter U-Boot except by resetting the CPU. |
| 91 | * "RAMDisk Images" are more or less just data blocks, and their |
| 92 | * parameters (address, size) are passed to an OS kernel that is |
| 93 | * being started. |
| 94 | * "Multi-File Images" contain several images, typically an OS |
| 95 | * (Linux) kernel image and one or more data images like |
| 96 | * RAMDisks. This construct is useful for instance when you want |
| 97 | * to boot over the network using BOOTP etc., where the boot |
| 98 | * server provides just a single image file, but you want to get |
| 99 | * for instance an OS kernel and a RAMDisk image. |
| 100 | * |
| 101 | * "Multi-File Images" start with a list of image sizes, each |
| 102 | * image size (in bytes) specified by an "uint32_t" in network |
| 103 | * byte order. This list is terminated by an "(uint32_t)0". |
| 104 | * Immediately after the terminating 0 follow the images, one by |
| 105 | * one, all aligned on "uint32_t" boundaries (size rounded up to |
wdenk | e1599e8 | 2004-10-10 23:27:33 +0000 | [diff] [blame] | 106 | * a multiple of 4 bytes - except for the last file). |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 107 | * |
| 108 | * "Firmware Images" are binary images containing firmware (like |
| 109 | * U-Boot or FPGA images) which usually will be programmed to |
| 110 | * flash memory. |
| 111 | * |
| 112 | * "Script files" are command sequences that will be executed by |
| 113 | * U-Boot's command interpreter; this feature is especially |
| 114 | * useful when you configure U-Boot to use a real shell (hush) |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 115 | * as command interpreter (=> Shell Scripts). |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 116 | */ |
| 117 | |
| 118 | #define IH_TYPE_INVALID 0 /* Invalid Image */ |
| 119 | #define IH_TYPE_STANDALONE 1 /* Standalone Program */ |
| 120 | #define IH_TYPE_KERNEL 2 /* OS Kernel Image */ |
| 121 | #define IH_TYPE_RAMDISK 3 /* RAMDisk Image */ |
| 122 | #define IH_TYPE_MULTI 4 /* Multi-File Image */ |
| 123 | #define IH_TYPE_FIRMWARE 5 /* Firmware Image */ |
| 124 | #define IH_TYPE_SCRIPT 6 /* Script file */ |
wdenk | fbe4b5c | 2003-10-06 21:55:32 +0000 | [diff] [blame] | 125 | #define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */ |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 126 | |
| 127 | /* |
| 128 | * Compression Types |
| 129 | */ |
| 130 | #define IH_COMP_NONE 0 /* No Compression Used */ |
| 131 | #define IH_COMP_GZIP 1 /* gzip Compression Used */ |
| 132 | #define IH_COMP_BZIP2 2 /* bzip2 Compression Used */ |
| 133 | |
| 134 | #define IH_MAGIC 0x27051956 /* Image Magic Number */ |
| 135 | #define IH_NMLEN 32 /* Image Name Length */ |
| 136 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 137 | /* |
| 138 | * all data in network byte order (aka natural aka bigendian) |
| 139 | */ |
| 140 | |
| 141 | typedef struct image_header { |
| 142 | uint32_t ih_magic; /* Image Header Magic Number */ |
| 143 | uint32_t ih_hcrc; /* Image Header CRC Checksum */ |
| 144 | uint32_t ih_time; /* Image Creation Timestamp */ |
| 145 | uint32_t ih_size; /* Image Data Size */ |
| 146 | uint32_t ih_load; /* Data Load Address */ |
| 147 | uint32_t ih_ep; /* Entry Point Address */ |
| 148 | uint32_t ih_dcrc; /* Image Data CRC Checksum */ |
| 149 | uint8_t ih_os; /* Operating System */ |
| 150 | uint8_t ih_arch; /* CPU architecture */ |
| 151 | uint8_t ih_type; /* Image Type */ |
| 152 | uint8_t ih_comp; /* Compression Type */ |
| 153 | uint8_t ih_name[IH_NMLEN]; /* Image Name */ |
| 154 | } image_header_t; |
| 155 | |
| 156 | |
| 157 | #endif /* __IMAGE_H__ */ |