Statistics
| Branch: | Revision:

root / uboot_image.h @ a74cdab4

History | View | Annotate | Download (5.9 kB)

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