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