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