Statistics
| Branch: | Revision:

root / uboot_image.h @ 1eec614b

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